12 #include <Cee_Errors.h>
13 #include <osgEarth/Notify>
14 #include <osgEarth/MapNodeObserver>
15 #include <osgEarth/Map>
16 #include <osgEarth/Feature>
19 using namespace com_cae::Cee;
21 namespace makVrv {
namespace oe {
namespace CDB {
42 static bool createEarthMtfFilesForCDB(
const std::string& cdbRoot,
43 const std::string& terrainConfigPath,
const std::string& appDataPath, std::string& earthOutputFile, std::string& mtfOutputFile,
bool overwrite);
46 static void moreInfoOnCDBError(
unsigned int caeCdbErrorCode,
const char* cdbRoot);
58 static std::int64_t makeCdbFeatureUniqueId(
int dsCode,
75 static std::tuple<int, int, std::string>
classify(
const std::string& s)
79 auto extractNumber = [](
const std::string& str,
size_t start)->
int
81 int val = 0;
bool found =
false;
82 while (start < str.size() && std::isdigit(static_cast<unsigned char>(str[start])))
84 val = val * 10 + (str[start] -
'0');
88 return found ? val : -1;
91 size_t pos = s.find(
"_LC");
92 if (pos != std::string::npos)
94 int num = extractNumber(s, pos + 3);
97 return { 0, -num, s };
99 return { 0, -9999, s };
103 if (pos != std::string::npos)
106 if ((pos + 2) < s.size() && s[pos + 2] !=
'C' && std::isdigit(static_cast<unsigned char>(s[pos + 2])))
108 int num = extractNumber(s, pos + 2);
111 return { 1, num, s };
119 bool operator()(
const std::string& a,
const std::string& b)
const
121 if (a == b)
return false;
122 auto ca = classify(a);
123 auto cb = classify(b);
124 if (ca < cb)
return true;
125 if (cb < ca)
return false;
136 static std::string createMtfFile(
const std::string& terrainConfigPath,
const std::string& earthFile,
const std::string& cdbRoot,
const std::string& cdbFileName);
138 static void addElevationDataset(std::ofstream& earthFile,
const std::string& cdbRoot,
const std::string& cdbFileName,
bool bathymetry);
140 static void addImageryDataset(std::ofstream& earthFile,
const std::string& cdbRoot,
const std::string& cdbFileName);
142 static void addImageryLightMapDataset(std::ofstream& earthFile,
const std::string& cdbRoot,
const std::string& cdbFileName);
144 static void addModelDataset(std::ofstream& earthFile,
const std::string& cdbRoot,
const std::string& cdbFileName,
const std::string& datasetName,
145 unsigned int dataset,
unsigned int componentSelector1,
unsigned int componentSelector2,
bool enabled);
147 static void addFeatureDataset(std::ofstream& earthFile,
const std::string& cdbRoot,
const std::string& cdbFileName,
const std::string& datasetName,
148 const std::string& vrfLayer,
unsigned int dataset,
unsigned int componentSelector1,
unsigned int componentSelector2,
bool enabled);
184 void operator()(osg::Node* node, osg::NodeVisitor* nv)
override;
201 void operator()(osg::Node*, osg::NodeVisitor*)
override;
216 bool isCanceled()
const;
219 void touch(
const osg::FrameStamp* stamp);
251 bool use_procedural_imagery,
bool use_procedural_vegetation,
char* out);
261 unsigned int dataset,
unsigned int componentSelector1,
unsigned int componentSelector2,
bool vrfEnable,
bool sensorFxEnable,
char* out);
265 unsigned int dataset,
unsigned int componentSelector1,
unsigned int componentSelector2,
bool vrvEnable,
char* out);
void DT_DLL_OSGEARTH_CDB_UTILS imageryLightMapDataset(const char *cdbName, char *out)
Output the CDB imagery lightmap dataset information of the earth file.
void DT_DLL_OSGEARTH_CDB_UTILS rasterMaterialDataset(const char *cdbName, unsigned int max_cdb_elevation, unsigned int max_cdb_rasterMaterial, bool use_procedural_imagery, bool use_procedural_vegetation, char *out)
Output the CDB raster material dataset information of the earth file.
void DT_DLL_OSGEARTH_CDB_UTILS imageryDataset(const char *cdbName, char *out)
Output the CDB imagery dataset information of the earth file.
void DT_DLL_OSGEARTH_CDB_UTILS mtfFile(const char *terrainConfigPath, const char *earthFile, const char *cdbName, bool dynamicOcean, char *out)
Output the CDB vector feature dataset information of the earth file.
void DT_DLL_OSGEARTH_CDB_UTILS elevationDataset(const char *cdbName, bool bathymetry, char *out)
Output the CDB elevation/bathymetry dataset information of the earth file.
#define DT_DLL_OSGEARTH_CDB_UTILS
Definition: DtCDBExport.h:18
Class used to find CDB Tiles information.
Definition: DtCDBUtils.h:29
Definition: featureContext.h:36
std::map< std::string, osgEarth::FeatureList > CacheVectorDataMap
Definition: DtCDBUtils.h:25
bool myCanCancel
Definition: DtCDBUtils.h:187
void DT_DLL_OSGEARTH_CDB_UTILS modelDataset(const char *cdbName, const char *datasetName, unsigned int dataset, unsigned int componentSelector1, unsigned int componentSelector2, bool vrfEnable, bool sensorFxEnable, char *out)
Output the CDB model dataset information of the earth file.
static std::tuple< int, int, std::string > classify(const std::string &s)
Definition: DtCDBUtils.h:75
std::set< std::string, CdbTileFilenameComparator > CdbTileOrderedSet
Definition: DtCDBUtils.h:131
"Progress" and cancellation callbacks, defined as if the frame number on the callback has been update...
Definition: DtCDBUtils.h:177
int DT_DLL_OSGEARTH_CDB_UTILS getDatasetMaxLod(const char *appDataPath, const char *cdbRoot, unsigned int dataset, unsigned int componentSelector1, unsigned int componentSelector2)
Get the maximum LOD available for a given dataset and component selectors in the CDB.
DtCDBUtils()
CTOR.
Definition: DtCDBUtils.h:33
osg::observer_ptr< DtSceneGraphFrameNumberCallback > myScenegraphFrameNumberCallback
Definition: DtCDBUtils.h:223
The DtCdbGroupNodeProgressthat gets passed to createPagedNode() to use. It will report cancellation i...
Definition: DtCDBUtils.h:209
Paged LOD callback touches DtCdbGroupNodeProgress for each of its (up to) four children.
Definition: DtCDBUtils.h:194
void DT_DLL_OSGEARTH_CDB_UTILS earthFileHeader(const char *cdbRoot, char *out)
Create and output the CDB file header information.
unsigned myFrameNumber
Definition: DtCDBUtils.h:186
bool operator()(const std::string &a, const std::string &b) const
Definition: DtCDBUtils.h:119
bool DT_DLL_OSGEARTH_CDB_UTILS isCdbFolder(const char *cdbRoot)
Check if the given folder is a valid CDB root folder.
unsigned myLastTouchedFrame
Definition: DtCDBUtils.h:222
bool myCanCancel
Definition: DtCDBUtils.h:221
void DT_DLL_OSGEARTH_CDB_UTILS featureDataset(const char *cdbName, const char *datasetName, const char *vrfLayer, const char *color, unsigned int dataset, unsigned int componentSelector1, unsigned int componentSelector2, bool vrvEnable, char *out)
Output the CDB feature dataset information of the earth file.
Definition: DtCDBUtils.h:73
void DT_DLL_OSGEARTH_CDB_UTILS earthFileFooter(char *out)
Create and output the CDB file footer information.
void DT_DLL_OSGEARTH_CDB_UTILS imagerySensorFxDataset(const char *cdbName, char *out)
Output the CDB imagery dataset information of the earth file.
void DT_DLL_OSGEARTH_CDB_UTILS cdbTileCacheInit()
R-initialize the CDB tile cache (when we change CDB root)