Hugin trunk 0.1
Loading...
Searching...
No Matches
GLPreviewFrame.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
23#ifndef _GLPREVIEWFRAME_H
24#define _GLPREVIEWFRAME_H
25
26class GLRenderer;
27class wxToolBar;
28class wxToggleButton;
29class wxCheckBox;
30class wxTextCtrl;
31class wxBitmapButton;
32class wxSpinButton;
33class wxScrolledWindow;
34class wxBoxSizer;
36class wxStaticText;
37class wxSlider;
38class GLViewer;
39class GLPreview;
40class GLOverview;
41class ViewState;
42class wxSpinEvent;
43class 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
49class MeshManager;
50
51class ToolHelper;
55class Tool;
56class PreviewTool;
57class PreviewCropTool;
58class DragTool;
62class PreviewDragTool;
71
75
78
80
81class GLPreviewFrame;
82
83class 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.
97class ImageToogleButtonEventHandler : public wxEvtHandler
98{
99public:
103 void OnChange(wxCommandEvent &e);
105protected:
106 void OnEnter(wxMouseEvent & e);
107 void OnLeave(wxMouseEvent & e);
108private:
109 unsigned int image_number;
110 std::vector<PreviewIdentifyTool**> identify_tools;
113};
114
115class ImageGroupButtonEventHandler : public wxEvtHandler
116{
117public:
119 void OnChange(wxCommandEvent &e);
122protected:
123 void OnEnter(wxMouseEvent & e);
124 void OnLeave(wxMouseEvent & e);
125private:
126 unsigned int image_number;
127 std::vector<DragTool**> drag_tools;
128 std::vector<PreviewIdentifyTool**> identify_tools;
131};
132
133
145
163
164
165
173class GLPreviewFrame : public wxFrame, public HuginBase::PanoramaObserver
174{
175public:
176
179 GLPreviewFrame(wxFrame * frame, HuginBase::Panorama &pano);
180
183 virtual ~GLPreviewFrame();
186
187 virtual void panoramaChanged(HuginBase::Panorama &pano);
189
190 void MakePreviewTools(PreviewToolHelper * helper);
193
194 void SetImageButtonColour(unsigned int image_nr, unsigned char red,
195 unsigned char green, unsigned char blue);
199 void FillBlendChoice();
201 void LoadOpenGLLayout();
203 void InitPreviews();
207 void AddUserDefinedSequence(int id, const wxString& desc, const wxString& help);
209 void AddUserDefinedAssistant(int id, const wxString& desc, const wxString& help);
210
214
215 void PauseResize();
216 void ContinueResize();
217 bool CanResize() {return GLresize;}
218
225 void redrawPreview();
227 void ResetPreviewZoom();
230 void OnShowEvent(wxShowEvent& e);
231
232 bool individualDragging();
233 void ToggleImageInDragGroup(unsigned int image_nr, bool update_check_box = true);
234 void RemoveImageFromDragGroup(unsigned int image_nr, bool update_check_box = true);
235 void AddImageToDragGroup(unsigned int image_nr, bool update_check_box = true);
238 void ClearDragGroupImages(bool update_check_box = true);
243 void UpdateGlobalWhiteBalance(double redFactor, double blueFactor);
244 void UpdateIdentifyTools(std::set<unsigned int> new_image_set);
245
247
248protected:
249
250 bool GLresize = true;
251
252 void OnClose(wxCloseEvent& e);
253
254 void OnOverviewToggle(wxCommandEvent& e);
255
256 void OnCenterHorizontally(wxCommandEvent & e);
257 void OnFitPano(wxCommandEvent& e);
258 void OnStraighten(wxCommandEvent & e);
259 void OnShowAll(wxCommandEvent & e);
260 void OnShowNone(wxCommandEvent & e);
261 void OnPhotometric(wxCommandEvent & e);
262 void OnIdentify(wxCommandEvent &e);
263 void OnAutocrop(wxCommandEvent &e);
264 void OnStackAutocrop(wxCommandEvent &e);
265 void OnAutocropOutside(wxCommandEvent& e);
266 void OnControlPoint(wxCommandEvent &e);
267 void OnNumTransform(wxCommandEvent & e);
270 void OnExposureChanged(wxCommandEvent & e);
271 void OnProjParameterChanged(wxCommandEvent & e);
273 void OnProjParameterReset(wxCommandEvent & e);
275 void OnSwitchPreviewGrid(wxCommandEvent & e);
277 void OnUserExit(wxCommandEvent & e);
278
279 void OnDefaultExposure( wxCommandEvent & e );
284 void OnRangeCompressionChanged(wxCommandEvent& e);
285
286 void OnBlendChoice(wxCommandEvent & e);
287 void OnDragChoice(wxCommandEvent & e);
288
289 void KeyDown(wxKeyEvent & e);
290 void KeyUp(wxKeyEvent & e);
291
292 void DragChoiceLayout( int index );
293 void OnProjectionChoice(wxCommandEvent & e);
294 void OnOverviewModeChoice(wxCommandEvent & e);
296 void OnROIChanged(wxCommandEvent & e);
298 void OnResetCrop(wxCommandEvent & e);
300 void OnSetCropAspect(wxCommandEvent& e);
301 void OnHFOVChanged(wxCommandEvent & e);
302 void OnVFOVChanged(wxCommandEvent & e);
304 void OnHideProjectionHints(wxCommandEvent &e);
305 // No HDR display yet
306 // void OnOutputChoice(wxCommandEvent & e);
307 // update tools according to blend mode choice
308 void updateBlendMode();
310 void OnFullScreen(wxCommandEvent &e);
316 void OnLayoutScaleChange(wxCommandEvent &e);
318 void OnColorPicker(wxCommandEvent &e);
320 void OnEditCPTool(wxCommandEvent &e);
324 void OnGuideChanged(wxCommandEvent &e);
326 void OnShowMainFrame(wxCommandEvent &e);
327 // assistant related event handler
328 void OnLoadImages( wxCommandEvent & e );
330 void OnAlign( wxCommandEvent & e );
331 void OnCreate( wxCommandEvent & e );
333 void OnCreateCP(wxCommandEvent & e);
335 void OnRemoveCP(wxCommandEvent & e);
337 void OnSelectAllMenu(wxCommandEvent& e);
338 void OnSelectMedianMenu(wxCommandEvent& e);
339 void OnSelectDarkestMenu(wxCommandEvent& e);
340 void OnSelectBrightestMenu(wxCommandEvent& e);
341 void OnSelectKeepSelection(wxCommandEvent& e);
342 void OnSelectResetSelection(wxCommandEvent& e);
345 void OnRemoveImage(wxCommandEvent& e);
346private:
355 bool UpdateOverviewMode(int newMode);
360
361 void SetMode(int newMode);
363
366
368
370
380 wxTextCtrl * m_HFOVText;
381 wxTextCtrl * m_VFOVText;
382 wxTextCtrl * m_ROILeftTxt;
383 wxTextCtrl * m_ROIRightTxt;
384 wxTextCtrl * m_ROITopTxt;
385 wxTextCtrl * m_ROIBottomTxt;
393 // No HDR display yet.
394 // wxChoice * m_outputModeChoice;
395 wxTextCtrl * m_exposureTextCtrl;
402 //assistant related controls
408 // context menu on image toggle buttons
410 // image nr on which context menu was opened
412 // id for "remove image" menu item in context menu
424
426
428
431 // index of difference mode
433
434 wxScrolledWindow * m_ButtonPanel;
437
441 std::vector<wxStaticText *> m_projParamNamesLabel;
442 std::vector<wxTextCtrl *> m_projParamTextCtrl;
443 std::vector<wxSlider *> m_projParamSlider;
444
445 std::vector<wxToggleButton *> m_ToggleButtons;
446 std::vector<wxCheckBox *> m_GroupToggleButtons;
447 std::vector<wxPanel *> m_ToggleButtonPanel;
448 std::vector<ImageToogleButtonEventHandler *> toogle_button_event_handlers;
449 std::vector<ImageGroupButtonEventHandler *> toggle_group_button_event_handlers;
450
451 // tools
453
460
464
468
472
474
479
483
485
487
489
492
495
497
498 void TurnOffTools(std::set<Tool*> tools);
499
500#ifdef __WXGTK__
501 bool loadedLayout;
502#endif
503
510 void CleanButtonColours();
517};
518
519
520#endif // _GLPREVIEWFRAME_H
declaration of helper for work with different GuiLevels
GuiLevel
Definition GuiLevel.h:32
Allows the user to change the yaw, pitch and roll of a connected component of images by dragging them...
Definition DragTool.h:51
The OpenGL preview frame.
void OnResetCrop(wxCommandEvent &e)
event handler to reset crop area
void OnImageContextMenu(wxContextMenuEvent &e)
show context menu on image buttons
void LoadImages(int preferredLensType)
void OnAutocrop(wxCommandEvent &e)
void EnableGroupCheckboxes(bool isShown)
changes the visibility of the group check boxes
PreviewProjectionGridTool * preview_projection_grid
PreviewControlPointTool * panosphere_control_point_tool
void OnProjectionChoice(wxCommandEvent &e)
PanosphereOverviewCameraTool * panosphere_overview_camera_tool
virtual void panoramaChanged(HuginBase::Panorama &pano)
Notification about a Panorama change.
void OnStraighten(wxCommandEvent &e)
void ResetTranslationPlaneParameters()
resets all translation plane parameters to zero
void OnCenterHorizontally(wxCommandEvent &e)
wxChoice * m_OverviewModeChoice
void KeyDown(wxKeyEvent &e)
void OnFitPano(wxCommandEvent &e)
wxBoxSizer * m_topsizer
void OnSelectResetSelection(wxCommandEvent &e)
PreviewControlPointTool * preview_control_point_tool
void OnClose(wxCloseEvent &e)
void OnCreateCP(wxCommandEvent &e)
handler for creating cp in pano space
wxMenu * m_filemenuSimple
void InitPreviews()
init previews
void OnBlendChoice(wxCommandEvent &e)
PreviewPanoMaskTool * pano_mask_tool
void OnRangeCompressionIncrease(wxSpinEvent &e)
void OnIncreaseExposure(wxSpinEvent &e)
void OnTrackChangeProjectionParam(wxScrollEvent &e)
void DragChoiceLayout(int index)
PreviewControlPointTool * plane_control_point_tool
void OnSetCropAspect(wxCommandEvent &e)
event handler to set fixed aspect ratio of crop
std::vector< ImageGroupButtonEventHandler * > toggle_group_button_event_handlers
PreviewDragTool * drag_tool
PreviewIdentifyTool * panosphere_overview_identify_tool
void OnSelectAllMenu(wxCommandEvent &e)
handle all options of select all context menu
void OnSelectDarkestMenu(wxCommandEvent &e)
wxColour m_preview_background_color
void OnStackAutocrop(wxCommandEvent &e)
wxToggleButton * m_identify_togglebutton
void TurnOffTools(std::set< Tool * > tools)
PlaneOverviewToolHelper * plane_overview_helper
PlaneOverviewOutlinesTool * plane_overview_outlines_tool
void OnSwitchPreviewGrid(wxCommandEvent &e)
event handler for switch on/off grid on preview
PreviewLayoutLinesTool * m_preview_layoutLinesTool
ViewState * m_view_state
wxSlider * m_VFOVSlider
void UpdateRoiDisplay(const HuginBase::PanoramaOptions opts)
update display of ROI
void OnOverviewModeChoice(wxCommandEvent &e)
void OnEditCPTool(wxCommandEvent &e)
event handler when starting edit cp tool
wxToggleButton * m_colorpicker_togglebutton
void updateBlendMode()
Update tools and GUI elements according to blend mode choice.
virtual ~GLPreviewFrame()
dtor.
void OnDefaultExposure(wxCommandEvent &e)
void OnShowNone(wxCommandEvent &e)
void OnCreate(wxCommandEvent &e)
void MakePlaneOverviewTools(PlaneOverviewToolHelper *helper)
void OnShowEvent(wxShowEvent &e)
HuginBase::UIntSet GetDragGroupImages()
wxInfoBar * m_infoBar
Bar for context sensitive projection information.
wxChoice * m_GuideChoiceCrop
wxTextCtrl * m_ROILeftTxt
wxTextCtrl * m_ROIRightTxt
void ClearDragGroupImages(bool update_check_box=true)
void FillBlendChoice()
fills the blend wxChoice with all valid blend modes and restore the last used one
void SetGuiLevel(GuiLevel newLevel)
sets the gui level
PreviewIdentifyTool * identify_tool
void OnOverviewToggle(wxCommandEvent &e)
wxSpinButton * m_exposureSpinBut
PreviewDifferenceTool * panosphere_difference_tool
HuginBase::Panorama & m_pano
wxNotebook * m_tool_notebook
wxChoice * m_GuideChoiceProj
PlaneOverviewCameraTool * plane_overview_camera_tool
void SetMode(int newMode)
PanosphereOverviewProjectionGridTool * overview_projection_grid
void OnExposureChanged(wxCommandEvent &e)
void MakePreviewTools(PreviewToolHelper *helper)
void ToggleImageInDragGroup(unsigned int image_nr, bool update_check_box=true)
wxPanel * m_overviewCommandPanel
PanosphereOverviewToolHelper * panosphere_overview_helper
PreviewToolHelper * preview_helper
void OnROIChanged(wxCommandEvent &e)
event handler for changed roi
void SetStatusMessage(wxString message)
wxBoxSizer * m_projParamSizer
HuginBase::UIntSet imageDragGroup
wxChoice * m_GuideChoiceDrag
wxColour GetPreviewBackgroundColor()
wxPanel * m_projection_panel
bool HasNonZeroTranslationPlaneParameters()
check, if panorama has non-zero translation plane parameters
void LoadOpenGLLayout()
loads the layout of the OpenGL windows and restores it
wxToggleButton * m_editCP_togglebutton
wxTextCtrl * m_ROITopTxt
void OnLoadImages(wxCommandEvent &e)
bool UpdateOverviewMode(int newMode)
updates the mode of the overview window
void OnDragChoice(wxCommandEvent &e)
wxMenu * m_filemenuAdvanced
SelectAllMode m_selectAllMode
void StorePositionAndSize()
store position and size of window in wxConfig
wxStaticBoxSizer * m_ToggleButtonSizer
PreviewColorPickerTool * color_picker_tool
std::vector< wxCheckBox * > m_GroupToggleButtons
wxChoice * m_DragModeChoice
PreviewIdentifyTool * plane_overview_identify_tool
void AddUserDefinedSequence(int id, const wxString &desc, const wxString &help)
adds the given user defined output sequence to SplitButton menu
void RemoveImageFromDragGroup(unsigned int image_nr, bool update_check_box=true)
void OnControlPoint(wxCommandEvent &e)
void OnProjParameterChanged(wxCommandEvent &e)
void redrawPreview()
Display an updated version of the preview images.
wxChoice * m_BlendModeChoice
GLPreview * getPreview()
void OnUserExit(wxCommandEvent &e)
user wants to quit program
void OnDecreaseExposure(wxSpinEvent &e)
void OnShowAll(wxCommandEvent &e)
void AddUserDefinedAssistant(int id, const wxString &desc, const wxString &help)
adds the given user defined assistant to SplitButton menu
void OnAutocropOutside(wxCommandEvent &e)
void UpdateIdentifyTools(std::set< unsigned int > new_image_set)
GLOverview * getOverview()
PreviewDifferenceTool * plane_difference_tool
void SetDragGroupImages(HuginBase::UIntSet imageDragGroup_in, bool update_check_box=true)
void OnFullScreen(wxCommandEvent &e)
event handler for full screen
void OnSelectKeepSelection(wxCommandEvent &e)
void OnPreviewBackgroundColorChanged(wxColourPickerEvent &e)
event handler when user changes background color
virtual void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &changed)
notifies about changes to images
void OnHideProjectionHints(wxCommandEvent &e)
event handler when user hides the infobar
wxScrolledWindow * m_ButtonPanel
std::vector< wxSlider * > m_projParamSlider
wxTextCtrl * m_HFOVText
void OnSelectBrightestMenu(wxCommandEvent &e)
void OnShowMainFrame(wxCommandEvent &e)
event handler to show main frame
void OnChangeProjectionParam(wxScrollEvent &e)
void AddImageToDragGroup(unsigned int image_nr, bool update_check_box=true)
void OnRangeCompressionChanged(wxCommandEvent &e)
PanosphereOverviewOutlinesTool * overview_outlines_tool
std::vector< wxPanel * > m_ToggleButtonPanel
SplitButton * m_createButton
GLOverview * m_GLOverview
std::vector< ImageToogleButtonEventHandler * > toogle_button_event_handlers
void OnIdentify(wxCommandEvent &e)
GLwxAuiManager * getAuiManager()
void OnRemoveImage(wxCommandEvent &e)
void OnRemoveCP(wxCommandEvent &e)
handler to remove cp
wxChoice * m_ProjectionChoice
PreviewDifferenceTool * difference_tool
PreviewCameraTool * camera_tool
wxTextCtrl * m_rangeCompressionTextCtrl
void OnColorPicker(wxCommandEvent &e)
event handler when starting color picker
wxSlider * m_HFOVSlider
GLwxAuiManager * m_mgr
The dock manager.
void OnVFOVChanged(wxCommandEvent &e)
SplitButton * m_selectAllButton
PreviewCropTool * crop_tool
void ResetPreviewZoom()
reset zoom level for preview window
void OnLayoutScaleChange(wxCommandEvent &e)
event handler for change scale of layout mode
std::vector< wxTextCtrl * > m_projParamTextCtrl
void OnNumTransform(wxCommandEvent &e)
void MakePanosphereOverviewTools(PanosphereOverviewToolHelper *helper)
wxSpinButton * m_rangeCompressionSpinBut
void OnPhotometric(wxCommandEvent &e)
OverviewDragTool * overview_drag_tool
void ShowProjectionWarnings()
Tell the user anything suspicious about the projection choice.
GLPreview * m_GLPreview
void UpdateGlobalWhiteBalance(double redFactor, double blueFactor)
updates the global white balance
SplitButton * m_loadImagesButton
wxTextCtrl * m_VFOVText
PreviewEditCPTool * edit_cp_tool
void OnProjParameterReset(wxCommandEvent &e)
event handler for reset projection parameters
void OnGuideChanged(wxCommandEvent &e)
event handler when user selects different guide
wxString m_choices[3]
SplitButton * m_alignButton
std::vector< wxStaticText * > m_projParamNamesLabel
wxTextCtrl * m_exposureTextCtrl
void OnSelectMode(wxNotebookEvent &e)
event handler for selection of new mode
wxBoxSizer * m_ButtonSizer
PreviewLayoutLinesTool * m_plane_layoutLinesTool
void OnToolModeChanging(wxNotebookEvent &e)
event handler for blocking changing mode when panorama contains no images
PreviewLayoutLinesTool * m_panosphere_layoutLinesTool
void KeyUp(wxKeyEvent &e)
void SetImageButtonColour(unsigned int image_nr, unsigned char red, unsigned char green, unsigned char blue)
void OnSelectMedianMenu(wxCommandEvent &e)
std::vector< wxToggleButton * > m_ToggleButtons
void SetShowProjectionHints(bool new_value)
set status if projection hints should be shown or not
wxTextCtrl * m_ROIBottomTxt
void OnHFOVChanged(wxCommandEvent &e)
PreviewGuideTool * preview_guide_tool
wxBitmapButton * m_defaultExposureBut
PanosphereSphereTool * panosphere_sphere_tool
void OnRangeCompressionDecrease(wxSpinEvent &e)
void OnAlign(wxCommandEvent &e)
The renderer handles drawing the opengl scene.
Definition GLRenderer.h:48
A wxWidget to display the fast preview.
Definition GLViewer.h:52
subclass for a floating frame of the dock manager
void OnActivate(wxActivateEvent &evt)
customized subclass of the dock manager, created just for the purpose to create a workaround for the ...
GLPreviewFrame * frame
GLwxAuiFloatingFrame * CreateFloatingFrame(wxWindow *parent, const wxAuiPaneInfo &p)
GLOverview * getGLOverview()
GLPreviewFrame * getPreviewFrame()
GLPreview * getGLPreview()
GLwxAuiManager(GLPreviewFrame *frame, GLPreview *preview, GLOverview *overview)
GLOverview * overview
GLPreview * preview
this handler class will receive change events from the Panorama.
Panorama image options.
Model for a panorama.
Definition Panorama.h:153
void OnChange(wxCommandEvent &e)
void AddIdentifyTool(PreviewIdentifyTool **identify_tool_in)
void AddDragTool(DragTool **drag_tool_in)
void OnEnter(wxMouseEvent &e)
HuginBase::Panorama * m_pano
void OnLeave(wxMouseEvent &e)
std::vector< PreviewIdentifyTool ** > identify_tools
std::vector< DragTool ** > drag_tools
void OnChange(wxCommandEvent &e)
std::vector< PreviewIdentifyTool ** > identify_tools
HuginBase::Panorama * m_pano
void AddIdentifyTool(PreviewIdentifyTool **identify_tool_in)
A MeshManager handles the graphics system representation of a remapping, by creating OpenGL display l...
Definition MeshManager.h:38
tool for the manipulation of the opengl 'camera' properties It handles rotation of the camera positio...
tool to draw a whiteish transparent sphere for the panosphere
tool for manipulation of the opengl 'camera' properties It handles the position of the camera in 3 di...
tool for the manipulation of the opengl 'camera' properties It handles zooming in/out of the main pre...
The PreviewColorPickerTool allows to select a region in the panorama which should be grey.
The PreviewCropTool shows lines between the ends of control points in the fast preview.
Allow the user to change the cropping region by dragging it in the fast preview.
Finds the topmost image underneath the mouse pontier, cancel it's normal drawing, and then subtract i...
Tool to delete all cp in a selected rectangle.
Draws guide lines over the panorama in fast preview window.
Visually connect the image numbers with the image on the preview.
The PreviewLayoutLinesTool handles the lines connecting images in the layout view of the fast preview...
For projections where the output range is limited, but the approximatly remaped images can extend thi...
Definition Tool.h:43
std::set< unsigned int > UIntSet
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41