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
[legend]
List of all members.

Public Member Functions

 PreviewLayoutLinesTool (ToolHelper *helper)
 ~PreviewLayoutLinesTool ()
void panoramaChanged (HuginBase::PanoramaData &pano)
 This just sets a flag when the panorama is changed.
void panoramaImagesChanged (HuginBase::PanoramaData &, const HuginBase::UIntSet &)
 notifies about changes to images
void Activate ()
 Start using the PreviewLayoutLinesTool.
virtual void MouseMoveEvent (double x, double y, wxMouseEvent &e)
 Revaluate the lines under the mouse pointer when it moves.
void MouseButtonEvent (wxMouseEvent &e)
 Capture clicks on lines, and load up the relavent images in the control point tab.
void BeforeDrawImagesEvent ()
 Draw all the lines between images that indicate the quality and quantity of control points.
bool BeforeDrawImageEvent (unsigned int image)
 Draw what the tool requires just before a given image is drawn.
void AfterDrawImagesEvent ()
 Draw a border over the images when a line is hilighted, similar to the identify tool.

Private Member Functions

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

Private Attributes

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

Classes

class  LineDetails
 A class to store information about each line that will be drawn. 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 informations 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  ) 

Definition at line 82 of file PreviewLayoutLinesTool.cpp.

References HuginBase::Panorama::addObserver(), ToolHelper::GetPanoramaPtr(), Tool::helper, m_rectangleBorderTex, and rect_ts.

PreviewLayoutLinesTool::~PreviewLayoutLinesTool (  ) 

Definition at line 143 of file PreviewLayoutLinesTool.cpp.

References ToolHelper::GetPanoramaPtr(), Tool::helper, m_rectangleBorderTex, m_transforms, and HuginBase::Panorama::removeObserver().


Member Function Documentation

void PreviewLayoutLinesTool::Activate (  )  [virtual]

Start using the PreviewLayoutLinesTool.

Implements Tool.

Definition at line 169 of file PreviewLayoutLinesTool.cpp.

References ToolHelper::DRAW_OVER_IMAGES, ToolHelper::DRAW_UNDER_IMAGES, Tool::helper, ToolHelper::MOUSE_MOVE, ToolHelper::MOUSE_PRESS, ToolHelper::NotifyMe(), and ToolHelper::SetStatusMessage().

void PreviewLayoutLinesTool::AfterDrawImagesEvent (  )  [virtual]

Draw a border over the images when a line is hilighted, similar to the identify tool.

Reimplemented from Tool.

Definition at line 274 of file PreviewLayoutLinesTool.cpp.

References TextureManager::DisableTexture(), drawIdentificationBorder(), TextureManager::DrawImage(), VisualizationState::GetMeshDisplayList(), ViewState::GetTextureManager(), ToolHelper::GetViewStatePtr(), ToolHelper::GetVisualizationStatePtr(), Tool::helper, m_lines, m_nearestLine, m_rectangleBorderTex, and m_useNearestLine.

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, 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]

Draw a border for an image.

Definition at line 308 of file PreviewLayoutLinesTool.cpp.

References HuginBase::BaseSrcPanoImage::CROP_CIRCLE, HuginBase::BaseSrcPanoImage::CROP_RECTANGLE, VisualizationState::GetMeshDisplayList(), ToolHelper::GetViewStatePtr(), ToolHelper::GetVisualizationStatePtr(), Tool::helper, and HuginBase::BaseSrcPanoImage::NO_CROP.

Referenced by AfterDrawImagesEvent().

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, m_holdOnNear, m_lines, m_nearestLine, m_useNearestLine, and MainFrame::ShowCtrlPointEditor().

void PreviewLayoutLinesTool::MouseMoveEvent ( double  x,
double  y,
wxMouseEvent &  e 
) [virtual]

Revaluate the lines under the mouse pointer when it moves.

Reimplemented from Tool.

Definition at line 180 of file PreviewLayoutLinesTool.cpp.

References VisualizationState::ForceRequireRedraw(), ToolHelper::GetMousePanoPosition(), VisualizationState::GetScale(), ToolHelper::GetVisualizationStatePtr(), Tool::helper, PreviewLayoutLinesTool::LineDetails::image1, PreviewLayoutLinesTool::LineDetails::image2, ToolHelper::IsMouseOverPano(), m_holdOnNear, m_lines, m_nearestLine, m_useNearestLine, ToolHelper::NotifyMeBeforeDrawing(), and VisualizationState::Redraw().

void PreviewLayoutLinesTool::panoramaChanged ( HuginBase::PanoramaData 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::PanoramaData ,
const HuginBase::UIntSet  
) [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:
pano the panorama object that changed
changed set of changed images

Implements HuginBase::PanoramaObserver.

Definition at line 163 of file PreviewLayoutLinesTool.cpp.

References m_updateStatistics.

void PreviewLayoutLinesTool::updateImageCentres (  )  [private]

Update the locations of the image centres.

Definition at line 519 of file PreviewLayoutLinesTool.cpp.

References HuginBase::PTools::Transform::createInvTransform(), HuginBase::PanoramaOptions::EQUIRECTANGULAR, HuginBase::Panorama::getNrOfImages(), ViewState::GetOptions(), ToolHelper::GetPanoramaPtr(), ViewState::GetSrcImage(), ToolHelper::GetViewStatePtr(), Tool::helper, m_imageCentres, m_imageCentresSpherical, m_transforms, HuginBase::PanoramaOptions::setHeight(), HuginBase::PanoramaOptions::setHFOV(), HuginBase::PanoramaOptions::setProjection(), HuginBase::PanoramaOptions::setWidth(), and HuginBase::PTools::Transform::transformImgCoord().

Referenced by BeforeDrawImagesEvent().

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 HuginBase::PTools::Transform::createTransform(), 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, HuginBase::ControlPoint::image1Nr, HuginBase::SrcPanoImage::isInside(), 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]

A container for the line information.

Definition at line 149 of file PreviewLayoutLinesTool.h.

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

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:
Generated on 31 Oct 2014 for Hugintrunk by  doxygen 1.4.7