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 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...
 
void OnColumnWidthChange (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 UpdateCropDisplay ()
 update GUI display More...
 
void CenterCrop ()
 
size_t GetImgNr ()
 
 DECLARE_EVENT_TABLE ()
 

Private Attributes

MaskImageCtrlm_editImg
 
ImagesListMaskm_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
 
HuginBase::UIntSet m_selectedImages
 
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 ( )

ctor.

Definition at line 70 of file MaskEditorPanel.cpp.

References DEBUG_TRACE, and HuginBase::MaskPolygon::Mask_negative.

MaskEditorPanel::~MaskEditorPanel ( )
virtual

Member Function Documentation

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

Definition at line 958 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") 
)
MaskEditorPanel::DECLARE_EVENT_TABLE ( )
private
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 785 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 735 of file MaskEditorPanel.cpp.

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

Referenced by setImage().

unsigned int MaskEditorPanel::GetSelectedMask ( )
private

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

Definition at line 719 of file MaskEditorPanel.cpp.

References m_maskList.

Referenced by OnMaskSelect(), and UpdateMaskList().

void MaskEditorPanel::Init ( HuginBase::Panorama pano)
void MaskEditorPanel::OnAutoCenter ( wxCommandEvent &  e)

Definition at line 947 of file MaskEditorPanel.cpp.

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

void MaskEditorPanel::OnColourChanged ( wxColourPickerEvent &  e)
void MaskEditorPanel::OnColumnWidthChange ( wxListEvent &  e)
private

called, when column with of mask list box was changed

Definition at line 729 of file MaskEditorPanel.cpp.

References m_maskList.

void MaskEditorPanel::OnImageSelect ( wxListEvent &  e)
void MaskEditorPanel::OnMaskAdd ( wxCommandEvent &  e)

called when user wants to create new polygon

Definition at line 444 of file MaskEditorPanel.cpp.

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

void MaskEditorPanel::OnMaskCopy ( wxCommandEvent &  e)

called when user wants to copy a mask to clipboard

Definition at line 533 of file MaskEditorPanel.cpp.

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

void MaskEditorPanel::OnMaskDelete ( wxCommandEvent &  e)

called when user wants to delete active mask

Definition at line 591 of file MaskEditorPanel.cpp.

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

Referenced by 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 457 of file MaskEditorPanel.cpp.

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

void MaskEditorPanel::OnMaskSelect ( wxListEvent &  e)

called when user selected another mask

Definition at line 429 of file MaskEditorPanel.cpp.

References GetSelectedMask(), and setMask().

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 780 of file MaskEditorPanel.cpp.

References m_editImg, and MaskImageCtrl::setDrawingActiveMasks().

void MaskEditorPanel::OnZoom ( wxCommandEvent &  e)

sets the actual zoom factor

Definition at line 602 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 360 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

Implements HuginBase::PanoramaObserver.

Definition at line 364 of file MaskEditorPanel.cpp.

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

void MaskEditorPanel::SelectMask ( unsigned int  newMaskNr)

selects the mask with index newMaskNr in the listbox

Definition at line 342 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 243 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, m_selectedImages, HuginBase::BaseSrcPanoImage::NO_CROP, ImagesList::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 306 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 991 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 842 of file MaskEditorPanel.cpp.

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

Referenced by MaskImageCtrl::OnMouseMove().

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 680 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 175 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 180 of file MaskEditorPanel.h.

Referenced by CenterCrop(), and DisplayCrop().

wxCheckBox* MaskEditorPanel::m_cropLens
private

Definition at line 176 of file MaskEditorPanel.h.

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

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

Definition at line 177 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

Definition at line 160 of file MaskEditorPanel.h.

Referenced by AddMask(), Create(), OnMaskTypeChange(), setMask(), and ~MaskEditorPanel().

MaskImageCtrl* MaskEditorPanel::m_editImg
private
std::string MaskEditorPanel::m_File
private

Definition at line 168 of file MaskEditorPanel.h.

Referenced by Create(), and setImage().

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

Definition at line 157 of file MaskEditorPanel.h.

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

ImagesListMask* MaskEditorPanel::m_imagesListMask
private

Definition at line 150 of file MaskEditorPanel.h.

Referenced by Create(), Init(), OnImageSelect(), OnModeChanged(), and setImage().

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

Definition at line 153 of file MaskEditorPanel.h.

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

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

Definition at line 162 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 152 of file MaskEditorPanel.h.

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

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

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