Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLPreviewFrame.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
23 #ifndef _GLPREVIEWFRAME_H
24 #define _GLPREVIEWFRAME_H
25 
26 class GLRenderer;
27 class wxToolBar;
28 class wxToggleButton;
29 class wxCheckBox;
30 class wxTextCtrl;
31 class wxBitmapButton;
32 class wxSpinButton;
33 class wxScrolledWindow;
34 class wxBoxSizer;
35 class wxStaticBoxSizer;
36 class wxStaticText;
37 class wxSlider;
38 class GLViewer;
39 class GLPreview;
40 class GLOverview;
41 class ViewState;
42 class wxSpinEvent;
43 class wxChoice;
44 //forward declaration for wxInfoBar works only for wxGTK
45 //for other systems wxInfoBar is defined as preprocessor macro and not as class
46 //class wxInfoBar;
47 #include <wx/infobar.h>
48 
49 class MeshManager;
50 
51 class ToolHelper;
52 class PreviewToolHelper;
55 class Tool;
56 class PreviewTool;
57 class PreviewCropTool;
58 class DragTool;
59 class OverviewDragTool;
62 class PreviewDragTool;
69 class PreviewEditCPTool;
70 class PreviewCameraTool;
71 
75 
78 
79 class PreviewGuideTool;
80 
81 class GLPreviewFrame;
82 
83 class GLwxAuiManager;
85 
86 #include <wx/string.h>
87 #include <wx/frame.h>
88 #include <wx/aui/aui.h>
89 #include <wx/clrpicker.h>
90 #include "hugin/GuiLevel.h"
91 #include "hugin/SplitButton.h"
92 
93 #include <iostream>
94 
95 // the image toggle buttons need a special event handler to trap mouse enter and
96 // leave events.
97 class ImageToogleButtonEventHandler : public wxEvtHandler
98 {
99 public:
101  wxToggleButton* identify_button_in,
103  void OnChange(wxCommandEvent &e);
104  void AddIdentifyTool(PreviewIdentifyTool** identify_tool_in);
105 protected:
106  void OnEnter(wxMouseEvent & e);
107  void OnLeave(wxMouseEvent & e);
108 private:
109  DECLARE_EVENT_TABLE()
110  unsigned int image_number;
112  wxToggleButton* m_identify_button;
113  HuginBase::Panorama * m_pano;
114 };
115 
116 class ImageGroupButtonEventHandler : public wxEvtHandler
117 {
118 public:
119  ImageGroupButtonEventHandler(unsigned int image_number, GLPreviewFrame* frame_in, HuginBase::Panorama* m_pano);
120  void OnChange(wxCommandEvent &e);
121  void AddDragTool(DragTool** drag_tool_in);
122  void AddIdentifyTool(PreviewIdentifyTool** identify_tool_in);
123 protected:
124  void OnEnter(wxMouseEvent & e);
125  void OnLeave(wxMouseEvent & e);
126 private:
127  DECLARE_EVENT_TABLE()
128  unsigned int image_number;
129  std::vector<DragTool**> drag_tools;
130  std::vector<PreviewIdentifyTool**> identify_tools;
132  HuginBase::Panorama * m_pano;
133 };
134 
135 
139 class GLwxAuiFloatingFrame : public wxAuiFloatingFrame {
140 public:
141  GLwxAuiFloatingFrame(wxWindow* parent,
142  GLwxAuiManager* owner_mgr,
143  const wxAuiPaneInfo& pane,
144  wxWindowID id = wxID_ANY,
145  long style = wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION |
146 // wxFRAME_NO_TASKBAR |
147  wxFRAME_FLOAT_ON_PARENT |
148  wxCLIP_CHILDREN
149  ) : wxAuiFloatingFrame(parent, (wxAuiManager*) owner_mgr, pane, id, style) {}
150 
151 
152  void OnActivate(wxActivateEvent& evt);
153  void OnMoveFinished();
154 // void OnClose(wxCloseEvent& event);
155 
156  DECLARE_EVENT_TABLE()
157 
158 };
159 
164 class GLwxAuiManager : public wxAuiManager {
165 public:
166  GLwxAuiManager(GLPreviewFrame* frame, GLPreview * preview, GLOverview * overview) : frame(frame), preview(preview), overview(overview) {}
167  GLwxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
168  GLPreviewFrame * getPreviewFrame() {return frame;}
169  GLPreview * getGLPreview() {return preview;}
170  GLOverview * getGLOverview() {return overview;}
171 
172 private:
176 };
177 
178 
179 
187 class GLPreviewFrame : public wxFrame, public HuginBase::PanoramaObserver
188 {
189 public:
190 
193  GLPreviewFrame(wxFrame * frame, HuginBase::Panorama &pano);
194 
197  virtual ~GLPreviewFrame();
199  void StorePositionAndSize();
200 
201  virtual void panoramaChanged(HuginBase::Panorama &pano);
202  virtual void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &changed);
203 
204  void MakePreviewTools(PreviewToolHelper * helper);
205  void MakePanosphereOverviewTools(PanosphereOverviewToolHelper * helper);
206  void MakePlaneOverviewTools(PlaneOverviewToolHelper* helper);
207 
208  void SetImageButtonColour(unsigned int image_nr, unsigned char red,
209  unsigned char green, unsigned char blue);
210  void SetStatusMessage(wxString message);
213  void FillBlendChoice();
215  void LoadOpenGLLayout();
217  void InitPreviews();
219  void SetGuiLevel(GuiLevel newLevel);
221  void AddUserDefinedSequence(int id, const wxString& desc, const wxString& help);
223  void AddUserDefinedAssistant(int id, const wxString& desc, const wxString& help);
224 
225  GLwxAuiManager* getAuiManager() {return m_mgr;}
226  GLPreview* getPreview() {return m_GLPreview;}
227  GLOverview* getOverview() {return m_GLOverview;}
228 
229  void PauseResize();
230  void ContinueResize();
231  bool CanResize() {return GLresize;}
232 
239  void redrawPreview();
241  void ResetPreviewZoom();
243  void SetShowProjectionHints(bool new_value);
244  void OnShowEvent(wxShowEvent& e);
245 
246  bool individualDragging();
247  void ToggleImageInDragGroup(unsigned int image_nr, bool update_check_box = true);
248  void RemoveImageFromDragGroup(unsigned int image_nr, bool update_check_box = true);
249  void AddImageToDragGroup(unsigned int image_nr, bool update_check_box = true);
250  void SetDragGroupImages(HuginBase::UIntSet imageDragGroup_in, bool update_check_box = true);
251  HuginBase::UIntSet GetDragGroupImages();
252  void ClearDragGroupImages(bool update_check_box = true);
257  void UpdateGlobalWhiteBalance(double redFactor, double blueFactor);
258  void UpdateIdentifyTools(std::set<unsigned int> new_image_set);
259 
260  wxColour GetPreviewBackgroundColor();
261 
262 protected:
263 
264  bool GLresize = true;
265 
266  void OnClose(wxCloseEvent& e);
267 
268  void OnOverviewToggle(wxCommandEvent& e);
269 
270  void OnCenterHorizontally(wxCommandEvent & e);
271  void OnFitPano(wxCommandEvent& e);
272  void OnStraighten(wxCommandEvent & e);
273  void OnShowAll(wxCommandEvent & e);
274  void OnShowNone(wxCommandEvent & e);
275  void OnPhotometric(wxCommandEvent & e);
276  void OnIdentify(wxCommandEvent &e);
277  void OnAutocrop(wxCommandEvent &e);
278  void OnStackAutocrop(wxCommandEvent &e);
279  void OnAutocropOutside(wxCommandEvent& e);
280  void OnControlPoint(wxCommandEvent &e);
281  void OnNumTransform(wxCommandEvent & e);
282  void OnChangeFOV(wxScrollEvent & e);
283  void OnTrackChangeFOV(wxScrollEvent & e);
284  void OnExposureChanged(wxCommandEvent & e);
285  void OnProjParameterChanged(wxCommandEvent & e);
287  void OnProjParameterReset(wxCommandEvent & e);
289  void OnSwitchPreviewGrid(wxCommandEvent & e);
291  void OnUserExit(wxCommandEvent & e);
292 
293  void OnDefaultExposure( wxCommandEvent & e );
294  void OnDecreaseExposure( wxSpinEvent & e );
295  void OnIncreaseExposure( wxSpinEvent & e );
296  void OnRangeCompressionIncrease(wxSpinEvent & e);
297  void OnRangeCompressionDecrease(wxSpinEvent & e);
298  void OnRangeCompressionChanged(wxCommandEvent& e);
299 
300  void OnBlendChoice(wxCommandEvent & e);
301  void OnDragChoice(wxCommandEvent & e);
302 
303  void KeyDown(wxKeyEvent & e);
304  void KeyUp(wxKeyEvent & e);
305 
306  void DragChoiceLayout( int index );
307  void OnProjectionChoice(wxCommandEvent & e);
308  void OnOverviewModeChoice(wxCommandEvent & e);
310  void OnROIChanged(wxCommandEvent & e);
312  void OnResetCrop(wxCommandEvent & e);
314  void OnSetCropAspect(wxCommandEvent& e);
315  void OnHFOVChanged(wxCommandEvent & e);
316  void OnVFOVChanged(wxCommandEvent & e);
318  void OnHideProjectionHints(wxCommandEvent &e);
319  // No HDR display yet
320  // void OnOutputChoice(wxCommandEvent & e);
321  // update tools according to blend mode choice
322  void updateBlendMode();
324  void OnFullScreen(wxCommandEvent &e);
326  void OnSelectMode(wxNotebookEvent &e);
328  void OnToolModeChanging(wxNotebookEvent &e);
330  void OnLayoutScaleChange(wxScrollEvent &e);
332  void OnColorPicker(wxCommandEvent &e);
334  void OnEditCPTool(wxCommandEvent &e);
336  void OnPreviewBackgroundColorChanged(wxColourPickerEvent & e);
338  void OnGuideChanged(wxCommandEvent &e);
340  void OnShowMainFrame(wxCommandEvent &e);
341  // assistant related event handler
342  void OnLoadImages( wxCommandEvent & e );
343  void LoadImages(int preferredLensType);
344  void OnAlign( wxCommandEvent & e );
345  void OnCreate( wxCommandEvent & e );
347  void OnCreateCP(wxCommandEvent & e);
349  void OnRemoveCP(wxCommandEvent & e);
351  void OnMenuClose(wxMenuEvent & e);
353  void OnSelectAllMenu(wxCommandEvent& e);
354  void OnSelectMedianMenu(wxCommandEvent& e);
355  void OnSelectDarkestMenu(wxCommandEvent& e);
356  void OnSelectBrightestMenu(wxCommandEvent& e);
357  void OnSelectKeepSelection(wxCommandEvent& e);
358  void OnSelectResetSelection(wxCommandEvent& e);
359 private:
363  void EnableGroupCheckboxes(bool isShown);
368  bool UpdateOverviewMode(int newMode);
370  void UpdateRoiDisplay(const HuginBase::PanoramaOptions opts);
373 
374  void SetMode(int newMode);
376 
379 
381 
383 
384  int m_mode;
386  wxToggleButton* m_identify_togglebutton;
387  wxToggleButton* m_colorpicker_togglebutton;
388  wxToggleButton* m_editCP_togglebutton;
389  wxNotebook* m_tool_notebook;
391  wxSlider * m_HFOVSlider;
392  wxSlider * m_VFOVSlider;
393  wxTextCtrl * m_HFOVText;
394  wxTextCtrl * m_VFOVText;
395  wxTextCtrl * m_ROILeftTxt;
396  wxTextCtrl * m_ROIRightTxt;
397  wxTextCtrl * m_ROITopTxt;
398  wxTextCtrl * m_ROIBottomTxt;
399  wxChoice * m_BlendModeChoice;
400  wxChoice * m_DragModeChoice;
401  wxChoice * m_ProjectionChoice;
403  wxChoice * m_GuideChoiceCrop;
404  wxChoice * m_GuideChoiceDrag;
405  wxChoice * m_GuideChoiceProj;
406  // No HDR display yet.
407  // wxChoice * m_outputModeChoice;
408  wxTextCtrl * m_exposureTextCtrl;
409  wxBitmapButton * m_defaultExposureBut;
410  wxSpinButton * m_exposureSpinBut;
414  wxInfoBar * m_infoBar;
415  //assistant related controls
423  {
424  SELECT_ALL_IMAGES = 0,
425  SELECT_MEDIAN_IMAGES = 1,
426  SELECT_BRIGHTEST_IMAGES = 2,
427  SELECT_DARKEST_IMAGES = 3,
428  };
431 
433 
435 
436  wxString m_choices[3];
438  // index of difference mode
440 
441  wxScrolledWindow * m_ButtonPanel;
442  wxBoxSizer * m_ButtonSizer;
443  wxStaticBoxSizer * m_ToggleButtonSizer;
444 
445  wxBoxSizer * m_topsizer;
446  wxBoxSizer * m_projParamSizer;
448  std::vector<wxStaticText *> m_projParamNamesLabel;
449  std::vector<wxTextCtrl *> m_projParamTextCtrl;
450  std::vector<wxSlider *> m_projParamSlider;
451 
452  std::vector<wxToggleButton *> m_ToggleButtons;
453  std::vector<wxCheckBox *> m_GroupToggleButtons;
454  std::vector<wxPanel *> m_ToggleButtonPanel;
455  std::vector<ImageToogleButtonEventHandler *> toogle_button_event_handlers;
456  std::vector<ImageGroupButtonEventHandler *> toggle_group_button_event_handlers;
457 
458  DECLARE_EVENT_TABLE()
459 
460  // tools
461  PreviewToolHelper *preview_helper;
462 
463  PreviewCropTool *crop_tool;
464  HuginBase::UIntSet imageDragGroup;
465  PreviewDragTool *drag_tool;
466  PreviewCameraTool *camera_tool;
467  PreviewColorPickerTool *color_picker_tool;
468  PreviewEditCPTool* edit_cp_tool;
469 
470  PreviewIdentifyTool *identify_tool;
471  PreviewIdentifyTool *panosphere_overview_identify_tool;
472  PreviewIdentifyTool *plane_overview_identify_tool;
473 
474  PreviewDifferenceTool *difference_tool;
475  PreviewDifferenceTool *plane_difference_tool;
476  PreviewDifferenceTool *panosphere_difference_tool;
477 
478  PreviewControlPointTool *preview_control_point_tool;
479  PreviewControlPointTool *panosphere_control_point_tool;
480  PreviewControlPointTool *plane_control_point_tool;
481 
482  PreviewPanoMaskTool *pano_mask_tool;
483 
484  bool m_showProjectionHints;
485  PreviewLayoutLinesTool *m_preview_layoutLinesTool;
486  PreviewLayoutLinesTool *m_panosphere_layoutLinesTool;
487  PreviewLayoutLinesTool *m_plane_layoutLinesTool;
488 
489  PanosphereOverviewProjectionGridTool * overview_projection_grid;
490  PreviewProjectionGridTool * preview_projection_grid;
491  PanosphereSphereTool * panosphere_sphere_tool;
492 
493  PanosphereOverviewToolHelper *panosphere_overview_helper;
494 
495  PlaneOverviewToolHelper *plane_overview_helper;
496 
497  OverviewDragTool *overview_drag_tool;
498 
499  PanosphereOverviewCameraTool *panosphere_overview_camera_tool;
500  PlaneOverviewCameraTool *plane_overview_camera_tool;
501 
502  PanosphereOverviewOutlinesTool *overview_outlines_tool;
503  PlaneOverviewOutlinesTool *plane_overview_outlines_tool;
504 
505  PreviewGuideTool *preview_guide_tool;
506 
507  void TurnOffTools(std::set<Tool*> tools);
508 
509 #ifdef __WXGTK__
510  bool loadedLayout;
511 #endif
512 
516  bool HasNonZeroTranslationPlaneParameters();
518  void ResetTranslationPlaneParameters();
519  void CleanButtonColours();
525  void ShowProjectionWarnings();
526 };
527 
528 
529 #endif // _GLPREVIEWFRAME_H
tool for the manipulation of the opengl &#39;camera&#39; properties It handles rotation of the camera positio...
wxSlider * m_HFOVSlider
wxTextCtrl * m_ROITopTxt
wxTextCtrl * m_rangeCompressionTextCtrl
SelectAllMode m_selectAllMode
Allow the user to change the cropping region by dragging it in the fast preview.
wxSpinButton * m_exposureSpinBut
declaration of helper for work with different GuiLevels
std::vector< wxToggleButton * > m_ToggleButtons
The OpenGL preview frame.
ViewState * m_view_state
wxChoice * m_DragModeChoice
wxBoxSizer * m_topsizer
std::vector< ImageToogleButtonEventHandler * > toogle_button_event_handlers
tool for the manipulation of the opengl &#39;camera&#39; properties It handles zooming in/out of the main pre...
GLPreview * getGLPreview()
GuiLevel m_guiLevel
ImageToogleButtonEventHandler(unsigned int image_number, wxToggleButton *identify_button_in, HuginBase::Panorama *m_pano)
wxPanel * m_overviewCommandPanel
wxTextCtrl * m_ROIRightTxt
SplitButton * m_createButton
wxBitmapButton * m_defaultExposureBut
GLOverview * overview
GLPreview * m_GLPreview
wxColour m_preview_background_color
std::vector< wxCheckBox * > m_GroupToggleButtons
wxNotebook * m_tool_notebook
std::vector< wxPanel * > m_ToggleButtonPanel
std::vector< PreviewIdentifyTool ** > identify_tools
wxTextCtrl * m_ROILeftTxt
void OnChange(wxCommandEvent &e)
wxChoice * m_GuideChoiceCrop
wxChoice * m_GuideChoiceDrag
wxStaticBoxSizer * m_ToggleButtonSizer
std::set< unsigned int > UIntSet
Definition: PanoramaData.h:51
GLwxAuiFloatingFrame(wxWindow *parent, GLwxAuiManager *owner_mgr, const wxAuiPaneInfo &pane, wxWindowID id=wxID_ANY, long style=wxRESIZE_BORDER|wxSYSTEM_MENU|wxCAPTION|wxFRAME_FLOAT_ON_PARENT|wxCLIP_CHILDREN)
wxSlider * m_VFOVSlider
Draws guide lines over the panorama in fast preview window.
wxChoice * m_ProjectionChoice
Finds the topmost image underneath the mouse pontier, cancel it&#39;s normal drawing, and then subtract i...
Model for a panorama.
Definition: Panorama.h:152
wxSpinButton * m_rangeCompressionSpinBut
wxMenu * m_filemenuSimple
wxBoxSizer * m_ButtonSizer
GLwxAuiManager * m_mgr
The dock manager.
GLOverview * getGLOverview()
std::vector< wxSlider * > m_projParamSlider
wxScrolledWindow * m_ButtonPanel
Definition: Tool.h:42
wxTextCtrl * m_VFOVText
The PreviewCropTool shows lines between the ends of control points in the fast preview.
void OnEnter(wxMouseEvent &e)
SplitButton * m_selectAllButton
void AddIdentifyTool(PreviewIdentifyTool **identify_tool_in)
wxMenu * m_filemenuAdvanced
The renderer handles drawing the opengl scene.
Definition: GLRenderer.h:47
std::vector< wxTextCtrl * > m_projParamTextCtrl
HuginBase::Panorama * m_pano
wxInfoBar * m_infoBar
Bar for context sensitive projection information.
wxToggleButton * m_editCP_togglebutton
SplitButton * m_loadImagesButton
wxPanel * m_projection_panel
GLPreview * preview
GLPreviewFrame * getPreviewFrame()
std::vector< ImageGroupButtonEventHandler * > toggle_group_button_event_handlers
wxToggleButton * m_identify_togglebutton
GLwxAuiManager * getAuiManager()
Tool to delete all cp in a selected rectangle.
The PreviewLayoutLinesTool handles the lines connecting images in the layout view of the fast preview...
GLOverview * m_GLOverview
bool m_selectKeepSelection
wxChoice * m_BlendModeChoice
wxBoxSizer * m_projParamSizer
tool to draw a whiteish transparent sphere for the panosphere
GLwxAuiManager(GLPreviewFrame *frame, GLPreview *preview, GLOverview *overview)
A MeshManager handles the graphics system representation of a remapping, by creating OpenGL display l...
Definition: MeshManager.h:37
this handler class will receive change events from the Panorama.
Definition: PanoramaData.h:401
wxTextCtrl * m_ROIBottomTxt
subclass for a floating frame of the dock manager
SplitButton * m_alignButton
wxToggleButton * m_identify_button
GLOverview * getOverview()
wxToggleButton * m_colorpicker_togglebutton
tool for manipulation of the opengl &#39;camera&#39; properties It handles the position of the camera in 3 di...
The PreviewColorPickerTool allows to select a region in the panorama which should be grey...
For projections where the output range is limited, but the approximatly remaped images can extend thi...
wxTextCtrl * m_exposureTextCtrl
GuiLevel
Definition: GuiLevel.h:31
std::vector< wxStaticText * > m_projParamNamesLabel
GLPreview * getPreview()
customized subclass of the dock manager, created just for the purpose to create a workaround for the ...
HuginBase::Panorama & m_pano
Allows the user to change the yaw, pitch and roll of a connected component of images by dragging them...
Definition: DragTool.h:50
wxChoice * m_GuideChoiceProj
Panorama image options.
Visually connect the image numbers with the image on the preview.
wxTextCtrl * m_HFOVText
wxChoice * m_OverviewModeChoice
A wxWidget to display the fast preview.
Definition: GLViewer.h:51
GLPreviewFrame * frame
void OnLeave(wxMouseEvent &e)