vtlib library
Public Member Functions | List of all members
vtContourConverter Class Reference

Public Member Functions

vtGeodeSetup (vtTerrain *pTerr, const RGBf &color, float fHeight)
 Setup to generate geometry directly on a terrain. More...
 
bool Setup (vtTerrain *pTerr, vtFeatureSetLineString *fset)
 Setup to generate line features. More...
 
void GenerateContour (float fAlt)
 
void GenerateContours (float fAInterval)
 
void Finish ()
 

Detailed Description

This class provides the ability to easily construct contour lines on a terrain. It does so by calling the QuikGrid library to generate contour vectors, then converts those vectors into 3D line geometry draped on the terrain.

Here is an example of how to use it:
cc.Setup(pTerrain, RGBf(1,1,0), 10);
cc.Finish();
Or, you can generate specific contour lines:
cc.Setup(pTerrain, RGBf(1,1,0), 10);
cc.Finish();
If you keep a pointer to the geometry, you can toggle or delete it later:
vtGeode *geode = cc.Setup(pTerrain, RGBf(1,1,0), 10);
[...]
geom->SetEnabled(bool); // set visibility
[...]
pTerrain->GetScaledFeatures()->RemoveChild(geom);
geom->Release(); // delete

Member Function Documentation

void vtContourConverter::Finish ( )

Finishes the contour generation process. Call once when you are done using the class to generate contours.

void vtContourConverter::GenerateContour ( float  fAlt)

Generate a contour line to be draped on the terrain.

Parameters
fAltThe altitude (elevation) of the line to be generated.
void vtContourConverter::GenerateContours ( float  fInterval)

Generate a set of contour lines to be draped on the terrain.

Parameters
fIntervalThe vertical spacing between the contours. For example, if the elevation range of your data is from 50 to 350 meters, then an fIterval of 100 will place contour bands at 100,200,300 meters.
vtGeode * vtContourConverter::Setup ( vtTerrain pTerr,
const RGBf color,
float  fHeight 
)

Set up the class to create geometry on a terrain.

Parameters
pTerrThe terrain you will generate the contour lines on.
colorThe colors of the generated lines.
fHeightThe height above the terrain to drape the lines. Generally you will want to use a small offset value here, to keep the lines from colliding with the terrain itself.
Returns
A geometry node which contains the contours.
bool vtContourConverter::Setup ( vtTerrain pTerr,
vtFeatureSetLineString fset 
)

Set up the class to create line features on a terrain.

Parameters
pTerrThe terrain you will generate the contour lines on.
fsetThe featureset to receive the polylines.
Returns
True if successful.