Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MaskEditorPanel Class Reference

mask editor panel. More...

#include <MaskEditorPanel.h>

Inheritance diagram for MaskEditorPanel:
Inheritance graph

Public Member Functions

 MaskEditorPanel ()
 ctor. More...
 
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"))
 
void Init (HuginBase::Panorama *pano)
 
virtual ~MaskEditorPanel ()
 dtor. More...
 
void SetPano (HuginBase::Panorama *panorama)
 
void setImage (unsigned int imgNr, bool updateListSelection=false)
 sets the image, which is currently edited More...
 
void setMask (unsigned int maskNr)
 sets active mask number, set to UINT_MAX, if no mask is currently editing More...
 
void UpdateMask ()
 called when mask where changed in MaskImageCtrl More...
 
void AddMask ()
 called when new mask added in MaskImageCtrl More...
 
void SelectMask (unsigned int newMaskNr)
 selects the mask with index newMaskNr in the listbox More...
 
void UpdateCrop (bool updateFromImgCtrl=false)
 updated the crop in the Panorama object with the current values from GUI More...
 
void UpdateCropFromImage ()
 updates the displayed crop in the text boxes (for dragging) More...
 
void SwitchToCropMode ()
 switches the controls to crop mode More...
 
void panoramaChanged (HuginBase::Panorama &pano)
 called when the panorama changes and we should update our display More...
 
void panoramaImagesChanged (HuginBase::Panorama &pano, const HuginBase::UIntSet &imgNr)
 notifies about changes to images More...
 
void OnImageListChar (wxKeyEvent &e)
 key handler for images list More...
 
void OnImageSelect (wxListEvent &e)
 called when user selected another image More...
 
void OnMaskSelect (wxListEvent &e)
 called when user selected another mask More...
 
void OnMaskTypeChange (wxCommandEvent &e)
 handler when mask type was changed More...
 
void OnMaskAdd (wxCommandEvent &e)
 called when user wants to create new polygon More...
 
void OnMaskSave (wxCommandEvent &e)
 called when user wants to save active mask More...
 
void OnMaskLoad (wxCommandEvent &e)
 called when user wants to load a mask into the selected image More...
 
void OnMaskCopy (wxCommandEvent &e)
 called when user wants to copy a mask to clipboard More...
 
void OnMaskPaste (wxCommandEvent &e)
 called when user wants to paste a mask from clipboard More...
 
void OnMaskDelete (wxCommandEvent &e)
 called when user wants to delete active mask More...
 
void OnZoom (wxCommandEvent &e)
 sets the actual zoom factor More...
 
void OnColourChanged (wxColourPickerEvent &e)
 event handler for changing colours More...
 
void OnShowActiveMasks (wxCommandEvent &e)
 event handler for changing option if active masks should be drawn More...
 
void OnResetButton (wxCommandEvent &e)
 
void OnSetLeft (wxCommandEvent &e)
 
void OnSetRight (wxCommandEvent &e)
 
void OnSetTop (wxCommandEvent &e)
 
void OnSetBottom (wxCommandEvent &e)
 
void OnAutoCenter (wxCommandEvent &e)
 
void OnModeChanged (wxNotebookEvent &e)
 
- Public Member Functions inherited from HuginBase::PanoramaObserver
virtual ~PanoramaObserver ()
 

Private Member Functions

void UpdateMaskList (bool restoreSelection=false)
 updates the display after another image has been selected. More...
 
unsigned int GetSelectedMask ()
 return index of currently selected masks, return UINT_MAX if no mask is selected More...
 
const HuginBase::UIntSet GetSelectedImages ()
 return the currently selected image(s) More...
 
void OnImagesColumnWidthChange (wxListEvent &e)
 called, when column with of images list box was changed More...
 
void OnMaskColumnWidthChange (wxListEvent &e)
 called, when column with of mask list box was changed More...
 
MaskImageCtrl::ImageRotation GetRot (const unsigned int imgNr)
 determines, if the image should be rotated for display More...
 
void DisplayCrop (int imgNr)
 copies the crop information from the Panorama object to GUI More...
 
void UpdateImage (size_t imgNr)
 update the list box for the given imgNr More...
 
void UpdateCropDisplay ()
 update GUI display More...
 
void CenterCrop ()
 
size_t GetImgNr ()
 

Private Attributes

MaskImageCtrlm_editImg
 
wxListCtrl * m_imagesListMask
 
wxListCtrl * m_maskList
 
wxChoice * m_maskType
 
wxNotebook * m_maskCropCtrl
 
HuginBase::Panoramam_pano
 
HuginBase::ConstStandardImageVariableGroupsm_imageGroups =nullptr
 
HuginBase::MaskPolygonVector m_currentMasks
 
HuginBase::MaskPolygon::MaskType m_defaultMaskType
 
bool m_maskMode
 
unsigned int m_MaskNr
 
std::string m_File
 
wxTextCtrl * m_left_textctrl
 
wxTextCtrl * m_right_textctrl
 
wxTextCtrl * m_top_textctrl
 
wxTextCtrl * m_bottom_textctrl
 
wxCheckBox * m_autocenter_cb
 
wxCheckBox * m_cropLens
 
HuginBase::SrcPanoImage::CropMode m_cropMode
 
vigra::Rect2D m_cropRect
 
bool m_autoCenterCrop = true
 
vigra::Point2D m_cropCenter
 

Detailed Description

mask editor panel.

This panel is used to create/change/edit masks

Definition at line 44 of file MaskEditorPanel.h.

Constructor & Destructor Documentation

MaskEditorPanel::MaskEditorPanel ( )
MaskEditorPanel::~MaskEditorPanel ( )
virtual

Member Function Documentation

void MaskEditorPanel::AddMask ( )
void MaskEditorPanel::CenterCrop ( )
private

Definition at line 1065 of file MaskEditorPanel.cpp.

References m_cropCenter, and m_cropRect.

Referenced by OnAutoCenter(), OnSetBottom(), OnSetLeft(), OnSetRight(), and OnSetTop().

bool MaskEditorPanel::Create ( wxWindow *  parent,
wxWindowID  id = wxID_ANY,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxTAB_TRAVERSAL,
const wxString &  name = wxT("panel") 
)
void MaskEditorPanel::DisplayCrop ( int  imgNr)
private

copies the crop information from the Panorama object to GUI

Todo:
can this be done with img.getSize() / 2 + img.getRadialDistortionCenterShift()?

Definition at line 892 of file MaskEditorPanel.cpp.

References HuginBase::Panorama::getImage(), m_autoCenterCrop, m_cropCenter, m_cropMode, m_cropRect, m_pano, hugin_utils::roundi(), and UpdateCropDisplay().

Referenced by OnImageSelect(), and panoramaImagesChanged().

size_t MaskEditorPanel::GetImgNr ( )
private
MaskImageCtrl::ImageRotation MaskEditorPanel::GetRot ( const unsigned int  imgNr)
private

determines, if the image should be rotated for display

Definition at line 842 of file MaskEditorPanel.cpp.

References HuginBase::Panorama::getImage(), m_pano, MaskImageCtrl::ROT0, MaskImageCtrl::ROT180, MaskImageCtrl::ROT270, and MaskImageCtrl::ROT90.

Referenced by setImage().

const HuginBase::UIntSet MaskEditorPanel::GetSelectedImages ( )
private

return the currently selected image(s)

Definition at line 817 of file MaskEditorPanel.cpp.

References m_imagesListMask.

Referenced by GetImgNr(), OnImageSelect(), and UpdateCrop().

unsigned int MaskEditorPanel::GetSelectedMask ( )
private

return index of currently selected masks, return UINT_MAX if no mask is selected

Definition at line 807 of file MaskEditorPanel.cpp.

References m_maskList.

Referenced by OnMaskSelect(), and UpdateMaskList().

void MaskEditorPanel::Init ( HuginBase::Panorama pano)

Definition at line 214 of file MaskEditorPanel.cpp.

References HuginBase::Panorama::addObserver(), m_imageGroups, and m_pano.

Referenced by MainFrame::MainFrame().

void MaskEditorPanel::OnAutoCenter ( wxCommandEvent &  e)

Definition at line 1054 of file MaskEditorPanel.cpp.

References CenterCrop(), m_autoCenterCrop, UpdateCrop(), and UpdateCropDisplay().

Referenced by Create().

void MaskEditorPanel::OnColourChanged ( wxColourPickerEvent &  e)
void MaskEditorPanel::OnImageListChar ( wxKeyEvent &  e)

key handler for images list

Definition at line 480 of file MaskEditorPanel.cpp.

References m_imagesListMask.

Referenced by Create().

void MaskEditorPanel::OnImagesColumnWidthChange ( wxListEvent &  e)
private

called, when column with of images list box was changed

Definition at line 830 of file MaskEditorPanel.cpp.

References m_imagesListMask.

Referenced by Create().

void MaskEditorPanel::OnImageSelect ( wxListEvent &  e)

called when user selected another image

Definition at line 498 of file MaskEditorPanel.cpp.

References DisplayCrop(), GetImgNr(), GetSelectedImages(), m_bottom_textctrl, m_left_textctrl, m_right_textctrl, m_top_textctrl, setImage(), and setMask().

Referenced by Create().

void MaskEditorPanel::OnMaskAdd ( wxCommandEvent &  e)

called when user wants to create new polygon

Definition at line 532 of file MaskEditorPanel.cpp.

References MainFrame::Get(), GetImgNr(), m_editImg, m_maskList, m_MaskNr, setMask(), and MaskImageCtrl::startNewPolygon().

Referenced by Create().

void MaskEditorPanel::OnMaskColumnWidthChange ( wxListEvent &  e)
private

called, when column with of mask list box was changed

Definition at line 836 of file MaskEditorPanel.cpp.

References m_maskList.

Referenced by Create().

void MaskEditorPanel::OnMaskCopy ( wxCommandEvent &  e)

called when user wants to copy a mask to clipboard

Definition at line 621 of file MaskEditorPanel.cpp.

References HuginBase::Panorama::getImage(), GetImgNr(), m_currentMasks, m_maskMode, m_MaskNr, m_pano, and HuginBase::SaveMaskToStream().

Referenced by Create().

void MaskEditorPanel::OnMaskDelete ( wxCommandEvent &  e)

called when user wants to delete active mask

Definition at line 679 of file MaskEditorPanel.cpp.

References PanoCommand::CommandHistory::addCommand(), GetImgNr(), PanoCommand::GlobalCmdHist::getInstance(), m_currentMasks, m_MaskNr, and m_pano.

Referenced by Create(), and MaskImageCtrl::OnKeyUp().

void MaskEditorPanel::OnMaskLoad ( wxCommandEvent &  e)
void MaskEditorPanel::OnMaskPaste ( wxCommandEvent &  e)
void MaskEditorPanel::OnMaskSave ( wxCommandEvent &  e)

called when user wants to save active mask

Definition at line 545 of file MaskEditorPanel.cpp.

References HuginBase::Panorama::getImage(), GetImgNr(), HUGIN_CONV_FILENAME, m_currentMasks, m_MaskNr, m_pano, and HuginBase::SaveMaskToStream().

Referenced by Create().

void MaskEditorPanel::OnMaskSelect ( wxListEvent &  e)

called when user selected another mask

Definition at line 517 of file MaskEditorPanel.cpp.

References GetSelectedMask(), and setMask().

Referenced by Create().

void MaskEditorPanel::OnMaskTypeChange ( wxCommandEvent &  e)
void MaskEditorPanel::OnModeChanged ( wxNotebookEvent &  e)
void MaskEditorPanel::OnResetButton ( wxCommandEvent &  e)
void MaskEditorPanel::OnSetBottom ( wxCommandEvent &  e)
void MaskEditorPanel::OnSetLeft ( wxCommandEvent &  e)
void MaskEditorPanel::OnSetRight ( wxCommandEvent &  e)
void MaskEditorPanel::OnSetTop ( wxCommandEvent &  e)
void MaskEditorPanel::OnShowActiveMasks ( wxCommandEvent &  e)

event handler for changing option if active masks should be drawn

Definition at line 887 of file MaskEditorPanel.cpp.

References m_editImg, and MaskImageCtrl::setDrawingActiveMasks().

Referenced by Create().

void MaskEditorPanel::OnZoom ( wxCommandEvent &  e)

sets the actual zoom factor

Definition at line 690 of file MaskEditorPanel.cpp.

References DEBUG_ERROR, MaskImageCtrl::getScale(), m_editImg, and MaskImageCtrl::setScale().

Referenced by Create().

void MaskEditorPanel::panoramaChanged ( HuginBase::Panorama pano)
virtual

called when the panorama changes and we should update our display

Implements HuginBase::PanoramaObserver.

Definition at line 378 of file MaskEditorPanel.cpp.

void MaskEditorPanel::panoramaImagesChanged ( HuginBase::Panorama pano,
const HuginBase::UIntSet changed 
)
virtual

notifies about changes to images

Images might have been added/removed. to find out how many images are still there, use Panorama::getNrOfImages.

Parameters
panothe panorama object that changed
changedset of changed images

update images list

Implements HuginBase::PanoramaObserver.

Definition at line 408 of file MaskEditorPanel.cpp.

References DisplayCrop(), HuginBase::Panorama::getImage(), GetImgNr(), HuginBase::Panorama::getNrOfImages(), m_currentMasks, m_imageGroups, m_imagesListMask, SelectMask(), set_contains(), setImage(), HuginBase::ConstStandardImageVariableGroups::update(), UpdateCropDisplay(), and UpdateImage().

void MaskEditorPanel::SelectMask ( unsigned int  newMaskNr)

selects the mask with index newMaskNr in the listbox

Definition at line 360 of file MaskEditorPanel.cpp.

References GetImgNr(), m_currentMasks, m_maskList, and m_MaskNr.

Referenced by AddMask(), MaskImageCtrl::FindPolygon(), OnModeChanged(), and panoramaImagesChanged().

void MaskEditorPanel::setImage ( unsigned int  imgNr,
bool  updateListSelection = false 
)

sets the image, which is currently edited

Parameters
imgNrthe image which should be shown, use UINT_MAX for no image selected
updateListSelectionif true, the selection of the images list is updated, otherwise the selection of the list remains unchanged (e.g. when calling from the list selection changed event handler)

Definition at line 269 of file MaskEditorPanel.cpp.

References DEBUG_TRACE, MaskImageCtrl::getCurrentRotation(), HuginBase::Panorama::getImage(), GetImgNr(), HuginBase::SrcPanoImage::getRadialDistortionCenter(), GetRot(), HuginBase::SrcPanoImage::isCircularCrop(), m_currentMasks, m_editImg, m_File, m_imagesListMask, m_MaskNr, m_pano, HuginBase::BaseSrcPanoImage::NO_CROP, SelectSingleImage(), MaskImageCtrl::setCrop(), MaskImageCtrl::setImage(), setMask(), MaskImageCtrl::setNewMasks(), and UpdateMaskList().

Referenced by OnImageSelect(), panoramaImagesChanged(), and MainFrame::ShowMaskEditor().

void MaskEditorPanel::setMask ( unsigned int  maskNr)

sets active mask number, set to UINT_MAX, if no mask is currently editing

Definition at line 324 of file MaskEditorPanel.cpp.

References GetImgNr(), m_currentMasks, m_defaultMaskType, m_editImg, m_MaskNr, m_maskType, and MaskImageCtrl::setActiveMask().

Referenced by OnImageSelect(), OnMaskAdd(), OnMaskSelect(), and setImage().

void MaskEditorPanel::SetPano ( HuginBase::Panorama panorama)
inline

Definition at line 59 of file MaskEditorPanel.h.

References m_pano.

void MaskEditorPanel::SwitchToCropMode ( )

switches the controls to crop mode

Definition at line 1096 of file MaskEditorPanel.cpp.

References m_maskCropCtrl, and OnModeChanged().

Referenced by MainFrame::ShowMaskEditor().

void MaskEditorPanel::UpdateCrop ( bool  updateFromImgCtrl = false)
void MaskEditorPanel::UpdateCropDisplay ( )
private
void MaskEditorPanel::UpdateCropFromImage ( )

updates the displayed crop in the text boxes (for dragging)

Definition at line 949 of file MaskEditorPanel.cpp.

References MaskImageCtrl::getCrop(), m_cropRect, m_editImg, and UpdateCropDisplay().

Referenced by MaskImageCtrl::OnMouseMove().

void MaskEditorPanel::UpdateImage ( size_t  imgNr)
private
void MaskEditorPanel::UpdateMask ( )
void MaskEditorPanel::UpdateMaskList ( bool  restoreSelection = false)
private

updates the display after another image has been selected.

updates mask list and editor panel

Definition at line 768 of file MaskEditorPanel.cpp.

References GetImgNr(), GetSelectedMask(), m_currentMasks, m_maskList, and m_maskType.

Referenced by setImage().

Member Data Documentation

wxCheckBox* MaskEditorPanel::m_autocenter_cb
private

Definition at line 181 of file MaskEditorPanel.h.

Referenced by Create(), and UpdateCropDisplay().

bool MaskEditorPanel::m_autoCenterCrop = true
private
wxTextCtrl* MaskEditorPanel::m_bottom_textctrl
private
vigra::Point2D MaskEditorPanel::m_cropCenter
private

Definition at line 186 of file MaskEditorPanel.h.

Referenced by CenterCrop(), and DisplayCrop().

wxCheckBox* MaskEditorPanel::m_cropLens
private

Definition at line 182 of file MaskEditorPanel.h.

Referenced by Create(), UpdateCrop(), and ~MaskEditorPanel().

HuginBase::SrcPanoImage::CropMode MaskEditorPanel::m_cropMode
private

Definition at line 183 of file MaskEditorPanel.h.

Referenced by DisplayCrop(), and OnResetButton().

vigra::Rect2D MaskEditorPanel::m_cropRect
private
HuginBase::MaskPolygonVector MaskEditorPanel::m_currentMasks
private
HuginBase::MaskPolygon::MaskType MaskEditorPanel::m_defaultMaskType
private
MaskImageCtrl* MaskEditorPanel::m_editImg
private
std::string MaskEditorPanel::m_File
private

Definition at line 174 of file MaskEditorPanel.h.

Referenced by Create(), and setImage().

HuginBase::ConstStandardImageVariableGroups* MaskEditorPanel::m_imageGroups =nullptr
private

Definition at line 165 of file MaskEditorPanel.h.

Referenced by Init(), panoramaImagesChanged(), UpdateCrop(), and ~MaskEditorPanel().

wxListCtrl* MaskEditorPanel::m_imagesListMask
private
wxTextCtrl* MaskEditorPanel::m_left_textctrl
private
wxNotebook* MaskEditorPanel::m_maskCropCtrl
private

Definition at line 161 of file MaskEditorPanel.h.

Referenced by Create(), MaskEditorPanel(), OnModeChanged(), and SwitchToCropMode().

wxListCtrl* MaskEditorPanel::m_maskList
private
bool MaskEditorPanel::m_maskMode
private

Definition at line 170 of file MaskEditorPanel.h.

Referenced by Create(), OnMaskCopy(), OnMaskPaste(), and OnModeChanged().

unsigned int MaskEditorPanel::m_MaskNr
private
wxChoice* MaskEditorPanel::m_maskType
private

Definition at line 160 of file MaskEditorPanel.h.

Referenced by Create(), setMask(), and UpdateMaskList().

HuginBase::Panorama* MaskEditorPanel::m_pano
private
wxTextCtrl* MaskEditorPanel::m_right_textctrl
private
wxTextCtrl* MaskEditorPanel::m_top_textctrl
private

The documentation for this class was generated from the following files: