HuginBase::MaskPolygon Class Reference

base class, which stores one mask polygon More...

#include <Mask.h>

List of all members.

Public Types

enum  MaskType {
  Mask_negative = 0, Mask_positive = 1, Mask_Stack_negative = 2, Mask_Stack_positive = 3,
  Mask_negative_lens = 4
}
 enumeration with type of possible masks More...

Public Member Functions

 MaskPolygon ()
 constructor
bool isInside (const FDiff2D p) const
 checks if given point is inside of the stored polygon
int getWindingNumber (const FDiff2D p) const
 returns the winding number of the polygon around point p
int getTotalWindingNumber () const
 returns the total winding number of the polygon
MaskType getMaskType () const
 returns mask type
void setMaskType (const MaskType newType)
 sets mask type
bool isPositive () const
 returns true, if mask type is positive
VectorPolygon getMaskPolygon () const
 returns vector with coordinates of the polygon
void setMaskPolygon (const VectorPolygon newMask)
 set complete vector with all corrdinates of the polygon
unsigned int getImgNr () const
 returns the associated image number, only used when loading a project, otherwise discarded
void setImgNr (const unsigned int newImgNr)
 sets the associated image number, only used when loading a project, otherwise discarded
void setInverted (const bool inverted)
 set mask to normal or inverted
bool isInverted () const
 returns if mask is inverted
void addPoint (const FDiff2D p)
 adds point at the end to the polygon
void insertPoint (const unsigned int index, const FDiff2D p)
 insert point at the position index into the polygon
void removePoint (const unsigned int index)
 removes point at the position index from the polygon
void movePointTo (const unsigned int index, const FDiff2D p)
 moves the point at position index to the new absolute position p
void movePointBy (const unsigned int index, const FDiff2D diff)
 relativ moves the point at position index by diff
void scale (const double factorx, const double factory)
 scales all polygon coordinates by factorx for x position and factory for y position
void scale (const double factor)
 scales x and y axis equally by factor
void transformPolygon (const PTools::Transform &trans)
 transforms the polygon coordinates by the given transformation
bool clipPolygon (const vigra::Rect2D rect)
 clips the polygon to the given rectangle
bool clipPolygon (const FDiff2D center, const double radius)
 clips the polygon to the circle with center and radius
void rotate90 (bool clockwise, unsigned int maskWidth, unsigned int maskHeight)
 rotate the polygon by 90 degrees
void subSample (const double max_distance)
 subsamples the polygon, so that the longest distance between 2 points is max_distance
unsigned int FindPointNearPos (const FDiff2D p, const double tol)
 search a point which lies near the polygon line and return the index for inserting the new point
MaskPolygonoperator= (const MaskPolygon otherPoly)
 assign operator
const bool operator== (const MaskPolygon &otherPoly) const
 comparision operator
bool parsePolygonString (const std::string polygonStr)
 parses the x and y positions from the given string
void printPolygonLine (std::ostream &o, const unsigned int newImgNr) const
 writes the complete k line which describes the mask to the stream, using the given newImgNr for the i parameter

Private Member Functions

void calcBoundingBox ()
 calculates the bounding box of the polygon to speed up tests

Private Attributes

MaskType m_maskType
VectorPolygon m_polygon
unsigned int m_imgNr
bool m_invert
vigra::Rect2D m_boundingBox


Detailed Description

base class, which stores one mask polygon

note: the mask handling (e.g. propagating of positive masks) happens in HuginBase::Panorama::updateMasks which is automatic called after a change to the panorama object by HuginBase::Panorama::changedFinished

Definition at line 54 of file Mask.h.


Member Enumeration Documentation

enum HuginBase::MaskPolygon::MaskType
 

enumeration with type of possible masks

Enumeration values:
Mask_negative 
Mask_positive 
Mask_Stack_negative 
Mask_Stack_positive 
Mask_negative_lens 

Definition at line 58 of file Mask.h.


Constructor & Destructor Documentation

HuginBase::MaskPolygon::MaskPolygon  )  [inline]
 

constructor

Definition at line 67 of file Mask.h.


Member Function Documentation

void HuginBase::MaskPolygon::addPoint const FDiff2D  p  ) 
 

adds point at the end to the polygon

Definition at line 111 of file Mask.cpp.

References calcBoundingBox(), hugin_utils::FDiff2D, and m_polygon.

Referenced by getTotalWindingNumber(), MaskImageCtrl::OnLeftMouseDown(), MaskImageCtrl::OnLeftMouseUp(), and subSample().

void HuginBase::MaskPolygon::calcBoundingBox  )  [private]
 

calculates the bounding box of the polygon to speed up tests

Definition at line 208 of file Mask.cpp.

References m_boundingBox, and m_polygon.

Referenced by addPoint(), insertPoint(), movePointBy(), movePointTo(), removePoint(), scale(), setMaskPolygon(), and transformPolygon().

bool HuginBase::MaskPolygon::clipPolygon const FDiff2D  center,
const double  radius
 

clips the polygon to the circle with center and radius

Definition at line 448 of file Mask.cpp.

References HuginBase::angle_between(), HuginBase::clip_getIntersectionCircle(), HuginBase::clip_insideCircle(), DEBUG_ASSERT, hugin_utils::FDiff2D, HuginBase::generateArc(), m_polygon, and HuginBase::VectorPolygon.

bool HuginBase::MaskPolygon::clipPolygon const vigra::Rect2D  rect  ) 
 

clips the polygon to the given rectangle

Definition at line 327 of file Mask.cpp.

References HuginBase::clip_onPlane(), HuginBase::clipBottom, HuginBase::clipLeft, HuginBase::clipRight, HuginBase::clipTop, and m_polygon.

unsigned int HuginBase::MaskPolygon::FindPointNearPos const FDiff2D  p,
const double  tol
 

search a point which lies near the polygon line and return the index for inserting the new point

Definition at line 558 of file Mask.cpp.

References hugin_utils::FDiff2D, m_polygon, hugin_utils::norm(), hugin_utils::sqr(), hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

Referenced by MaskImageCtrl::OnLeftMouseDown().

unsigned int HuginBase::MaskPolygon::getImgNr  )  const [inline]
 

returns the associated image number, only used when loading a project, otherwise discarded

Definition at line 87 of file Mask.h.

Referenced by operator=().

VectorPolygon HuginBase::MaskPolygon::getMaskPolygon  )  const [inline]
 

returns vector with coordinates of the polygon

Definition at line 83 of file Mask.h.

References HuginBase::VectorPolygon.

Referenced by MaskImageCtrl::DrawPolygon(), MaskImageCtrl::OnDraw(), MaskImageCtrl::OnKeyUp(), MaskImageCtrl::OnLeftMouseDblClick(), MaskImageCtrl::OnLeftMouseDown(), MaskImageCtrl::OnLeftMouseUp(), MaskImageCtrl::OnMouseMove(), MaskImageCtrl::OnRightMouseDown(), MaskImageCtrl::OnRightMouseUp(), operator=(), operator==(), and MaskImageCtrl::SelectPointsInsideMouseRect().

MaskType HuginBase::MaskPolygon::getMaskType  )  const [inline]
 

returns mask type

Definition at line 77 of file Mask.h.

Referenced by MaskImageCtrl::DrawPolygon(), operator=(), and operator==().

int HuginBase::MaskPolygon::getTotalWindingNumber  )  const
 

returns the total winding number of the polygon

Definition at line 86 of file Mask.cpp.

References addPoint(), hugin_utils::FDiff2D, getWindingNumber(), and m_polygon.

int HuginBase::MaskPolygon::getWindingNumber const FDiff2D  p  )  const
 

returns the winding number of the polygon around point p

Definition at line 55 of file Mask.cpp.

References hugin_utils::FDiff2D, m_polygon, hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

Referenced by getTotalWindingNumber(), and isInside().

void HuginBase::MaskPolygon::insertPoint const unsigned int  index,
const FDiff2D  p
 

insert point at the position index into the polygon

Definition at line 117 of file Mask.cpp.

References calcBoundingBox(), hugin_utils::FDiff2D, and m_polygon.

Referenced by MaskImageCtrl::OnLeftMouseDown().

bool HuginBase::MaskPolygon::isInside const FDiff2D  p  )  const
 

checks if given point is inside of the stored polygon

Definition at line 42 of file Mask.cpp.

References hugin_utils::FDiff2D, getWindingNumber(), m_boundingBox, m_polygon, hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

Referenced by MaskImageCtrl::OnRightMouseDown().

bool HuginBase::MaskPolygon::isInverted  )  const [inline]
 

returns if mask is inverted

Definition at line 93 of file Mask.h.

Referenced by operator=().

bool HuginBase::MaskPolygon::isPositive  )  const
 

returns true, if mask type is positive

Definition at line 99 of file Mask.cpp.

References m_maskType.

void HuginBase::MaskPolygon::movePointBy const unsigned int  index,
const FDiff2D  diff
 

relativ moves the point at position index by diff

Definition at line 146 of file Mask.cpp.

References calcBoundingBox(), hugin_utils::FDiff2D, m_polygon, hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

Referenced by MaskImageCtrl::OnMouseMove().

void HuginBase::MaskPolygon::movePointTo const unsigned int  index,
const FDiff2D  p
 

moves the point at position index to the new absolute position p

Definition at line 136 of file Mask.cpp.

References calcBoundingBox(), hugin_utils::FDiff2D, m_polygon, hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

Referenced by MaskImageCtrl::OnLeftMouseUp(), MaskImageCtrl::OnMouseMove(), and MaskImageCtrl::OnRightMouseUp().

MaskPolygon & HuginBase::MaskPolygon::operator= const MaskPolygon  otherPoly  ) 
 

assign operator

Definition at line 587 of file Mask.cpp.

References getImgNr(), getMaskPolygon(), getMaskType(), isInverted(), setImgNr(), setInverted(), setMaskPolygon(), and setMaskType().

const bool HuginBase::MaskPolygon::operator== const MaskPolygon otherPoly  )  const
 

comparision operator

Definition at line 598 of file Mask.cpp.

References getMaskPolygon(), getMaskType(), m_maskType, and m_polygon.

bool HuginBase::MaskPolygon::parsePolygonString const std::string  polygonStr  ) 
 

parses the x and y positions from the given string

Definition at line 603 of file Mask.cpp.

References hugin_utils::FDiff2D, and m_polygon.

Referenced by HuginBase::LoadMaskFromStream().

void HuginBase::MaskPolygon::printPolygonLine std::ostream o,
const unsigned int  newImgNr
const
 

writes the complete k line which describes the mask to the stream, using the given newImgNr for the i parameter

Definition at line 620 of file Mask.cpp.

References m_maskType, m_polygon, hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

Referenced by HuginBase::SaveMaskToStream().

void HuginBase::MaskPolygon::removePoint const unsigned int  index  ) 
 

removes point at the position index from the polygon

Definition at line 127 of file Mask.cpp.

References calcBoundingBox(), and m_polygon.

Referenced by MaskImageCtrl::OnKeyUp(), MaskImageCtrl::OnLeftMouseDblClick(), and MaskImageCtrl::OnRightMouseUp().

void HuginBase::MaskPolygon::rotate90 bool  clockwise,
unsigned int  maskWidth,
unsigned int  maskHeight
 

rotate the polygon by 90 degrees

Definition at line 539 of file Mask.cpp.

References hugin_utils::FDiff2D, m_polygon, hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

void HuginBase::MaskPolygon::scale const double  factor  )  [inline]
 

scales x and y axis equally by factor

Definition at line 109 of file Mask.h.

void HuginBase::MaskPolygon::scale const double  factorx,
const double  factory
 

scales all polygon coordinates by factorx for x position and factory for y position

Definition at line 156 of file Mask.cpp.

References calcBoundingBox(), m_polygon, hugin_utils::TDiff2D< T >::x, and hugin_utils::TDiff2D< T >::y.

void HuginBase::MaskPolygon::setImgNr const unsigned int  newImgNr  )  [inline]
 

sets the associated image number, only used when loading a project, otherwise discarded

Definition at line 89 of file Mask.h.

Referenced by HuginBase::LoadMaskFromStream(), and operator=().

void HuginBase::MaskPolygon::setInverted const bool  inverted  )  [inline]
 

set mask to normal or inverted

Definition at line 91 of file Mask.h.

Referenced by operator=().

void HuginBase::MaskPolygon::setMaskPolygon const VectorPolygon  newMask  ) 
 

set complete vector with all corrdinates of the polygon

Definition at line 105 of file Mask.cpp.

References calcBoundingBox(), and m_polygon.

Referenced by operator=().

void HuginBase::MaskPolygon::setMaskType const MaskType  newType  )  [inline]
 

sets mask type

Definition at line 79 of file Mask.h.

Referenced by HuginBase::LoadMaskFromStream(), and operator=().

void HuginBase::MaskPolygon::subSample const double  max_distance  ) 
 

subsamples the polygon, so that the longest distance between 2 points is max_distance

Definition at line 181 of file Mask.cpp.

References addPoint(), vigra_ext::distance(), hugin_utils::FDiff2D, m_polygon, hugin_utils::norm(), and HuginBase::VectorPolygon.

void HuginBase::MaskPolygon::transformPolygon const PTools::Transform trans  ) 
 

transforms the polygon coordinates by the given transformation

Definition at line 166 of file Mask.cpp.

References calcBoundingBox(), hugin_utils::FDiff2D, m_polygon, HuginBase::PTools::Transform::transformImgCoord(), and HuginBase::VectorPolygon.


Member Data Documentation

vigra::Rect2D HuginBase::MaskPolygon::m_boundingBox [private]
 

Definition at line 146 of file Mask.h.

Referenced by calcBoundingBox(), and isInside().

unsigned int HuginBase::MaskPolygon::m_imgNr [private]
 

Definition at line 144 of file Mask.h.

bool HuginBase::MaskPolygon::m_invert [private]
 

Definition at line 145 of file Mask.h.

MaskType HuginBase::MaskPolygon::m_maskType [private]
 

Definition at line 142 of file Mask.h.

Referenced by isPositive(), operator==(), and printPolygonLine().

VectorPolygon HuginBase::MaskPolygon::m_polygon [private]
 

Definition at line 143 of file Mask.h.

Referenced by addPoint(), calcBoundingBox(), clipPolygon(), FindPointNearPos(), getTotalWindingNumber(), getWindingNumber(), insertPoint(), isInside(), movePointBy(), movePointTo(), operator==(), parsePolygonString(), printPolygonLine(), removePoint(), rotate90(), scale(), setMaskPolygon(), subSample(), and transformPolygon().


The documentation for this class was generated from the following files:
Generated on Mon Sep 1 01:25:52 2014 for Hugintrunk by  doxygen 1.3.9.1