|
|
MapGuide API Extensions v5.0 |
TIN/Contour ControlThe TIN/Contour Control is an ActiveX component that extends the capability of the MapGuide Viewer API by enabling the development of applications that require the TIN generation and contouring. The Control provides a set of public methods that enable the developer to:
The control appears as a clickable button:
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 TIN/Contour About Dialog:
The control allows display of the coordinates of the points selected to generate the TIN, as well as some of the parameters related to TIN and contour generation:
The control also allows display of the last object loaded into memory, whether it is a node, arc or polygon in the TIN, or a contour line. The following graphic portrays the attributes of a TIN polygon:
Loading the ControlInstructions for implementing the control on web pages are provided with the Toolkit documentation.
Parameters
TIN Generation and ContouringThe general sequence of steps for creating a TIN and contouring are as follows:
To obtain the geometry of each contour line created:
A similar process may be used to retrieve the nodes, arcs and polygons of the TIN. The number of objects of a particular type may be obtained by one of the four getNumXXXX() methods. The object with a particular index may then be set as the current object in the Control by one of the four 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:
The key value assigned to nodes, arcs and polygons in the TIN, and to contour lines, is equivalent to the index location of the object in its respective list. The name value assigned to the nodes is controlled by the setNodeNameOut() method: the name may be either the original key value of the input point (or points in the case of shared X,Y locations), or the Z value. The name value assigned to arcs is the index values of its start and end nodes, separated by the ID Delimiter defined by setIDDelimiter(). For example, if an arc starts at node 17 and ends at node 32, then its name will be "17:32". The name value assigned to a TIN polygon is defined by the setPolygonNameOut method. The name may be either the index values of its three arcs or its three nodes, ordered in a counter-clockwise manner, with each index separated by the ID Delimiter. For example, a polygon name based on arcs may be "13:-25:42"; note that the arcs are directed. The name value assigned to a contour line is its Z value. When computing the TIN, if more than one input point shares the same location, then the Z values of the points are averaged and the keys are appended to form a new key; the separator between the original key values is specified with the setIDDelimiter(). For example, if the ID Delimiter was set to ":" and points with key values of "13" and "6" share the same location, then the resultant key will be "13:6". Points are the X,Y,Z values that are input; nodes are the X,Y,Z values that constitute the TIN. Thus, the number of nodes in the result may not equal the number of input points. The Z value may be altered before and/or after a TIN has been generated. In some applications, it may be necessary to generate the TIN once, then alter the Z values of the nodes in order to contour different attributes. In such cases, the setNodeZValueByKey() method may be used in order to adjust each point's/node's Z value. Remember, if two or more points shared the same location, then the resultant node will have the keys of each of the originating points. The setDefaultZValue() method allows the user to assign a value that will be assigned to input points/nodes in cases where no Z value has been provided for the point. The setInvalidZValue() performs a similar function; however, a node that is assigned such a value is an Invalid node that will be used in TIN generation but will not be used for contouring. When points share the same location, if one point has an Invalid Z value, then the resultant node will also be assigned an Invalid Z value. The number of Invalid points may be obtained by getNumInvalidPoints(). The key of the Nth Invalid point may be retrieved by the getInvalidPointKey() method; a subsequent call to setNodeZValueByKey() can be used to establish a valid Z value for the point/node. 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:
MethodsA complete list of the public methods is provided with the Toolkit documentation. |
|||
| © 2002, Hunter GIS |