REGION2D Class Reference

Container for generic 2D region in memory. More...

#include <mi32/region2d.h>

List of all members.

Classes

class  COPYFILTER
 Filter for copying region. More...

Public Types

typedef
SUBREGIONLIST::CONST_ITERATOR 
CONST_ITERATOR

Public Member Functions

 REGION2D (const POLYLINELIST &)
 REGION2D (const SUBREGION2D &SubRegion)
 REGION2D (const DRECT2D &rhs)
 REGION2D (const REGION2D &rhs)
 REGION2D ()
 ~REGION2D ()
void AddLine (const POLYLINE &PolyLine)
void AddLines (const POLYLINELIST &LineList)
void AddPoint (const DPOINT3D &Point)
void AddPoints (const POLYLINE &points)
void AddSubRegion (const SUBREGION2D &SubRegion)
ERRVALUE Assign (const POLYLINE &PolyLine, const SIMPLE_ARRAY< INT32 > &Index)
ERRVALUE AssignFromXML (const XMLNODE *topnode)
CONST_ITERATOR Begin () const
void Clear ()
void ClearCoordRefSys ()
int ClipLine (POLYLINE &PolyLine, POLYLINE::CLIP &ClipTarget, CLIPMODE ClipMode=CLIPMODE_Inside) const
double ComputeArea () const
double ComputeAreaNoIslands () const
void ComputeCentroid (DPOINT3D &centroid) const
ERRVALUE ComputeExpansion (const double Distance, REGION2D &Expansion) const
ERRVALUE ComputePerimeter (double &result, SPATREF::COORDREFSYS::MEASUREMETHOD method, UOM::IDNUM LengthUnitIdNum=UOM::IDNUM_Length_Meter) 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 ConvertTo (const SPATREF::COORDREFSYS &DestCoordRefSys, double tolerance=0.0)
ERRVALUE CopyTo (REGION2D &target, COPYFILTER &filter) const
void DumpCoords (MISTRING &result, int indent, bool maxprec=false) const
CONST_ITERATOR End () const
ERRVALUE ExclusiveUnion (const REGION2D &RegionA, const REGION2D &RegionB)
ERRVALUE ExclusiveUnion (const REGION2D &RegionB)
ERRVALUE Expand (const double Distance)
const SPATREF::COORDREFSYSGetCoordRefSys () const
const DRECT3DGetExtents () const
const DRECT2DGetExtents2D () const
const POLYLINELISTGetLineList () const
INT32 GetNumLines () const
INT32 GetNumPoints () const
INT32 GetNumSubRegions () const
const POLYLINEGetPointList () const
const SUBREGIONLISTGetSubRegionList () const
XMLNODEGetXML (XMLNODE *parentnode, const char *nodename="Region") const
bool HasLines () const
bool HasPoints () const
bool HasSubRegions () const
ERRVALUE Intersect (const REGION2D &RegionA, const REGION2D &RegionB)
ERRVALUE Intersect (const REGION2D &RegionB)
ERRVALUE Intersect (const SUBREGION2D &SubRegion)
ERRVALUE Intersect (const POLYLINE &PolyLine)
ERRVALUE Intersect (const DRECT2D &Rect)
ERRVALUE IntersectValidated (const POLYLINE &PolyLine)
bool IsEmpty () const
bool IsEquivalentTo (const REGION2D &rhs, double threshold=0.0) const
bool IsPointInside (const DPOINT2D &point) const
bool IsRectangle () const
ERRVALUE NormalizeToCRS ()
REGION2Doperator= (const SUBREGION2D &SubRegion)
REGION2Doperator= (const DRECT3D &rhs)
REGION2Doperator= (const DRECT2D &rhs)
REGION2Doperator= (const REGION2D &rhs)
void RemoveIslands ()
void Reverse ()
void SetCoordRefSys (const SPATREF::COORDREFSYS &CoordSysRef)
void SetDimension (DIMENSION dim)
void SetOrientation (ORIENTATION Orientation)
void SetZRange (const DOUBLE_RANGE &range)
ERRVALUE Subtract (const REGION2D &RegionA, const REGION2D &RegionB)
ERRVALUE Subtract (const REGION2D &RegionB)
ERRVALUE Subtract (const SUBREGION2D &SubRegion)
ERRVALUE Subtract (const POLYLINE &PolyLine)
ERRVALUE Subtract (const DRECT2D &Rect)
ERRVALUE SubtractValidated (const POLYLINE &PolyLine)
bool TestLine (const POLYLINE &PolyLine, TESTCRITERIA TestCriteria) const
bool TestPoint (const DPOINT2D &Point, TESTCRITERIA TestCriteria) const
bool TestPolygon (const POLYLINE &PolyLine, TESTCRITERIA TestCriteria) const
bool TestRegion (const REGION2D &Region, TESTCRITERIA TestCriteria) const
bool TestSubRegion (const SUBREGION2D &SubRegion, TESTCRITERIA TestCriteria) const
ERRVALUE Union (const REGION2D &RegionB)
ERRVALUE Union (const REGION2D &RegionA, const REGION2D &RegionB)
ERRVALUE Union (const SUBREGION2D &SubRegion)
ERRVALUE Union (const POLYLINE &PolyLine)
ERRVALUE Union (const DRECT2D &Rect)
ERRVALUE UnionValidated (const POLYLINE &PolyLine)

Detailed Description

Container for generic 2D region in memory.

A region has three basic component types, point, line and subregion, and can have zero or more of each type. A region may also be represented as a simple rectangle. The coordinate reference system SPATREF::COORDREFSYS for the component coordinates is contained also.


Member Typedef Documentation


Constructor & Destructor Documentation

REGION2D::REGION2D (  ) 

Default constructor, initializes to an invalid region.

REGION2D::REGION2D ( const REGION2D rhs  ) 

Copy constructor.

REGION2D::REGION2D ( const DRECT2D rhs  ) 

Constructor from DRECT2D.

REGION2D::REGION2D ( const SUBREGION2D SubRegion  ) 

Constructor from SUBREGION2D.

REGION2D::REGION2D ( const POLYLINELIST  ) 

Constructor from a list of polylines.

REGION2D::~REGION2D (  ) 

Destructor.


Member Function Documentation

void REGION2D::AddLine ( const POLYLINE PolyLine  ) 

Add a line to the region without validating it.

void REGION2D::AddLines ( const POLYLINELIST LineList  ) 

Add lines to region without validation.

void REGION2D::AddPoint ( const DPOINT3D Point  ) 

Add a point to the region without validating it.

void REGION2D::AddPoints ( const POLYLINE points  ) 

Add points without validation.

void REGION2D::AddSubRegion ( const SUBREGION2D SubRegion  ) 

Add a sub-region to the list without validating it.

ERRVALUE REGION2D::Assign ( const POLYLINE PolyLine,
const SIMPLE_ARRAY< INT32 > &  Index 
)

Assign from a POLYLINE and an index array defining how the polyline is formatted.

Parameters:
Index Each entry is the number of points >0 is shell <0 is island
ERRVALUE REGION2D::AssignFromXML ( const XMLNODE topnode  ) 

Assign from XMLNODE.

CONST_ITERATOR REGION2D::Begin (  )  const [inline]

Get the beginning of the list of SUBREGION's.

Returns:
Iterator to the beginning of the subregion list
void REGION2D::Clear (  ) 

Clear the region.

void REGION2D::ClearCoordRefSys (  ) 

Clear coordinate reference system.

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

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

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

Compute the region area in region units.

double REGION2D::ComputeAreaNoIslands (  )  const

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

void REGION2D::ComputeCentroid ( DPOINT3D centroid  )  const

Compute centroid of region.

If region has subregions, only they will be used in calculation, with weighting by area. Otherwise if region has lines, only they will be used, with weighting by length. Otherwise points will be used with equal weighting.

Parameters:
centroid Centroid returned
ERRVALUE REGION2D::ComputeExpansion ( const double  Distance,
REGION2D Expansion 
) const

Compute difference between expansion of current region by Distance and current region if Distance is positive Compute difference between current region and shrinkage of current region by Distance if Distance is negative Points and lines would be processed and not copied to result.

ERRVALUE REGION2D::ComputePerimeter ( double &  result,
SPATREF::COORDREFSYS::MEASUREMETHOD  method,
UOM::IDNUM  LengthUnitIdNum = UOM::IDNUM_Length_Meter 
) const

Compute the region perimeter using spatial reference measurement method.

This includes any lines that are part of the region

double REGION2D::ComputePerimeter (  )  const

Compute the region perimeter in region units This includes any lines that are part of the region.

double REGION2D::ComputePerimeterNoIslands (  )  const

Compute the region perimeter in region units but do not include sub-region islands in the calculation This includes any lines that are part of the region.

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

Translate the region using a coordinate operation (SPATREF::COORDOP) transformation Region coordinate reference system GetCoordRefSys()' must equate to the Op.GetSourceCRS().

The Op.GetTargetCRS() is assigned as the region's COORDREFSYS after the transformation.

ERRVALUE REGION2D::ConvertForward ( const TRANS2D_MAPGEN tmg  ) 

Translate the region using a mapgen transformation An error will occur if the COORDREFSYS of 'this' is not local and the TRANS2D_MAPGEN's input transformation is not identity or the COORDREFSYS of 'this' does not match the TRANS2D_MAPGEN's input COORDREFSYS.

If the TRANS2D_MAPGEN's output transformation is identity, 'this' COORDREFSYS will be set to the TRANS2D_MAPGEN's output COORDREFSYS. otherwise it will be set to "Undefined".

void REGION2D::ConvertForward ( const TRANS2D_AFFINE taf  ) 

Translate the region using an affine transformation If the COORDREFSYS of 'this' is set, it will be changed to "Undefined".

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

Translate the region using a coordinate operation (SPATREF::COORDOP) transformation with densification.

Region coordinate reference system GetCoordRefSys()' must equate to the Op.GetSourceCRS(). The Op.GetTargetCRS() is assigned as the region's COORDREFSYS after the transformation.

ERRVALUE REGION2D::ConvertForwardDense ( const TRANS2D_MAPGEN tmg  ) 

Translate the region using a mapgen transformation with densification An error will occur if the COORDREFSYS of 'this' is not local and the TRANS2D_MAPGEN's input transformation is not identity or the COORDREFSYS of 'this' does not match the TRANS2D_MAPGEN's input COORDREFSYS.

If the TRANS2D_MAPGEN's output transformation is identity, 'this' COORDREFSYS will be set to the TRANS2D_MAPGEN's output COORDREFSYS. otherwise it will be set to "Undefined".

ERRVALUE REGION2D::ConvertInverse ( const TRANS2D_MAPGEN tmg  ) 

Translate the region using a mapgen transformation.

An error will occur if the COORDREFSYS of 'this' is not local and the TRANS2D_MAPGEN's output transformation is not identity or the COORDREFSYS of 'this' does not match the TRANS2D_MAPGEN's output COORDREFSYS. If the TRANS2D_MAPGEN's input transformation is identity, 'this' COORDREFSYS will be set to the TRANS2D_MAPGEN's input COORDREFSYS otherwise it will be set to "Undefined".

void REGION2D::ConvertInverse ( const TRANS2D_AFFINE taf  ) 

Translate the region using an affine transformation.

If the COORDREFSYS of 'this' is set, it will be changed to "Undefined"

ERRVALUE REGION2D::ConvertInverseDense ( const TRANS2D_MAPGEN tmg  ) 

Translate the region using a mapgen transformation with densification.

An error will occur if the COORDREFSYS of 'this' is not local and the TRANS2D_MAPGEN's output transformation is not identity or the COORDREFSYS of 'this' does not match the TRANS2D_MAPGEN's output COORDREFSYS. If the TRANS2D_MAPGEN's input transformation is identity, 'this' COORDREFSYS will be set to the TRANS2D_MAPGEN's input COORDREFSYS. otherwise it will be set to "Undefined".

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

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

Region coordinate reference system must equate to the Op.GetTargetCRS(). The Op.GetSourceCRS() is assigned as the region's COORDREFSYS after the transformation.

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

Translate the region using a coordinate operation (SPATREF::COORDOP) transformation with densification.

Region coordinate reference system must equate to the Op.GetTargetCRS(). The Op.GetSourceCRS() is assigned as the region's COORDREFSYS after the transformation.

ERRVALUE REGION2D::ConvertTo ( const SPATREF::COORDREFSYS DestCoordRefSys,
double  tolerance = 0.0 
)

Convert 'this' to a different COORDREFSYS.

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

Copy region to specified target with filter.

Parameters:
target Target subregion
filter Filter to determine which subregions and islands to copy
void REGION2D::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 REGION2D::End (  )  const [inline]

Get the end of the list of SUBREGION's.

Returns:
End of SUBREGION list, see Begin() for details
ERRVALUE REGION2D::ExclusiveUnion ( const REGION2D RegionA,
const REGION2D RegionB 
)

Exclusive Union (XOR) RegionB with RegionA and place in 'this' Will convert 'this' to RegionA's SPATREF::COORDREFSYS.

ERRVALUE REGION2D::ExclusiveUnion ( const REGION2D RegionB  ) 

Exclusive Union (XOR) RegionB with 'this'.

ERRVALUE REGION2D::Expand ( const double  Distance  ) 

Expand current region by Distance if Distance is positive Shrink current region by Distance if Distance is negative Points and lines would be processed if expand and not copied to result.

const SPATREF::COORDREFSYS& REGION2D::GetCoordRefSys (  )  const [inline]

Get the region's coordinate reference system.

Returns:
SPATREF::COORDREFSYS of the region
const DRECT3D& REGION2D::GetExtents (  )  const [inline]

Get region extents.

Returns:
Extents of the entire region
const DRECT2D& REGION2D::GetExtents2D (  )  const [inline]

Get region extents.

Returns:
Extents of the entire region
const POLYLINELIST& REGION2D::GetLineList (  )  const [inline]

Get the POLYLINELIST of the line component of this region.

Returns:
The line component list
INT32 REGION2D::GetNumLines (  )  const [inline]

Get number of line components.

Returns:
Number of lines.
INT32 REGION2D::GetNumPoints (  )  const [inline]

Get number of point components.

Returns:
Number of points
INT32 REGION2D::GetNumSubRegions (  )  const [inline]

Get number of subregions.

Returns:
Number of subregions
const POLYLINE& REGION2D::GetPointList (  )  const [inline]

Get the POLYLINE of the point component of this region.

Returns:
The point component list
const SUBREGIONLIST& REGION2D::GetSubRegionList (  )  const [inline]

Get the SUBREGION2D of the subregion component of this region.

Returns:
The subregion component list
XMLNODE* REGION2D::GetXML ( XMLNODE parentnode,
const char *  nodename = "Region" 
) const

Get XML representation.

Parameters:
parentnode Parent node
nodename Node name
bool REGION2D::HasLines (  )  const [inline]

Determine if has any line components.

bool REGION2D::HasPoints (  )  const [inline]

Determine if has any point components.

bool REGION2D::HasSubRegions (  )  const [inline]

Determine if has any subregion components.

ERRVALUE REGION2D::Intersect ( const REGION2D RegionA,
const REGION2D RegionB 
)

Intersect RegionB with RegionA and place in 'this' Will convert 'this' to RegionA's SPATREF::COORDREFSYS.

ERRVALUE REGION2D::Intersect ( const REGION2D RegionB  ) 

Intersect RegionB with 'this'.

ERRVALUE REGION2D::Intersect ( const SUBREGION2D SubRegion  ) 

Intersect a sub-region with 'this'.

ERRVALUE REGION2D::Intersect ( const POLYLINE PolyLine  ) 

Intersect a polygon with 'this'.

ERRVALUE REGION2D::Intersect ( const DRECT2D Rect  ) 

Intersect rectangle with 'this'.

ERRVALUE REGION2D::IntersectValidated ( const POLYLINE PolyLine  ) 

Intersect a validated polygon with 'this'.

bool REGION2D::IsEmpty (  )  const [inline]

Is the region an empty region.

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

Determine if the two regions 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 REGION2D::IsPointInside ( const DPOINT2D point  )  const

Determine if the point falls inside the region.

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

Is the region a simple rectangle region?

ERRVALUE REGION2D::NormalizeToCRS (  ) 

Normalize region to range used for CRS if angular axis.

Will handle wrapping for X (longitude) axis and clipping for Y (latitude) axis. If CRS does not require normalization region will be unchanged.

REGION2D& REGION2D::operator= ( const SUBREGION2D SubRegion  ) 

Assignment from SUBREGION2D.

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

Assignment from DRECT3D.

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

Assignment from DRECT2D.

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

Assignment.

void REGION2D::RemoveIslands (  ) 

Remove all of the islands from the region.

void REGION2D::Reverse (  ) 

Reverse the orientation of the subregions in the region.

void REGION2D::SetCoordRefSys ( const SPATREF::COORDREFSYS CoordSysRef  )  [inline]

Set the region's coordinate reference system Does not do any transformations of the region, assumes that the region is in the system specified.

void REGION2D::SetDimension ( DIMENSION  dim  ) 

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

void REGION2D::SetOrientation ( ORIENTATION  Orientation  ) 

Set region orientation Each subregion is set using SUBREGION2D::SetOrientation().

void REGION2D::SetZRange ( const DOUBLE_RANGE range  ) 

Set the Z init and Z last fields of the extents box.

ERRVALUE REGION2D::Subtract ( const REGION2D RegionA,
const REGION2D RegionB 
)

Subtract RegionB from RegionA and place in 'this' Will convert 'this' to RegionA's SPATREF::COORDREFSYS.

ERRVALUE REGION2D::Subtract ( const REGION2D RegionB  ) 

Subtract RegionB from 'this'.

ERRVALUE REGION2D::Subtract ( const SUBREGION2D SubRegion  ) 

Subtract a sub-region from 'this'.

ERRVALUE REGION2D::Subtract ( const POLYLINE PolyLine  ) 

Subtract a polygon from 'this'.

ERRVALUE REGION2D::Subtract ( const DRECT2D Rect  ) 

Subtract rectangle from 'this'.

ERRVALUE REGION2D::SubtractValidated ( const POLYLINE PolyLine  ) 

Subtract a validated polygon from 'this'.

bool REGION2D::TestLine ( const POLYLINE PolyLine,
TESTCRITERIA  TestCriteria 
) const

Test the line given the test criteria against the region.

Returns:
"True" if the line meets the criteria, "false" if not
bool REGION2D::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
bool REGION2D::TestPolygon ( const POLYLINE PolyLine,
TESTCRITERIA  TestCriteria 
) const

Test the polygon given the test criteria against the region.

Returns:
"True" if the polygon meets the criteria, "false" if not
bool REGION2D::TestRegion ( const REGION2D Region,
TESTCRITERIA  TestCriteria 
) const

Test the 'Region' region given the test criteria against 'this' region.

Returns:
"True" if the 'Region' region meets the criteria, "false" if not
bool REGION2D::TestSubRegion ( const SUBREGION2D SubRegion,
TESTCRITERIA  TestCriteria 
) const

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

Returns:
"True" if the sub-region meets the criteria, "false" if not
ERRVALUE REGION2D::Union ( const REGION2D RegionB  ) 

Union (ADD) RegionB to 'this'.

ERRVALUE REGION2D::Union ( const REGION2D RegionA,
const REGION2D RegionB 
)

Union (ADD) RegionB to RegionA and place in 'this' Will convert 'this' to RegionA's SPATREF::COORDREFSYS.

ERRVALUE REGION2D::Union ( const SUBREGION2D SubRegion  ) 

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

ERRVALUE REGION2D::Union ( const POLYLINE PolyLine  ) 

Union (ADD) a polygon to 'this'.

ERRVALUE REGION2D::Union ( const DRECT2D Rect  ) 

Union (ADD) rectangle to 'this'.

ERRVALUE REGION2D::UnionValidated ( const POLYLINE PolyLine  ) 

Union (ADD) a validated polygon to 'this'.


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

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