PreviewIdentifyTool Class Reference

Visually connect the image numbers with the image on the preview. More...

#include <PreviewIdentifyTool.h>

Inheritance diagram for PreviewIdentifyTool:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 PreviewIdentifyTool (ToolHelper *helper, GLPreviewFrame *owner)
 ~PreviewIdentifyTool ()
void Activate ()
 Switch on a tool.
void ImagesUnderMouseChangedEvent ()
 Notify when the images directly underneath the mouse pointer have changed.
void AfterDrawImagesEvent ()
 Draw (using OpenGL) images above the others.
bool BeforeDrawImageEvent (unsigned int image)
 Draw what the tool requires just before a given image is drawn.
void ShowImageNumber (unsigned int image)
 Notification for when moving the mouse on an image button.
void StopShowingImages ()
 Notification for when moving the mouse off an image button.
void MouseButtonEvent (wxMouseEvent &e)
 Show control point editor if mouse is over two images.
void MouseMoveEvent (double x, double y, wxMouseEvent &e)
 Notify when the mouse pointer has moved over the panorama preview.
void KeypressEvent (int keycode, int modifiers, int pressed)
void setConstantOn (bool constant_on_in)
void UpdateWithNewImageSet (std::set< unsigned int > new_image_set)
void ForceRedraw ()

Private Member Functions

void HighlightColour (unsigned int index, unsigned int count, unsigned char &red, unsigned char &green, unsigned char &blue)
 Generate a colour given how many colours we need and an index.
void StopUpdating ()
void ContinueUpdating ()

Private Attributes

std::set< unsigned int > image_set
 Set of image numbers of the images we are displaying highlighted.
GLPreviewFramepreview_frame
unsigned int mouse_over_image
 The image the user last placed their mouse over the button for.
bool mouse_is_over_button
bool stopUpdating
bool holdLeft
bool holdControl
bool constantOn

Static Private Attributes

static bool texture_created = false
static unsigned int circle_border_tex
 OpenGL texture name for the circular border texture.
static unsigned int rectangle_border_tex
 OpenGL texture name for the rectangular border texture.
static unsigned int font_tex
 OpenGL texture name for the font texture.
static unsigned int font_list
 OpenGL call list id for font.
static std::vector< int > m_glyphWidth
 glyph width for font

Detailed Description

Visually connect the image numbers with the image on the preview.

There are two ways it does this:

  1. When the user moves the mouse pointer over a image button, the image is highlighted in the preview.
  2. When the user moves the mouse pointer over the preview, the image under the pointer are highlighted with matching colours over the buttons.

The highlighted images are drawn on top of the other images, with a coloured border. If the mouse is over exactly two images, a click opens the control point editor with those two images shown.

Definition at line 43 of file PreviewIdentifyTool.h.


Constructor & Destructor Documentation

PreviewIdentifyTool::PreviewIdentifyTool ( ToolHelper helper,
GLPreviewFrame owner 
)

Definition at line 102 of file PreviewIdentifyTool.cpp.

References circle_border_inner, circle_border_outer, circle_border_peak, circle_border_tex, circle_middle, circle_ts, circle_ts_multiple, constantOn, font_list, font_tex, FONT_TEXTURE_HEIGHT, GenerateFontTexture(), holdControl, holdLeft, m_glyphWidth, preview_frame, rect_ts, rectangle_border_tex, stopUpdating, and texture_created.

PreviewIdentifyTool::~PreviewIdentifyTool (  ) 

Definition at line 256 of file PreviewIdentifyTool.cpp.

References circle_border_tex, font_list, font_tex, and rectangle_border_tex.


Member Function Documentation

void PreviewIdentifyTool::Activate (  )  [virtual]

Switch on a tool.

Inherited classes also register events they want to respond to with the PreviewToolHelper. As events are lost when the tool is deactivated without notification to the PreviewTool, things from the last activation can be cleaned up here too.

Implements Tool.

Definition at line 265 of file PreviewIdentifyTool.cpp.

References ToolHelper::DRAW_OVER_IMAGES, Tool::helper, image_set, ToolHelper::IMAGES_UNDER_MOUSE_CHANGE, ImagesUnderMouseChangedEvent(), mouse_is_over_button, ToolHelper::MOUSE_MOVE, ToolHelper::MOUSE_PRESS, ToolHelper::NotifyMe(), and ToolHelper::SetStatusMessage().

void PreviewIdentifyTool::AfterDrawImagesEvent (  )  [virtual]

Draw (using OpenGL) images above the others.

Reimplemented from Tool.

Definition at line 404 of file PreviewIdentifyTool.cpp.

References TextureManager::BindTexture(), circle_border_tex, HuginBase::PTools::Transform::createInvTransform(), HuginBase::BaseSrcPanoImage::CROP_CIRCLE, HuginBase::BaseSrcPanoImage::CROP_RECTANGLE, DEBUG_ASSERT, font_list, font_tex, FONT_TEXTURE_HEIGHT, HuginBase::PanoramaOptions::getHeight(), VisualizationState::GetMeshDisplayList(), ViewState::GetOptions(), ViewState::GetSrcImage(), ViewState::GetSupportMultiTexture(), ViewState::GetTextureManager(), ToolHelper::GetViewStatePtr(), ToolHelper::GetVisualizationStatePtr(), HuginBase::PanoramaOptions::getWidth(), Tool::helper, HighlightColour(), image_set, m_glyphWidth, celeste::min(), HuginBase::BaseSrcPanoImage::NO_CROP, preview_frame, rectangle_border_tex, GLPreviewFrame::SetImageButtonColour(), and HuginBase::PTools::Transform::transformImgCoord().

bool PreviewIdentifyTool::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 548 of file PreviewIdentifyTool.cpp.

References DEBUG_ASSERT, and image_set.

void PreviewIdentifyTool::ContinueUpdating (  )  [private]

Definition at line 305 of file PreviewIdentifyTool.cpp.

References ImagesUnderMouseChangedEvent(), and stopUpdating.

Referenced by KeypressEvent(), MouseMoveEvent(), and setConstantOn().

void PreviewIdentifyTool::ForceRedraw (  ) 

Definition at line 723 of file PreviewIdentifyTool.cpp.

References VisualizationState::ForceRequireRedraw(), ToolHelper::GetVisualizationStatePtr(), Tool::helper, and VisualizationState::Redraw().

Referenced by ShowImageNumber(), StopShowingImages(), StopUpdating(), and UpdateWithNewImageSet().

void PreviewIdentifyTool::HighlightColour ( unsigned int  index,
unsigned int  count,
unsigned char &  red,
unsigned char &  green,
unsigned char &  blue 
) [private]

Generate a colour given how many colours we need and an index.

Definition at line 588 of file PreviewIdentifyTool.cpp.

References DEBUG_ASSERT.

Referenced by AfterDrawImagesEvent().

void PreviewIdentifyTool::ImagesUnderMouseChangedEvent (  )  [virtual]

Notify when the images directly underneath the mouse pointer have changed.

It is monitored by the PreviewToolHelper.

Reimplemented from Tool.

Definition at line 379 of file PreviewIdentifyTool.cpp.

References ToolHelper::GetImageNumbersUnderMouse(), Tool::helper, image_set, preview_frame, ToolHelper::SetStatusMessage(), stopUpdating, and GLPreviewFrame::UpdateIdentifyTools().

Referenced by Activate(), ContinueUpdating(), and MouseButtonEvent().

void PreviewIdentifyTool::KeypressEvent ( int  keycode,
int  modifiers,
int  pressed 
)

Definition at line 351 of file PreviewIdentifyTool.cpp.

References ContinueUpdating(), holdControl, and StopUpdating().

void PreviewIdentifyTool::MouseButtonEvent ( wxMouseEvent &  e  )  [virtual]

Show control point editor if mouse is over two images.

Reimplemented from Tool.

Definition at line 631 of file PreviewIdentifyTool.cpp.

References constantOn, MainFrame::Get(), Tool::helper, holdLeft, image_set, ImagesUnderMouseChangedEvent(), ToolHelper::IsMouseOverPano(), MainFrame::ShowCtrlPointEditor(), MainFrame::ShowMaskEditor(), and stopUpdating.

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

Notify when the mouse pointer has moved over the panorama preview.

The coordinates are in the space of the panorama output at full size, with no output cropping.

Parameters:
x The horizontal position of the mouse pointer in panorama pixels.
y The vertical position of the mouse pointer in panorama pixels.
e The event created by wxWidgets.

Reimplemented from Tool.

Definition at line 310 of file PreviewIdentifyTool.cpp.

References constantOn, ContinueUpdating(), holdControl, holdLeft, StopUpdating(), and stopUpdating.

void PreviewIdentifyTool::setConstantOn ( bool  constant_on_in  ) 

Definition at line 366 of file PreviewIdentifyTool.cpp.

References constantOn, ContinueUpdating(), StopUpdating(), and stopUpdating.

Referenced by GLPreviewFrame::OnIdentify(), GLPreviewFrame::SetMode(), and GLPreviewFrame::updateBlendMode().

void PreviewIdentifyTool::ShowImageNumber ( unsigned int  image  ) 

Notification for when moving the mouse on an image button.

Parameters:
image the image number of the image the mouse is on.

Definition at line 556 of file PreviewIdentifyTool.cpp.

References DEBUG_ASSERT, ForceRedraw(), Tool::helper, image_set, mouse_is_over_button, mouse_over_image, and ToolHelper::NotifyMeBeforeDrawing().

void PreviewIdentifyTool::StopShowingImages (  ) 

Notification for when moving the mouse off an image button.

Definition at line 573 of file PreviewIdentifyTool.cpp.

References ToolHelper::DoNotNotifyMeBeforeDrawing(), ForceRedraw(), Tool::helper, image_set, mouse_is_over_button, mouse_over_image, preview_frame, and GLPreviewFrame::SetImageButtonColour().

void PreviewIdentifyTool::StopUpdating (  )  [private]

Definition at line 287 of file PreviewIdentifyTool.cpp.

References DEBUG_ASSERT, ToolHelper::DoNotNotifyMeBeforeDrawing(), ForceRedraw(), Tool::helper, image_set, preview_frame, GLPreviewFrame::SetImageButtonColour(), stopUpdating, and GLPreviewFrame::UpdateIdentifyTools().

Referenced by KeypressEvent(), MouseMoveEvent(), and setConstantOn().

void PreviewIdentifyTool::UpdateWithNewImageSet ( std::set< unsigned int >  new_image_set  ) 

Definition at line 673 of file PreviewIdentifyTool.cpp.

References DEBUG_ASSERT, ToolHelper::DoNotNotifyMeBeforeDrawing(), ForceRedraw(), Tool::helper, image_set, ToolHelper::NotifyMeBeforeDrawing(), preview_frame, and GLPreviewFrame::SetImageButtonColour().

Referenced by GLPreviewFrame::UpdateIdentifyTools().


Member Data Documentation

unsigned int PreviewIdentifyTool::circle_border_tex [static, private]

OpenGL texture name for the circular border texture.

Definition at line 76 of file PreviewIdentifyTool.h.

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

bool PreviewIdentifyTool::constantOn [private]

Definition at line 102 of file PreviewIdentifyTool.h.

Referenced by MouseButtonEvent(), MouseMoveEvent(), PreviewIdentifyTool(), and setConstantOn().

unsigned int PreviewIdentifyTool::font_list [static, private]

OpenGL call list id for font.

Definition at line 82 of file PreviewIdentifyTool.h.

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

unsigned int PreviewIdentifyTool::font_tex [static, private]

OpenGL texture name for the font texture.

Definition at line 80 of file PreviewIdentifyTool.h.

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

bool PreviewIdentifyTool::holdControl [private]

Definition at line 100 of file PreviewIdentifyTool.h.

Referenced by KeypressEvent(), MouseMoveEvent(), and PreviewIdentifyTool().

bool PreviewIdentifyTool::holdLeft [private]

Definition at line 98 of file PreviewIdentifyTool.h.

Referenced by MouseButtonEvent(), MouseMoveEvent(), and PreviewIdentifyTool().

std::set<unsigned int> PreviewIdentifyTool::image_set [private]

Set of image numbers of the images we are displaying highlighted.

Definition at line 87 of file PreviewIdentifyTool.h.

Referenced by Activate(), AfterDrawImagesEvent(), BeforeDrawImageEvent(), ImagesUnderMouseChangedEvent(), MouseButtonEvent(), ShowImageNumber(), StopShowingImages(), StopUpdating(), and UpdateWithNewImageSet().

std::vector< int > PreviewIdentifyTool::m_glyphWidth [static, private]

glyph width for font

Definition at line 84 of file PreviewIdentifyTool.h.

Referenced by AfterDrawImagesEvent(), and PreviewIdentifyTool().

bool PreviewIdentifyTool::mouse_is_over_button [private]

Definition at line 91 of file PreviewIdentifyTool.h.

Referenced by Activate(), ShowImageNumber(), and StopShowingImages().

unsigned int PreviewIdentifyTool::mouse_over_image [private]

The image the user last placed their mouse over the button for.

Definition at line 90 of file PreviewIdentifyTool.h.

Referenced by ShowImageNumber(), and StopShowingImages().

GLPreviewFrame* PreviewIdentifyTool::preview_frame [private]

Definition at line 88 of file PreviewIdentifyTool.h.

Referenced by AfterDrawImagesEvent(), ImagesUnderMouseChangedEvent(), PreviewIdentifyTool(), StopShowingImages(), StopUpdating(), and UpdateWithNewImageSet().

unsigned int PreviewIdentifyTool::rectangle_border_tex [static, private]

OpenGL texture name for the rectangular border texture.

Definition at line 78 of file PreviewIdentifyTool.h.

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

bool PreviewIdentifyTool::stopUpdating [private]

Definition at line 96 of file PreviewIdentifyTool.h.

Referenced by ContinueUpdating(), ImagesUnderMouseChangedEvent(), MouseButtonEvent(), MouseMoveEvent(), PreviewIdentifyTool(), setConstantOn(), and StopUpdating().

bool PreviewIdentifyTool::texture_created = false [static, private]

Definition at line 74 of file PreviewIdentifyTool.h.

Referenced by PreviewIdentifyTool().


The documentation for this class was generated from the following files:
Generated on 2 Aug 2015 for Hugintrunk by  doxygen 1.4.7