![]() |
VR-Forces 5.0.3 Developer's Guide
|
DtDynamicTerrainRasterLibrary
This class is used to managed rasters and out-the-window images applied to osgEarth terrain layers for our crater implementation. These rasters may be applied to an osgEarth decal image layer as imagery; a decal elevation layer to deform the terrain skin; and a decal land cover layer to modify landcover.
DtDynamicTerrainRasterLibrary uses a number of maps to look up the necessary rasters based on data sent by VR - Forces to represent craters.The information conveyed that is used here is an effect type enumerant, which includes DtTerrainCraterElevationEffect, DtTerrainCraterSoilEffect, and DtTerrainCraterElevAndSoilEffect; a crater type string; a VR - Forces soil type enumerant, and a heading.
The effect type determines which osgEarth layers will be affected; different maps are used to look up rasters for different layers or, in the case of the out the window images, a different map for each effect type.
The rasters themselves will be read from disk using the DtOsgFileCache and stored as osg::images. Additional caches are provided within the library with maps that index from the input values to pointers to those osg::images. Cached images are rotated by the specified heading when requested.
The following maps for finding raster / image filenames are used:

Public Member Functions | |
| virtual | ~DtDynamicTerrainRasterLibrary () |
| virtual void | init () |
| virtual osg::ref_ptr< osg::Image > | getLandCoverRaster (osgEarth::LandCoverDictionary *landCoverDictionary, double &scaleFactorX, double &scaleFactorY, const std::string &craterType, int soilType, double heading=0.0) |
| virtual osg::ref_ptr< osg::Image > | getElevationRaster (double &scaleFactorX, double &scaleFactorY, const std::string &craterType, double heading=0.0) |
| virtual osg::ref_ptr< osg::Image > | getElevationOtwImage (double &scaleFactorX, double &scaleFactorY, const std::string &craterType, int soilType, double heading=0.0) |
| virtual osg::ref_ptr< osg::Image > | getLandCoverOtwImage (double &scaleFactorX, double &scaleFactorY, const std::string &craterType, int soilType, double heading=0.0) |
| virtual osg::ref_ptr< osg::Image > | getElevationAndLandCoverOtwImage (double &scaleFactorX, double &scaleFactorY, const std::string &craterType, int soilType, double heading=0.0) |
| osgEarth::GeoExtent | calculateNewExtent (const DtVector ¢erPoint, osg::ref_ptr< const osgEarth::SpatialReference > srs, double minorAxis, double majorAxis, double heading, double scaleFactorX, double scaleFactorY) |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| virtual | ~DtVirtualBaseClass () |
Static Public Member Functions | |
Static member accessors | |
| static std::string | defaultCraterType () |
| static std::string | defaultCraterImageFilename () |
| static std::string | defaultCraterElevationFilename () |
| static std::string | craterTypeToElevationMapFilename () |
| static std::string | craterTypeToLandCoverMapFilename () |
| static std::string | elevationOtwMapFilename () |
| static std::string | landCoverOtwMapFilename () |
| static std::string | elevationAndLandCoverOtwMapFilename () |
Protected Types | |
| typedef std::map< std::string, osg::ref_ptr< osg::Image > > | StrToImgMap |
| typedef std::map< std::string, std::string > | StrToStrMap |
| typedef std::map< std::string, StrToStrMap > | OtwImageMap |
Protected Member Functions | |
| DtDynamicTerrainRasterLibrary (DtDe &de) | |
| virtual osg::ref_ptr< osg::Image > | rotateImage (double &scaleFactorX, double &scaleFactorY, const osg::ref_ptr< osg::Image > &templateImg, double heading, RasterImageType imgType=RasterElevation) |
| virtual osg::ref_ptr< osg::Image > | allocateImageAndInitialize (int s, int t, RasterImageType imgType) |
| virtual osg::ref_ptr< osg::Image > | loadRasterToCache (StrToImgMap &rasterCache, const std::string &craterType, const StrToStrMap &keyToFilenameMap) |
| virtual osg::ref_ptr< osg::Image > | loadOtwImageToCache (StrToImgMap &imageCache, const std::string &craterType, const std::string &soilTypeName, const OtwImageMap &keysToFilenameMap) |
| virtual osg::ref_ptr< osg::Image > | createLandCoverFromImage (osgEarth::LandCoverDictionary *landCoverDictionary, osg::ref_ptr< osg::Image > img, const std::string &landCover) const |
| virtual osg::ref_ptr< osg::Image > | getOtwImage (StrToImgMap &imgCache, const OtwImageMap &keysToFilenameMap, double &scaleFactorX, double &scaleFactorY, const std::string &craterType, int soilType, double heading) |
| virtual std::string | lookupRasterFileAndResolvePath (const std::string &craterType, const StrToStrMap &keyToFilenameMap) const |
| virtual std::string | lookupOtwImageFileAndResolvePath (const std::string &craterType, const std::string &soilTypeName, const OtwImageMap &keysToFilenameMap) const |
| virtual bool | populateRasterMap (StrToStrMap &mapToPopulate, const std::string &rasterFilename) |
| virtual bool | populateImageMap (OtwImageMap &mapToPopulate, const std::string &imageMapFilename) |
| virtual std::string | otwImageCacheKey (const std::string &craterType, const std::string &soilTypeName) const |
Static Protected Attributes | |
| static const std::string | theDefaultCraterType |
| static const std::string | theDefaultCraterImageFilename |
| static const std::string | theDefaultCraterElevationFilename |
| static const std::string | theCraterTypeToElevationMapFilename |
| static const std::string | theCraterTypeToLandCoverMapFilename |
| static const std::string | theElevationOtwMapFilename |
| static const std::string | theLandCoverOtwMapFilename |
| static const std::string | theElevationAndLandCoverOtwMapFilename |
Private Member Functions | |
| DtDynamicTerrainRasterLibrary () | |
| DtDynamicTerrainRasterLibrary (const DtDynamicTerrainRasterLibrary &orig) | |
| DtDynamicTerrainRasterLibrary & | operator= (const DtDynamicTerrainRasterLibrary &) |
Friends | |
| class | DtDynamicTerrainRasterLibraryCreator |
|
protected |
|
protected |
|
protected |
|
protected |
Constructor.
| de | reference to a VRV display engine |
|
virtual |
Destructor.
|
private |
Default CTOR (unimplemented)
|
private |
Copy CTOR (Unimplemented)
|
virtual |
Initializes the library. Note that if the library can not be fully initialized, default images will be provided. Hence there is no return code. Ideally you should call init when the library is created, but the public API calls will check and call init() if you haven't.
|
virtual |
Returns the land cover raster based on a crater type, soil type, and heading.
| landCoverDictionary | pointer to a land cover dictionary to look up the osgEarth land cover class for the soil type specified |
| scaleFactorX | the X amount the image was increased in size to accommodate any rotation |
| scaleFactorY | the Y amount the image was increased in size to accommodate any rotation |
| craterType | a key into the CraterTypeToLandCoverFilenameMap |
| soilType | the soil Type value to find the land cover |
| heading | the heading in degrees |
|
virtual |
Returns the elevation raster given a crater type and heading.
| scaleFactorX | the X amount the image was increased in size to accommodate any rotation |
| scaleFactorY | the Y amount the image was increased in size to accommodate any rotation |
| craterType | a key into the CraterTypeToElevationFilenameMap |
| heading | the heading in degrees |
|
virtual |
Returns the visual image given a crater type, soil type, and heading for DtTerrainCraterElevationEffects.
| scaleFactorX | the X amount the image was increased in size to accommodate any rotation |
| scaleFactorY | the Y amount the image was increased in size to accommodate any rotation |
| craterType | a key into the CraterTypeAndSoilTypeToOtwFilenameForElevationMap |
| soilType | a secondary key into the map |
| heading | the heading in degrees |
|
virtual |
Returns the visual image given a crater type, soil type, and heading for DtTerrainCraterSoilEffects.
| scaleFactorX | the X amount the image was increased in size to accommodate any rotation |
| scaleFactorY | the Y amount the image was increased in size to accommodate any rotation |
| craterType | a key into the CraterTypeAndSoilTypeToOtwFilenameForLandCoverMap |
| soilType | a secondary key into the map |
| heading | the heading in degrees |
|
virtual |
Returns the visual image given a crater type, soil type, and heading for DtTerrainCraterElevAndSoilEffects.
| scaleFactorX | the X amount the image was increased in size to accommodate any rotation |
| scaleFactorY | the Y amount the image was increased in size to accommodate any rotation |
| craterType | a key into the CraterTypeAndSoilTypeToOtwFilenameForElevationAndLandCoverMap |
| soilType | a secondary key into the map |
| heading | the heading in degrees |
| osgEarth::GeoExtent makVrv::DtDynamicTerrainRasterLibrary::calculateNewExtent | ( | const DtVector & | centerPoint, |
| osg::ref_ptr< const osgEarth::SpatialReference > | srs, | ||
| double | minorAxis, | ||
| double | majorAxis, | ||
| double | heading, | ||
| double | scaleFactorX, | ||
| double | scaleFactorY | ||
| ) |
Returns an extent that accounts for any scaling due to rotation.
| centerPoint | center point in geocentric coordinates |
| srs | OSG Earth Spatial Reference |
| minorAxis | the minor axis (x-axis) |
| majorAxis | the major axis (y-axis) |
| heading | the topographic heading |
| scaleFactorX | scale factor along the x axis |
| scaleFactorY | scale factor along the y axis |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
protectedvirtual |
Rotates a given image based on a heading.
| scaleFactorX | the X amount the image was increased in size to accommodate any rotation |
| scaleFactorY | the Y amount the image was increased in size to accommodate any rotation |
| templateImg | the image to be rotated |
| heading | the heading in degrees |
| imgType | enumeration for the type of raster/image |
|
protectedvirtual |
Allocates and initializes a new image. Land cover is initialized with NO_DATA_VALUE whereas elevation is 0.0.
| s | the s size of the new image |
| t | the t size of the new image |
| imgType | enumeration for the type of raster/image |
|
protectedvirtual |
Loads an image into a cache based on the crater type and using the specified mapping file.
| rasterCache | a cache used to store images based on crater type |
| crater | type the key for the image to load |
| keyToFilenameMap | map used to look up the image filename based on the crater type |
|
protectedvirtual |
Loads an image into a cache based on the crater type and soil type and using the specified mapping file.
| rasterCache | a cache used to store images based on crater type |
| crater | type the key for the image to load |
| soilTypeName | secondary key for the image to load |
| keyToFilenameMap | map used to look up the image filename based on the crater type |
|
protectedvirtual |
Creates a landcover image given an existing image and a land cover value.
| img | an existing image that the land cover values will be applied to |
| landCover | is the string value of the land cover that will be applied to the pixels in the image |
|
protectedvirtual |
Helper method used by getElevationOtwImage, getLandCoverOtwImage, and getElevationAndLandCoverOtwImage. This method does the actual work; the calling methods provide the appropriate cache and mapper to use.
|
protectedvirtual |
Looks up and the resolves the filename and path for a given crater type using the specified mapper.
| craterType | key to look up in keyToFilenameMap |
| keyToFilenameMap | name of map to use to look up the filename (the path to resolve) |
|
protectedvirtual |
Looks up and the resolves the filename and path for a given crater type and soil type using the specified mapper.
| craterType | key to look up in keysToFilenameMap |
| soilTypeName | secondary key to look up in keysToFilenameMap |
| keysToFilenameMap | name of map to use to look up the filename (the path to resolve) |
|
protectedvirtual |
Loads an raster mapping file and stores the results in an std::map.
| mapToPopulate | the map that is to be populated |
| rasterFilename | the raster mapping filename |
|
protectedvirtual |
Loads an image mapping file and stores the results in an std::multimap.
| mapToPopulate | the map that is to be populated |
| imageFilename | the image mapping filename |
|
protectedvirtual |
Returns a key for use in the out-the-window image caches.
| craterType | crater type used to retrieve the image to be cached |
| soilTypeName | soil type name used to retrieve the image to be cached |
|
private |
Assignment Operator (Unimplemented)
|
friend |
Only the DtDynamicTerrainRasterLibraryCreator should create instances of the DtDynamicTerrainRasterLibrary.
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |