00001
00023 #ifndef __OVERVIEW_OUTLINES_TOOL_H__
00024 #define __OVERVIEW_OUTLINES_TOOL_H__
00025
00026 #include "Tool.h"
00027
00028 class GLViewer;
00029
00043 class OverviewOutlinesTool : public HuginBase::PanoramaObserver
00044 {
00045 public:
00046 OverviewOutlinesTool(ToolHelper *, GLViewer * preview);
00047 virtual ~OverviewOutlinesTool();
00048
00049
00050 void panoramaChanged(HuginBase::PanoramaData &pano);
00051 void panoramaImagesChanged(HuginBase::PanoramaData&, const HuginBase::UIntSet&) {}
00052
00056 class Rect {
00057 public:
00058 Rect(double left, double top, double right, double bottom) {
00059 val[0][0] = left; val[0][1] = top;
00060 val[1][0] = left; val[1][1] = bottom;
00061 val[2][0] = right; val[2][1] = bottom;
00062 val[3][0] = right; val[3][1] = top;
00063 }
00068 Rect transformImgCoord(HuginBase::PTools::Transform *trans) {
00069 Rect res(0,0,0,0);
00070 for (int s = 0 ; s < 4 ; s++) {
00071 double x,y;
00072 trans->transformImgCoord(x,y, val[s][0], val[s][1]);
00073 res.val[s][0] = x;
00074 res.val[s][1] = y;
00075 }
00076 return res;
00077 }
00081 void center(double &x, double &y) {
00082 x = (val[0][0] + val[1][0] + val[2][0] + val[3][0]) / 4.0;
00083 y = (val[0][1] + val[1][1] + val[2][1] + val[3][1]) / 4.0;
00084 }
00085 double val[4][2];
00086 };
00087
00091 virtual void drawBackground() {}
00092
00093 protected:
00094
00095 void draw();
00096
00097 void DrawRect(double left, double top, double right, double bottom, bool outline, double linewidth = 1.0);
00098
00099 ToolHelper * thelper;
00100
00101 bool dirty_meshes;
00102
00103
00104
00105 const static double res;
00106 const static double mindist;
00107
00108 GLViewer * preview;
00109
00110 unsigned int display_list_number_canvas;
00111 unsigned int display_list_number_crop;
00112 unsigned int display_list_number_canvas_outline;
00113 unsigned int display_list_number_crop_outline;
00114
00115
00116 };
00117
00118 class PanosphereOverviewOutlinesTool : public OverviewOutlinesTool, public PanosphereOverviewTool
00119 {
00120 public:
00121
00122 PanosphereOverviewOutlinesTool(PanosphereOverviewToolHelper* helper, GLViewer * preview) : PanosphereOverviewTool(helper), OverviewOutlinesTool(helper, preview) {}
00123
00124 void Activate();
00125 void AfterDrawImagesBackEvent();
00126 void AfterDrawImagesFrontEvent();
00127
00128
00129 void drawBackground();
00130
00131
00132 };
00133
00134 class PlaneOverviewOutlinesTool : public OverviewOutlinesTool, public PlaneOverviewTool
00135 {
00136 public:
00137
00138 PlaneOverviewOutlinesTool(PlaneOverviewToolHelper* helper, GLViewer * preview) : PlaneOverviewTool(helper), OverviewOutlinesTool(helper, preview) {}
00139
00140 void Activate();
00141 void AfterDrawImagesEvent();
00142
00143 void drawBackground();
00144
00145 };
00146
00147
00148 #endif
00149