Hugin trunk 0.1
Loading...
Searching...
No Matches
MaskEditorPanel.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
10/* This is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
14 *
15 * This software is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public
21 * License along with this software. If not, see
22 * <http://www.gnu.org/licenses/>.
23 *
24 */
25
26#ifndef _MaskEditorPanel_H
27#define _MaskEditorPanel_H
28
29
30//-----------------------------------------------------------------------------
31// Headers
32//-----------------------------------------------------------------------------
33
34#include <panodata/Panorama.h>
35#include <wx/clrpicker.h>
36#include "MaskImageCtrl.h"
38
44class MaskEditorPanel : public wxPanel, public HuginBase::PanoramaObserver
45{
46public:
50
51 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = "panel");
52
53 void Init(HuginBase::Panorama * pano);
54
57 virtual ~MaskEditorPanel();
58
67 void setImage(unsigned int imgNr, bool updateListSelection=false);
69 void setMask(unsigned int maskNr);
71 void UpdateMask();
73 void AddMask();
75 void SelectMask(unsigned int newMaskNr);
76
81 void UpdateCrop(bool updateFromImgCtrl=false);
85 void SwitchToCropMode();
86
92
100 void OnMaskTypeChange(wxCommandEvent &e);
102 void OnMaskAdd(wxCommandEvent &e);
104 void OnMaskSave(wxCommandEvent &e);
106 void OnMaskLoad(wxCommandEvent &e);
108 void OnMaskCopy(wxCommandEvent &e);
110 void OnMaskPaste(wxCommandEvent &e);
112 void OnMaskDelete(wxCommandEvent &e);
114 void OnZoom(wxCommandEvent & e);
118 void OnShowActiveMasks(wxCommandEvent &e);
119 // reset crop area.
120 void OnResetButton(wxCommandEvent & e);
121 void OnSetLeft(wxCommandEvent & e);
122 void OnSetRight(wxCommandEvent & e);
123 void OnSetTop(wxCommandEvent & e);
124 void OnSetBottom(wxCommandEvent & e);
125 void OnAutoCenter(wxCommandEvent & e);
127
128private:
129
133 void UpdateMaskList(bool restoreSelection=false);
135 unsigned int GetSelectedMask();
143 MaskImageCtrl::ImageRotation GetRot(const unsigned int imgNr);
145 void DisplayCrop(int imgNr);
147 void UpdateImage(size_t imgNr);
148
150 void UpdateCropDisplay();
151 // ensure that the crop roi is centered
152 void CenterCrop();
153 // switch between single or multiselectio mode for images list box
155
156 size_t GetImgNr();
157
158 // GUI controls
160 wxListCtrl *m_imagesListMask;
161 wxListCtrl *m_maskList;
164
165 // my data
168 // current masks vector
171 // mask or crop mode
173 // the current mask
174 unsigned int m_MaskNr;
175 // the filename of the current image
176 std::string m_File;
177
178 // controls for crop editing
179 wxTextCtrl * m_left_textctrl;
180 wxTextCtrl * m_right_textctrl;
181 wxTextCtrl * m_top_textctrl;
182 wxTextCtrl * m_bottom_textctrl;
186 vigra::Rect2D m_cropRect;
187 bool m_autoCenterCrop = true;
188 vigra::Point2D m_cropCenter;
189
191};
192
194class MaskEditorPanelXmlHandler : public wxXmlResourceHandler
195{
197
198public:
200 virtual wxObject *DoCreateResource();
201 virtual bool CanHandle(wxXmlNode *node);
202};
203
204
205#endif // _MaskEditorPanel_H
Somewhere to specify what variables belong to what.
Make an ImageVariableGroup for lenses and other common concepts.
MaskType
enumeration with type of possible masks
Definition Mask.h:57
this handler class will receive change events from the Panorama.
Model for a panorama.
Definition Panorama.h:153
xrc handler for handling mask editor panel
virtual wxObject * DoCreateResource()
virtual bool CanHandle(wxXmlNode *node)
mask editor panel.
void OnMaskColumnWidthChange(wxListEvent &e)
called, when column with of mask list box was changed
void UpdateCropFromImage()
updates the displayed crop in the text boxes (for dragging)
unsigned int m_MaskNr
void UpdateImage(size_t imgNr)
update the list box for the given imgNr
void OnMaskCopy(wxCommandEvent &e)
called when user wants to copy a mask to clipboard
wxListCtrl * m_imagesListMask
void OnMaskTypeChange(wxCommandEvent &e)
handler when mask type was changed
void UpdateMask()
called when mask where changed in MaskImageCtrl
void OnAutoCenter(wxCommandEvent &e)
void OnImageListChar(wxKeyEvent &e)
key handler for images list
void OnMaskAdd(wxCommandEvent &e)
called when user wants to create new polygon
void Init(HuginBase::Panorama *pano)
void OnSetRight(wxCommandEvent &e)
void DisplayCrop(int imgNr)
copies the crop information from the Panorama object to GUI
HuginBase::SrcPanoImage::CropMode m_cropMode
void AddMask()
called when new mask added in MaskImageCtrl
void OnSetLeft(wxCommandEvent &e)
void OnMaskDelete(wxCommandEvent &e)
called when user wants to delete active mask
wxCheckBox * m_autocenter_cb
void SelectMask(unsigned int newMaskNr)
selects the mask with index newMaskNr in the listbox
void UpdateMaskList(bool restoreSelection=false)
updates the display after another image has been selected.
void SwitchToCropMode()
switches the controls to crop mode
vigra::Rect2D m_cropRect
void setMask(unsigned int maskNr)
sets active mask number, set to UINT_MAX, if no mask is currently editing
wxTextCtrl * m_left_textctrl
void OnMaskPaste(wxCommandEvent &e)
called when user wants to paste a mask from clipboard
void OnImageSelect(wxListEvent &e)
called when user selected another image
wxCheckBox * m_cropLens
wxTextCtrl * m_top_textctrl
void OnShowActiveMasks(wxCommandEvent &e)
event handler for changing option if active masks should be drawn
wxListCtrl * m_maskList
const HuginBase::UIntSet GetSelectedImages()
return the currently selected image(s)
void OnSetBottom(wxCommandEvent &e)
unsigned int GetSelectedMask()
return index of currently selected masks, return UINT_MAX if no mask is selected
void panoramaChanged(HuginBase::Panorama &pano)
called when the panorama changes and we should update our display
void SetPano(HuginBase::Panorama *panorama)
void OnSetTop(wxCommandEvent &e)
void SetSingleSelection(bool singleSelMode)
void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &imgNr)
notifies about changes to images
MaskImageCtrl::ImageRotation GetRot(const unsigned int imgNr)
determines, if the image should be rotated for display
void UpdateCrop(bool updateFromImgCtrl=false)
updated the crop in the Panorama object with the current values from GUI
void OnZoom(wxCommandEvent &e)
sets the actual zoom factor
HuginBase::Panorama * m_pano
void OnMaskLoad(wxCommandEvent &e)
called when user wants to load a mask into the selected image
wxTextCtrl * m_bottom_textctrl
HuginBase::MaskPolygon::MaskType m_defaultMaskType
void OnImagesColumnWidthChange(wxListEvent &e)
called, when column with of images list box was changed
HuginBase::MaskPolygonVector m_currentMasks
HuginBase::ConstStandardImageVariableGroups * m_imageGroups
virtual ~MaskEditorPanel()
dtor.
void UpdateCropDisplay()
update GUI display
void OnColourChanged(wxColourPickerEvent &e)
event handler for changing colours
void OnModeChanged(wxNotebookEvent &e)
void OnMaskSave(wxCommandEvent &e)
called when user wants to save active mask
wxChoice * m_maskType
wxTextCtrl * m_right_textctrl
wxNotebook * m_maskCropCtrl
MaskImageCtrl * m_editImg
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name="panel")
vigra::Point2D m_cropCenter
void setImage(unsigned int imgNr, bool updateListSelection=false)
sets the image, which is currently edited
void OnMaskSelect(wxListEvent &e)
called when user selected another mask
void OnResetButton(wxCommandEvent &e)
mask editor
ImageRotation
image rotation.
std::vector< MaskPolygon > MaskPolygonVector
Definition Mask.h:150
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