SDTS_AL
Public Member Functions | Public Attributes | List of all members
SDTSRawPolygon Class Reference

#include <sdts_al.h>

Inheritance diagram for SDTSRawPolygon:
SDTSFeature

Public Member Functions

int AssembleRings ()
 
virtual void Dump (FILE *) override
 

Public Attributes

int nRings
 
int nVertices
 
int * panRingStart
 
double * padfX
 
double * padfY
 
double * padfZ
 
- Public Attributes inherited from SDTSFeature
SDTSModId oModId
 
int nAttributes
 
SDTSModIdpaoATID
 

Detailed Description

Class for holding information about a polygon feature.

When directly read from a polygon module, the polygon has no concept of its geometry. Just it's ID, and references to attribute records. However, if the SDTSLineReader::AttachToPolygons() method is called on the module containing the lines forming the polygon boundaries, then the nEdges/papoEdges information on the SDTSRawPolygon will be filled in.

Once this is complete the AssembleRings() method can be used to fill in the nRings/nVertices/panRingStart/padfX/padfY/padfZ information defining the ring geometry.

Note that the rings may not appear in any particular order, nor with any meaningful direction (clockwise or counterclockwise).

Member Function Documentation

◆ AssembleRings()

int SDTSRawPolygon::AssembleRings ( )

This method will assemble the edges associated with a polygon into rings, returning FALSE if problems are encountered during assembly.

Form border lines (arcs) into outer and inner rings.

See SDTSPolygonReader::AssemblePolygons() for a simple one step process to assembling geometry for all polygons in a transfer.

This method will assemble the lines attached to a polygon into an outer ring, and zero or more inner rings. Before calling it is necessary that all the lines associated with this polygon have already been attached. Normally this is accomplished by calling SDTSLineReader::AttachToPolygons() on all line layers that might contain edges related to this layer.

This method then forms the lines into rings. Rings are formed by:

  1. Take a previously unconsumed line, and start a ring with it. Mark it as consumed, and keep track of its start and end node ids as being the start and end node ids of the ring.
  2. If the rings start id is the same as the end node id then this ring is completely formed, return to step 1.
  3. Search all unconsumed lines for a line with the same start or end node id as the rings current node id. If none are found then the assembly has failed. Return to step 1 but report failure on completion.
  4. Once found, add the line to the current ring, dropping the duplicated vertex and reverse order if necessary. Mark the line as consumed, and update the rings end node id accordingly.
  5. go to step 2.

Once ring assembly from lines is complete, another pass is made to order the rings such that the exterior ring is first, the first ring has counter-clockwise vertex ordering and the inner rings have clockwise vertex ordering. This is accomplished based on the assumption that the outer ring has the largest area, and using the +/- sign of area to establish direction of rings.

Returns
TRUE if all rings assembled without problems or FALSE if a problem occurred. If a problem occurs rings are still formed from all lines, but some of the rings will not be closed, and rings will have no particular order or direction.

◆ Dump()

void SDTSRawPolygon::Dump ( FILE *  )
overridevirtual

Dump readable description of feature to indicated stream.

Implements SDTSFeature.

Member Data Documentation

◆ nRings

int SDTSRawPolygon::nRings

Number of rings in assembled polygon.

◆ nVertices

int SDTSRawPolygon::nVertices

Total number of vertices in all rings of assembled polygon.

◆ padfX

double* SDTSRawPolygon::padfX

List of nVertices X coordinates for the polygon (split over multiple rings via panRingStart.

◆ padfY

double* SDTSRawPolygon::padfY

List of nVertices Y coordinates for the polygon (split over multiple rings via panRingStart.

◆ padfZ

double* SDTSRawPolygon::padfZ

List of nVertices Z coordinates for the polygon (split over multiple rings via panRingStart. The values are almost always zero.

◆ panRingStart

int* SDTSRawPolygon::panRingStart

Offsets into padfX/padfY/padfZ for the beginning of each ring in the polygon. This array is nRings long.


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