00001
00024 #ifndef _PREVIEWPANEL_H
00025 #define _PREVIEWPANEL_H
00026
00027 #include <vector>
00028
00029 #include <base_wx/wxImageCache.h>
00030
00031 #include <vigra_ext/ROIImage.h>
00032
00033 class wxImage;
00034 class PreviewFrame;
00035
00040 class PreviewPanel : public wxPanel, public PT::PanoramaObserver
00041 {
00042 typedef PT::RemappedPanoImage<vigra::BRGBImage, vigra::BImage> RemappedImage;
00043 public:
00044
00047 PreviewPanel();
00048
00049 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = wxT("panel"));
00050
00051 void Init(PreviewFrame *parent, PT::Panorama * pano );
00052
00055 virtual ~PreviewPanel();
00056
00057 void panoramaChanged(PT::Panorama &pano);
00058 void panoramaImagesChanged(PT::Panorama &pano, const PT::UIntSet & imgNr);
00059
00060 void SetAutoUpdate(bool enabled);
00061
00062
00063 void ForceUpdate();
00064
00065
00066
00067
00068
00069 enum BlendMode { BLEND_COPY, BLEND_DIFFERENCE };
00070
00071 void SetBlendMode(BlendMode b);
00072
00073 private:
00074
00075
00076 void DrawPreview(wxDC & dc);
00077
00078
00079 void updatePreview();
00080
00081 void mapPreviewImage(unsigned int imgNr);
00082
00084 void OnResize(wxSizeEvent & e);
00085 void OnDraw(wxPaintEvent & event);
00086 void OnMouse(wxMouseEvent & e);
00087 void mousePressRMBEvent(wxMouseEvent & e);
00088 void mousePressLMBEvent(wxMouseEvent & e);
00089
00090 void OnUpdatePreview(wxCommandEvent & e);
00091 void DrawOutline(const std::vector<hugin_utils::FDiff2D> & points, wxDC & dc, int offX, int offY);
00092
00093 void mouse2erect(int xm, int ym, double &xd, double & yd);
00094
00096 PT::Panorama * pano;
00097
00098 bool m_autoPreview;
00099
00100 vigra::Diff2D m_panoImgSize;
00101
00102 wxBitmap * m_panoBitmap;
00103
00104
00105 PT::UIntSet m_dirtyImgs;
00106
00107
00108 PT::PanoramaOptions opts;
00109
00110
00111 PTools::Transform * m_pano2erect;
00112
00113
00114 SmallRemappedImageCache m_remapCache;
00115
00116 BlendMode m_blendMode;
00117
00118 PreviewFrame * parentWindow;
00119 wxCursor * m_cursor;
00120
00121 bool m_state_rendering;
00122 bool m_rerender;
00123 bool m_imgsDirty;
00124
00125 DECLARE_EVENT_TABLE()
00126 DECLARE_DYNAMIC_CLASS(PreviewPanel)
00127 };
00128
00130 class PreviewPanelXmlHandler : public wxXmlResourceHandler
00131 {
00132 DECLARE_DYNAMIC_CLASS(PreviewPanelXmlHandler)
00133
00134 public:
00135 PreviewPanelXmlHandler();
00136 virtual wxObject *DoCreateResource();
00137 virtual bool CanHandle(wxXmlNode *node);
00138 };
00139
00140 #endif // _PREVIEWPANEL_H