26 #ifndef PerspectiveImageCtrl_H
27 #define PerspectiveImageCtrl_H
68 bool Create(wxWindow* parent, wxWindowID
id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString& name =
"panel");
129 void OnSize(wxSizeEvent& e);
162 void DrawRect(wxDC& dc,
const std::vector<hugin_utils::FDiff2D>& rect);
164 void DrawLines(wxDC& dc,
const std::vector<Line>& lines);
231 return T(
m_realSize.GetHeight() - 1 - p.y, p.x);
237 return T(p.y,
m_realSize.GetWidth() - 1 - p.x);
251 return T(p.y,
m_realSize.GetHeight() - 1 - p.x);
257 return T(
m_realSize.GetWidth() - 1 - p.y, p.x);
308 #endif // PerspectiveImageCtrl_H
void rescaleImage()
rescale the image
wxColor m_colour_selected
ImageCache::EntryPtr m_img
image cache entry for current image
void OnRightMouseUp(wxMouseEvent &mouse)
event handler when right mouse button is released
PerspectiveEditorState
different states of the editor
void OnSize(wxSizeEvent &e)
handler called when size of control was changed
void ChangeRotation(ImageRotation newRot)
std::vector< hugin_utils::FDiff2D > m_rectPoints
include file for the hugin project
int GetNearestLine(const hugin_utils::FDiff2D &p)
return index of nearest line or -1 if the point is too far from all lines
void setScale(double factor)
set the scaling factor for mask editing display.
void SetRectMode(bool newMode)
set line or rect mode
T applyRot(const T &p) const
ImageRotation m_imgRotation
void OnMiddleMouseDown(wxMouseEvent &mouse)
event handler for middle mouse button, start scrolling
represents a control point
double calcAutoScaleFactor(wxSize size)
calculate new scale factor for this image
void DrawRect(wxDC &dc, const std::vector< hugin_utils::FDiff2D > &rect)
void ClipPos(hugin_utils::FDiff2D &pos)
clip the given pos to image size + offset
void OnPaint(wxPaintEvent &e)
drawing routine
void OnMouseMove(wxMouseEvent &mouse)
event handler when mouse is moving
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name="panel")
creates the control
double getScaleFactor() const
get scale factor (calculates factor when fit to window is active)
HuginBase::ControlPoint GetCP(const unsigned int index, const hugin_utils::FDiff2D &p1, const hugin_utils::FDiff2D &p2)
return the HuginBase::ControlPoint, using index as image index, p1 and p2 as position, take image rotation into account to decide if control point is horizontal or vertical
void setImage(const std::string &filename, ImageRotation rot)
set the current image and mask list, this loads also the image from cache
void SetRemappedMode(const HuginBase::Panorama &pano)
set the panorama object for remapping, the mouse handler are deactivated
int GetNearestRectanglePoint(const hugin_utils::FDiff2D &p)
return index of nearest rectangle point or -1 if the point is too far from rectangle ...
void AddLines(const HuginBase::CPVector &lines)
add the lines to the list
const int polygonPointSize
half size of markers
int scale(int x) const
helper function for scale, offset and rotation
const int PerspectiveOffset
size of border at all sides
void DrawLines(wxDC &dc, const std::vector< Line > &lines)
HuginBase::CPVector GetControlPoints(const unsigned int index)
return list of control points
void SetLineColour(wxColour newColour)
sets the colour for the lines
int transform(int x) const
convert image coordinate to screen coordinates, considers additional added border ...
std::vector< Line > m_lines
image previewer for perspective correction
double scale(double x) const
TDiff2D< double > FDiff2D
T applyRotInv(const T &p) const
PerspectiveEditorState m_editorState
ImageCache::EntryPtr getCachedImage()
return pointer to ImageCache
void OnLeftMouseDown(wxMouseEvent &mouse)
event handler when left mouse button is pressed
void OnLeftMouseUp(wxMouseEvent &mouse)
event handler when right mouse button is released
bool IsInsideRect(const hugin_utils::FDiff2D &p)
return true, if the point p is inside the rect
hugin_utils::FDiff2D start
bool IsOriginalShown() const
void setOriginalMode()
show the original images with selected zoom ration, the mouse handlers are activated ...
void GenerateRemappedImage(const unsigned int newWidth, const unsigned int newHeight)
generates the remapped image suitable for wxBitmap
int invtransform(int x) const
translate screen coordinates to image coordinates, considers additional added border ...
void OnCaptureLost(wxMouseCaptureLostEvent &e)
event handler, when mouse capture is lost, e.g.
ImageRotation
image rotation.
double transform(double x) const
Line(const hugin_utils::FDiff2D &p1, const hugin_utils::FDiff2D &p2)
int GetNearestRectangleLine(const hugin_utils::FDiff2D &p)
return index of nearest rectangle line or -1 if the point is too far from the rectangle lines ...
wxPoint transform(const hugin_utils::FDiff2D &p) const
std::string m_imageFilename
std::vector< Line > m_currentLine
void OnMiddleMouseUp(wxMouseEvent &mouse)
event handler for middle mouse button, end scrolling
hugin_utils::FDiff2D invtransform(const wxPoint &p) const
const int maxSelectionDistance
maximal distance for selection of one point
std::vector< ControlPoint > CPVector
std::vector< hugin_utils::FDiff2D > m_rectPointsStartDrag
void OnKillFocus(wxFocusEvent &e)
event handler, when editor lost focus, mainly cancels creating new polygon
double invtransform(double x) const
void UpdateVirtualSize()
update the virtual size of the control, necessary for correctly display the scrollbars ...
HuginBase::Panorama m_pano
HuginBase::Panorama object for calculation of remapped image.
wxBitmap m_remappedImg
the remapped image as wxBitmap
ImageRotation getCurrentRotation()
returns the current rotation of displayed image
double getScale() const
return scale factor, 0 for autoscale
int GetNearestLinePoint(const hugin_utils::FDiff2D &p, bool &isStart)
return index of nearest line or -1 if the point to far from line