Hugintrunk
0.1
|
Visually connect the image numbers with the image on the preview. More...
#include <PreviewIdentifyTool.h>
Public Member Functions | |
PreviewIdentifyTool (ToolHelper *helper, GLPreviewFrame *owner, bool showNumbers) | |
constructor More... | |
~PreviewIdentifyTool () | |
void | Activate () |
Switch on a tool. More... | |
void | ImagesUnderMouseChangedEvent () |
Notify when the images directly underneath the mouse pointer have changed. More... | |
void | AfterDrawImagesEvent () |
Draw (using OpenGL) images above the others. More... | |
bool | BeforeDrawImageEvent (unsigned int image) |
Draw what the tool requires just before a given image is drawn. More... | |
void | ShowImageNumber (unsigned int image) |
Notification for when moving the mouse on an image button. More... | |
void | StopShowingImages () |
Notification for when moving the mouse off an image button. More... | |
void | MouseButtonEvent (wxMouseEvent &e) |
Show control point editor if mouse is over two images. More... | |
void | MouseMoveEvent (double x, double y, wxMouseEvent &e) |
Notify when the mouse pointer has moved over the panorama preview. More... | |
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 () |
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 | KeypressEvent (int keycode, int modifiers, bool pressed) |
Notify of a Keypress event. More... | |
virtual void | BeforeDrawImagesEvent () |
Draw using OpenGL anything the tool requires underneath the images. 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 () |
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. More... | |
void | StopUpdating () |
void | ContinueUpdating () |
Private Attributes | |
std::set< unsigned int > | m_image_set |
Set of image numbers of the images we are displaying highlighted. More... | |
GLPreviewFrame * | m_preview_frame |
unsigned int | m_mouse_over_image |
The image the user last placed their mouse over the button for. More... | |
bool | m_mouse_is_over_button |
bool | m_stopUpdating |
bool | m_holdLeft |
bool | m_holdControl |
bool | m_constantOn |
bool | m_showNumbers |
Static Private Attributes | |
static bool | texture_created = false |
static unsigned int | circle_border_tex |
OpenGL texture name for the circular border texture. More... | |
static unsigned int | rectangle_border_tex |
OpenGL texture name for the rectangular border texture. More... | |
static unsigned int | font_tex |
OpenGL texture name for the font texture. More... | |
static unsigned int | font_list |
OpenGL call list id for font. More... | |
static std::vector< int > | m_glyphWidth |
glyph width for font More... | |
Additional Inherited Members | |
Protected Attributes inherited from Tool | |
ToolHelper * | helper |
The PreviewToolHelper that uses the same preview window and panorama as the tool should. More... | |
Visually connect the image numbers with the image on the preview.
There are two ways it does this:
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.
PreviewIdentifyTool::PreviewIdentifyTool | ( | ToolHelper * | helper, |
GLPreviewFrame * | owner, | ||
bool | showNumbers | ||
) |
constructor
helper | pointer to ToolHelper class for managing Tool notifications |
owner | pointer to GLPreviewFrame, needed for updating the color of the image buttons |
showNumbers | true, if the image number should be shown above the images, this image show code works only for the preview, not for the panosphere and mosaic plane so pass the correct parameter depending on the underlying GLRenderer/GLViewer class |
Definition at line 95 of file PreviewIdentifyTool.cpp.
References circle_border_inner, circle_border_outer, circle_border_peak, circle_border_tex, circle_middle, circle_ts, circle_ts_multiple, font_list, font_tex, FONT_TEXTURE_HEIGHT, GenerateFontTexture(), m_constantOn, m_glyphWidth, m_holdControl, m_holdLeft, m_preview_frame, m_showNumbers, m_stopUpdating, rect_ts, rectangle_border_tex, and texture_created.
PreviewIdentifyTool::~PreviewIdentifyTool | ( | ) |
Definition at line 249 of file PreviewIdentifyTool.cpp.
References circle_border_tex, font_list, font_tex, rectangle_border_tex, and texture_created.
|
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 262 of file PreviewIdentifyTool.cpp.
References ToolHelper::DRAW_OVER_IMAGES, Tool::helper, ToolHelper::IMAGES_UNDER_MOUSE_CHANGE, ImagesUnderMouseChangedEvent(), m_image_set, m_mouse_is_over_button, ToolHelper::MOUSE_MOVE, ToolHelper::MOUSE_PRESS, and ToolHelper::NotifyMe().
|
virtual |
Draw (using OpenGL) images above the others.
Reimplemented from Tool.
Definition at line 400 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(), m_glyphWidth, m_image_set, m_preview_frame, m_showNumbers, celeste::min(), HuginBase::BaseSrcPanoImage::NO_CROP, rectangle_border_tex, GLPreviewFrame::SetImageButtonColour(), and HuginBase::PTools::Transform::transformImgCoord().
|
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).
Reimplemented from Tool.
Definition at line 546 of file PreviewIdentifyTool.cpp.
References DEBUG_ASSERT, and m_image_set.
|
private |
Definition at line 300 of file PreviewIdentifyTool.cpp.
References ImagesUnderMouseChangedEvent(), and m_stopUpdating.
Referenced by KeypressEvent(), MouseMoveEvent(), and setConstantOn().
void PreviewIdentifyTool::ForceRedraw | ( | ) |
Definition at line 721 of file PreviewIdentifyTool.cpp.
References VisualizationState::ForceRequireRedraw(), ToolHelper::GetVisualizationStatePtr(), Tool::helper, and VisualizationState::Redraw().
Referenced by ShowImageNumber(), StopShowingImages(), StopUpdating(), and UpdateWithNewImageSet().
|
private |
Generate a colour given how many colours we need and an index.
Definition at line 586 of file PreviewIdentifyTool.cpp.
References DEBUG_ASSERT.
Referenced by AfterDrawImagesEvent().
|
virtual |
Notify when the images directly underneath the mouse pointer have changed.
It is monitored by the PreviewToolHelper.
Reimplemented from Tool.
Definition at line 375 of file PreviewIdentifyTool.cpp.
References ToolHelper::GetImageNumbersUnderMouse(), Tool::helper, m_image_set, m_preview_frame, m_stopUpdating, ToolHelper::SetStatusMessage(), and GLPreviewFrame::UpdateIdentifyTools().
Referenced by Activate(), ContinueUpdating(), and MouseButtonEvent().
void PreviewIdentifyTool::KeypressEvent | ( | int | keycode, |
int | modifiers, | ||
int | pressed | ||
) |
Definition at line 346 of file PreviewIdentifyTool.cpp.
References ContinueUpdating(), m_holdControl, and StopUpdating().
|
virtual |
Show control point editor if mouse is over two images.
Reimplemented from Tool.
Definition at line 629 of file PreviewIdentifyTool.cpp.
References MainFrame::Get(), Tool::helper, ImagesUnderMouseChangedEvent(), ToolHelper::IsMouseOverPano(), m_constantOn, m_holdLeft, m_image_set, m_stopUpdating, MainFrame::ShowCtrlPointEditor(), and MainFrame::ShowMaskEditor().
|
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.
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 305 of file PreviewIdentifyTool.cpp.
References ContinueUpdating(), m_constantOn, m_holdControl, m_holdLeft, m_stopUpdating, and StopUpdating().
void PreviewIdentifyTool::setConstantOn | ( | bool | constant_on_in | ) |
Definition at line 361 of file PreviewIdentifyTool.cpp.
References ContinueUpdating(), Tool::helper, m_constantOn, m_stopUpdating, ToolHelper::SetStatusMessage(), 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.
image | the image number of the image the mouse is on. |
Definition at line 554 of file PreviewIdentifyTool.cpp.
References DEBUG_ASSERT, ForceRedraw(), Tool::helper, m_image_set, m_mouse_is_over_button, m_mouse_over_image, and ToolHelper::NotifyMeBeforeDrawing().
void PreviewIdentifyTool::StopShowingImages | ( | ) |
Notification for when moving the mouse off an image button.
Definition at line 571 of file PreviewIdentifyTool.cpp.
References ToolHelper::DoNotNotifyMeBeforeDrawing(), ForceRedraw(), Tool::helper, m_image_set, m_mouse_is_over_button, m_mouse_over_image, m_preview_frame, and GLPreviewFrame::SetImageButtonColour().
|
private |
Definition at line 282 of file PreviewIdentifyTool.cpp.
References DEBUG_ASSERT, ToolHelper::DoNotNotifyMeBeforeDrawing(), ForceRedraw(), Tool::helper, m_image_set, m_preview_frame, m_stopUpdating, GLPreviewFrame::SetImageButtonColour(), and GLPreviewFrame::UpdateIdentifyTools().
Referenced by KeypressEvent(), MouseMoveEvent(), and setConstantOn().
void PreviewIdentifyTool::UpdateWithNewImageSet | ( | std::set< unsigned int > | new_image_set | ) |
Definition at line 671 of file PreviewIdentifyTool.cpp.
References DEBUG_ASSERT, ToolHelper::DoNotNotifyMeBeforeDrawing(), ForceRedraw(), Tool::helper, m_image_set, m_preview_frame, ToolHelper::NotifyMeBeforeDrawing(), and GLPreviewFrame::SetImageButtonColour().
Referenced by GLPreviewFrame::UpdateIdentifyTools().
|
staticprivate |
OpenGL texture name for the circular border texture.
Definition at line 83 of file PreviewIdentifyTool.h.
Referenced by AfterDrawImagesEvent(), PreviewIdentifyTool(), and ~PreviewIdentifyTool().
|
staticprivate |
OpenGL call list id for font.
Definition at line 89 of file PreviewIdentifyTool.h.
Referenced by AfterDrawImagesEvent(), PreviewIdentifyTool(), and ~PreviewIdentifyTool().
|
staticprivate |
OpenGL texture name for the font texture.
Definition at line 87 of file PreviewIdentifyTool.h.
Referenced by AfterDrawImagesEvent(), PreviewIdentifyTool(), and ~PreviewIdentifyTool().
|
private |
Definition at line 109 of file PreviewIdentifyTool.h.
Referenced by MouseButtonEvent(), MouseMoveEvent(), PreviewIdentifyTool(), and setConstantOn().
|
staticprivate |
glyph width for font
Definition at line 91 of file PreviewIdentifyTool.h.
Referenced by AfterDrawImagesEvent(), and PreviewIdentifyTool().
|
private |
Definition at line 107 of file PreviewIdentifyTool.h.
Referenced by KeypressEvent(), MouseMoveEvent(), and PreviewIdentifyTool().
|
private |
Definition at line 105 of file PreviewIdentifyTool.h.
Referenced by MouseButtonEvent(), MouseMoveEvent(), and PreviewIdentifyTool().
|
private |
Set of image numbers of the images we are displaying highlighted.
Definition at line 94 of file PreviewIdentifyTool.h.
Referenced by Activate(), AfterDrawImagesEvent(), BeforeDrawImageEvent(), ImagesUnderMouseChangedEvent(), MouseButtonEvent(), ShowImageNumber(), StopShowingImages(), StopUpdating(), and UpdateWithNewImageSet().
|
private |
Definition at line 98 of file PreviewIdentifyTool.h.
Referenced by Activate(), ShowImageNumber(), and StopShowingImages().
|
private |
The image the user last placed their mouse over the button for.
Definition at line 97 of file PreviewIdentifyTool.h.
Referenced by ShowImageNumber(), and StopShowingImages().
|
private |
Definition at line 95 of file PreviewIdentifyTool.h.
Referenced by AfterDrawImagesEvent(), ImagesUnderMouseChangedEvent(), PreviewIdentifyTool(), StopShowingImages(), StopUpdating(), and UpdateWithNewImageSet().
|
private |
Definition at line 110 of file PreviewIdentifyTool.h.
Referenced by AfterDrawImagesEvent(), and PreviewIdentifyTool().
|
private |
Definition at line 103 of file PreviewIdentifyTool.h.
Referenced by ContinueUpdating(), ImagesUnderMouseChangedEvent(), MouseButtonEvent(), MouseMoveEvent(), PreviewIdentifyTool(), setConstantOn(), and StopUpdating().
|
staticprivate |
OpenGL texture name for the rectangular border texture.
Definition at line 85 of file PreviewIdentifyTool.h.
Referenced by AfterDrawImagesEvent(), PreviewIdentifyTool(), and ~PreviewIdentifyTool().
|
staticprivate |
Definition at line 81 of file PreviewIdentifyTool.h.
Referenced by PreviewIdentifyTool(), and ~PreviewIdentifyTool().