39#include <wx/clipbrd.h>
66 wxXmlResource::Get()->LoadPanel(
this,
"mask_panel");
93 int width =
config->Read(wxString::Format(
"/ImagesListMask/ColumnWidth%d",
j), -1);
117 int width =
config->Read(wxString::Format(
"/MaskEditorPanel/ColumnWidth%d",
j ), -1);
199 wxCommandEvent
dummy;
257 unsigned int nrItems = list->GetItemCount();
291 m_File=image.getFilename();
296 m_File=image.getFilename();
320 ImageCache::getInstance().softFlush();
406 vigra::Rect2D c = img.getCropRect();
407 cropstr.Printf(
"%d,%d,%d,%d", c.left(), c.right(), c.top(), c.bottom());
416 ImageCache::getInstance().softFlush();
424 for (
long i =
nrItems - 1;
i >= nrImages;
i--)
490 if (e.GetKeyCode() == 1 && e.CmdDown())
544 MainFrame::Get()->SetStatusText(
_(
"Create a polygon mask by clicking with the left mouse button on image, set the last point with the right mouse button."),0);
560 if (
fn.Right(4) !=
".msk")
563 if (wxFile::Exists(
fn))
627 std::ostringstream
stream;
651 std::istringstream
stream(std::string(data.GetText().mb_str()));
704 switch (e.GetSelection())
737 if (e.GetString() ==
"update_selection")
739 XRCCTRL(*
this,
"mask_editor_choice_zoom",
wxChoice)->SetSelection(e.GetSelection());
745 if(e.GetId()==
XRCID(
"mask_editor_colour_polygon_negative"))
748 wxConfigBase::Get()->Write(
"/MaskEditorPanel/ColourPolygonNegative",e.GetColour().GetAsString(
wxC2S_HTML_SYNTAX));
751 if(e.GetId()==
XRCID(
"mask_editor_colour_polygon_positive"))
754 wxConfigBase::Get()->Write(
"/MaskEditorPanel/ColourPolygonPositive",e.GetColour().GetAsString(
wxC2S_HTML_SYNTAX));
757 if(e.GetId()==
XRCID(
"mask_editor_colour_point_selected"))
760 wxConfigBase::Get()->Write(
"/MaskEditorPanel/ColourPointSelected",e.GetColour().GetAsString(
wxC2S_HTML_SYNTAX));
765 wxConfigBase::Get()->Write(
"/MaskEditorPanel/ColourPointUnselected",e.GetColour().GetAsString(
wxC2S_HTML_SYNTAX));
834 int colNum = e.GetColumn();
840 int colNum = e.GetColumn();
841 wxConfigBase::Get()->Write( wxString::Format(
"/MaskEditorPanel/ColumnWidth%d",
colNum),
m_maskList->GetColumnWidth(
colNum) );
854 while (roll > 360) roll-= 360;
855 while (roll < 0) roll += 360;
857 while (pitch > 180) pitch -= 360;
858 while (pitch < -180) pitch += 360;
859 const bool headOver = (pitch > 90 || pitch < -90);
861 if (wxConfig::Get()->Read(
"/CPEditorPanel/AutoRot", 1L))
863 if (roll >= 315 || roll < 45)
869 if (roll >= 45 && roll < 135)
875 if (roll >= 135 && roll < 225)
904 m_cropCenter = vigra::Point2D(img.getSize().width()/2 + dx, img.getSize().height()/2 + dy);
917 std::vector<HuginBase::SrcPanoImage>
srcImgs;
928 std::copy(
j.begin(),
j.end(), std::inserter(imgs, imgs.begin()));
1048 m_cropRect.setUpperLeft(vigra::Point2D(0,0));
1049 m_cropRect.setLowerRight(vigra::Point2D(0,0));
1127 : wxXmlResourceHandler()
1138 GetPosition(), GetSize(),
options getSize().area()) int wxCALLBACK SortFieldOfViewAscending(wxIntPtr item1
void SelectSingleImage(wxListCtrl *list, unsigned int imgNr)
Definition of mask load dialog.
UIntSetVector getPartsSet() const
return a vector which contains a HuginBase::UIntSet for each group with the corresponding images numb...
Make an ImageVariableGroup for lenses and other common concepts.
void update()
Update part numbers for each variable group.
ConstImageVariableGroup & getLenses()
Get the ImageVariableGroup representing the group of lens variables.
MaskType
enumeration with type of possible masks
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
void addObserver(PanoramaObserver *o)
add a panorama observer.
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
std::size_t getNrOfImages() const
number of images.
All variables of a source image.
bool isCircularCrop() const
returns true, if projection requires cicular crop
hugin_utils::FDiff2D getRadialDistortionCenter() const
bool hasMasks() const
returns true, if image has masks associated
static MainFrame * Get()
hack.. kind of a pseudo singleton...
xrc handler for handling mask editor panel
virtual wxObject * DoCreateResource()
virtual bool CanHandle(wxXmlNode *node)
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)
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
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
wxTextCtrl * m_top_textctrl
void OnShowActiveMasks(wxCommandEvent &e)
event handler for changing option if active masks should be drawn
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 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
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)
void setActiveMask(unsigned int newMask, bool doUpdate=true)
mark mask with image as beeing editing
void SetUserColourPointUnselected(wxColour newColour)
void setImage(const std::string &filename, HuginBase::MaskPolygonVector newMask, HuginBase::MaskPolygonVector masksToDraw, ImageRotation rot)
set the current image and mask list, this loads also the image from cache
double getScale()
return scale factor, 0 for autoscale
void SetUserColourPolygonPositive(wxColour newColour)
void setScale(double factor)
set the scaling factor for mask editing display.
HuginBase::MaskPolygonVector getNewMask() const
returns the vector of all mask (including new created mask)
void setDrawingActiveMasks(bool newDrawActiveMasks)
set if active masks should be drawn
void setNewMasks(HuginBase::MaskPolygonVector newMasks, HuginBase::MaskPolygonVector masksToDraw)
updates masks for currently selected image
void startNewPolygon()
starts creating a new polygon
ImageRotation
image rotation.
void Init(MaskEditorPanel *parent)
vigra::Rect2D getCrop()
returns the current crop rect
void SetMaskMode(bool newMaskMode)
sets the control to mask (newMaskMode=true) or crop (newMaskMode=false) mode
ImageRotation getCurrentRotation()
returns the current rotation of displayed image
void selectAllMarkers()
select all points of active mask
void SetUserColourPointSelected(wxColour newColour)
void setCrop(HuginBase::SrcPanoImage::CropMode newCropMode, vigra::Rect2D newCropRect, bool isCentered, hugin_utils::FDiff2D center, bool isCircleCrop)
updates the crop mode and crop rect
void SetUserColourPolygonNegative(wxColour newColour)
sets the colour for different parts
Dialog for loading masks.
void addCommand(PanoCommand *command, bool execute=true)
Adds a command to the history.
static GlobalCmdHist & getInstance()
update mask for given image
Handle EVT_KILL_FOCUS and convert it to a EVT_TEXT_ENTER event.
#define HUGIN_MASK_COLOUR_POINT_SELECTED
#define HUGIN_MASK_COLOUR_POINT_UNSELECTED
#define HUGIN_MASK_COLOUR_POLYGON_NEGATIVE
#define HUGIN_MASK_COLOUR_POLYGON_POSITIVE
#define DEBUG_ASSERT(cond)
std::vector< MaskPolygon > MaskPolygonVector
std::vector< UIntSet > UIntSetVector
std::set< unsigned int > UIntSet
TDiff2D< double > FDiff2D
bool AskUserOverwrite(const wxString &filename, const wxString &caption, wxWindow *parent)
ask user if the given file should be overwritten, return true if the user confirmed the overwritting
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
include file for the hugin project
include file for the hugin project
bool set_contains(const _Container &c, const typename _Container::key_type &key)
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.