Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

C2DHoledPolyBase Class Reference

class which represents a C2DPolyBase with holes. More...

#include <2DHoledPolyBase.h>

Inheritance diagram for C2DHoledPolyBase:

C2DBase C2DHoledPolyArc C2DHoledPolygon List of all members.

Public Member Functions

 C2DHoledPolyBase (void)
 Constructor.
 C2DHoledPolyBase (const C2DHoledPolyBase &Other)
 Copy constructor.
 ~C2DHoledPolyBase (void)
 Destructor.
const C2DHoledPolyBase & operator= (const C2DHoledPolyBase &Other)
 Assignment.
void SetRim (const C2DPolyBase &Polygon)
 Sets the rim to a copy of the polygon given.
void AddHole (const C2DPolyBase &Polygon)
 Adds a copy of the polygon given.
void SetHole (const C2DPolyBase &Polygon, unsigned int usIndex)
 Sets the holes to be a copy of the polygon given.
void SetRimDirect (C2DPolyBase *Polygon)
 Sets the rim to be the polygon provided. Will delete on destruction.
void AddHoleDirect (C2DPolyBase *Polygon)
 Adds the hole provided. Will delete on destruction.
void SetHoleDirect (C2DPolyBase *Polygon, unsigned int usIndex)
 Sets the hole to be the polygon provided. Will delete on destruction. Deletes old one.
void RemoveHole (unsigned int usIndex)
 Removes the hole at the index given.
C2DPolyBase * GetRim (void)
 Returns the rim.
const C2DPolyBase * GetRim (void) const
 Returns the rim.
C2DPolyBase * ExtractRim (void)
 Extracts the rim. Deletion of the rim needs to be managed elsewhere.
C2DPolyBase * GetHole (unsigned int usIndex)
 Returns a pointer to the hole specified.
const C2DPolyBase * GetHole (unsigned int usIndex) const
 Returns a pointer to the hole specified.
C2DPolyBase * ExtractHole (unsigned int usIndex)
 Extracts the hole. Deletion of the hole needs to be managed elsewhere.
unsigned int GetHoleCount (void) const
 Returns the number of holes.
unsigned int GetLineCount (void) const
 Return the number of lines.
void Clear (void)
 Clears the shape.
bool IsValid (void)
 True if the holes are contained and non-intersecting.
void RotateToRight (double dAng, const C2DPoint &Origin)
 Rotates to the right by the angle around the origin.
void Move (const C2DVector &Vector)
 Moves the polygon.
void Grow (double dFactor, const C2DPoint &Origin)
 Grows around the origin.
void Reflect (const C2DPoint &Point)
 Point reflection.
void Reflect (const C2DLine &Line)
 Reflects throught the line provided.
double Distance (const C2DPoint &TestPoint) const
 Distance from the point.
double Distance (const C2DLineBase &Line) const
 Distance from the line provided.
double Distance (const C2DPolyBase &Poly, C2DPoint *ptOnThis=0, C2DPoint *ptOnOther=0) const
 Distance from the polygon provided. Also returns points if provided.
bool IsWithinDistance (const C2DPoint &TestPoint, double dDist) const
 Distance from the point.
double GetPerimeter (void) const
 Returns the perimeter.
void Project (const C2DLine &Line, CInterval &Interval) const
 Projection onto the line.
void Project (const C2DVector &Vector, CInterval &Interval) const
 Projection onto the vector.
bool HasCrossingLines (void) const
 True if there are crossing lines.
void GetBoundingRect (C2DRect &Rect) const
 Returns the bounding rectangle.
bool Contains (const C2DPoint &pt) const
 Point inside test.
bool Contains (const C2DLineBase &Line) const
 Line entirely inside test.
bool Contains (const C2DPolyBase &Polygon) const
 Polygon entirely inside test.
bool Contains (const C2DHoledPolyBase &Polygon) const
 Polygon entirely inside test.
bool Crosses (const C2DLineBase &Line) const
 True if this crosses the line.
bool Crosses (const C2DLineBase &Line, C2DPointSet *IntersectionPts) const
 True if this crosses the line, returns the intersection points.
bool Crosses (const C2DPolyBase &Poly) const
 True if it crosses the other.
bool CrossesRay (const C2DLine &Ray, C2DPointSet *IntersectionPts) const
 True if this crosses the ray, returns the intersection points.
bool Overlaps (const C2DHoledPolyBase &Other) const
 True if this overlaps the other.
bool Overlaps (const C2DPolyBase &Other) const
 True if this overlaps the other.
void GetOverlaps (const C2DHoledPolyBase &Other, C2DHoledPolyBaseSet &HoledPolys, CGrid::eDegenerateHandling eDegen=CGrid::None) const
 Returns the overlaps between this and the other complex polygon.
void GetNonOverlaps (const C2DHoledPolyBase &Other, C2DHoledPolyBaseSet &HoledPolys, CGrid::eDegenerateHandling eDegen=CGrid::None) const
 Returns the difference between this and the other polygon.
void GetUnion (const C2DHoledPolyBase &Other, C2DHoledPolyBaseSet &HoledPolys, CGrid::eDegenerateHandling eDegen=CGrid::None) const
 Returns the union of this and the other.
void RandomPerturb (void)
 Moves this by a small random amount.
void SnapToGrid (void)
 Snaps this to the conceptual grip.
void GetBoolean (const C2DHoledPolyBase &Other, C2DHoledPolyBaseSet &HoledPolys, bool bThisInside, bool bOtherInside, CGrid::eDegenerateHandling eDegen=CGrid::None) const
 GetBoolean.

Static Public Member Functions

static void PolygonsToHoledPolygons (C2DHoledPolyBaseSet &HoledPolys, C2DPolyBaseSet &Polygons)
 Function to convert polygons to complex polygons. Assigning holes to those that are contained.
static void GetRoutes (const C2DHoledPolyBase &Poly1, bool bP1RoutesInside, const C2DHoledPolyBase &Poly2, bool bP2RoutesInside, C2DLineBaseSetSet &Routes1, C2DLineBaseSetSet &Routes2, C2DPolyBaseSet &CompleteHoles1, C2DPolyBaseSet &CompleteHoles2)
 GetRoutes.

Protected Attributes

C2DPolyBase * m_Rim
 The rim.
C2DPolyBaseSet m_Holes
 The holes.

Detailed Description

class which represents a C2DPolyBase with holes.

A class which represents an C2DPolyBase with holes. Note that some of the functions assume that the holes are inside the area for simplicity and speed. E.g. the projection function will project the rim and not the holes as there should be no need as long as it is a valid area.

---------------------------------------------------------------------------


Constructor & Destructor Documentation

C2DHoledPolyBase::C2DHoledPolyBase (  void   ) 
 

Constructor.

--------------------------------------------------------------------------
C2DHoledPolyBase::C2DHoledPolyBase

---------------------------------------------------------------------------

C2DHoledPolyBase::C2DHoledPolyBase (  const C2DHoledPolyBase &  Other  ) 
 

Copy constructor.

--------------------------------------------------------------------------
C2DHoledPolyBase::C2DHoledPolyBase

---------------------------------------------------------------------------

C2DHoledPolyBase::~C2DHoledPolyBase (  void   ) 
 

Destructor.

--------------------------------------------------------------------------
C2DHoledPolyBase::~C2DHoledPolyBase

---------------------------------------------------------------------------


Member Function Documentation

void C2DHoledPolyBase::AddHole (  const C2DPolyBase &  Polygon  ) 
 

Adds a copy of the polygon given.

--------------------------------------------------------------------------
C2DHoledPolyBase::AddHole

---------------------------------------------------------------------------

void C2DHoledPolyBase::AddHoleDirect (  C2DPolyBase *  Polygon  ) 
 

Adds the hole provided. Will delete on destruction.

--------------------------------------------------------------------------
C2DHoledPolyBase::AddHoleDirect

---------------------------------------------------------------------------

void C2DHoledPolyBase::Clear (  void   ) 
 

Clears the shape.

--------------------------------------------------------------------------
C2DHoledPolyBase::Clear

---------------------------------------------------------------------------

bool C2DHoledPolyBase::Contains (  const C2DHoledPolyBase &  Polygon  )  const
 

Polygon entirely inside test.

--------------------------------------------------------------------------
C2DHoledPolyBase::Contains

---------------------------------------------------------------------------

bool C2DHoledPolyBase::Contains (  const C2DPolyBase &  Polygon  )  const
 

Polygon entirely inside test.

--------------------------------------------------------------------------
C2DHoledPolyBase::Contains

---------------------------------------------------------------------------

bool C2DHoledPolyBase::Contains (  const C2DLineBase &  Line  )  const
 

Line entirely inside test.

--------------------------------------------------------------------------
C2DHoledPolyBase::Contains

---------------------------------------------------------------------------

bool C2DHoledPolyBase::Contains (  const C2DPoint &  pt  )  const
 

Point inside test.

--------------------------------------------------------------------------
C2DHoledPolyBase::Contains

---------------------------------------------------------------------------

bool C2DHoledPolyBase::Crosses (  const C2DPolyBase &  Poly  )  const
 

True if it crosses the other.

--------------------------------------------------------------------------
C2DHoledPolyBase::Crosses

---------------------------------------------------------------------------

bool C2DHoledPolyBase::Crosses (  const C2DLineBase &  Line,
C2DPointSet *  IntersectionPts
)  const
 

True if this crosses the line, returns the intersection points.

--------------------------------------------------------------------------
C2DHoledPolyBase::Crosses

---------------------------------------------------------------------------

bool C2DHoledPolyBase::Crosses (  const C2DLineBase &  Line  )  const
 

True if this crosses the line.

--------------------------------------------------------------------------
C2DHoledPolyBase::Crosses

---------------------------------------------------------------------------

bool C2DHoledPolyBase::CrossesRay (  const C2DLine &  Ray,
C2DPointSet *  IntersectionPts
)  const
 

True if this crosses the ray, returns the intersection points.

--------------------------------------------------------------------------
C2DHoledPolyBase::CrossesRay

---------------------------------------------------------------------------

double C2DHoledPolyBase::Distance (  const C2DPolyBase &  Poly,
C2DPoint *  ptOnThis = 0,
C2DPoint *  ptOnOther = 0
)  const
 

Distance from the polygon provided. Also returns points if provided.

--------------------------------------------------------------------------
C2DHoledPolyBase::Distance

---------------------------------------------------------------------------

double C2DHoledPolyBase::Distance (  const C2DLineBase &  Line  )  const
 

Distance from the line provided.

--------------------------------------------------------------------------
C2DHoledPolyBase::Distance

---------------------------------------------------------------------------

double C2DHoledPolyBase::Distance (  const C2DPoint &  TestPoint  )  const [virtual]
 

Distance from the point.

--------------------------------------------------------------------------
C2DHoledPolyBase::Distance

---------------------------------------------------------------------------

Implements C2DBase.

C2DPolyBase * C2DHoledPolyBase::ExtractHole (  unsigned int  usIndex  ) 
 

Extracts the hole. Deletion of the hole needs to be managed elsewhere.

--------------------------------------------------------------------------
C2DHoledPolyBase::ExtractHole

---------------------------------------------------------------------------

C2DPolyBase * C2DHoledPolyBase::ExtractRim (  void   ) 
 

Extracts the rim. Deletion of the rim needs to be managed elsewhere.

--------------------------------------------------------------------------
C2DHoledPolyBase::ExtractRim

---------------------------------------------------------------------------

Reimplemented in C2DHoledPolyArc, and C2DHoledPolygon.

void C2DHoledPolyBase::GetBoolean (  const C2DHoledPolyBase &  Other,
C2DHoledPolyBaseSet &  HoledPolys,
bool  bThisInside,
bool  bOtherInside,
CGrid::eDegenerateHandling  eDegen = CGrid::None
)  const
 

GetBoolean.

Returns the boolean result (e.g. union) of 2 shapes. Boolean Operation defined by the inside / outside flags.

void C2DHoledPolyBase::GetBoundingRect (  C2DRect &  Rect  )  const [virtual]
 

Returns the bounding rectangle.

--------------------------------------------------------------------------
C2DHoledPolyBase::GetBoundingRect

---------------------------------------------------------------------------

Implements C2DBase.

const C2DPolyBase * C2DHoledPolyBase::GetHole (  unsigned int  usIndex  )  const
 

Returns a pointer to the hole specified.

--------------------------------------------------------------------------
C2DHoledPolyBase::GetHole

---------------------------------------------------------------------------

C2DPolyBase * C2DHoledPolyBase::GetHole (  unsigned int  usIndex  ) 
 

Returns a pointer to the hole specified.

--------------------------------------------------------------------------
C2DHoledPolyBase::GetHole

---------------------------------------------------------------------------

unsigned int C2DHoledPolyBase::GetLineCount (  void   )  const
 

Return the number of lines.

--------------------------------------------------------------------------
C2DHoledPolyBase::GetLineCount

---------------------------------------------------------------------------

void C2DHoledPolyBase::GetNonOverlaps (  const C2DHoledPolyBase &  Other,
C2DHoledPolyBaseSet &  HoledPolys,
CGrid::eDegenerateHandling  eDegen = CGrid::None
)  const
 

Returns the difference between this and the other polygon.

--------------------------------------------------------------------------
C2DHoledPolyBase::GetNonOverlaps

---------------------------------------------------------------------------

void C2DHoledPolyBase::GetOverlaps (  const C2DHoledPolyBase &  Other,
C2DHoledPolyBaseSet &  HoledPolys,
CGrid::eDegenerateHandling  eDegen = CGrid::None
)  const
 

Returns the overlaps between this and the other complex polygon.

--------------------------------------------------------------------------
C2DHoledPolyBase::GetOverlaps

---------------------------------------------------------------------------

double C2DHoledPolyBase::GetPerimeter (  void   )  const
 

Returns the perimeter.

--------------------------------------------------------------------------
C2DHoledPolyBase::GetPerimeter

---------------------------------------------------------------------------

void C2DHoledPolyBase::GetRoutes (  const C2DHoledPolyBase &  Poly1,
bool  bP1RoutesInside,
const C2DHoledPolyBase &  Poly2,
bool  bP2RoutesInside,
C2DLineBaseSetSet &  Routes1,
C2DLineBaseSetSet &  Routes2,
C2DPolyBaseSet &  CompleteHoles1,
C2DPolyBaseSet &  CompleteHoles2
)  [static]
 

GetRoutes.

Returns the routes (multiple lines or part polygons) either inside or outside the polygons provided. These are based on the intersections of the 2 polygons e.g. the routes / part polygons of one inside the other.

void C2DHoledPolyBase::GetUnion (  const C2DHoledPolyBase &  Other,
C2DHoledPolyBaseSet &  HoledPolys,
CGrid::eDegenerateHandling  eDegen = CGrid::None
)  const
 

Returns the union of this and the other.

--------------------------------------------------------------------------
C2DHoledPolyBase::GetUnion

---------------------------------------------------------------------------

void C2DHoledPolyBase::Grow (  double  dFactor,
const C2DPoint &  Origin
)  [virtual]
 

Grows around the origin.

--------------------------------------------------------------------------
C2DHoledPolyBase::Grow

---------------------------------------------------------------------------

Implements C2DBase.

Reimplemented in C2DHoledPolygon.

bool C2DHoledPolyBase::HasCrossingLines (  void   )  const
 

True if there are crossing lines.

--------------------------------------------------------------------------
C2DHoledPolyBase::HasCrossingLines

---------------------------------------------------------------------------

bool C2DHoledPolyBase::IsValid (  void   ) 
 

True if the holes are contained and non-intersecting.

--------------------------------------------------------------------------
C2DHoledPolyBase::IsValid

---------------------------------------------------------------------------

bool C2DHoledPolyBase::IsWithinDistance (  const C2DPoint &  TestPoint,
double  dDist
)  const
 

Distance from the point.

--------------------------------------------------------------------------
C2DHoledPolyBase::IsWithinDistance

---------------------------------------------------------------------------

void C2DHoledPolyBase::Move (  const C2DVector &  Vector  )  [virtual]
 

Moves the polygon.

--------------------------------------------------------------------------
C2DHoledPolyBase::Move

---------------------------------------------------------------------------

Implements C2DBase.

const C2DHoledPolyBase & C2DHoledPolyBase::operator= (  const C2DHoledPolyBase &  Other  ) 
 

Assignment.

--------------------------------------------------------------------------
C2DHoledPolyBase::C2DHoledPolyBase

---------------------------------------------------------------------------

bool C2DHoledPolyBase::Overlaps (  const C2DPolyBase &  Other  )  const
 

True if this overlaps the other.

--------------------------------------------------------------------------
C2DHoledPolyBase::Overlaps

---------------------------------------------------------------------------

bool C2DHoledPolyBase::Overlaps (  const C2DHoledPolyBase &  Other  )  const
 

True if this overlaps the other.

--------------------------------------------------------------------------
C2DHoledPolyBase::Overlaps

---------------------------------------------------------------------------

void C2DHoledPolyBase::PolygonsToHoledPolygons (  C2DHoledPolyBaseSet &  HoledPolys,
C2DPolyBaseSet &  Polygons
)  [static]
 

Function to convert polygons to complex polygons. Assigning holes to those that are contained.

--------------------------------------------------------------------------
C2DHoledPolyBase::PolygonsToHoledPolygons

---------------------------------------------------------------------------

void C2DHoledPolyBase::Project (  const C2DVector &  Vector,
CInterval &  Interval
)  const [virtual]
 

Projection onto the vector.

--------------------------------------------------------------------------
C2DHoledPolyBase::Project

---------------------------------------------------------------------------

Implements C2DBase.

void C2DHoledPolyBase::Project (  const C2DLine &  Line,
CInterval &  Interval
)  const [virtual]
 

Projection onto the line.

--------------------------------------------------------------------------
C2DHoledPolyBase::Project

---------------------------------------------------------------------------

Implements C2DBase.

void C2DHoledPolyBase::RandomPerturb (  void   ) 
 

Moves this by a small random amount.

--------------------------------------------------------------------------
C2DPolyBase::RandomPerturb

---------------------------------------------------------------------------

void C2DHoledPolyBase::Reflect (  const C2DLine &  Line  )  [virtual]
 

Reflects throught the line provided.

--------------------------------------------------------------------------
C2DHoledPolyBase::Reflect

---------------------------------------------------------------------------

Implements C2DBase.

void C2DHoledPolyBase::Reflect (  const C2DPoint &  Point  )  [virtual]
 

Point reflection.

--------------------------------------------------------------------------
C2DHoledPolyBase::Reflect

---------------------------------------------------------------------------

Implements C2DBase.

void C2DHoledPolyBase::RemoveHole (  unsigned int  usIndex  ) 
 

Removes the hole at the index given.

--------------------------------------------------------------------------
C2DHoledPolyBase::RemoveHole

---------------------------------------------------------------------------

void C2DHoledPolyBase::RotateToRight (  double  dAng,
const C2DPoint &  Origin
)  [virtual]
 

Rotates to the right by the angle around the origin.

--------------------------------------------------------------------------
C2DHoledPolyBase::RotateToRight

---------------------------------------------------------------------------

Implements C2DBase.

Reimplemented in C2DHoledPolygon.

void C2DHoledPolyBase::SetHole (  const C2DPolyBase &  Polygon,
unsigned int  usIndex
) 
 

Sets the holes to be a copy of the polygon given.

--------------------------------------------------------------------------
C2DHoledPolyBase::SetHole

---------------------------------------------------------------------------

void C2DHoledPolyBase::SetHoleDirect (  C2DPolyBase *  Polygon,
unsigned int  usIndex
) 
 

Sets the hole to be the polygon provided. Will delete on destruction. Deletes old one.

--------------------------------------------------------------------------
C2DHoledPolyBase::SetHoleDirect

---------------------------------------------------------------------------

void C2DHoledPolyBase::SetRim (  const C2DPolyBase &  Polygon  ) 
 

Sets the rim to a copy of the polygon given.

--------------------------------------------------------------------------
C2DHoledPolyBase::SetRim

---------------------------------------------------------------------------

void C2DHoledPolyBase::SetRimDirect (  C2DPolyBase *  Polygon  ) 
 

Sets the rim to be the polygon provided. Will delete on destruction.

--------------------------------------------------------------------------
C2DHoledPolyBase::SetRimDirect

---------------------------------------------------------------------------

void C2DHoledPolyBase::SnapToGrid (  void   )  [virtual]
 

Snaps this to the conceptual grip.

--------------------------------------------------------------------------
C2DHoledPolyBase::SnapToGrid

---------------------------------------------------------------------------

Implements C2DBase.


The documentation for this class was generated from the following files:
Generated on Mon Apr 21 11:43:51 2008 for GeoLib by  doxygen 1.4.4