MapGuide API Extensions v5.0

 

Thiessen Control

The Thiessen Control is an ActiveX component that extends the capability of the MapGuide Viewer API by enabling the development of applications that require the generation of Thiessen polygons, also referred to as the Voronoi tessallation. The Control provides a set of public methods that enable the developer to:

  • establish the points around which to construct the Thiessen Polygons,
  • set parameters related to construction of the polygons,
  • generate the polygons,
  • retrieve the coordinates of the polygons or the arcs that form the polygons.

The control appears as a clickable button:

HgisThiessen

The button may be sized through the BoxWidth and BoxHeight parameters while the label is set through the ButtonLabel parameter. Clicking on the button pulls up the Thiessen About Dialog:

HgisThiessenMenu

The control allows display of the coordinates of the points selected to generate the Thiessen Polygons, as well as the number of arcs and polygons generated by the analysis:

HgisThiessenListPnts

The control also allows the display of the coordinates of the nodes, arcs and polygons generated by the analysis:

HgisThiessenListVerts

Loading the Control

Instructions for implementing the control on web pages are provided with the Toolkit documentation.

Parameters

Name Description
AboutDlgStatus Toggles the ability to display the About Dialog Box by clicking on the Control. A value of "0" prevents the display of the Dialog, while a value of "1" enables display (Default: "1" )
ButtonLabel The label to appear on the button (Default: "Hgis Thiessen" )
BoxWidth The width of the control in Twips (Default: 1500 Minimum: 200 )
BoxHeight The height of the control in Twips (Default: 500 Minimum: 50 )

Thiessen Polygon Analysis

The general sequence of steps for performing Thiessen Polygon Analysis are as follows:

  • ensure that the coordinates of objects on the point layer to be analyzed can be accessed (validatePassword())
  • submit the points to be analyzed one at at time (addPointsXY() or as a collection of point objects (addPointsAsCollection())
  • set parameters for the analysis, including the type of coordinates, maximum number of points, and whether arcs will be generated (in addition to polygons)
  • undertake the analysis (calculateThiessen())
  • to obtain the geometry of each polygon created:
    • obtain the number of polygons generated (getNumPolygons())
    • for each polygon:
      • set the nth polygon as the current object in the Control (setObjectAsPolygonAt())
      • retrieve the key and name (getObjectKey() and getObjectName())
      • retrieve the number of internal objects in the polygon (getObjectNumObjects())
      • retrieve a collection of the vertice counts of the internal objects (getObjectNumVerts())
      • retrieve a collection of the vertices of the internal objects (getObjectVertices())
A similar process may be used to retrieve the node and arcs generated in the analysis. The number of objects of a particular type may be obtained by one of the three getNumXXXX() methods. The object with a particular index may then be set as the current object in the Control by one of the three setObjectAsXXXXAt() methods. Once an object has been set as the current object, the following commands may be issued to transfer the information from the Control to the application:
  • getObjectKey()
  • getObjectName()
  • getObjectType()
  • getObjectMinX()
  • getObjectMinY()
  • getObjectMaxX()
  • getObjectMaxY()
  • getObjectNumObjects()
  • getObjectNumVerts()
  • getObjectVertices()

It is important to bear in mind the types of coordinates that are being sent to the Control's methods, which is defined by the setCoordType() method:

  • 0 - coordinates are in latitude/longitude
     
  • 1 - coordinates are in MCS units
The getVertices() method of the MGMapObject class of the MapGuide Viewer API returns coordinates in MCS units, while the getExtents() method and the digitizing methods, return coordinates in latitude/longitude. All coordinates passed to the Control must either be in MCS units or latitude/longitude, as defined by setCoordType().

When computing the Thiessen polygons, if more than one input point shares the same location, then only the first point encountered will be retained. Points are the X,Y values that are input; nodes are the X,Y values that are output. Thus, the number of nodes in the result may not equal the number of input points.

The name value assigned to nodes, arcs and polygons is equivalent to its index value or location within the node, arc or polygon lists. The name value should actually be assigned as an object's key value, as it is guaranteed to be unique for a particular object type. The key value assigned to a node is the same as assigned to the input point. As a node falls within a polygon, and each polygon contains only one node, the node and polygon are assigned the same key value. The key value of an arc is defined as the name values of the polygons on the left and right of the directed arc. For example, "13/6", indicates that when traversing the arc from its head to tail, polygon with name=13 on the left, and polygon with name=6 is on the right.

Methods

A complete list of the public methods is provided with the Toolkit documentation.

 © 2002, Hunter GIS