Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
PreviewLayoutLinesTool Class Reference

The PreviewLayoutLinesTool handles the lines connecting images in the layout view of the fast preview. More...

#include <PreviewLayoutLinesTool.h>

Inheritance diagram for PreviewLayoutLinesTool:
Inheritance graph

Classes

class  LineDetails
 A class to store information about each line that will be drawn. More...
 

Public Member Functions

 PreviewLayoutLinesTool (ToolHelper *helper)
 
 ~PreviewLayoutLinesTool ()
 
void panoramaChanged (HuginBase::Panorama &pano)
 This just sets a flag when the panorama is changed. More...
 
void panoramaImagesChanged (HuginBase::Panorama &, const HuginBase::UIntSet &)
 notifies about changes to images More...
 
void Activate ()
 Start using the PreviewLayoutLinesTool. More...
 
virtual void MouseMoveEvent (double x, double y, wxMouseEvent &e)
 Revaluate the lines under the mouse pointer when it moves. More...
 
void MouseButtonEvent (wxMouseEvent &e)
 Capture clicks on lines, and load up the relavent images in the control point tab. More...
 
void BeforeDrawImagesEvent ()
 Draw all the lines between images that indicate the quality and quantity of control points. More...
 
bool BeforeDrawImageEvent (unsigned int image)
 Draw what the tool requires just before a given image is drawn. More...
 
void AfterDrawImagesEvent ()
 Draw a border over the images when a line is hilighted, similar to the identify tool. More...
 
- Public Member Functions inherited from Tool
 Tool (ToolHelper *helper)
 Construct keeping a pointer to a PreviewToolHelper. More...
 
virtual ~Tool ()
 
virtual void MouseWheelEvent (wxMouseEvent &e)
 Notify of a mouse wheel event on the panorama preview. More...
 
virtual void ImagesUnderMouseChangedEvent ()
 Notify when the images directly underneath the mouse pointer have changed. More...
 
virtual void KeypressEvent (int keycode, int modifiers, bool pressed)
 Notify of a Keypress event. More...
 
virtual void ReallyAfterDrawImagesEvent ()
 Draw (using OpenGL) the overlays, e.g. crop highlights, guides. More...
 
virtual void AfterDrawImageEvent (unsigned int image)
 Notification called just after the image was drawn normally. More...
 
virtual void MarkDirty ()
 
- Public Member Functions inherited from HuginBase::PanoramaObserver
virtual ~PanoramaObserver ()
 

Private Member Functions

void updateLineInformation ()
 Update the line information. More...
 
void updateImageCentres ()
 Update the locations of the image centres. More...
 
void drawIdentificationBorder (unsigned int image)
 Draw a border for an image. More...
 

Private Attributes

bool m_holdOnNear
 
bool m_updateStatistics
 Flag set to true to update statistics next redraw. More...
 
unsigned int m_rectangleBorderTex
 OpenGL texture names for the border highlight. More...
 
std::vector< hugin_utils::FDiff2Dm_imageCentres
 The location on the panorama that the middle of the images map to. More...
 
std::vector< hugin_utils::FDiff2Dm_imageCentresSpherical
 The spherical coordinates of the middle of the images. More...
 
std::vector
< HuginBase::PTools::Transform * > 
m_transforms
 The transformations used to make the image centres. More...
 
std::vector< LineDetailsm_lines
 A container for the line information. More...
 
unsigned int m_nearestLine
 The index of nearest line to the mouse position. More...
 
bool m_useNearestLine
 True if we should highlight the nearest line to the mouse position. More...
 

Additional Inherited Members

- Protected Attributes inherited from Tool
ToolHelperhelper
 The PreviewToolHelper that uses the same preview window and panorama as the tool should. More...
 

Detailed Description

The PreviewLayoutLinesTool handles the lines connecting images in the layout view of the fast preview.

These are its functions:

  1. Draw the coloured lines indicating control point error behind the images.
  2. Draw the grey lines for images overlapping that share no control points.
  3. Interprate clicks on lines and load up the relevant pair in the control point tab.
Todo:
Update line information when control point information changes, and only when it changes. The main preview system doesn't redraw when control points change. This should save on the draw time, since we don't always need to examine the control points to draw the preview.

Definition at line 47 of file PreviewLayoutLinesTool.h.

Constructor & Destructor Documentation

PreviewLayoutLinesTool::PreviewLayoutLinesTool ( ToolHelper helper)
explicit
PreviewLayoutLinesTool::~PreviewLayoutLinesTool ( )

Member Function Documentation

void PreviewLayoutLinesTool::Activate ( )
virtual
void PreviewLayoutLinesTool::AfterDrawImagesEvent ( )
virtual
bool PreviewLayoutLinesTool::BeforeDrawImageEvent ( unsigned int  image)
virtual

Draw what the tool requires just before a given image is drawn.

This can be used to modify how the images are drawn, prevent drawing of the image, or change the order of the image drawing (with another event to draw the image when it is needed).

Returns
false if the tool does not want the image drawn normally, or true when the image should be drawn normally.

Reimplemented from Tool.

Definition at line 342 of file PreviewLayoutLinesTool.cpp.

References ToolHelper::DoNotNotifyMeBeforeDrawing(), Tool::helper, PreviewLayoutLinesTool::LineDetails::image1, PreviewLayoutLinesTool::LineDetails::image2, celeste::line, m_lines, m_nearestLine, and m_useNearestLine.

void PreviewLayoutLinesTool::BeforeDrawImagesEvent ( )
virtual

Draw all the lines between images that indicate the quality and quantity of control points.

Reimplemented from Tool.

Definition at line 241 of file PreviewLayoutLinesTool.cpp.

References TextureManager::DisableTexture(), ViewState::GetTextureManager(), ToolHelper::GetViewStatePtr(), Tool::helper, m_lines, m_nearestLine, m_updateStatistics, m_useNearestLine, updateImageCentres(), and updateLineInformation().

void PreviewLayoutLinesTool::drawIdentificationBorder ( unsigned int  image)
private
void PreviewLayoutLinesTool::MouseButtonEvent ( wxMouseEvent &  e)
virtual

Capture clicks on lines, and load up the relavent images in the control point tab.

Reimplemented from Tool.

Definition at line 359 of file PreviewLayoutLinesTool.cpp.

References MainFrame::Get(), PreviewLayoutLinesTool::LineDetails::image1, PreviewLayoutLinesTool::LineDetails::image2, celeste::line, m_holdOnNear, m_lines, m_nearestLine, m_useNearestLine, and MainFrame::ShowCtrlPointEditor().

void PreviewLayoutLinesTool::MouseMoveEvent ( double  x,
double  y,
wxMouseEvent &  e 
)
virtual
void PreviewLayoutLinesTool::panoramaChanged ( HuginBase::Panorama pano)
virtual

This just sets a flag when the panorama is changed.

When we next redraw, we recalculate the statistics for the lines if the flag is set.

Implements HuginBase::PanoramaObserver.

Definition at line 159 of file PreviewLayoutLinesTool.cpp.

References m_updateStatistics.

void PreviewLayoutLinesTool::panoramaImagesChanged ( HuginBase::Panorama pano,
const HuginBase::UIntSet changed 
)
virtual

notifies about changes to images

Images might have been added/removed. to find out how many images are still there, use Panorama::getNrOfImages.

Parameters
panothe panorama object that changed
changedset of changed images

Implements HuginBase::PanoramaObserver.

Definition at line 163 of file PreviewLayoutLinesTool.cpp.

References m_updateStatistics.

void PreviewLayoutLinesTool::updateImageCentres ( )
private
void PreviewLayoutLinesTool::updateLineInformation ( )
private

Update the line information.

Todo:
Check both ways around. This only checks if points from the smallest numbered image are within the largest numbered image. If the first image is huge compared to the second, then it many points will miss and we might not reach the target even if the second image is contained within the first.
Todo:
Use only points inside the circle when circular crop is used.

test if the line should be visible.

Definition at line 380 of file PreviewLayoutLinesTool.cpp.

References PreviewLayoutLinesTool::LineDetails::arc, HuginBase::PTools::Transform::createTransform(), PreviewLayoutLinesTool::LineDetails::dud, HuginBase::ControlPoint::error, HuginBase::Panorama::getActiveImages(), HuginBase::Panorama::getCtrlPoint(), HuginBase::Panorama::getImage(), HuginBase::Panorama::getNrOfCtrlPoints(), HuginBase::Panorama::getNrOfImages(), ViewState::GetOptions(), ToolHelper::GetPanoramaPtr(), ViewState::GetSrcImage(), ToolHelper::GetViewStatePtr(), ToolHelper::GetVisualizationStatePtr(), Tool::helper, PreviewLayoutLinesTool::LineDetails::image1, HuginBase::ControlPoint::image1Nr, PreviewLayoutLinesTool::LineDetails::image2, HuginBase::ControlPoint::image2Nr, HuginBase::SrcPanoImage::isInside(), celeste::line, m_imageCentresSpherical, m_lines, m_transforms, MIN_SAMPLE_OVERLAPS, PreviewLayoutLinesTool::LineDetails::numberOfControlPoints, SAMPLE_FREQUENCY, set_contains(), PreviewLayoutLinesTool::LineDetails::totalError, HuginBase::PTools::Transform::transformImgCoord(), and PreviewLayoutLinesTool::LineDetails::worstError.

Referenced by BeforeDrawImagesEvent().

Member Data Documentation

bool PreviewLayoutLinesTool::m_holdOnNear
private

Definition at line 86 of file PreviewLayoutLinesTool.h.

Referenced by MouseButtonEvent(), and MouseMoveEvent().

std::vector<hugin_utils::FDiff2D> PreviewLayoutLinesTool::m_imageCentres
private

The location on the panorama that the middle of the images map to.

Definition at line 94 of file PreviewLayoutLinesTool.h.

Referenced by updateImageCentres().

std::vector<hugin_utils::FDiff2D> PreviewLayoutLinesTool::m_imageCentresSpherical
private

The spherical coordinates of the middle of the images.

Definition at line 97 of file PreviewLayoutLinesTool.h.

Referenced by updateImageCentres(), and updateLineInformation().

std::vector<LineDetails> PreviewLayoutLinesTool::m_lines
private
unsigned int PreviewLayoutLinesTool::m_nearestLine
private

The index of nearest line to the mouse position.

Definition at line 152 of file PreviewLayoutLinesTool.h.

Referenced by AfterDrawImagesEvent(), BeforeDrawImageEvent(), BeforeDrawImagesEvent(), MouseButtonEvent(), and MouseMoveEvent().

unsigned int PreviewLayoutLinesTool::m_rectangleBorderTex
private

OpenGL texture names for the border highlight.

Definition at line 91 of file PreviewLayoutLinesTool.h.

Referenced by AfterDrawImagesEvent(), PreviewLayoutLinesTool(), and ~PreviewLayoutLinesTool().

std::vector<HuginBase::PTools::Transform *> PreviewLayoutLinesTool::m_transforms
private

The transformations used to make the image centres.

Definition at line 100 of file PreviewLayoutLinesTool.h.

Referenced by updateImageCentres(), updateLineInformation(), and ~PreviewLayoutLinesTool().

bool PreviewLayoutLinesTool::m_updateStatistics
private

Flag set to true to update statistics next redraw.

Definition at line 89 of file PreviewLayoutLinesTool.h.

Referenced by BeforeDrawImagesEvent(), panoramaChanged(), and panoramaImagesChanged().

bool PreviewLayoutLinesTool::m_useNearestLine
private

True if we should highlight the nearest line to the mouse position.

Definition at line 155 of file PreviewLayoutLinesTool.h.

Referenced by AfterDrawImagesEvent(), BeforeDrawImageEvent(), BeforeDrawImagesEvent(), MouseButtonEvent(), and MouseMoveEvent().


The documentation for this class was generated from the following files: