![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
This class provides an interface to the contouring functionality of the Terrain SDK. It can be used to generate contour lines from arbitrary data provided to it in the form of TSLTerrainContourVertexes.
Rendering of the contour lines is entirely dictated by the client due to the use of rendering callbacks. Client provided callback methods are invoked for each calculated contour line, leaving the appearence of the contours entirely up to the user.
Public Member Functions | |
TSLTerrainContour () | |
void | clearNullValue () |
void | contourSmoothing (bool enable) |
void | destroy () |
bool | drawContourLine (int attributeLevel, double attribute, TSLTerrainContourLineType contourType=TSLTerrainContourLineTypeStandard, const char *textPrefix=0, TSLVerticalAlignment textAlignment=TSLVerticalAlignmentMiddle, int textWidth=0) |
bool | drawContourPolygon (int attributeLevel, double minAttribute, double maxAttribute) |
void | drawTIN (int attributeLevel, double attribute) |
TSLTerrainContourVertexList * | getVertices () |
void | notifyChanged () |
TSLTerrainReturn | process (TSLTerrainContourLineType type, int attributeLevel, double attribute, bool qualityMesh=true, double maxError=0.0) |
TSLTerrainContourBaseCallbacks * | setCallbackHandler (TSLTerrainContourBaseCallbacks *handler) |
void | setNullValue (double nullValue, double nullError=0.01) |
void | setVertices (TSLTerrainContourVertexList *vertexList) |
void * | operator new (size_t size) |
void | operator delete (void *mem, size_t s) |
void * | operator new (size_t size, char *filename, int line) |
TSLTerrainContour::TSLTerrainContour | ( | ) |
Default constructor.
void TSLTerrainContour::clearNullValue | ( | ) |
Clears the currently set NULL value.
After the NULL value is cleared, the contouring algorithm does not stop at any value.
void TSLTerrainContour::contourSmoothing | ( | bool | enable | ) |
Enables or disables smoothing of contour lines. The default is not to smooth contour lines.
void TSLTerrainContour::destroy | ( | ) |
Deletes this object. This method should be called instead of deleting the contour object.
bool TSLTerrainContour::drawContourLine | ( | int | attributeLevel, |
double | attribute, | ||
TSLTerrainContourLineType | contourType = TSLTerrainContourLineTypeStandard, | ||
const char * | textPrefix = 0, | ||
TSLVerticalAlignment | textAlignment = TSLVerticalAlignmentMiddle, | ||
int | textWidth = 0 ) |
Draws contour lines using the specified algorithm and data provided in the setVertex() method.
Note that text labels will only be generated when using the TSLContourType Standard algorithm.
attributeLevel | Index from the attribute list of the vertices to use when contouring. For data with multiple attributes this allows selection of the group of attribute data to use for the contouring process. |
attribute | The value of the attribute in the data for which to draw the contour lines. |
contourType | A member of the TSLContourType enumeration specifying which algorith to use to generate the contour lines. |
textPrefix | Text prefix to pass to the text rendering callback. |
textAlignment | Where to display the text labels in relation to the contour lines. If the value is TSLVerticalAlignmentMiddle then the contour lines will be split to accomodate the labels. |
textWidth | Maximum width of the text labels in the units of the vertex data. This parameter is ignored if textAlignment is not TSLVerticalAlignmentMiddle. |
bool TSLTerrainContour::drawContourPolygon | ( | int | attributeLevel, |
double | minAttribute, | ||
double | maxAttribute ) |
Draws contour polygons using the data provided in the setVertex() method.
attributeLevel | Index from the attribute list of the vertices to use when contouring. For data with multiple attributes this allows selection of the group of attribute data to use for the contouring process. |
minAttribute | The lowest attribute value to include in the generated polygons. |
maxAttribute | The highest attribute value to include in the generated polygons. |
void TSLTerrainContour::drawTIN | ( | int | attributeLevel, |
double | attribute ) |
Draws point generated from the TIN (Triangulated Irregular Network) model. This method shows the triangles generated rather than the result of processing these into contour lines.
attributeLevel | Index from the attribute list of the vertices to use when contouring. For data with multiple attributes this allows selection of the group of attribute data to use for the contouring process. |
attribute | The value of the attribute in the data for which to draw the contour lines. |
TSLTerrainContourVertexList * TSLTerrainContour::getVertices | ( | ) |
Returns the current vertex list held by the contour object. The contour object still retails ownership of the list and so it should not be deleted by the user.
If the contents of the vertex list is modified after the grids have been generated by calling process() or any of the draw methods, then the notify Changed() method should be called to inform the library that it should discard any precalculated information regarding the generated contours.
Returns the vertex list held by the contour object, or NULL if it currently has no list.
void TSLTerrainContour::notifyChanged | ( | ) |
Informs the contouring library that the vertex data it holds has been modified and that it should discard any precalculated contour data. The data will be regenerated based on the new vertex data on the next call to process() or any of the draw() methods.
void TSLTerrainContour::operator delete | ( | void * | mem, |
size_t | s ) |
void * TSLTerrainContour::operator new | ( | size_t | size | ) |
void * TSLTerrainContour::operator new | ( | size_t | size, |
char * | filename, | ||
int | line ) |
When included in an MFC application in debug mode, the debug new expects this to be here. Override it and return the same as the normal one. The library must include it when compiled in release mode, since the user's application may be in debug mode.
TSLTerrainReturn TSLTerrainContour::process | ( | TSLTerrainContourLineType | type, |
int | attributeLevel, | ||
double | attribute, | ||
bool | qualityMesh = true, | ||
double | maxError = 0.0 ) |
Precalculates information needed for the contouring operations from the data provided in setVertices. Calling this function means that the data necessary to perform a contouring operation has already been generated prior to a call to either drawContourLine() or drawContourPolygon(), reducing the time the drawing operation takes to complete.
When called with the type parameter as TSLContourLineTypeStandard or TSLContourLineTypeSimple this method will generate the TIN needed to generate contour lines for these algorithms. When called with TSLContourLine TypeCONREC this will generate the necessary intermediate values for calculating contour lines with this algorithm in addition to precalculating the contour lines for the attribute level and attribute specified.
Note that invoking this method is optional. If it is not called then the draw() methods will perform the necessary calculations themselves.
attributeLevel | attributeLevel: Index from the attribute list of the vertices to use when contouring. For data with multiple attributes this allows selection of which group of attribute data to use for the contouring process. |
attribute | The value of the attribute in the data for which to draw the contour lines. |
type | which type of contour operation to prepare for. |
qualityMesh | if this flag is true the generated TIN will be a quality mesh. Only used when type is set to TSLContourTypeSimple or TSLContourLineType Standard. |
maxError | if the maximum error is greater than 0.0 the TIN is thinned so that only enough points to generate a TIN with a greatest point error equal to this value. Only used when type is set to TSLContourLineTypeSimple or TSLContourLineTypeStandard. |
TSLTerrainContourBaseCallbacks * TSLTerrainContour::setCallbackHandler | ( | TSLTerrainContourBaseCallbacks * | handler | ) |
Sets the callback handler to use.
If a class derived from TSLTerrainContourCallbacks or TSLTerrainContour GeometryCallbacks is set then callbacks are invoked from the process(), draw ContourLine(), drawContourPolygon() and drawTIN() methods.
handler | Pointer to a class that implements the TSLTerrainContourCallbacks interface. Pass NULL to clear an existing callback handler. |
void TSLTerrainContour::setNullValue | ( | double | nullValue, |
double | nullError = 0.01 ) |
Sets the NULL value for the contouring algorithm. Contours will not be displayed through planes containing NULL values. Only one NULL value can be defined at any one time.
nullValue | Value to be considered NULL. |
nullError | Amount of deviation from NULL value to be considered NULL. For avoiding rounding errors. |
void TSLTerrainContour::setVertices | ( | TSLTerrainContourVertexList * | vertexList | ) |
Set the vertices for the grid. The contour object assumes ownership of the vertex list.
vertexList | The vertex list to set. Pass NULL to clear an existing vertex list. |