BDonut Class Reference

#include <BDonut.h>

Inheritance diagram for BDonut:

Inheritance graph
[legend]

List of all members.


Detailed Description

A geometry object that contains an outer shell and a collection of holes.

For example, a Donut could be used to represent a lake that has islands in it.

Public Member Functions

void AddHole (const BAreaGeoPtr &pHole)
 Adds a hole to this BDonut.
 BDonut (const BDonut &p)
 Copy constructor.
 BDonut (EOrientation orientation)
 Constructor.
 BDonut ()
 Default constructor.
virtual BGeometryClone (void) const
 Creates a deep-copy of this object.
virtual size_t ComputeSize (void) const
 Computes the size of the BByteArray required to store this object.
virtual bool Contains (const BPoint &point) const
 Determines whether or not the specified point is contained within this BGeometry.
virtual double DistanceTo (const BPoint &point) const
 Calculates the minimum distance from this BGeometry to the specified BPoint.
virtual void DoResolveToPoint (const BPoint &refPt)
 Resolves this BGeometry based on the input BPoint.
BAggregateAreaPtr Flatten (void) const
 Flattens this BDonut.
virtual void FromByteArray (const BByteArray &bytes, size_t &startPos)
 Initializes an instance of this object from a BByteArray.
const BAreaGeoPtr GetHoleAt (size_t index) const
 Gets the hole associated with the specified index.
BAreaGeoPtr GetHoleAt (size_t index)
 Gets the hole associated with the specified index.
size_t GetHoleCount (void) const
 Get the number of holes that have been added to this BDonut.
virtual size_t GetPointCount (void) const
 Get the total number of points in this donut.
BAreaGeoPtr GetShell (void)
 Gets the outer shell of this BDonut.
const BAreaGeoPtr GetShell (void) const
 Gets the outer shell of this BDonut.
bool HasShell (void) const
 Indicate whether or not this BDonut has a shell.
virtual bool Intersects (const BRect &rect) const
 Determines whether or not this BGeometry intersects the specified rectangle.
virtual bool IsClosed (void) const
 Indicates whether or not this is a "closed" geometry.
void SetShell (const BAreaGeoPtr &pArea)
 Sets the outer shell of the donut.
virtual BByteArray ToByteArray (void) const
 Stores this object in a BByteArray.
virtual void Transform (const BTransform &cst)
 Transforms the coordinates in this BGeometry to a different coordinate system.
virtual void TransformReverse (const BTransform &cst)
 Transforms the coordinates in this BGeometry to a different coordinate system using the "reverse" of the BTransform.
virtual ~BDonut ()
 Destructor.

Protected Member Functions

virtual BRect ComputeMBR () const
 Computes the minimum bounding rectangle for this BGeometry.
virtual void ComputeStats () const
 Computes the MBR, centroid, area, perimeter, and orientation.
bool ContainsAll (const BPoints &points) const
 Indicates whether or not the shell contains all of the points in the specified collection.
bool ContainsArea (const BAreaGeoPtr &pArea) const
 Indicates whether or not the shell completely contains the specified BAreaGeo object.

Protected Attributes

BAggregateArea m_holes
 The collection of BAreaGeo objects that define the holes.
BAreaGeoPtr m_pShell
 The outer shell.


Constructor & Destructor Documentation

BDonut (  )  [inline]

Default constructor.

BDonut ( EOrientation  orientation  )  [inline]

Constructor.

This constructs a BDonut with the specified orientation. The orientation of the shell must match the orientation of the BDonut.

Parameters:
orientation The orientation to be applied to this BDonut.

BDonut ( const BDonut p  ) 

Copy constructor.

Parameters:
p The BDonut object to copy.

virtual ~BDonut (  )  [inline, virtual]

Destructor.


Member Function Documentation

void AddHole ( const BAreaGeoPtr pHole  ) 

Adds a hole to this BDonut.

The orientation of the hole must be the opposite of the orientation for this BDonut, which is the same as the orientation of the shell.

Parameters:
pHole A BAreaGeo that represents the hole.
Exceptions:
BUnknownGeometryException This exception will be thrown if the orientation of the hole is the same as the orientation for the BDonut.

virtual BGeometry* Clone ( void   )  const [inline, virtual]

Creates a deep-copy of this object.

Returns:
A deep-copy of this object.

Implements BGeometry.

virtual BRect ComputeMBR (  )  const [protected, virtual]

Computes the minimum bounding rectangle for this BGeometry.

Returns:
The minimum bounding rectangle.

Implements BGeometry.

virtual size_t ComputeSize ( void   )  const [virtual]

Computes the size of the BByteArray required to store this object.

Returns:
The size of the BByteArray.

Reimplemented from BAreaGeo.

virtual void ComputeStats (  )  const [protected, virtual]

Computes the MBR, centroid, area, perimeter, and orientation.

Implements BAreaGeo.

virtual bool Contains ( const BPoint point  )  const [virtual]

Determines whether or not the specified point is contained within this BGeometry.

Parameters:
point The BPoint to test for containment.
Returns:
True if the point is contained within this BGeometry and false otherwise.

Implements BAreaGeo.

bool ContainsAll ( const BPoints points  )  const [protected]

Indicates whether or not the shell contains all of the points in the specified collection.

Parameters:
points The points to test for containment.
Returns:
True if all of the points are contained in this BDonut.

bool ContainsArea ( const BAreaGeoPtr pArea  )  const [protected]

Indicates whether or not the shell completely contains the specified BAreaGeo object.

Parameters:
pArea The BAreaGeo to test for containment.
Returns:
True if the BAreaGeo is completely contained in this BDonut.

virtual double DistanceTo ( const BPoint point  )  const [virtual]

Calculates the minimum distance from this BGeometry to the specified BPoint.

Parameters:
point The BPoint used to calculate distance.
Returns:
The distance. The units used to express this distance are the same as the units used to express the location of this BGeometry.

Reimplemented from BGeometry.

virtual void DoResolveToPoint ( const BPoint refPt  )  [virtual]

Resolves this BGeometry based on the input BPoint.

This should only be called on BGeometry objects that are part of a BBlockDef and contain coordinates that represent offsets from a point rather then an absolute location.

Parameters:
refPt The insertion point.

Implements BGeometry.

BAggregateAreaPtr Flatten ( void   )  const

Flattens this BDonut.

Returns a BAggregateArea that contains only primitive geometries. Any aggregates (e.g. BAggregateArea or BDonut) will be flattened, and their geometries added to this collection.

Returns:
The BAggregateArea containing primitive geometries.

virtual void FromByteArray ( const BByteArray bytes,
size_t &  startPos 
) [virtual]

Initializes an instance of this object from a BByteArray.

Parameters:
bytes The BByteArray containing the byte representation for this object.
startPos The position in the BByteArray where the byte representation begins. This value will be updated to point to the byte past the end of this object in the byte array.

Reimplemented from BAreaGeo.

const BAreaGeoPtr GetHoleAt ( size_t  index  )  const [inline]

Gets the hole associated with the specified index.

Parameters:
index The zero-based index for the desired hole.
Returns:
The BAreaGeo that represents the hole.

BAreaGeoPtr GetHoleAt ( size_t  index  )  [inline]

Gets the hole associated with the specified index.

Parameters:
index The zero-based index for the desired hole.
Returns:
The BAreaGeo that represents the hole.

size_t GetHoleCount ( void   )  const [inline]

Get the number of holes that have been added to this BDonut.

Returns:
The number of holes.

virtual size_t GetPointCount ( void   )  const [virtual]

Get the total number of points in this donut.

The point count includes all points in the shell and holes.

Returns:
The total number of points in this BDonut.

BAreaGeoPtr GetShell ( void   )  [inline]

Gets the outer shell of this BDonut.

Returns:
An BAreaGeo object that represents the shell of this BDonut.

const BAreaGeoPtr GetShell ( void   )  const [inline]

Gets the outer shell of this BDonut.

Returns:
An BAreaGeo object that represents the shell of this BDonut.

bool HasShell ( void   )  const [inline]

Indicate whether or not this BDonut has a shell.

Returns:
True if the shell has been specified and false otherwise.

virtual bool Intersects ( const BRect rect  )  const [virtual]

Determines whether or not this BGeometry intersects the specified rectangle.

Parameters:
rect The rectangle to test for intersection.
Returns:
True if this BGeometry intersects the rectangle and false otherwise.

Reimplemented from BGeometry.

virtual bool IsClosed ( void   )  const [inline, virtual]

Indicates whether or not this is a "closed" geometry.

Since this is a BDonut, this method will always return true.

return Since this is a BDonut, this method will always return true.

Reimplemented from BGeometry.

void SetShell ( const BAreaGeoPtr pArea  ) 

Sets the outer shell of the donut.

If the orientation for the BDonut has been set, then the orientation of the shell must be the same as the orientation of the BDonut. If the orientation for the BDonut has not yet been set, then it will be set to the orientation of the shell.

Parameters:
pArea The area that represents the outer shell of the BDonut. The orientation for this area must be the same as the orientation of the BDonut.
Exceptions:
BUnknownGeometryException This exception will be thrown if the orientation of this BDonut has been set and the orientation of the shell is different than the orientation of the BDonut.

virtual BByteArray ToByteArray ( void   )  const [virtual]

Stores this object in a BByteArray.

Returns:
A BByteArray that stores the contents of this object.

Reimplemented from BAreaGeo.

virtual void Transform ( const BTransform cst  )  [virtual]

Transforms the coordinates in this BGeometry to a different coordinate system.

Parameters:
cst The BTransform that describes the transformation.

Reimplemented from BGeometry.

virtual void TransformReverse ( const BTransform cst  )  [virtual]

Transforms the coordinates in this BGeometry to a different coordinate system using the "reverse" of the BTransform.

Parameters:
cst The BTransform that describes the transformation.

Reimplemented from BGeometry.


Member Data Documentation

BAggregateArea m_holes [protected]

The collection of BAreaGeo objects that define the holes.

BAreaGeoPtr m_pShell [protected]

The outer shell.


The documentation for this class was generated from the following file:

GeoTranslate 5.0 From Blue Marble Geographics