Container for generic 2D region in memory. More...
#include <mi32/region2d.h>
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.
| REGION2D::REGION2D | ( | ) |
Default constructor, initializes to an invalid region.
| REGION2D::REGION2D | ( | const REGION2D & | rhs | ) |
Copy constructor.
| REGION2D::REGION2D | ( | const SUBREGION2D & | SubRegion | ) |
Constructor from SUBREGION2D.
| REGION2D::REGION2D | ( | const POLYLINELIST & | ) |
Constructor from a list of polylines.
| REGION2D::~REGION2D | ( | ) |
Destructor.
| 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.
| Index | Each entry is the number of points >0 is shell <0 is island |
| CONST_ITERATOR REGION2D::Begin | ( | ) | const [inline] |
Get the beginning of the list of SUBREGION's.
| 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.
| 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.
| centroid | Centroid returned |
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.
| 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.
| 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.
Exclusive Union (XOR) RegionB with RegionA and place in 'this' Will convert 'this' to RegionA's SPATREF::COORDREFSYS.
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.
| const DRECT3D& REGION2D::GetExtents | ( | ) | const [inline] |
Get region extents.
| const DRECT2D& REGION2D::GetExtents2D | ( | ) | const [inline] |
Get region extents.
| const POLYLINELIST& REGION2D::GetLineList | ( | ) | const [inline] |
Get the POLYLINELIST of the line component of this region.
| INT32 REGION2D::GetNumLines | ( | ) | const [inline] |
Get number of line components.
| INT32 REGION2D::GetNumPoints | ( | ) | const [inline] |
Get number of point components.
| INT32 REGION2D::GetNumSubRegions | ( | ) | const [inline] |
Get number of subregions.
| const POLYLINE& REGION2D::GetPointList | ( | ) | const [inline] |
Get the POLYLINE of the point component of this region.
| const SUBREGIONLIST& REGION2D::GetSubRegionList | ( | ) | const [inline] |
Get the SUBREGION2D of the subregion component of this region.
Get XML representation.
| 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.
Intersect RegionB with RegionA and place in 'this' Will convert 'this' to RegionA's SPATREF::COORDREFSYS.
| ERRVALUE REGION2D::Intersect | ( | const SUBREGION2D & | SubRegion | ) |
Intersect a sub-region with 'this'.
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.
| 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.
| 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.
| 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.
Subtract RegionB from RegionA and place in 'this' Will convert 'this' to RegionA's SPATREF::COORDREFSYS.
| ERRVALUE REGION2D::Subtract | ( | const SUBREGION2D & | SubRegion | ) |
Subtract a sub-region from 'this'.
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.
| bool REGION2D::TestPoint | ( | const DPOINT2D & | Point, | |
| TESTCRITERIA | TestCriteria | |||
| ) | const |
Test the point given the test criteria against the sub-region.
| bool REGION2D::TestPolygon | ( | const POLYLINE & | PolyLine, | |
| TESTCRITERIA | TestCriteria | |||
| ) | const |
Test the polygon given the test criteria against the region.
| bool REGION2D::TestRegion | ( | const REGION2D & | Region, | |
| TESTCRITERIA | TestCriteria | |||
| ) | const |
Test the 'Region' region given the test criteria against 'this' region.
| bool REGION2D::TestSubRegion | ( | const SUBREGION2D & | SubRegion, | |
| TESTCRITERIA | TestCriteria | |||
| ) | const |
Test the sub-region given the test criteria against the region.
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.
Union (ADD) a validated polygon to 'this'.
1.6.1