![]() |
VR-Forces 4.8 Class Documentation
|
Features are usually accessed using the following process:
The following example shows the entire process. It prints the attributes on each point building feature within a given area. Each step is discussed in greater detail in subsequent sections.
Feature data is accessed in the API through the DtTerrainInterface object. The DtTerrainInterface allows feature sets to be accessed using the following functions:
These functions return sets of features, using the "type" string to determine what type of features should be included - for example "MAK_ROAD" or "MAK_OBSTACLE". See ./appData/settings/featureconfig.txt for the available feature type strings.
Once a feature set has been acquired, it can be filtered using DtQuery objects, with which the user can cause matching features to be loaded.
This function returns a set of obstacle features - features that have been configured to be obstacle objects. All obstacle features have a "footprint" geometry - an areal geometry representing the 2-dimensional footprint of the feature. This is either taken directly from the original feature geometry or, if the feature is a point feature, it is generated from the feature's length, width, and rotation.
This function returns a set of path features, or linear features that can be used for path planning.
This function returns the set of all features, which can then be filtered with specific queries.
Once a feature set has been acquired, you can filter it using a DtQuery object. DtQuery objects can be constructed through code like this (taken from the addSensorPropagator example):
Once the query object is created, it can be applied to the feature set using the filter function:
To iterate over the features in a feature set, use the forEachFeature() function. forEachFeature() can be called using any bound function, or using a functor:
Features are composed of 1 or more geometries, along with 1 or more attributes. Attributes are looked up by name, and will have integer, double, or string values. Individual feature attributes can be accessed using the attributeAs() function:
To iterate over all attributes, use the forEachAttribute() function, as follows. This example is a simple object that takes a feature and prints out its attributes:
Each feature will contain at least one DtFeatureGeometry object, accessed via the geometry() function. The DtFeatureGeometry object contains the point(s) that make up the geometry, the projection the geometry is in, as well as various utility functions for relating geometries.
DtFeatureGeometry objects can be created using static functions in the DtFeatureGeometry class, most of which require a DtProj object, a VR-Forces wrapper for the proj library. This object is integrated with the existing VR-Forces Coordinate System classes, in that a DtProj object can be accessed from any Coordinate_System object, and new DtProj objects can be created using Coordinate_System objects. Here is an example that tests whether a feature's geometry intersects the geodetic origin:
The sim's current "Local" projection can be acquired from the DtTerrainInterface:
[<< Terrain Implementations] [Home] [Top of Page] [Dynamic Terrain Network Interface >>]