Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

SDTSRawPolygon Class Reference

Class for holding information about a polygon feature. More...

#include <sdts_al.h>

Class diagram for SDTSRawPolygon:

SDTSFeature

List of all members.


Public Members

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

int nRings
Number of rings in assembled polygon.

int nVertices
Total number of vertices in all rings of assembled polygon.

int* panRingStart
Offsets into padfX/padfY/padfZ for the beginning of each ring in the polygon. More...

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

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

double* padfZ
List of nVertices Z coordinates for the polygon (split over multiple rings via panRingStart. More...


Detailed Description

Class for holding information about a polygon feature.

When directly read from a polygon module, the polygon has no concept of it's 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

int SDTSRawPolygon::AssembleRings ()

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

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 it's 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 occured. 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.

Member Data Documentation

int* SDTSRawPolygon::panRingStart

Offsets into padfX/padfY/padfZ for the beginning of each ring in the polygon.

This array is nRings long.

double* SDTSRawPolygon::padfZ

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

The values are almost always zero.


The documentation for this classwas generated from the following files:
Generated at Wed Sep 22 10:32:08 1999 for SDTS_AL by doxygen  written by Dimitri van Heesch, © 1997-1999