Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DragTool Class Referenceabstract

Allows the user to change the yaw, pitch and roll of a connected component of images by dragging them in the fast preview. More...

#include <DragTool.h>

Inheritance diagram for DragTool:
Inheritance graph

Classes

class  ParamStore
 

Public Types

enum  DragMode { drag_mode_normal, drag_mode_mosaic }
 

Public Member Functions

 DragTool (ToolHelper *helper)
 
void Activate ()
 Switch on a tool. More...
 
void MouseMoveEvent (double x, double y, wxMouseEvent &e)
 Notify when the mouse pointer has moved over the panorama preview. More...
 
void MouseButtonEvent (wxMouseEvent &e)
 Notify of a mouse button press on the panorama preview. More...
 
virtual void ReallyAfterDrawImagesEvent ()=0
 Draw (using OpenGL) the overlays, e.g. crop highlights, guides. More...
 
void setDragMode (DragMode drag_mode)
 
DragMode getDragMode ()
 
void getTranslationShift (double &delta_x, double &delta_y)
 
- 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 BeforeDrawImagesEvent ()
 Draw using OpenGL anything the tool requires underneath the images. More...
 
virtual void AfterDrawImagesEvent ()
 Draw (using OpenGL) images above the others. More...
 
virtual bool BeforeDrawImageEvent (unsigned int image)
 Draw what the tool requires just before a given image is drawn. More...
 
virtual void AfterDrawImageEvent (unsigned int image)
 Notification called just after the image was drawn normally. More...
 
virtual void MarkDirty ()
 

Protected Member Functions

void SetRotationMatrix (double yaw_shift, double pitch_shift, double roll_shift, double yaw_start, double pitch_start, double roll_start)
 

Protected Attributes

std::map< unsigned int,
ParamStore
image_params
 
std::set< unsigned int > draging_images
 
bool drag_yaw
 
bool drag_pitch
 
bool drag_roll
 
double start_angle
 
double shift_angle
 
hugin_utils::FDiff2D centre
 
hugin_utils::FDiff2D start_coordinates
 
hugin_utils::FDiff2D shift_coordinates
 
bool shift
 
bool control
 
Matrix3 rotation_matrix
 
DragMode drag_mode
 
bool custom_drag
 
- Protected Attributes inherited from Tool
ToolHelperhelper
 The PreviewToolHelper that uses the same preview window and panorama as the tool should. More...
 

Detailed Description

Allows the user to change the yaw, pitch and roll of a connected component of images by dragging them in the fast preview.

If there are multiple components under the pointer when the user begins to drag, the lowest number one is chosen, since it is drawn on top.

Modifiers Variables changed
none yaw and pitch
shift yaw or pitch, depending on biggest difference.
control roll

You can also change only roll by using the secondary mouse button (if there is one).

Reasoning: control click on mac is equivalent right click on other platforms, no modifiers should be close to old behaviour (where no modifiers were used), alt moves windows on some window managers, leaving shift as the only common modifier suitable for constrained drag.

Definition at line 50 of file DragTool.h.

Member Enumeration Documentation

Enumerator
drag_mode_normal 
drag_mode_mosaic 

Definition at line 71 of file DragTool.h.

Constructor & Destructor Documentation

DragTool::DragTool ( ToolHelper helper)
explicit

Definition at line 42 of file DragTool.cpp.

Member Function Documentation

void DragTool::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 69 of file DragTool.cpp.

References control, drag_pitch, drag_roll, drag_yaw, Tool::helper, ToolHelper::MOUSE_MOVE, ToolHelper::MOUSE_PRESS, ToolHelper::NotifyMe(), ToolHelper::REALLY_DRAW_OVER_IMAGES, ToolHelper::SetStatusMessage(), and shift.

DragTool::DragMode DragTool::getDragMode ( )

Definition at line 52 of file DragTool.cpp.

References drag_mode.

Referenced by GLPreviewFrame::panoramaImagesChanged().

void DragTool::getTranslationShift ( double &  delta_x,
double &  delta_y 
)
void DragTool::MouseButtonEvent ( wxMouseEvent &  e)
virtual
void DragTool::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
xThe horizontal position of the mouse pointer in panorama pixels.
yThe vertical position of the mouse pointer in panorama pixels.
eThe event created by wxWidgets.

Reimplemented from Tool.

Definition at line 81 of file DragTool.cpp.

References centre, drag_mode, drag_mode_mosaic, drag_pitch, drag_roll, drag_yaw, ToolHelper::GetMousePanoPosition(), VisualizationState::GetProjectionInfo(), getTranslationShift(), ToolHelper::GetViewStatePtr(), ToolHelper::GetVisualizationStatePtr(), Tool::helper, image_params, OutputProjectionInfo::ImageToAngular(), VisualizationState::Redraw(), rotation_matrix, SetRotationMatrix(), ViewState::SetSrcImage(), ToolHelper::SetStatusMessage(), shift, shift_angle, shift_coordinates, start_angle, start_coordinates, hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

virtual void DragTool::ReallyAfterDrawImagesEvent ( )
pure virtual

Draw (using OpenGL) the overlays, e.g. crop highlights, guides.

Reimplemented from Tool.

Implemented in OverviewDragTool, and PreviewDragTool.

void DragTool::setDragMode ( PreviewDragTool::DragMode  dmode)

Definition at line 47 of file DragTool.cpp.

References drag_mode.

Referenced by GLPreviewFrame::OnDragChoice(), and GLPreviewFrame::panoramaImagesChanged().

void DragTool::SetRotationMatrix ( double  yaw_shift,
double  pitch_shift,
double  roll_shift,
double  yaw_start,
double  pitch_start,
double  roll_start 
)
protected

Definition at line 417 of file DragTool.cpp.

References DEG_TO_RAD, rotation_matrix, and Matrix3::SetRotationPT().

Referenced by MouseButtonEvent(), and MouseMoveEvent().

Member Data Documentation

hugin_utils::FDiff2D DragTool::centre
protected
bool DragTool::control
protected

Definition at line 86 of file DragTool.h.

Referenced by Activate(), and MouseButtonEvent().

bool DragTool::custom_drag
protected

Definition at line 93 of file DragTool.h.

DragMode DragTool::drag_mode
protected

Definition at line 92 of file DragTool.h.

Referenced by getDragMode(), MouseMoveEvent(), and setDragMode().

bool DragTool::drag_pitch
protected
bool DragTool::drag_roll
protected
bool DragTool::drag_yaw
protected
std::set<unsigned int> DragTool::draging_images
protected

Definition at line 82 of file DragTool.h.

Referenced by MouseButtonEvent().

std::map<unsigned int, ParamStore> DragTool::image_params
protected

Definition at line 81 of file DragTool.h.

Referenced by MouseButtonEvent(), and MouseMoveEvent().

Matrix3 DragTool::rotation_matrix
protected

Definition at line 87 of file DragTool.h.

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

bool DragTool::shift
protected

Definition at line 86 of file DragTool.h.

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

double DragTool::shift_angle
protected
hugin_utils::FDiff2D DragTool::shift_coordinates
protected
double DragTool::start_angle
protected
hugin_utils::FDiff2D DragTool::start_coordinates
protected

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