24 #ifndef _CPIMAGECTRL_H
25 #define _CPIMAGECTRL_H
32 #include <wx/overlay.h>
53 CPEvent(wxWindow *win,
unsigned int cpNr);
65 virtual wxEvent*
Clone()
const;
93 BEGIN_DECLARE_EVENT_TYPES()
94 #if defined _WIN32 && defined Hugin_shared
99 END_DECLARE_EVENT_TYPES()
101 #define EVT_CPEVENT(func) \
102 DECLARE_EVENT_TABLE_ENTRY( EVT_CPEVENT, \
105 (wxObjectEventFunction) \
106 (CPEventFunction) & func, \
119 void SetColour(wxColour pointColour, wxColour textColour);
125 void Draw(wxDC& dc,
const wxRect& visibleRect,
bool selected,
bool newPoint=
false);
245 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"));
282 void selectPoint(
unsigned int,
bool scrollTo =
true);
350 wxPoint
scale(
const wxPoint & p)
const
395 return T(
m_realSize.GetHeight()-1 - p.y, p.x);
416 return T(p.y,
m_realSize.GetHeight()-1 - p.x);
442 virtual void OnDraw(wxDC& dc);
449 void OnImageLoaded(ImageCache::EntryPtr entry, std::string filename,
bool load_small);
450 void OnSize(wxSizeEvent & e);
451 void OnKey(wxKeyEvent & e);
455 void OnTimer(wxTimerEvent & e);
560 #endif // _CPIMAGECTRL_H
void ScrollDelta(const wxPoint &delta)
scroll the window by delta pixels
wxPoint invScale(const wxPoint &p) const
double calcAutoScaleFactor(wxSize size)
calculate new scale factor for this image
wxColour m_pointColour
colour of the point
HuginBase::PTools::Transform * getFirstInvTrans() const
hugin_utils::FDiff2D invScale(const hugin_utils::FDiff2D &p) const
DisplayedControlPoint()
default constructor
wxSize DoGetBestSize() const
int invScale(int x) const
void setNewPoint(const hugin_utils::FDiff2D &p)
set new point to a specific point
ImageRotation m_imgRotation
CPEventMode getMode()
accessor functions (they could check mode to see if a getXYZ() is allowed
hugin_utils::FDiff2D GetPos() const
returns selected position
void deselect()
remove selection.
void SetColour(wxColour pointColour, wxColour textColour)
set colours for drawing control points
void OnKeyDown(wxKeyEvent &e)
double getScaleFactor() const
get scale factor (calculates factor when fit to window is active)
ImageCache::RequestPtr m_imgRequest
const bool GetForceMagnifier() const
control point editor panel.
bool operator==(const DisplayedControlPoint other)
compare operator
wxBitmap & GetMagBitmap(hugin_utils::FDiff2D point)
draw the magnified view of a selected control point
void Draw(wxDC &dc, const wxRect &visibleRect, bool selected, bool newPoint=false)
draw the control points to the given device context
const bool IsMirrored() const
return true, if cp is used with mirrored coordinates by current CPImageCtrl
virtual wxEvent * Clone() const
void selectPoint(unsigned int, bool scrollTo=true)
select a point for usage
Events to notify about new point / region / point change.
void mousePressLMBEvent(wxMouseEvent &mouse)
bool m_sameImage
true, if in control point tab the same image is selected 2 times in this case a special treatment for...
void DrawSelectionRectangle(hugin_utils::FDiff2D pos1, hugin_utils::FDiff2D pos2)
hugin_utils::FDiff2D m_magImgCenter
double scale(double x) const
helper class to display and manipulate cp in cp tab
EditorState isOccupied(wxPoint mousePos, const hugin_utils::FDiff2D &point, unsigned int &pointNr) const
check if p is over a known point, if it is, pointNr contains the point
EditorState
state machine for selection process:
unsigned int getPointNr()
represents a control point
wxCursor * m_CPSelectCursor
void mousePressRMBEvent(wxMouseEvent &mouse)
void mouseMoveEvent(wxMouseEvent &mouse)
void DrawLineSegment(wxDC &dc)
draw line control point over different images
ImageCache::EntryPtr m_img
const wxSize GetRealImageSize() const
return the real size of the image in the control
bool m_mirrored
is first or second image in cp used
void OnImageLoaded(ImageCache::EntryPtr entry, std::string filename, bool load_small)
HuginBase::ImageCache::ImageCacheRGB8Ptr GetImg()
get pointer to image, for DisplayedControlPoint
void SetControl(CPImageCtrl *control)
remember the control, where the information should be drawn
void UpdateControlPointY(double y)
update y coordinate of selected cp coordinate
const bool isOccupiedLabel(const wxPoint mousePos) const
check if given point is over label of cp, using screen coordinates
const bool GetMouseInWindow() const
void mouseReleaseLMBEvent(wxMouseEvent &mouse)
std::vector< DisplayedControlPoint > m_points
void clearNewPoint()
clear new point
std::string imageFilename
void OnMouseLeave(wxMouseEvent &e)
double getScale()
return scale factor, 0 for autoscale
wxCursor * m_ScrollCursor
CPImageCtrl * m_control
pointer to control to access some functions
void CheckSelection(const wxPoint mousePos, const hugin_utils::FDiff2D &p)
used by manipulating line control points, remember if the selected point given in screen coordinates ...
virtual void OnDraw(wxDC &dc)
void Init(CPEditorPanel *parent)
void clearCtrlPointList()
clear internal control point list
HuginBase::PTools::Transform * m_firstInvTrans
wxPoint scale(const wxPoint &p) const
std::shared_ptr< vigra::BRGBImage > ImageCacheRGB8Ptr
use reference counted pointers
std::vector< wxColour > pointColors
virtual wxObject * DoCreateResource()
void ShiftControlPoint(hugin_utils::FDiff2D shift)
shift selected cp coordinate by given
HuginBase::PTools::Transform * getSecondInvTrans() const
T applyRot(const T &p) const
void showTemplateArea(bool show=true)
wxPoint MaxScrollDelta(wxPoint delta)
calculate maximum delta that is allowed when scrolling
void OnMouseEnter(wxMouseEvent &e)
hugin_utils::FDiff2D scale(const hugin_utils::FDiff2D &p) const
wxRect m_labelPos
position of the point labels (in screen coordinates)
hugin_utils::FDiff2D rectStartPos
void update()
initiate redraw
const wxString GetLabel() const
return label
const hugin_utils::FDiff2D & getPoint()
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 mouseReleaseRMBEvent(wxMouseEvent &mouse)
T applyRotInv(const T &p) const
void setTransforms(HuginBase::PTools::Transform *firstTrans, HuginBase::PTools::Transform *firstInvTrans, HuginBase::PTools::Transform *secondInvTrans)
void showSearchArea(bool show=true)
show/hide the search area rectangle
const wxSize GetBitmapSize() const
return the size of the drawn bitmap (possible rotate is applied)
const HuginBase::ControlPoint GetControlPoint() const
returns the control point
wxColour m_textColour
colour of the text background
HuginBase::PTools::Transform * m_magTrans
HuginBase::ControlPoint m_cp
void OnKey(wxKeyEvent &e)
hugin_utils::FDiff2D getNewPoint()
get the new point
void OnSize(wxSizeEvent &e)
HuginBase::PTools::Transform * m_magInvTrans
void DrawLine(wxDC &dc)
draw line control point on same image
std::vector< wxColour > textColours
HuginBase::PTools::Transform * m_secondInvTrans
void(wxEvtHandler::* CPEventFunction)(CPEvent &)
virtual bool CanHandle(wxXmlNode *node)
void StartLineControlPoint(hugin_utils::FDiff2D newPoint)
starts a new line control point with given coodinates
bool IsDrawingLine() const
return true, if line cp should be drawn as separate line
bool emit(CPEvent &ev)
helper func to emit a region
HuginBase::ControlPoint m_cp
representation of underlying control point
void setCtrlPoint(const HuginBase::ControlPoint &cp, const bool mirrored)
add control piont to internal cp list
wxRect DrawTextMag(wxDC &dc, wxPoint p, hugin_utils::FDiff2D pointInput, bool drawMag, wxColour pointColour, wxColour textColour)
draw magnified area
const bool isOccupiedPos(const hugin_utils::FDiff2D &p) const
check if the given point is over the drawn cp, using image coordinates
hugin_utils::FDiff2D newPoint
void mousePressMMBEvent(wxMouseEvent &mouse)
void setScale(double factor)
set the scaling factor for cp display.
const HuginBase::ControlPoint & getControlPoint()
void OnTimer(wxTimerEvent &e)
void setImage(const std::string &filename, ImageRotation rot)
display img.
#define EVT_CPEVENT(func)
void setMagTransforms(HuginBase::PTools::Transform *magTrans, HuginBase::PTools::Transform *magInvTrans)
DisplayedControlPoint m_selectedPoint
void showPosition(hugin_utils::FDiff2D point, bool warpPointer=false)
Show point x, y.
CPEditorPanel * m_editPanel
void setSameImage(bool sameImage)
void OnScrollWin(wxScrollWinEvent &e)
bool m_line
true, if line control point on same image
hugin_utils::FDiff2D point
HuginBase::PTools::Transform * getFirstTrans() const
wxPoint roundP(const hugin_utils::FDiff2D &p) const
void UpdateControlPoint(hugin_utils::FDiff2D newPoint)
update selected cp coordinate
void UpdateControlPointX(double x)
update x coordinate of selected cp coordinate
void mouseReleaseMMBEvent(wxMouseEvent &mouse)
bool IsShowingLines() const
ImageRotation
image rotation.
wxString m_label
label of displayed control point: number or new
unsigned int selectedPointNr
hugin_utils::FDiff2D m_mousePos
void ShowLines(bool isShown)
double invScale(double x) const
HuginBase::PTools::Transform * m_firstTrans
void SetLabel(wxString newLabel)
set label to given wxString