00001
00023 #ifndef _PREVIEWDRAGTOOL_H
00024 #define _PREVIEWDRAGTOOL_H
00025
00026 #include "Tool.h"
00027
00028 #include <map>
00029 #include <hugin_math/Matrix3.h>
00030
00050 class DragTool : public Tool
00051 {
00052 public:
00053 DragTool(ToolHelper *helper);
00054 void Activate();
00055 void MouseMoveEvent(double x, double y, wxMouseEvent & e);
00056 void MouseButtonEvent(wxMouseEvent &e);
00057
00058 virtual void ReallyAfterDrawImagesEvent() = 0;
00059
00060 class ParamStore
00061 {
00062 public:
00063 double yaw, pitch, roll, TrX, TrY, TrZ, Tpy, Tpp;
00064 void Set(HuginBase::SrcPanoImage *img);
00065 void Move(Matrix3 *matrix,
00066 double &yaw_out, double &pitch_out, double &roll_out, double &TrX_out, double &TrY_out, double &TrZ_out,
00067 double &Tpy_out, double &Tpp_out);
00068 };
00069
00070
00071 enum DragMode {
00072 drag_mode_normal,
00073 drag_mode_mosaic
00074 };
00075 void setDragMode(DragMode drag_mode);
00076 DragMode getDragMode();
00077
00078 void getTranslationShift(double &delta_x, double &delta_y);
00079
00080 protected:
00081 std::map<unsigned int, ParamStore> image_params;
00082 std::set<unsigned int> draging_images;
00083 bool drag_yaw, drag_pitch, drag_roll;
00084 double start_angle, shift_angle;
00085 hugin_utils::FDiff2D centre, start_coordinates, shift_coordinates;
00086 bool shift, control;
00087 Matrix3 rotation_matrix;
00088 void SetRotationMatrix(double yaw_shift, double pitch_shift,
00089 double roll_shift,
00090 double yaw_start, double pitch_start,
00091 double roll_start);
00092 DragMode drag_mode;
00093 bool custom_drag;
00094 };
00095
00096 class PreviewDragTool : public DragTool
00097 {
00098 public:
00099 PreviewDragTool(PreviewToolHelper *helper) : DragTool(helper) {}
00100
00101 void ReallyAfterDrawImagesEvent();
00102
00103 };
00104
00105 class OverviewDragTool : public DragTool
00106 {
00107 public:
00108 OverviewDragTool(OverviewToolHelper *helper) : DragTool(helper) {}
00109
00110 void ReallyAfterDrawImagesEvent();
00111
00112 };
00113
00114 #endif
00115