IPolygon

IPolygon provides a wrapper for the IGPolygon geometry class. An IGPolygon is a collection of points connected by straight line segments, with the last point automatically connected to the first, closing the path.


IPolygon - Member Functions and Data by Group

Constructors & Destructor

Use the functions in this group to construct and destroy objects of class IPolygon.


[view class]
~IPolygon
public:
virtual ~IPolygon()
Destorys an IPolygon object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IPolygon
This function constructs an object of class IPolygon.


Overload 1
Copy constructor.
public:
IPolygon(const IPolygon&)
Use this constructor to copy the IGPolygon2D and sets the bounds to empty.

const IPolygon&
The polygon to be copied.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
Constructs an IPolygon by adopting an IGPolygon2D and an IGrafBundle.
public:
IPolygon( IGPolygon2D* adoptPolygon, IGrafBundle* adoptBundle = 0 )

adoptPolygon
The IGPolygon2D to be adopted.
adoptBundle
The bundle to be adopted. The default value is empty.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
Default constructor. Constructs an IPolygon which has an empty geometry and empty bounds.
public:
IPolygon()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Adopting and Releasing the Geometry

Use the functions in this group to take ownership of the polygon geometry or to return it to the caller.


[view class]
adoptGeometry
public:
virtual void adoptGeometry(IGPolygon2D*)
Takes over the ownership of a geometry after deleting any existing geometries.

IGPolygon2D*
The counterpart geometry to be adopted.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
orphanGeometry
public:
virtual IGPolygon2D* orphanGeometry()
Returns the ownership of a geometry to the caller.

Return
A pointer to the orphaned geometry

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Assignment Operator

Use the function in this group to assign the given IPolygon object to the target one.


[view class]
operator =
public:
IPolygon& operator =(const IPolygon& source)
Assignment operator.

source
The polygon to be copied.

Return
A const reference to the left-hand side line.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Drawing the Polygon

Use the function in this group to draw the polygon to the given graphics port.


[view class]
draw
public:
virtual void draw(IGrafPort&) const
Draws the IPolygon to the specific IGrafPort.

IGrafPort&
The port to which drawing should go.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obtaining an Alias to Counterpart Geometry

Use the function in this group to obtain an alias for accessing the counterpart geometry.


[view class]
geometry
public:
virtual const IGPolygon2D* geometry()
Returns an alias for accessing counterpart geometry.

Return
A pointer to the counterpart geometry.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obtaining Bounding Information

Use the functions in this group to obtain the bounding rectangle of the geometry or to obtain its the device-dependent bounds.


[view class]
geometricBounds
public:
virtual IGRect2D geometricBounds() const
Gets the bounding rectangle of the geometry, without considering any area added by the bundle.

Return
The bounding rectangle, which is the smallest axis-aligned rectangle that encloses the geometry.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
looseFitBounds
public:
virtual IGRect2D looseFitBounds(const IGrafPort* = 0) const
Returns the device dependent bounds of the graphic. Includes the cap, joints, pen width. Is dependent on the port in which the graphic is rendered. If the port is not defined, then returns geometric bounds.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obtaining Information About the Polygon

Use the function in this group to determine if the polygon intersects the given rectangle.


[view class]
intersects
public:
virtual bool intersects(const IGRect2D& rect) const
Tests if this polygon intersects with the specified rectangle. It also handles any degenerated rectangle which encloses zero area. If this polygon is not "hitEnabled", the function returns false.

rect
The rectangle to be intersected with.

Return
True if this polygon intersects or completely encloses the rectangle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Streaming an Object In and Out

Use the functions in this group to read the IPolygon object in from the specified stream or write it out to it.


[view class]
readFromStream
protected:
virtual void readFromStream(IDataStream& toWhere)
Reads the object in from the specified stream.

fromWhere
The stream from which the object is read in.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
writeToStream
protected:
virtual void writeToStream(IDataStream& toWhere) const
Writes the object out to the specified stream.

toWhere
The stream to which the object is written out.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Testing the IPolygon and IMDrawable Objects for Equality

Use the function in this group to compare the IPolygon object with the IMDrawable one for equality.


[view class]
operator ==
public:
virtual bool operator ==(const IMDrawable&) const
Tests this IPolygon and IMDrawable for equality, by determining whether the geometries are equal and the bundles are equal.

IMDrawable
A constant reference to the IMDrawable to be compared with this one.

Return
True if this IPolygon and the argument have equal geometries and bundles.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Transforming the Polygon

Use the function in this group to change the graphic's shape and position using the transformation matrix.


[view class]
transformBy
public:
virtual void transformBy(const IGrafMatrix&)
Transforms the graphic's shape and position by applying the specified transformation matrix.

IGrafMatrix
A constant reference to the transformation matrix by which the graphic's points are multiplied.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IPolygon - Inherited Member Functions and Data

Inherited Public Functions

IMDrawable
IMGraphic
IMStreamable

Inherited Public Data

Inherited Protected Functions

IMDrawable
IMGraphic
IMStreamable

Inherited Protected Data