Hugintrunk
0.1
|
mask editor More...
#include <MaskImageCtrl.h>
Public Types | |
enum | ImageRotation { ROT0 =0, ROT90, ROT180, ROT270 } |
image rotation. More... | |
Public Member Functions | |
MaskImageCtrl () | |
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 (MaskEditorPanel *parent) |
void | setPreviewOnly () |
if called, the mouse handlers are deactivated More... | |
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 More... | |
void | setNewMasks (HuginBase::MaskPolygonVector newMasks, HuginBase::MaskPolygonVector masksToDraw) |
updates masks for currently selected image More... | |
void | setCrop (HuginBase::SrcPanoImage::CropMode newCropMode, vigra::Rect2D newCropRect, bool isCentered, hugin_utils::FDiff2D center, bool isCircleCrop) |
updates the crop mode and crop rect More... | |
vigra::Rect2D | getCrop () |
returns the current crop rect More... | |
void | setActiveMask (unsigned int newMask, bool doUpdate=true) |
mark mask with image as beeing editing More... | |
HuginBase::MaskPolygonVector | getNewMask () const |
returns the vector of all mask (including new created mask) More... | |
void | selectAllMarkers () |
select all points of active mask More... | |
void | OnMouseMove (wxMouseEvent &mouse) |
event handler when mouse is moving More... | |
void | OnLeftMouseDown (wxMouseEvent &mouse) |
event handler when left mouse button is pressed More... | |
void | OnLeftMouseUp (wxMouseEvent &mouse) |
event handler when right mouse button is released More... | |
void | OnLeftMouseDblClick (wxMouseEvent &mouse) |
event handler for left double click More... | |
void | OnRightMouseDown (wxMouseEvent &mouse) |
event handler when right mouse button is pressed More... | |
void | OnRightMouseUp (wxMouseEvent &mouse) |
event handler when right mouse button is released More... | |
void | OnMiddleMouseDown (wxMouseEvent &mouse) |
event handler for middle mouse button, start scrolling More... | |
void | OnMiddleMouseUp (wxMouseEvent &mouse) |
event handler for middle mouse button, end scrolling More... | |
void | OnKeyUp (wxKeyEvent &e) |
event handler for keyboard More... | |
void | OnChar (wxKeyEvent &e) |
event handler for scrolling with keyboard More... | |
void | OnCaptureLost (wxMouseCaptureLostEvent &e) |
event handler, when mouse capture is lost, e.g. More... | |
void | OnKillFocus (wxFocusEvent &e) |
event handler, when editor lost focus, mainly cancels creating new polygon More... | |
void | OnScroll (wxScrollWinEvent &e) |
event handler for remember scroll position More... | |
void | startNewPolygon () |
starts creating a new polygon More... | |
wxSize | DoGetBestSize () const |
returns size of currently scaled image More... | |
void | SetMaskMode (bool newMaskMode) |
sets the control to mask (newMaskMode=true) or crop (newMaskMode=false) mode More... | |
void | setScale (double factor) |
set the scaling factor for mask editing display. More... | |
double | getScale () |
return scale factor, 0 for autoscale More... | |
ImageRotation | getCurrentRotation () |
returns the current rotation of displayed image More... | |
void | setDrawingActiveMasks (bool newDrawActiveMasks) |
set if active masks should be drawn More... | |
void | update () |
initiate redraw More... | |
void | SetUserColourPolygonNegative (wxColour newColour) |
sets the colour for different parts More... | |
void | SetUserColourPolygonPositive (wxColour newColour) |
void | SetUserColourPointSelected (wxColour newColour) |
void | SetUserColourPointUnselected (wxColour newColour) |
virtual void | OnDraw (wxDC &dc) wxOVERRIDE |
drawing routine More... | |
Protected Member Functions | |
void | OnSize (wxSizeEvent &e) |
handler called when size of control was changed More... | |
double | getScaleFactor () const |
get scale factor (calculates factor when fit to window is active) More... | |
double | calcAutoScaleFactor (wxSize size) |
calculate new scale factor for this image More... | |
void | rescaleImage () |
rescale the image More... | |
Private Types | |
enum | ClickPos { CLICK_OUTSIDE, CLICK_INSIDE, CLICK_LEFT, CLICK_RIGHT, CLICK_TOP, CLICK_BOTTOM, CLICK_CIRCLE } |
enum | MaskEditorState { NO_IMAGE =0, NO_MASK, NO_SELECTION, POINTS_SELECTED, POINTS_MOVING, POINTS_DELETING, POINTS_ADDING, POLYGON_SELECTING, REGION_SELECTING, NEW_POLYGON_STARTED, NEW_POLYGON_CREATING, CROP_SHOWING, CROP_MOVING, CROP_CIRCLE_SCALING, CROP_LEFT_MOVING, CROP_RIGHT_MOVING, CROP_TOP_MOVING, CROP_BOTTOM_MOVING } |
different states of the editor More... | |
Private Member Functions | |
int | scale (int x) const |
scale of width/height More... | |
double | scale (double x) const |
int | transform (int x) const |
convert image coordinate to screen coordinates, considers additional added border More... | |
double | transform (double x) const |
wxPoint | transform (const hugin_utils::FDiff2D &p) const |
int | invtransform (int x) const |
translate screen coordinates to image coordinates, considers additional added border More... | |
double | invtransform (double x) const |
hugin_utils::FDiff2D | invtransform (const wxPoint &p) const |
template<class T > | |
T | applyRot (const T &p) const |
template<class T > | |
T | applyRotInv (const T &p) const |
void | DrawImageBitmap (wxDC &dc, int offset) |
void | DrawPolygon (wxDC &dc, HuginBase::MaskPolygon poly, bool isSelected, bool drawMarker) |
void | DrawSelectionRectangle () |
void | DrawCrop (wxDC &dc) |
void | DrawCrop () |
void | FindPolygon (hugin_utils::FDiff2D p) |
bool | SelectPointsInsideMouseRect (HuginBase::UIntSet &points, const bool considerSelectedOnly) |
void | UpdateCrop (hugin_utils::FDiff2D delta) |
ClickPos | GetClickPos (vigra::Point2D pos) |
Private Attributes | |
wxBitmap | m_bitmap |
wxBitmap | m_disabledBitmap |
std::string | m_imageFilename |
ImageRotation | m_imgRotation |
wxSize | m_imageSize |
wxSize | m_realSize |
HuginBase::SrcPanoImage::CropMode | m_cropMode |
vigra::Rect2D | m_cropRect |
bool | m_cropCentered |
bool | m_cropCircle |
hugin_utils::FDiff2D | m_cropCenter |
bool | m_showActiveMasks |
bool | m_maskMode |
MaskEditorState | m_maskEditState |
double | m_scaleFactor |
bool | m_fitToWindow |
bool | m_previewOnly |
MaskEditorPanel * | m_editPanel |
HuginBase::MaskPolygonVector | m_imageMask |
HuginBase::MaskPolygonVector | m_masksToDraw |
unsigned int | m_activeMask |
HuginBase::MaskPolygon | m_editingMask |
HuginBase::UIntSet | m_selectedPoints |
ImageCache::EntryPtr | m_img |
wxPoint | m_dragStartPos |
wxPoint | m_currentPos |
bool | m_middleMouseScroll |
wxPoint | m_scrollPos |
wxColor | m_colour_polygon_negative |
wxColor | m_colour_polygon_positive |
wxColor | m_colour_point_selected |
wxColor | m_colour_point_unselected |
wxColour | m_color_selection |
wxOverlay | m_overlay |
int | m_oldScrollPosX |
int | m_oldScrollPosY |
|
private |
Enumerator | |
---|---|
CLICK_OUTSIDE | |
CLICK_INSIDE | |
CLICK_LEFT | |
CLICK_RIGHT | |
CLICK_TOP | |
CLICK_BOTTOM | |
CLICK_CIRCLE |
Definition at line 271 of file MaskImageCtrl.h.
image rotation.
Useful to display images depending on their roll setting. rotation is clockwise
Enumerator | |
---|---|
ROT0 | |
ROT90 | |
ROT180 | |
ROT270 |
Definition at line 55 of file MaskImageCtrl.h.
|
private |
different states of the editor
Definition at line 279 of file MaskImageCtrl.h.
|
inline |
ctor.
Definition at line 43 of file MaskImageCtrl.h.
|
inlineprivate |
Definition at line 211 of file MaskImageCtrl.h.
References m_imgRotation, m_realSize, ROT0, ROT180, ROT270, and ROT90.
Referenced by DrawCrop(), DrawPolygon(), and OnDraw().
|
inlineprivate |
Definition at line 235 of file MaskImageCtrl.h.
References m_imgRotation, m_realSize, ROT0, ROT180, ROT270, and ROT90.
Referenced by OnLeftMouseDown(), OnLeftMouseUp(), OnMouseMove(), OnRightMouseDown(), OnRightMouseUp(), SelectPointsInsideMouseRect(), and UpdateCrop().
|
protected |
calculate new scale factor for this image
Definition at line 1554 of file MaskImageCtrl.cpp.
References DEBUG_DEBUG, vigra_ext::EMoR::h, m_imgRotation, ROT270, and ROT90.
Referenced by rescaleImage(), and setScale().
bool MaskImageCtrl::Create | ( | wxWindow * | parent, |
wxWindowID | id = wxID_ANY , |
||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = wxTAB_TRAVERSAL , |
||
const wxString & | name = wxT("panel") |
||
) |
Definition at line 47 of file MaskImageCtrl.cpp.
References m_activeMask, m_fitToWindow, m_imgRotation, m_maskEditState, m_maskMode, m_middleMouseScroll, m_oldScrollPosX, m_oldScrollPosY, m_previewOnly, m_scaleFactor, m_showActiveMasks, NO_IMAGE, OnCaptureLost(), OnChar(), OnKeyUp(), OnKillFocus(), OnLeftMouseDblClick(), OnLeftMouseDown(), OnLeftMouseUp(), OnMiddleMouseDown(), OnMiddleMouseUp(), OnMouseMove(), OnRightMouseDown(), OnRightMouseUp(), OnScroll(), OnSize(), and ROT0.
wxSize MaskImageCtrl::DoGetBestSize | ( | ) | const |
returns size of currently scaled image
Definition at line 1142 of file MaskImageCtrl.cpp.
References m_imageSize.
|
private |
Definition at line 1217 of file MaskImageCtrl.cpp.
References applyRot(), HuginBase::BaseSrcPanoImage::CROP_CIRCLE, m_color_selection, m_cropMode, m_cropRect, m_maskMode, scale(), and transform().
|
private |
Definition at line 1209 of file MaskImageCtrl.cpp.
References DrawImageBitmap(), HuginBase::maskOffset, and scale().
Referenced by OnDraw(), and OnMouseMove().
|
private |
Definition at line 1242 of file MaskImageCtrl.cpp.
References m_bitmap.
Referenced by DrawCrop(), and OnDraw().
|
private |
Definition at line 1154 of file MaskImageCtrl.cpp.
References applyRot(), HuginBase::MaskPolygon::getMaskPolygon(), HuginBase::MaskPolygon::getMaskType(), m_colour_point_selected, m_colour_point_unselected, m_colour_polygon_negative, m_colour_polygon_positive, m_selectedPoints, HuginBase::MaskPolygon::Mask_negative, HuginBase::MaskPolygon::Mask_negative_lens, HuginBase::MaskPolygon::Mask_positive, HuginBase::MaskPolygon::Mask_Stack_negative, HuginBase::MaskPolygon::Mask_Stack_positive, polygonPointSize, set_contains(), and transform().
Referenced by OnDraw().
|
private |
Definition at line 1483 of file MaskImageCtrl.cpp.
References m_color_selection, m_currentPos, m_dragStartPos, and m_overlay.
Referenced by OnMouseMove().
|
private |
Definition at line 1495 of file MaskImageCtrl.cpp.
References m_editPanel, m_imageMask, and MaskEditorPanel::SelectMask().
Referenced by OnLeftMouseUp().
|
private |
Definition at line 265 of file MaskImageCtrl.cpp.
References CLICK_BOTTOM, CLICK_CIRCLE, CLICK_INSIDE, CLICK_LEFT, CLICK_OUTSIDE, CLICK_RIGHT, CLICK_TOP, HuginBase::BaseSrcPanoImage::CROP_CIRCLE, m_cropMode, m_cropRect, and maxSelectionDistance.
Referenced by OnLeftMouseDown(), and OnMouseMove().
|
inline |
returns the current crop rect
Definition at line 66 of file MaskImageCtrl.h.
References m_cropRect.
Referenced by MaskEditorPanel::UpdateCrop(), and MaskEditorPanel::UpdateCropFromImage().
|
inline |
returns the current rotation of displayed image
Definition at line 121 of file MaskImageCtrl.h.
References m_imgRotation.
Referenced by MaskEditorPanel::setImage().
|
inline |
returns the vector of all mask (including new created mask)
Definition at line 70 of file MaskImageCtrl.h.
References m_imageMask.
Referenced by MaskEditorPanel::AddMask(), and MaskEditorPanel::UpdateMask().
|
inline |
return scale factor, 0 for autoscale
Definition at line 117 of file MaskImageCtrl.h.
References m_fitToWindow, and m_scaleFactor.
Referenced by MaskEditorPanel::OnZoom().
|
protected |
get scale factor (calculates factor when fit to window is active)
Definition at line 1573 of file MaskImageCtrl.cpp.
References m_scaleFactor.
Referenced by invtransform(), OnLeftMouseDown(), OnLeftMouseUp(), OnRightMouseUp(), rescaleImage(), scale(), SelectPointsInsideMouseRect(), and transform().
void MaskImageCtrl::Init | ( | MaskEditorPanel * | parent | ) |
Definition at line 91 of file MaskImageCtrl.cpp.
References m_editPanel.
Referenced by MaskEditorPanel::Create().
|
inlineprivate |
translate screen coordinates to image coordinates, considers additional added border
Definition at line 194 of file MaskImageCtrl.h.
References getScaleFactor(), and HuginBase::maskOffset.
Referenced by invtransform(), OnLeftMouseDown(), OnLeftMouseUp(), OnMouseMove(), OnRightMouseDown(), OnRightMouseUp(), SelectPointsInsideMouseRect(), and UpdateCrop().
|
inlineprivate |
Definition at line 197 of file MaskImageCtrl.h.
References getScaleFactor(), and HuginBase::maskOffset.
|
inlineprivate |
Definition at line 200 of file MaskImageCtrl.h.
References invtransform(), hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.
void MaskImageCtrl::OnCaptureLost | ( | wxMouseCaptureLostEvent & | e | ) |
event handler, when mouse capture is lost, e.g.
user click outside of window cancels creating of new mask
Definition at line 1113 of file MaskImageCtrl.cpp.
References OnKillFocus().
Referenced by Create().
void MaskImageCtrl::OnChar | ( | wxKeyEvent & | e | ) |
event handler for scrolling with keyboard
Definition at line 1082 of file MaskImageCtrl.cpp.
References m_bitmap, and celeste::max().
Referenced by Create().
|
virtual |
drawing routine
Definition at line 1255 of file MaskImageCtrl.cpp.
References applyRot(), HuginBase::BaseSrcPanoImage::CROP_CIRCLE, HuginBase::BaseSrcPanoImage::CROP_RECTANGLE, DrawCrop(), DrawImageBitmap(), DrawPolygon(), m_activeMask, m_bitmap, m_cropMode, m_cropRect, m_disabledBitmap, m_editingMask, m_fitToWindow, m_imageMask, m_maskEditState, m_maskMode, m_masksToDraw, m_realSize, m_showActiveMasks, HuginBase::maskOffset, NEW_POLYGON_CREATING, HuginBase::BaseSrcPanoImage::NO_CROP, NO_IMAGE, PI, POINTS_ADDING, POINTS_MOVING, scale(), and transform().
Referenced by update().
void MaskImageCtrl::OnKeyUp | ( | wxKeyEvent & | e | ) |
event handler for keyboard
Definition at line 1002 of file MaskImageCtrl.cpp.
References CROP_SHOWING, HuginBase::MaskPolygon::getMaskPolygon(), m_activeMask, m_editingMask, m_editPanel, m_imageMask, m_maskEditState, m_selectedPoints, NO_MASK, NO_SELECTION, MaskEditorPanel::OnMaskDelete(), POINTS_SELECTED, HuginBase::MaskPolygon::removePoint(), and MaskEditorPanel::UpdateMask().
Referenced by Create().
void MaskImageCtrl::OnKillFocus | ( | wxFocusEvent & | e | ) |
event handler, when editor lost focus, mainly cancels creating new polygon
Definition at line 1119 of file MaskImageCtrl.cpp.
References m_editingMask, m_maskEditState, m_selectedPoints, NEW_POLYGON_CREATING, NEW_POLYGON_STARTED, NO_SELECTION, and update().
Referenced by Create(), and OnCaptureLost().
void MaskImageCtrl::OnLeftMouseDblClick | ( | wxMouseEvent & | mouse | ) |
event handler for left double click
Definition at line 781 of file MaskImageCtrl.cpp.
References MaskEditorPanel::AddMask(), MainFrame::Get(), HuginBase::MaskPolygon::getMaskPolygon(), m_activeMask, m_editingMask, m_editPanel, m_imageMask, m_maskEditState, m_middleMouseScroll, m_previewOnly, m_selectedPoints, NEW_POLYGON_CREATING, NEW_POLYGON_STARTED, NO_SELECTION, HuginBase::MaskPolygon::removePoint(), and update().
Referenced by Create().
void MaskImageCtrl::OnLeftMouseDown | ( | wxMouseEvent & | mouse | ) |
event handler when left mouse button is pressed
Definition at line 524 of file MaskImageCtrl.cpp.
References HuginBase::MaskPolygon::addPoint(), applyRotInv(), CLICK_BOTTOM, CLICK_CIRCLE, CLICK_INSIDE, CLICK_LEFT, CLICK_OUTSIDE, CLICK_RIGHT, CLICK_TOP, CROP_BOTTOM_MOVING, HuginBase::BaseSrcPanoImage::CROP_CIRCLE, CROP_CIRCLE_SCALING, CROP_LEFT_MOVING, CROP_MOVING, CROP_RIGHT_MOVING, CROP_SHOWING, CROP_TOP_MOVING, DEBUG_DEBUG, HuginBase::MaskPolygon::FindPointNearPos(), GetClickPos(), HuginBase::MaskPolygon::getMaskPolygon(), getScaleFactor(), HuginBase::MaskPolygon::insertPoint(), invtransform(), m_cropCentered, m_cropCircle, m_cropMode, m_cropRect, m_currentPos, m_dragStartPos, m_editingMask, m_maskEditState, m_maskMode, m_previewOnly, m_selectedPoints, maxSelectionDistance, NEW_POLYGON_STARTED, HuginBase::BaseSrcPanoImage::NO_CROP, NO_MASK, NO_SELECTION, POINTS_ADDING, POINTS_MOVING, POINTS_SELECTED, POLYGON_SELECTING, REGION_SELECTING, and SelectPointsInsideMouseRect().
Referenced by Create().
void MaskImageCtrl::OnLeftMouseUp | ( | wxMouseEvent & | mouse | ) |
event handler when right mouse button is released
Definition at line 658 of file MaskImageCtrl.cpp.
References HuginBase::MaskPolygon::addPoint(), applyRotInv(), CROP_BOTTOM_MOVING, CROP_CIRCLE_SCALING, CROP_LEFT_MOVING, CROP_MOVING, CROP_RIGHT_MOVING, CROP_SHOWING, CROP_TOP_MOVING, DEBUG_DEBUG, FindPolygon(), HuginBase::MaskPolygon::getMaskPolygon(), getScaleFactor(), invtransform(), m_activeMask, m_currentPos, m_dragStartPos, m_editingMask, m_editPanel, m_imageMask, m_maskEditState, m_middleMouseScroll, m_overlay, m_previewOnly, m_selectedPoints, maxSelectionDistance, HuginBase::MaskPolygon::movePointTo(), NEW_POLYGON_CREATING, NEW_POLYGON_STARTED, NO_SELECTION, POINTS_ADDING, POINTS_MOVING, POINTS_SELECTED, POLYGON_SELECTING, REGION_SELECTING, SelectPointsInsideMouseRect(), hugin_utils::sqr(), update(), MaskEditorPanel::UpdateCrop(), UpdateCrop(), MaskEditorPanel::UpdateMask(), hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.
Referenced by Create().
void MaskImageCtrl::OnMiddleMouseDown | ( | wxMouseEvent & | mouse | ) |
event handler for middle mouse button, start scrolling
Definition at line 960 of file MaskImageCtrl.cpp.
References CROP_SHOWING, m_maskEditState, m_middleMouseScroll, m_previewOnly, m_scrollPos, NEW_POLYGON_CREATING, NEW_POLYGON_STARTED, NO_MASK, NO_SELECTION, POINTS_ADDING, and POINTS_SELECTED.
Referenced by Create().
void MaskImageCtrl::OnMiddleMouseUp | ( | wxMouseEvent & | mouse | ) |
event handler for middle mouse button, end scrolling
Definition at line 989 of file MaskImageCtrl.cpp.
References m_middleMouseScroll, and m_previewOnly.
Referenced by Create().
void MaskImageCtrl::OnMouseMove | ( | wxMouseEvent & | mouse | ) |
event handler when mouse is moving
Definition at line 413 of file MaskImageCtrl.cpp.
References applyRotInv(), CLICK_BOTTOM, CLICK_CIRCLE, CLICK_INSIDE, CLICK_LEFT, CLICK_RIGHT, CLICK_TOP, CROP_BOTTOM_MOVING, CROP_CIRCLE_SCALING, CROP_LEFT_MOVING, CROP_MOVING, CROP_RIGHT_MOVING, CROP_SHOWING, CROP_TOP_MOVING, DrawCrop(), DrawSelectionRectangle(), GetClickPos(), HuginBase::MaskPolygon::getMaskPolygon(), invtransform(), m_activeMask, m_cropCentered, m_currentPos, m_dragStartPos, m_editingMask, m_editPanel, m_imageMask, m_imgRotation, m_maskEditState, m_middleMouseScroll, m_previewOnly, m_scrollPos, m_selectedPoints, HuginBase::MaskPolygon::movePointBy(), HuginBase::MaskPolygon::movePointTo(), NEW_POLYGON_CREATING, NEW_POLYGON_STARTED, NO_IMAGE, NO_MASK, NO_SELECTION, POINTS_ADDING, POINTS_DELETING, POINTS_MOVING, POINTS_SELECTED, POLYGON_SELECTING, REGION_SELECTING, ROT270, ROT90, update(), UpdateCrop(), and MaskEditorPanel::UpdateCropFromImage().
Referenced by Create().
void MaskImageCtrl::OnRightMouseDown | ( | wxMouseEvent & | mouse | ) |
event handler when right mouse button is pressed
Definition at line 825 of file MaskImageCtrl.cpp.
References applyRotInv(), fill_set(), HuginBase::MaskPolygon::getMaskPolygon(), invtransform(), HuginBase::MaskPolygon::isInside(), m_currentPos, m_dragStartPos, m_editingMask, m_maskEditState, m_middleMouseScroll, m_previewOnly, m_selectedPoints, NO_SELECTION, POINTS_DELETING, POINTS_MOVING, POINTS_SELECTED, and update().
Referenced by Create().
void MaskImageCtrl::OnRightMouseUp | ( | wxMouseEvent & | mouse | ) |
event handler when right mouse button is released
Definition at line 854 of file MaskImageCtrl.cpp.
References MaskEditorPanel::AddMask(), applyRotInv(), MainFrame::Get(), HuginBase::MaskPolygon::getMaskPolygon(), getScaleFactor(), invtransform(), m_activeMask, m_currentPos, m_dragStartPos, m_editingMask, m_editPanel, m_imageMask, m_maskEditState, m_middleMouseScroll, m_previewOnly, m_selectedPoints, maxSelectionDistance, HuginBase::MaskPolygon::movePointTo(), NEW_POLYGON_CREATING, NEW_POLYGON_STARTED, NO_SELECTION, POINTS_DELETING, POINTS_MOVING, POINTS_SELECTED, HuginBase::MaskPolygon::removePoint(), SelectPointsInsideMouseRect(), set_contains(), hugin_utils::sqr(), update(), MaskEditorPanel::UpdateMask(), hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.
Referenced by Create().
void MaskImageCtrl::OnScroll | ( | wxScrollWinEvent & | e | ) |
event handler for remember scroll position
Definition at line 1386 of file MaskImageCtrl.cpp.
References m_oldScrollPosX, and m_oldScrollPosY.
Referenced by Create().
|
protected |
handler called when size of control was changed
Definition at line 1375 of file MaskImageCtrl.cpp.
References DEBUG_TRACE, m_fitToWindow, m_imageFilename, and setScale().
Referenced by Create().
|
protected |
rescale the image
Definition at line 1393 of file MaskImageCtrl.cpp.
References calcAutoScaleFactor(), HuginBase::Color::CorrectImage(), huginApp::Get(), huginApp::GetMonitorProfile(), getScaleFactor(), huginApp::HasMonitorProfile(), imageCacheEntry2wxImage(), m_bitmap, m_color_selection, m_disabledBitmap, m_fitToWindow, m_imageSize, m_img, m_imgRotation, m_maskEditState, m_overlay, m_realSize, m_scaleFactor, HuginBase::maskOffset, celeste::max(), NO_IMAGE, ROT180, ROT270, ROT90, scale(), and vigra_ext::srcImageRange().
Referenced by setImage(), and setScale().
|
inlineprivate |
scale of width/height
Definition at line 172 of file MaskImageCtrl.h.
References getScaleFactor().
Referenced by DrawCrop(), OnDraw(), and rescaleImage().
|
inlineprivate |
Definition at line 175 of file MaskImageCtrl.h.
References getScaleFactor().
void MaskImageCtrl::selectAllMarkers | ( | ) |
select all points of active mask
Definition at line 257 of file MaskImageCtrl.cpp.
References fill_set(), m_activeMask, m_imageMask, and m_selectedPoints.
Referenced by MaskEditorPanel::AddMask().
|
private |
Definition at line 1509 of file MaskImageCtrl.cpp.
References applyRotInv(), HuginBase::MaskPolygon::getMaskPolygon(), getScaleFactor(), invtransform(), m_currentPos, m_dragStartPos, m_editingMask, m_selectedPoints, celeste::max(), maxSelectionDistance, celeste::min(), set_contains(), hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.
Referenced by OnLeftMouseDown(), OnLeftMouseUp(), and OnRightMouseUp().
void MaskImageCtrl::setActiveMask | ( | unsigned int | newMask, |
bool | doUpdate = true |
||
) |
mark mask with image as beeing editing
Definition at line 210 of file MaskImageCtrl.cpp.
References CROP_SHOWING, m_activeMask, m_editingMask, m_imageFilename, m_imageMask, m_maskEditState, m_maskMode, m_selectedPoints, NO_MASK, NO_SELECTION, and POINTS_SELECTED.
Referenced by setImage(), MaskEditorPanel::setMask(), SetMaskMode(), and setNewMasks().
void MaskImageCtrl::setCrop | ( | HuginBase::SrcPanoImage::CropMode | newCropMode, |
vigra::Rect2D | newCropRect, | ||
bool | isCentered, | ||
hugin_utils::FDiff2D | center, | ||
bool | isCircleCrop | ||
) |
updates the crop mode and crop rect
Definition at line 201 of file MaskImageCtrl.cpp.
References m_cropCenter, m_cropCentered, m_cropCircle, m_cropMode, and m_cropRect.
Referenced by MaskEditorPanel::setImage().
void MaskImageCtrl::setDrawingActiveMasks | ( | bool | newDrawActiveMasks | ) |
set if active masks should be drawn
Definition at line 1578 of file MaskImageCtrl.cpp.
References m_showActiveMasks, and update().
Referenced by MaskEditorPanel::Create(), and MaskEditorPanel::OnShowActiveMasks().
void MaskImageCtrl::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
Definition at line 119 of file MaskImageCtrl.cpp.
References CROP_SHOWING, DEBUG_TRACE, MainFrame::Get(), HUGIN_CONV_FILENAME, m_bitmap, m_disabledBitmap, m_imageFilename, m_imageMask, m_img, m_imgRotation, m_maskEditState, m_maskMode, m_masksToDraw, m_oldScrollPosX, m_oldScrollPosY, m_overlay, NO_IMAGE, NO_MASK, rescaleImage(), ROT0, setActiveMask(), and update().
Referenced by MaskLoadDialog::initValues(), and MaskEditorPanel::setImage().
void MaskImageCtrl::SetMaskMode | ( | bool | newMaskMode | ) |
sets the control to mask (newMaskMode=true) or crop (newMaskMode=false) mode
Definition at line 96 of file MaskImageCtrl.cpp.
References CROP_SHOWING, m_maskEditState, m_maskMode, m_overlay, NO_IMAGE, NO_SELECTION, setActiveMask(), and update().
Referenced by MaskEditorPanel::OnModeChanged().
void MaskImageCtrl::setNewMasks | ( | HuginBase::MaskPolygonVector | newMasks, |
HuginBase::MaskPolygonVector | masksToDraw | ||
) |
updates masks for currently selected image
Definition at line 186 of file MaskImageCtrl.cpp.
References m_activeMask, m_imageMask, m_masksToDraw, and setActiveMask().
Referenced by MaskEditorPanel::setImage(), and MaskLoadDialog::UpdatePreviewImage().
|
inline |
if called, the mouse handlers are deactivated
Definition at line 58 of file MaskImageCtrl.h.
References m_previewOnly.
Referenced by MaskLoadDialog::MaskLoadDialog().
void MaskImageCtrl::setScale | ( | double | factor | ) |
set the scaling factor for mask editing display.
factor | zoom factor, 0 means fit to window. |
Definition at line 1533 of file MaskImageCtrl.cpp.
References calcAutoScaleFactor(), DEBUG_DEBUG, m_fitToWindow, m_imageSize, m_scaleFactor, and rescaleImage().
Referenced by MaskLoadDialog::initValues(), OnSize(), and MaskEditorPanel::OnZoom().
|
inline |
Definition at line 131 of file MaskImageCtrl.h.
References m_colour_point_selected.
Referenced by MaskEditorPanel::Create(), MaskLoadDialog::MaskLoadDialog(), and MaskEditorPanel::OnColourChanged().
|
inline |
Definition at line 132 of file MaskImageCtrl.h.
References m_colour_point_unselected.
Referenced by MaskEditorPanel::Create(), MaskLoadDialog::MaskLoadDialog(), and MaskEditorPanel::OnColourChanged().
|
inline |
sets the colour for different parts
Definition at line 129 of file MaskImageCtrl.h.
References m_colour_polygon_negative.
Referenced by MaskEditorPanel::Create(), MaskLoadDialog::MaskLoadDialog(), and MaskEditorPanel::OnColourChanged().
|
inline |
Definition at line 130 of file MaskImageCtrl.h.
References m_colour_polygon_positive.
Referenced by MaskEditorPanel::Create(), MaskLoadDialog::MaskLoadDialog(), and MaskEditorPanel::OnColourChanged().
void MaskImageCtrl::startNewPolygon | ( | ) |
starts creating a new polygon
Definition at line 1134 of file MaskImageCtrl.cpp.
References m_editingMask, m_maskEditState, m_selectedPoints, and NEW_POLYGON_STARTED.
Referenced by MaskEditorPanel::OnMaskAdd().
|
inlineprivate |
convert image coordinate to screen coordinates, considers additional added border
Definition at line 179 of file MaskImageCtrl.h.
References getScaleFactor(), and HuginBase::maskOffset.
Referenced by DrawCrop(), DrawPolygon(), OnDraw(), and transform().
|
inlineprivate |
Definition at line 182 of file MaskImageCtrl.h.
References getScaleFactor(), and HuginBase::maskOffset.
|
inlineprivate |
Definition at line 185 of file MaskImageCtrl.h.
References transform(), hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.
void MaskImageCtrl::update | ( | ) |
initiate redraw
Definition at line 1147 of file MaskImageCtrl.cpp.
References OnDraw().
Referenced by OnKillFocus(), OnLeftMouseDblClick(), OnLeftMouseUp(), OnMouseMove(), OnRightMouseDown(), OnRightMouseUp(), setDrawingActiveMasks(), setImage(), and SetMaskMode().
|
private |
Definition at line 304 of file MaskImageCtrl.cpp.
References applyRotInv(), CROP_BOTTOM_MOVING, CROP_CIRCLE_SCALING, CROP_LEFT_MOVING, CROP_MOVING, CROP_RIGHT_MOVING, CROP_TOP_MOVING, invtransform(), m_cropCenter, m_cropCentered, m_cropRect, m_currentPos, m_dragStartPos, m_maskEditState, hugin_utils::roundi(), hugin_utils::sqr(), hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.
Referenced by OnLeftMouseUp(), and OnMouseMove().
|
private |
Definition at line 309 of file MaskImageCtrl.h.
Referenced by Create(), OnDraw(), OnKeyUp(), OnLeftMouseDblClick(), OnLeftMouseUp(), OnMouseMove(), OnRightMouseUp(), selectAllMarkers(), setActiveMask(), and setNewMasks().
|
private |
Definition at line 150 of file MaskImageCtrl.h.
Referenced by DrawImageBitmap(), OnChar(), OnDraw(), rescaleImage(), and setImage().
|
private |
Definition at line 329 of file MaskImageCtrl.h.
Referenced by DrawCrop(), DrawSelectionRectangle(), and rescaleImage().
|
private |
Definition at line 327 of file MaskImageCtrl.h.
Referenced by DrawPolygon(), and SetUserColourPointSelected().
|
private |
Definition at line 328 of file MaskImageCtrl.h.
Referenced by DrawPolygon(), and SetUserColourPointUnselected().
|
private |
Definition at line 325 of file MaskImageCtrl.h.
Referenced by DrawPolygon(), and SetUserColourPolygonNegative().
|
private |
Definition at line 326 of file MaskImageCtrl.h.
Referenced by DrawPolygon(), and SetUserColourPolygonPositive().
|
private |
Definition at line 165 of file MaskImageCtrl.h.
Referenced by setCrop(), and UpdateCrop().
|
private |
Definition at line 163 of file MaskImageCtrl.h.
Referenced by OnLeftMouseDown(), OnMouseMove(), setCrop(), and UpdateCrop().
|
private |
Definition at line 164 of file MaskImageCtrl.h.
Referenced by OnLeftMouseDown(), and setCrop().
|
private |
Definition at line 161 of file MaskImageCtrl.h.
Referenced by DrawCrop(), GetClickPos(), OnDraw(), OnLeftMouseDown(), and setCrop().
|
private |
Definition at line 162 of file MaskImageCtrl.h.
Referenced by DrawCrop(), GetClickPos(), getCrop(), OnDraw(), OnLeftMouseDown(), setCrop(), and UpdateCrop().
|
private |
Definition at line 319 of file MaskImageCtrl.h.
Referenced by DrawSelectionRectangle(), OnLeftMouseDown(), OnLeftMouseUp(), OnMouseMove(), OnRightMouseDown(), OnRightMouseUp(), SelectPointsInsideMouseRect(), and UpdateCrop().
|
private |
Definition at line 151 of file MaskImageCtrl.h.
Referenced by OnDraw(), rescaleImage(), and setImage().
|
private |
Definition at line 318 of file MaskImageCtrl.h.
Referenced by DrawSelectionRectangle(), OnLeftMouseDown(), OnLeftMouseUp(), OnMouseMove(), OnRightMouseDown(), OnRightMouseUp(), SelectPointsInsideMouseRect(), and UpdateCrop().
|
private |
Definition at line 311 of file MaskImageCtrl.h.
Referenced by OnDraw(), OnKeyUp(), OnKillFocus(), OnLeftMouseDblClick(), OnLeftMouseDown(), OnLeftMouseUp(), OnMouseMove(), OnRightMouseDown(), OnRightMouseUp(), SelectPointsInsideMouseRect(), setActiveMask(), and startNewPolygon().
|
private |
Definition at line 306 of file MaskImageCtrl.h.
Referenced by FindPolygon(), Init(), OnKeyUp(), OnLeftMouseDblClick(), OnLeftMouseUp(), OnMouseMove(), and OnRightMouseUp().
|
private |
Definition at line 303 of file MaskImageCtrl.h.
Referenced by Create(), getScale(), OnDraw(), OnSize(), rescaleImage(), and setScale().
|
private |
Definition at line 153 of file MaskImageCtrl.h.
Referenced by OnSize(), setActiveMask(), and setImage().
|
private |
Definition at line 307 of file MaskImageCtrl.h.
Referenced by FindPolygon(), getNewMask(), OnDraw(), OnKeyUp(), OnLeftMouseDblClick(), OnLeftMouseUp(), OnMouseMove(), OnRightMouseUp(), selectAllMarkers(), setActiveMask(), setImage(), and setNewMasks().
|
private |
Definition at line 157 of file MaskImageCtrl.h.
Referenced by DoGetBestSize(), rescaleImage(), and setScale().
|
private |
Definition at line 315 of file MaskImageCtrl.h.
Referenced by rescaleImage(), and setImage().
|
private |
Definition at line 155 of file MaskImageCtrl.h.
Referenced by applyRot(), applyRotInv(), calcAutoScaleFactor(), Create(), getCurrentRotation(), OnMouseMove(), rescaleImage(), and setImage().
|
private |
Definition at line 300 of file MaskImageCtrl.h.
Referenced by Create(), OnDraw(), OnKeyUp(), OnKillFocus(), OnLeftMouseDblClick(), OnLeftMouseDown(), OnLeftMouseUp(), OnMiddleMouseDown(), OnMouseMove(), OnRightMouseDown(), OnRightMouseUp(), rescaleImage(), setActiveMask(), setImage(), SetMaskMode(), startNewPolygon(), and UpdateCrop().
|
private |
Definition at line 169 of file MaskImageCtrl.h.
Referenced by Create(), DrawCrop(), OnDraw(), OnLeftMouseDown(), setActiveMask(), setImage(), and SetMaskMode().
|
private |
Definition at line 308 of file MaskImageCtrl.h.
Referenced by OnDraw(), setImage(), and setNewMasks().
|
private |
Definition at line 321 of file MaskImageCtrl.h.
Referenced by Create(), OnLeftMouseDblClick(), OnLeftMouseUp(), OnMiddleMouseDown(), OnMiddleMouseUp(), OnMouseMove(), OnRightMouseDown(), and OnRightMouseUp().
|
private |
Definition at line 331 of file MaskImageCtrl.h.
Referenced by Create(), OnScroll(), and setImage().
|
private |
Definition at line 331 of file MaskImageCtrl.h.
Referenced by Create(), OnScroll(), and setImage().
|
private |
Definition at line 330 of file MaskImageCtrl.h.
Referenced by DrawSelectionRectangle(), OnLeftMouseUp(), rescaleImage(), setImage(), and SetMaskMode().
|
private |
Definition at line 304 of file MaskImageCtrl.h.
Referenced by Create(), OnLeftMouseDblClick(), OnLeftMouseDown(), OnLeftMouseUp(), OnMiddleMouseDown(), OnMiddleMouseUp(), OnMouseMove(), OnRightMouseDown(), OnRightMouseUp(), and setPreviewOnly().
|
private |
Definition at line 159 of file MaskImageCtrl.h.
Referenced by applyRot(), applyRotInv(), OnDraw(), and rescaleImage().
|
private |
Definition at line 302 of file MaskImageCtrl.h.
Referenced by Create(), getScale(), getScaleFactor(), rescaleImage(), and setScale().
|
private |
Definition at line 322 of file MaskImageCtrl.h.
Referenced by OnMiddleMouseDown(), and OnMouseMove().
|
private |
Definition at line 313 of file MaskImageCtrl.h.
Referenced by DrawPolygon(), OnKeyUp(), OnKillFocus(), OnLeftMouseDblClick(), OnLeftMouseDown(), OnLeftMouseUp(), OnMouseMove(), OnRightMouseDown(), OnRightMouseUp(), selectAllMarkers(), SelectPointsInsideMouseRect(), setActiveMask(), and startNewPolygon().
|
private |
Definition at line 167 of file MaskImageCtrl.h.
Referenced by Create(), OnDraw(), and setDrawingActiveMasks().