oaPolygon Class Reference

Inheritance diagram for oaPolygon:

oaShape oaPinFig oaConnFig oaFig oaBlockObject oaDesignObject oaObject


Public Methods

oaUInt4 getNumPoints () const
void getPoints (oaPointArray &points) const
oaBoolean isOrthogonal () const
void setPoints (const oaPointArray &points)
oaRectconvertToRect ()

Static Public Methods

oaPolygon * create (oaBlock *block, oaLayerNum layerNum, oaPurposeNum purposeNum, const oaPointArray &points)

Detailed Description

The oaPolygon class implements a polygon shape. An oaPointArray describing an oaPolygon must conform to the following requirements and assumptions:

1) No duplicate (coincident) points -- duplicate points throw an exception (use oaPointArray::compress to remove coincident points).

2) No collinear edges -- that is, three or more collinear points are illegal and cause an exception to be thrown (use oaPointArray::compress to remove collinear points).

3) Polygon edges should not cross. An exception is NOT thrown if polygon edges cross, but oaPointArray::compress will produce incorrect results if the edges connected by the points in the array cross.

4) oaPolygon functions that throw exceptions for collinear and coincident points, such as oaPolygon::create and oaPolygon::setPoints, assume that the polygon point array is closed--that is, that an edge connects the first and last polygon points specified in the array (since a polygon cannot have coincident points, the first and last polygon points must be different points).

For more information on coincident and collinear points, see oaPointArray::compress()


Member Function Documentation

oaRect * oaPolygon::convertToRect  
 

This function converts this polygon into a rectangle. The rectangle is returned as the same pointer.

Note: Only a four-point polygon is converted to a rectangle.

Exceptions:
oacCannotConvertPolygonToRect 

oaPolygon * oaPolygon::create oaBlock *    block,
oaLayerNum    layerNum,
oaPurposeNum    purposeNum,
const oaPointArray &    points
[static]
 

This function creates a polygon with the specified attributes. If the array has collinear or coincident points, or the last and first points of the array are the same, an exception is thrown. If the array has less than three points, an exception also is thrown.

Parameters:
block The block in which this oaPolygon object is created
layerNum The number of the layer on which this oaPolygon is created
purposeNum The number of the layer purpose for this oaPolygon object
points The array of points for this oaPolygon object
Exceptions:
oacPolygonHasExtraPoints 
oacPolygonTooFewPoints 

oaUInt4 oaPolygon::getNumPoints   const
 

This function returns the number of points in this polygon.

void oaPolygon::getPoints oaPointArray &    points const
 

This function returns the point array of this polygon.

Parameters:
points The point array containing the points of this polygon

oaBoolean oaPolygon::isOrthogonal   const
 

This function returns a boolean value that indicates the pointArray of this polygon is orthogonal.

void oaPolygon::setPoints const oaPointArray &    points
 

This function sets the points of this polygon to the specified pointArray. If the array has collinear or coincident points, or the last and first points are the same, an exception is thrown. If the array has less than three points, an exception also is thrown.

Parameters:
points The point array containing the points to set the oaPolygon object.
Exceptions:
oacPolygonHasExtraPoints 
oacPolygonTooFewPoints 


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

Return to top of page