SUBREGION2D Class Reference

Generic 2D sub-region object in memory. More...

#include <mi32/region2d.h>

List of all members.

Classes

class  COPYFILTER
 Filter for copying subregion. More...

Public Types

typedef
POLYLINELIST::CONST_ITERATOR 
CONST_ITERATOR

Public Member Functions

 SUBREGION2D (const DRECT2D &rect)
 SUBREGION2D (const SUBREGION2D &rhs)
 SUBREGION2D ()
 ~SUBREGION2D ()
ERRVALUE Assign (const POLYLINE &Polygon)
ERRVALUE AssignFromXML (const XMLNODE *topnode)
void AssignValidated (const POLYLINELIST &PolygonList)
void AssignValidated (const POLYLINE &Polygon)
CONST_ITERATOR Begin () const
void Clear ()
int ClipLine (POLYLINE &PolyLine, POLYLINE::CLIP &ClipTarget, CLIPMODE ClipMode=CLIPMODE_Inside) const
double ComputeArea () const
double ComputeAreaNoIslands () const
double ComputeCentroid (DPOINT3D &centroid) const
double ComputePerimeter () const
double ComputePerimeterNoIslands () const
ERRVALUE ConvertForward (const SPATREF::COORDOP &Op)
ERRVALUE ConvertForward (const TRANS2D_MAPGEN &tmg)
void ConvertForward (const TRANS2D_AFFINE &taf)
ERRVALUE ConvertForwardDense (const SPATREF::COORDOP &Op, double tolerance)
ERRVALUE ConvertForwardDense (const TRANS2D_MAPGEN &tmg)
ERRVALUE ConvertInverse (const TRANS2D_MAPGEN &tmg)
void ConvertInverse (const TRANS2D_AFFINE &taf)
ERRVALUE ConvertInverseDense (const TRANS2D_MAPGEN &tmg)
ERRVALUE ConvertReverse (const SPATREF::COORDOP &Op)
ERRVALUE ConvertReverseDense (const SPATREF::COORDOP &Op, double tolerance)
ERRVALUE ConvertToLongFloor (SIMPLE_ARRAY< LPOLYGON > &PolygonArray, SIMPLE_ARRAY< LPOINT2D > &PointArray, const DPOINT2D &scale, const DPOINT2D &offset) const
ERRVALUE ConvertToLongFloor (SIMPLE_ARRAY< LPOLYGON > &PolygonArray, SIMPLE_ARRAY< LPOINT2D > &PointArray) const
ERRVALUE ConvertToLongNearInt (SIMPLE_ARRAY< LPOLYGON > &PolygonArray, SIMPLE_ARRAY< LPOINT2D > &PointArray) const
ERRVALUE ConvertToLongRound (SIMPLE_ARRAY< LPOLYGON > &PolygonArray, SIMPLE_ARRAY< LPOINT2D > &PointArray) const
ERRVALUE CopyTo (SUBREGION2D &target, COPYFILTER &filter) const
void DumpCoords (MISTRING &result, int indent, bool maxprec=false) const
CONST_ITERATOR End () const
int FitRectangleInside (const DPOINT2D &size, DPOINT2D &ptCenterRet, UINT32 QuantFactor=10, bool bUseFirstFound=false) const
ERRVALUE GeneratePointInside (DPOINT2D &PointInside) const
ERRVALUE GenerateRandomPointInside (DPOINT2D &PointInside) const
const DRECT3DGetExtents () const
const DRECT2DGetExtents2D () const
INT32 GetNumIslands () const
XMLNODEGetXML (XMLNODE *parentnode, const char *nodename="SubRegion") const
ERRVALUE Intersect (const SUBREGION2D &SubRegion, MILIST< SUBREGION2D > &SubRegionList)
ERRVALUE Intersect (const POLYLINE &PolyLine, MILIST< SUBREGION2D > &SubRegionList)
ERRVALUE Intersect (const DRECT2D &Rect, MILIST< SUBREGION2D > &SubRegionList)
ERRVALUE IntersectValidated (const POLYLINE &PolyLine, MILIST< SUBREGION2D > &SubRegionList)
bool IsEmpty () const
bool IsEquivalentTo (const SUBREGION2D &rhs, double threshold=0.0) const
bool IsPointInside (const DPOINT2D &point) const
bool IsRectangle () const
SUBREGION2Doperator= (const DRECT3D &rhs)
SUBREGION2Doperator= (const DRECT2D &rhs)
SUBREGION2Doperator= (const SUBREGION2D &rhs)
void RemoveIslands ()
void Reverse ()
void SetDimension (DIMENSION dim)
void SetOrientation (ORIENTATION Orientation)
ERRVALUE Subtract (const DRECT2D &IslandRect, MILIST< SUBREGION2D > &SubRegionList)
ERRVALUE Subtract (const SUBREGION2D &SubRegion, MILIST< SUBREGION2D > &SubRegionList)
ERRVALUE Subtract (const POLYLINE &Island, MILIST< SUBREGION2D > &SubRegionList)
ERRVALUE SubtractValidated (const POLYLINE &Island, MILIST< SUBREGION2D > &SubRegionList, double ConflateThreshold)
ERRVALUE SubtractValidated (const POLYLINE &Island, MILIST< SUBREGION2D > &SubRegionList)
POLYLINE::COMPRESULT TestLine (const POLYLINE &PolyLine) const
bool TestLine (const POLYLINE &PolyLine, TESTCRITERIA TestCriteria) const
bool TestPoint (const DPOINT2D &Point, TESTCRITERIA TestCriteria) const
POLYLINE::COMPRESULT TestPolygon (const POLYLINE &PolyLine) const
bool TestPolygon (const POLYLINE &PolyLine, TESTCRITERIA TestCriteria) const
POLYLINE::COMPRESULT TestSubRegion (const SUBREGION2D &SubRegion) const
bool TestSubRegion (const SUBREGION2D &SubRegion, TESTCRITERIA TestCriteria) const
ERRVALUE Union (const SUBREGION2D &SubRegion, MILIST< SUBREGION2D > &SubRegionList, POLYLINE::COMBINERESULT &CombineResult)
ERRVALUE Union (const POLYLINE &PolyLine, MILIST< SUBREGION2D > &SubRegionList)
ERRVALUE Union (const DRECT2D &Rect, MILIST< SUBREGION2D > &SubRegionList, POLYLINE::COMBINERESULT &CombineResult)
ERRVALUE UnionValidated (const POLYLINE &PolyLine, MILIST< SUBREGION2D > &SubRegionList, POLYLINE::COMBINERESULT &CombineResult)

Detailed Description

Generic 2D sub-region object in memory.

The sub-region can be represented by either a single rectangle or as a polygon and a list of zero or more islands. All POLYLINE's stored in the SUBREGION are closed.


Member Typedef Documentation

typedef POLYLINELIST::CONST_ITERATOR SUBREGION2D::CONST_ITERATOR

Constructor & Destructor Documentation

SUBREGION2D::SUBREGION2D (  ) 

Default Constructor.

SUBREGION2D::SUBREGION2D ( const SUBREGION2D rhs  ) 

Copy Constructor.

SUBREGION2D::SUBREGION2D ( const DRECT2D rect  ) 

Constructor from DRECT2D.

SUBREGION2D::~SUBREGION2D (  ) 

Destructor.


Member Function Documentation

ERRVALUE SUBREGION2D::Assign ( const POLYLINE Polygon  ) 

Assigns the sub-region to the passed in polygon This will clear any existing information in 'this'.

ERRVALUE SUBREGION2D::AssignFromXML ( const XMLNODE topnode  ) 

Assign from XMLNODE.

void SUBREGION2D::AssignValidated ( const POLYLINELIST PolygonList  ) 

Assigns the sub-region to the passed in polygon list.

Assumes that the first polygon is the shell and the rest are islands. A validated polygon is a polygon that does not intersect itself. This will clear any existing information in 'this'

void SUBREGION2D::AssignValidated ( const POLYLINE Polygon  ) 

Assigns the sub-region to the passed in polygon.

A validated polygon is a polygon that does not intersect itself. This will clear any existing information in 'this'

CONST_ITERATOR SUBREGION2D::Begin (  )  const [inline]

Get the beginning of the list of POLYLINE's.

The first item is the shell polygon, the rest following are islands.

Returns:
Iterator to the beginning of the POLYLINE list
void SUBREGION2D::Clear (  ) 

Clear the sub-region.

int SUBREGION2D::ClipLine ( POLYLINE PolyLine,
POLYLINE::CLIP ClipTarget,
CLIPMODE  ClipMode = CLIPMODE_Inside 
) const

Clip a polyline to a sub-region, call the ClipTarget for each segment.

Returns:
TRUE if part of the line is clipped, FALSE if not, < 0 error
double SUBREGION2D::ComputeArea (  )  const

Compute the sub-region area in sub-region units.

double SUBREGION2D::ComputeAreaNoIslands (  )  const

Compute the sub-region area in sub-region units but do not exclude islands in the calculation.

double SUBREGION2D::ComputeCentroid ( DPOINT3D centroid  )  const

Compute centroid of subregion.

Returns:
Subregion area (useful for weighting).
Parameters:
centroid Centroid returned
double SUBREGION2D::ComputePerimeter (  )  const

Compute the sub-region perimeter in sub-region units.

double SUBREGION2D::ComputePerimeterNoIslands (  )  const

Compute the sub-region perimeter in sub-region units but do not include islands in the calculation.

ERRVALUE SUBREGION2D::ConvertForward ( const SPATREF::COORDOP Op  ) 

Translate the subregion using a coordinate operation (SPATREF::COORDOP) transformation.

ERRVALUE SUBREGION2D::ConvertForward ( const TRANS2D_MAPGEN tmg  ) 

Translate the sub-region using a mapgen transformation.

void SUBREGION2D::ConvertForward ( const TRANS2D_AFFINE taf  ) 

Translate the sub-region using an affine transformation.

ERRVALUE SUBREGION2D::ConvertForwardDense ( const SPATREF::COORDOP Op,
double  tolerance 
)

Translate the region using a coordinate operation (SPATREF::COORDOP) transformation with densification If the region is the extents only, this will convert it to a proper sub-region before doing the transformation.

ERRVALUE SUBREGION2D::ConvertForwardDense ( const TRANS2D_MAPGEN tmg  ) 

Translate the sub-region using a mapgen transformation with densification If the sub-region is the extents only, this will convert it to a polygon sub-region before doing the transformation.

ERRVALUE SUBREGION2D::ConvertInverse ( const TRANS2D_MAPGEN tmg  ) 

Translate the sub-region using a mapgen transformation.

void SUBREGION2D::ConvertInverse ( const TRANS2D_AFFINE taf  ) 

Translate the sub-region using an affine transformation.

ERRVALUE SUBREGION2D::ConvertInverseDense ( const TRANS2D_MAPGEN tmg  ) 

Translate the sub-region using a mapgen transformation with densification If the sub-region is the extents only, this will convert it to a polygon sub-region before doing the transformation.

ERRVALUE SUBREGION2D::ConvertReverse ( const SPATREF::COORDOP Op  ) 

Translate the subregion using a coordinate operation (SPATREF::COORDOP) transformation.

ERRVALUE SUBREGION2D::ConvertReverseDense ( const SPATREF::COORDOP Op,
double  tolerance 
)

Translate the subregion using a coordinate operation (SPATREF::COORDOP) transformation with densification If the subregion is the extents only, this will convert it to a proper sub-region before doing the transformation.

ERRVALUE SUBREGION2D::ConvertToLongFloor ( SIMPLE_ARRAY< LPOLYGON > &  PolygonArray,
SIMPLE_ARRAY< LPOINT2D > &  PointArray,
const DPOINT2D scale,
const DPOINT2D offset 
) const

Convert subregion from double's to INT32's using floor method with scale and offset.

Parameters:
PolygonArray Array of polygons returned
PointArray Array of points (referenced by polygons) returned
scale Scaling factors
offset Offset values added after scaling
ERRVALUE SUBREGION2D::ConvertToLongFloor ( SIMPLE_ARRAY< LPOLYGON > &  PolygonArray,
SIMPLE_ARRAY< LPOINT2D > &  PointArray 
) const

Convert subregion from double's to INT32's using floor method.

Parameters:
PolygonArray Array of polygons returned
PointArray Array of points (referenced by polygons) returned
ERRVALUE SUBREGION2D::ConvertToLongNearInt ( SIMPLE_ARRAY< LPOLYGON > &  PolygonArray,
SIMPLE_ARRAY< LPOINT2D > &  PointArray 
) const

Convert subregion from double's to INT32's, using floor with a near integer offset.

ERRVALUE SUBREGION2D::ConvertToLongRound ( SIMPLE_ARRAY< LPOLYGON > &  PolygonArray,
SIMPLE_ARRAY< LPOINT2D > &  PointArray 
) const

Convert subregion from double's to INT32's with rounding, removes duplicate points.

ERRVALUE SUBREGION2D::CopyTo ( SUBREGION2D target,
COPYFILTER filter 
) const

Copy subregion to specified target with filter.

Parameters:
target Target subregion
filter Filter to determine which islands to copy
void SUBREGION2D::DumpCoords ( MISTRING result,
int  indent,
bool  maxprec = false 
) const

Dump coordinates to string.

Though intended for debugging, not for serialization, the format is compatible with AssignFromXML when maximum precision is used.

Parameters:
result String to append to
indent Amount to indent each coordinate
maxprec Use maximum precision
CONST_ITERATOR SUBREGION2D::End (  )  const [inline]

Get the end of the list of POLYLINE's.

Returns:
End of POLYLINE list, see Begin() for details
int SUBREGION2D::FitRectangleInside ( const DPOINT2D size,
DPOINT2D ptCenterRet,
UINT32  QuantFactor = 10,
bool  bUseFirstFound = false 
) const

Attempt to fit rectangle of specified size inside subregion.

Returns:
TRUE if rectangle fits, FALSE if not, < 0 if error. This function is typically used to generate a "label point" inside the subregion with the specified rectangle size determined from the desired label size. The QuantFactor controls the speed vs accuracy of this operation. The smaller dimension of the rectangle to be fit will used with the quantization factor to scale coordinates. Larger values will be more accurate, but the computation time increases approximately by the square of the quantization factor. Larger factors will also require more memory.
Parameters:
size Size of rectangle
ptCenterRet Point at center of rectangle returned rectangle fits, unchanged if not
QuantFactor Quantization factor, must be positive
bUseFirstFound Use first found location instead of one farthest from edge
ERRVALUE SUBREGION2D::GeneratePointInside ( DPOINT2D PointInside  )  const

Generate a point inside of the subregion This does deal with the islands of the subregion, the point will not be in an island.

ERRVALUE SUBREGION2D::GenerateRandomPointInside ( DPOINT2D PointInside  )  const

Generate a point inside of the subregion This does deal with the islands of the subregion, the point will not be in an island.

If called multiple times for the same subregion, the points generated will not be the same.

const DRECT3D& SUBREGION2D::GetExtents (  )  const [inline]

Get sub-region extents.

Returns:
Extents of the sub-region
const DRECT2D& SUBREGION2D::GetExtents2D (  )  const [inline]

Get sub-region extents.

Returns:
Extents of the sub-region
INT32 SUBREGION2D::GetNumIslands (  )  const [inline]

Get number of islands in the sub-region.

Returns:
Number of islands in the sub-region
XMLNODE* SUBREGION2D::GetXML ( XMLNODE parentnode,
const char *  nodename = "SubRegion" 
) const

Get XML representation.

Parameters:
parentnode Parent node
nodename Node name
ERRVALUE SUBREGION2D::Intersect ( const SUBREGION2D SubRegion,
MILIST< SUBREGION2D > &  SubRegionList 
)

Intersect an specified area against the sub-region If the "SubRegion" does not intersect with the sub-region area, 'this' will be set to empty.

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
ERRVALUE SUBREGION2D::Intersect ( const POLYLINE PolyLine,
MILIST< SUBREGION2D > &  SubRegionList 
)

Intersect an specified area against the sub-region If the polygon does not intersect the sub-region area, 'this' will be set to empty If the "PolyLine" passed in is invalid, this method will only use one of the valid polygons it finds, otherwise the results will be in error.

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
ERRVALUE SUBREGION2D::Intersect ( const DRECT2D Rect,
MILIST< SUBREGION2D > &  SubRegionList 
)

Intersect an specified rectangle area with the sub-region If the rectangle does not intersect with the sub-region area, 'this' will be set to empty.

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
ERRVALUE SUBREGION2D::IntersectValidated ( const POLYLINE PolyLine,
MILIST< SUBREGION2D > &  SubRegionList 
)

Intersect an specified area from the sub-region known to be valid A validated polygon is a polygon that does not intersect itself.

If the polygon does not intersect the sub-region area, 'this' will be set to empty

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
bool SUBREGION2D::IsEmpty (  )  const [inline]

Is the sub-region an empty sub-region.

bool SUBREGION2D::IsEquivalentTo ( const SUBREGION2D rhs,
double  threshold = 0.0 
) const

Determine if the two subregions are equivalent This method uses "Fuzzy" vertex comparisons and the direction and order of the elements are not relevant Specify a different threshold to allow greater distances.

Returns:
'True' if they are, 'False' if not
Parameters:
threshold Default threshold is max absolute value of rectangle coordinate * 1.0E-13
bool SUBREGION2D::IsPointInside ( const DPOINT2D point  )  const

Determine if the point falls inside the sub-region.

Returns:
'True' if point is inside the sub-region, 'false' if not
bool SUBREGION2D::IsRectangle (  )  const [inline]

Is the sub-region a simple rectangle region?

SUBREGION2D& SUBREGION2D::operator= ( const DRECT3D rhs  ) 

Assignment operator from 3d rectangle.

SUBREGION2D& SUBREGION2D::operator= ( const DRECT2D rhs  ) 

Assignment operator from rectangle.

SUBREGION2D& SUBREGION2D::operator= ( const SUBREGION2D rhs  ) 

Assignment operator.

void SUBREGION2D::RemoveIslands (  ) 

Remove all of the islands from the subregion.

void SUBREGION2D::Reverse (  ) 

Reverse the orientation of the polygons and islands in the subregion.

void SUBREGION2D::SetDimension ( DIMENSION  dim  ) 

Set the dimension of the points stored in 'this' as 2D or 3D vertices.

void SUBREGION2D::SetOrientation ( ORIENTATION  Orientation  ) 

Set subregion orientation Outer shell polygon is set to the orientation specified in respect to itself.

Islands are set in the opposite orientation in respect to themselves

ERRVALUE SUBREGION2D::Subtract ( const DRECT2D IslandRect,
MILIST< SUBREGION2D > &  SubRegionList 
)

Remove an specified rectangle area from the sub-region If the island removes the entire sub-region area, 'this' will be set to empty.

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
ERRVALUE SUBREGION2D::Subtract ( const SUBREGION2D SubRegion,
MILIST< SUBREGION2D > &  SubRegionList 
)

Remove an specified area from the sub-region If the "SubRegion" removes the entire sub-region area, 'this' will be set to empty.

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
ERRVALUE SUBREGION2D::Subtract ( const POLYLINE Island,
MILIST< SUBREGION2D > &  SubRegionList 
)

Remove an specified area from the sub-region If the island removes the entire sub-region area, 'this' will be set to empty If the "Island" passed in is invalid, this method will only use one of the valid polygons it finds, otherwise the results will be in error.

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
ERRVALUE SUBREGION2D::SubtractValidated ( const POLYLINE Island,
MILIST< SUBREGION2D > &  SubRegionList,
double  ConflateThreshold 
)

Remove an specified area from the sub-region known to be valid A validated polygon is a polygon that does not intersect itself.

If the island removes the entire sub-region area, 'this' will be set to empty

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
ERRVALUE SUBREGION2D::SubtractValidated ( const POLYLINE Island,
MILIST< SUBREGION2D > &  SubRegionList 
)

Remove an specified area from the sub-region known to be valid A validated polygon is a polygon that does not intersect itself.

If the island removes the entire sub-region area, 'this' will be set to empty

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
POLYLINE::COMPRESULT SUBREGION2D::TestLine ( const POLYLINE PolyLine  )  const

Test the line against the sub-region.

Returns:
POLYLINE::COMPRESULT
bool SUBREGION2D::TestLine ( const POLYLINE PolyLine,
TESTCRITERIA  TestCriteria 
) const

Test the line given the test criteria against the sub-region.

Returns:
"True" if the line meets the criteria, "false" if not
bool SUBREGION2D::TestPoint ( const DPOINT2D Point,
TESTCRITERIA  TestCriteria 
) const

Test the point given the test criteria against the sub-region.

Returns:
"True" if the point meets the criteria, "false" if not
POLYLINE::COMPRESULT SUBREGION2D::TestPolygon ( const POLYLINE PolyLine  )  const

Test the polygon against the sub-region.

Returns:
POLYLINE::COMPRESULT
bool SUBREGION2D::TestPolygon ( const POLYLINE PolyLine,
TESTCRITERIA  TestCriteria 
) const

Test the polygon given the test criteria against the sub-region.

Returns:
"True" if the polygon meets the criteria, "false" if not
POLYLINE::COMPRESULT SUBREGION2D::TestSubRegion ( const SUBREGION2D SubRegion  )  const

Test the subregion against 'this'.

Returns:
POLYLINE::COMPRESULT
bool SUBREGION2D::TestSubRegion ( const SUBREGION2D SubRegion,
TESTCRITERIA  TestCriteria 
) const

Test the subregion given the test criteria against 'this'.

Returns:
"True" if the subregion meets the criteria, "false" if not
ERRVALUE SUBREGION2D::Union ( const SUBREGION2D SubRegion,
MILIST< SUBREGION2D > &  SubRegionList,
POLYLINE::COMBINERESULT CombineResult 
)

Union (ADD) a sub-region to the sub-region.

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
ERRVALUE SUBREGION2D::Union ( const POLYLINE PolyLine,
MILIST< SUBREGION2D > &  SubRegionList 
)

Union (ADD) a Polygon to the sub-region.

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
ERRVALUE SUBREGION2D::Union ( const DRECT2D Rect,
MILIST< SUBREGION2D > &  SubRegionList,
POLYLINE::COMBINERESULT CombineResult 
)

Union (ADD) a rectangle to the sub-region.

Parameters:
SubRegionList Filled in if operation creates more than one sub-region
ERRVALUE SUBREGION2D::UnionValidated ( const POLYLINE PolyLine,
MILIST< SUBREGION2D > &  SubRegionList,
POLYLINE::COMBINERESULT CombineResult 
)

Union (ADD) a polygon to the sub-region.

Parameters:
SubRegionList Filled in if operation creates more than one sub-region

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

Generated on Sun Oct 7 21:33:54 2012 for TNTsdk 2012 by  doxygen 1.6.1