VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDynamicTerrainRasterLibrary.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <vrvOsg/vrvOsg.h>
12 
14 
15 #include <matrix/vlVector.h>
16 
17 #include<osg/ref_ptr>
18 
19 #include <tbb/spin_rw_mutex.h>
20 #include <string>
21 #include <map>
22 
23 // Forward declarations
24 namespace osg
25 {
26  class Image;
27 }
28 
29 namespace osgEarth
30 {
31  class LandCoverDictionary;
32  class GeoExtent;
33  class SpatialReference;
34 }
35 
36 namespace makVrv
37 {
38  typedef enum
39  {
44 
45  class DtDe;
46  class DtVrfSoilTypeToOsgEarthLandCoverMap;
47 
94 
96  : public DtVirtualBaseClass
97  {
98  protected:
99 
103 
107 
108  public:
109 
112 
117  virtual void init();
118 
129  virtual osg::ref_ptr <osg::Image> getLandCoverRaster(
130  osgEarth::LandCoverDictionary* landCoverDictionary, double& scaleFactorX, double& scaleFactorY,
131  const std::string& craterType, int soilType, double heading = 0.0);
132 
140  virtual osg::ref_ptr <osg::Image> getElevationRaster(double& scaleFactorX,
141  double & scaleFactorY, const std::string& craterType, double heading = 0.0);
142 
152  virtual osg::ref_ptr <osg::Image> getElevationOtwImage(double& scaleFactorX,
153  double & scaleFactorY, const std::string& craterType, int soilType, double heading = 0.0);
154 
164  virtual osg::ref_ptr <osg::Image> getLandCoverOtwImage(double& scaleFactorX, double & scaleFactorY,
165  const std::string& craterType, int soilType, double heading = 0.0);
166 
176  virtual osg::ref_ptr <osg::Image> getElevationAndLandCoverOtwImage(double& scaleFactorX,
177  double& scaleFactorY, const std::string& craterType, int soilType, double heading = 0.0);
178 
188  osgEarth::GeoExtent calculateNewExtent(const DtVector& centerPoint,
189  osg::ref_ptr<const osgEarth::SpatialReference> srs, double minorAxis, double majorAxis,
190  double heading, double scaleFactorX, double scaleFactorY);
191 
192  public:
194  static std::string defaultCraterType();
196  static std::string defaultCraterImageFilename();
197  static std::string defaultCraterElevationFilename();
198  static std::string craterTypeToElevationMapFilename();
199  static std::string craterTypeToLandCoverMapFilename();
200  static std::string elevationOtwMapFilename();
201  static std::string landCoverOtwMapFilename();
202  static std::string elevationAndLandCoverOtwMapFilename();
204 
205  protected:
206 
207  typedef std::map<std::string, osg::ref_ptr <osg::Image> > StrToImgMap;
208  typedef std::map<std::string, std::string> StrToStrMap;
209 
210  // The key is the crater type. The StrToStrMap maps
211  // soil type names to filenames
212  typedef std::map<std::string, StrToStrMap> OtwImageMap;
213 
221  virtual osg::ref_ptr<osg::Image> rotateImage(double & scaleFactorX, double & scaleFactorY,
222  const osg::ref_ptr<osg::Image> & templateImg, double heading, RasterImageType imgType = RasterElevation);
223 
229  virtual osg::ref_ptr<osg::Image> allocateImageAndInitialize(int s, int t, RasterImageType imgType);
230 
237  virtual osg::ref_ptr <osg::Image> loadRasterToCache(StrToImgMap& rasterCache,
238  const std::string& craterType, const StrToStrMap& keyToFilenameMap);
239 
247  virtual osg::ref_ptr <osg::Image> loadOtwImageToCache(StrToImgMap& imageCache,
248  const std::string& craterType, const std::string& soilTypeName,
249  const OtwImageMap& keysToFilenameMap);
250 
255  virtual osg::ref_ptr <osg::Image> createLandCoverFromImage(
256  osgEarth::LandCoverDictionary* landCoverDictionary, osg::ref_ptr <osg::Image> img,
257  const std::string& landCover) const;
258 
262  virtual osg::ref_ptr <osg::Image> getOtwImage(StrToImgMap& imgCache,
263  const OtwImageMap& keysToFilenameMap, double& scaleFactorX, double & scaleFactorY,
264  const std::string& craterType, int soilType, double heading);
265 
271  virtual std::string lookupRasterFileAndResolvePath(const std::string& craterType,
272  const StrToStrMap& keyToFilenameMap) const;
273 
280  virtual std::string lookupOtwImageFileAndResolvePath(const std::string& craterType,
281  const std::string& soilTypeName, const OtwImageMap& keysToFilenameMap) const;
282 
287  virtual bool populateRasterMap(StrToStrMap & mapToPopulate, const std::string rasterFilename);
288 
293  virtual bool populateImageMap(OtwImageMap& mapToPopulate, const std::string imageMapFilename);
294 
299  virtual std::string otwImageCacheKey(const std::string& craterType,
300  const std::string& soilTypeName) const;
301 
302  private:
303 
306 
309 
310  protected:
311 
312  static const std::string theDefaultCraterType;
313  static const std::string theDefaultCraterImageFilename;
314  static const std::string theDefaultCraterElevationFilename;
315  static const std::string theCraterTypeToElevationMapFilename;
316  static const std::string theCraterTypeToLandCoverMapFilename;
317  static const std::string theElevationOtwMapFilename;
318  static const std::string theLandCoverOtwMapFilename;
319  static const std::string theElevationAndLandCoverOtwMapFilename;
320 
321  protected:
322 
324 
325  tbb::spin_rw_mutex myLandCoverCacheMutex;
326  tbb::spin_rw_mutex myElevationRasterCacheMutex;
327  tbb::spin_rw_mutex myOtwImageCacheMutex;
328  tbb::spin_rw_mutex myInitMutex;
329 
330  // Used to cache ref_ptrs to images that were created for specific types of land cover codes
331  // key is crater type + land cover code
333 
334  // Used to cache ref_ptrs to images for land cover that have not been modified for
335  // a specific land cover code.
337 
338  // Cache for ref_ptrs to images for elevation rasters
340 
341  // Cache for ref_ptrs to OTW images used with the elevation effect type
343 
344  // Cache for ref_ptrs to OTW images used with the soil type effect type
346 
347  // Cache for ref_ptrs to OTW images used with the elevation and soil type effect type
349 
350  // Map crater type to raster filenames for use with osgEarth decal elevation layer
352 
353  // Map crater type to raster filenames for use with osgEarth decal land cover layer
355 
356  // Map crater type and soil type to visual images for osgEarth decal image layer
357  // when effect type is DtTerrainCraterElevationEffect
359 
360  // Map crater type and soil type to visual images for osgEarth decal image layer
361  // when effect type is DtTerrainCraterSoilEffect
363 
364  // Map crater type and soil type to visual images for osgEarth decal image layer
365  // when effect type is DtTerrainCraterElevAndSoilEffect
367 
369 
370  // External soil type to osgEarth land cover name mapper
372  };
373 
374 
378  : public DtVirtualBaseClass
379  {
380  public:
381 
384 
387 
390  static DtDynamicTerrainRasterLibraryCreator& instance(DtDe& de);
391 
393  static void registerInstance(DtDe& de, DtDynamicTerrainRasterLibraryCreator* creatorInstance);
394 
397  virtual DtDynamicTerrainRasterLibrary* create(DtDe& de);
398  };
399 
400 }
StrToImgMap myElevationAndLandCoverOtwImageCache
Definition: DtDynamicTerrainRasterLibrary.h:348
Virtual base class.
Definition: DtVirtualBaseClass.h:22
static const std::string theDefaultCraterElevationFilename
Definition: DtDynamicTerrainRasterLibrary.h:314
std::map< std::string, std::string > StrToStrMap
Definition: DtDynamicTerrainRasterLibrary.h:208
Definition: DtDynamicTerrainRasterLibrary.h:41
static const std::string theElevationOtwMapFilename
Definition: DtDynamicTerrainRasterLibrary.h:317
bool myIsInitialized
Definition: DtDynamicTerrainRasterLibrary.h:323
DtDynamicTerrainRasterLibrary This class is used to managed rasters and out-the-window images appl...
Definition: DtDynamicTerrainRasterLibrary.h:95
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
tbb::spin_rw_mutex myInitMutex
Definition: DtDynamicTerrainRasterLibrary.h:328
static const std::string theCraterTypeToLandCoverMapFilename
Definition: DtDynamicTerrainRasterLibrary.h:316
DtDe & myDe
Definition: DtDynamicTerrainRasterLibrary.h:368
static const std::string theDefaultCraterType
Definition: DtDynamicTerrainRasterLibrary.h:312
tbb::spin_rw_mutex myLandCoverCacheMutex
Definition: DtDynamicTerrainRasterLibrary.h:325
DtVrfSoilTypeToOsgEarthLandCoverMap * mySoilTypeToLandCoverMap
Definition: DtDynamicTerrainRasterLibrary.h:371
StrToImgMap myLandCoverOtwImageCache
Definition: DtDynamicTerrainRasterLibrary.h:345
RasterImageType
Definition: DtDynamicTerrainRasterLibrary.h:38
StrToImgMap myLandCoverElevationRasterCache
Definition: DtDynamicTerrainRasterLibrary.h:336
OtwImageMap myCraterTypeAndSoilTypeToOtwFilenameForElevationMap
Definition: DtDynamicTerrainRasterLibrary.h:358
Definition: DtDynamicTerrainRasterLibrary.h:40
static const std::string theDefaultCraterImageFilename
Definition: DtDynamicTerrainRasterLibrary.h:313
StrToStrMap myCraterTypeToElevationFilenameMap
Definition: DtDynamicTerrainRasterLibrary.h:351
StrToImgMap myLandCoverImageCache
Definition: DtDynamicTerrainRasterLibrary.h:332
std::map< std::string, StrToStrMap > OtwImageMap
Definition: DtDynamicTerrainRasterLibrary.h:212
Used to map VR-Forces soil types to OSG Earth Landcover names.
Definition: DtVrfSoilTypeToOsgEarthLandCoverMap.h:23
Contains makVrv::DtVirtualBaseClass class.
StrToImgMap myElevationRasterCache
Definition: DtDynamicTerrainRasterLibrary.h:339
OtwImageMap myCraterTypeAndSoilTypeToOtwFilenameForLandCoverMap
Definition: DtDynamicTerrainRasterLibrary.h:362
Creator for the DtDynamicTerrainRasterLibrary.
Definition: DtDynamicTerrainRasterLibrary.h:377
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
std::map< std::string, osg::ref_ptr< osg::Image > > StrToImgMap
Definition: DtDynamicTerrainRasterLibrary.h:207
tbb::spin_rw_mutex myOtwImageCacheMutex
Definition: DtDynamicTerrainRasterLibrary.h:327
static const std::string theLandCoverOtwMapFilename
Definition: DtDynamicTerrainRasterLibrary.h:318
StrToStrMap myCraterTypeToLandCoverFilenameMap
Definition: DtDynamicTerrainRasterLibrary.h:354
OtwImageMap myCraterTypeAndSoilTypeToOtwFilenameForElevationAndLandCoverMap
Definition: DtDynamicTerrainRasterLibrary.h:366
static const std::string theElevationAndLandCoverOtwMapFilename
Definition: DtDynamicTerrainRasterLibrary.h:319
StrToImgMap myElevationOtwImageCache
Definition: DtDynamicTerrainRasterLibrary.h:342
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
static const std::string theCraterTypeToElevationMapFilename
Definition: DtDynamicTerrainRasterLibrary.h:315
Contains DLL export macros.
tbb::spin_rw_mutex myElevationRasterCacheMutex
Definition: DtDynamicTerrainRasterLibrary.h:326
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
Definition: DtDynamicTerrainRasterLibrary.h:42

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)