36 #ifndef GEOTESSMETADATA_OBJECT_H
37 #define GEOTESSMETADATA_OBJECT_H
143 string* attributeNames;
149 string* attributeUnits;
156 bool boolAttributeFilter;
166 vector<int> attributeFilter;
173 vector<int> inputFilter;
179 string attributeFilterString;
205 string inputModelFile;
210 string inputGridFile;
215 double loadTimeModel;
220 string outputModelFile;
225 string outputGridFile;
231 double writeTimeModel;
246 string modelSoftwareVersion;
252 string modelGenerationDate;
275 : description(
""), nLayers(0), nVertices(0), layerNames(NULL), layerTessIds(
276 NULL), dataType(&
DataType::NONE), nAttributes(-1), attributeNames(
277 NULL), attributeUnits(NULL), boolAttributeFilter(false), optimization(
279 "none"), loadTimeModel(-1.0), outputModelFile(
"none"), outputGridFile(
280 "none"), writeTimeModel(-1.0), refCount(0), reuseGrids(
281 true), modelSoftwareVersion(
""), modelGenerationDate(
"")
309 return !(*
this == other);
339 void setReuseGrids(
bool rg)
349 const string& getInputModelFile()
const
351 return inputModelFile;
360 const string& getInputGridFile()
const
362 return inputGridFile;
370 double getLoadTimeModel()
const
372 return loadTimeModel;
380 const string& getOutputModelFile()
const
382 return outputModelFile;
391 const string& getOutputGridFile()
const
393 return outputGridFile;
402 double getWriteTimeModel()
const
404 return writeTimeModel;
413 const string& getDescription()
const
424 void setDescription(
const string& dscr)
427 description = CPPUtils::stringReplaceAll(
"\r\n",
"\n", description);
428 description = CPPUtils::stringReplaceAll(
"\r",
"\n", description);
433 CPPUtils::removeEOL(description);
434 description += CPPUtils::NEWLINE;
442 void setLayerNames(
const string& lyrNms)
444 vector<string> layrNames;
445 CPPUtils::tokenizeString(lyrNms,
";", layrNames);
446 setLayerNames(layrNames);
454 void setLayerNames(vector<string>& layrNms);
461 int getNVertices()
const
472 int getNLayers()
const
482 int getLayerIndex(
const string& layerName)
const;
487 void getLayerNames(vector<string>& layers)
490 for (
int i=0; i<nLayers; ++i)
491 layers.push_back(layerNames[i]);
498 const string*
const getLayerNames()
506 string getLayerName(
const int& layerIndex)
508 if (layerIndex < 0 || layerIndex >= nLayers)
511 os << endl <<
"ERROR in GeoTessMetaData::getLayerName(int layerIndex)" << endl
512 <<
"attributeIndex (" << layerIndex <<
") is out of range (0-" << nLayers-1 <<
")"
517 return layerNames[layerIndex];
526 string getLayerNamesString();
536 void setLayerTessIds(
int layrTsIds[])
541 os <<
"Cannot call GeoTessMetaData::setLayerTessIds() "
542 <<
"before calling GeoTessMetaData::setLayerNames()" << endl;
546 if (layerTessIds != NULL)
547 delete[] layerTessIds;
548 layerTessIds =
new int[nLayers];
549 for (
int i=0; i<nLayers; ++i)
550 layerTessIds[i] = layrTsIds[i];
558 void setLayerTessIds(vector<int>& layrTsIds);
566 const int* getLayerTessIds()
const
578 int getTessellation(
int layer)
const
580 return layerTessIds[layer];
590 void getLayers(
const int& tessId, vector<int>& layers)
593 for (
int i=0; i<nLayers; ++i)
594 if (layerTessIds[i] == tessId)
605 int getFirstLayer(
const int& tessId)
607 for (
int i=0; i<nLayers; ++i)
608 if (layerTessIds[i] == tessId)
620 int getLastLayer(
const int& tessId)
622 for (
int i=nLayers-1; i >= 0; --i)
623 if (layerTessIds[i] == tessId)
644 void setDataType(
const DataType& dt);
652 void setDataType(
const string& dt);
677 return *optimization;
724 void setOptimizationType(
const string& ot);
729 void getAttributeNames(vector<string>& attributes)
732 for (
int i = 0; i < nAttributes; ++i)
733 attributes.push_back(attributeNames[i]);
739 void getAttributeUnits(vector<string>& units)
742 for (
int i = 0; i < nAttributes; ++i)
743 units.push_back(attributeUnits[i]);
750 const string*
const getAttributeNames()
752 return attributeNames;
759 const string*
const getAttributeUnits()
761 return attributeUnits;
769 void setAttributes(
const string& nms,
const string& unts)
771 vector<string> names, units;
772 CPPUtils::tokenizeString(nms,
";", names);
773 CPPUtils::tokenizeString(unts,
";", units);
774 setAttributes(names, units);
783 void setAttributes(
const vector<string>& names,
const vector<string>& units);
790 int getNAttributes()
const
801 const string& getAttributeName(
int attributeIndex)
const
803 if (attributeIndex < 0 || attributeIndex >= nAttributes)
806 os << endl <<
"ERROR in GeoTessMetaData::getAttributeName(int attributeIndex)" << endl
807 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
812 return attributeNames[attributeIndex];
819 int getAttributeIndex(
string name);
827 string getAttributeNamesString()
const;
835 string getAttributeUnitsString()
const;
843 const string& getAttributeUnit(
int attributeIndex)
const
845 if (attributeIndex < 0 || attributeIndex >= nAttributes)
848 os << endl <<
"ERROR in GeoTessMetaData::getAttributeUnit(int attributeIndex)" << endl
849 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
853 return attributeUnits[attributeIndex];
859 string toString()
const;
877 const string& getModelGenerationDate()
878 {
return modelGenerationDate; }
885 void setModelSoftwareVersion(
const string& swVersion)
886 { modelSoftwareVersion = swVersion; }
894 void setModelGenerationDate(
const string& genDate)
895 { modelGenerationDate = genDate; }
908 bool applyAttributeFilter() {
return boolAttributeFilter; }
918 vector<int>& getAttributeFilter() {
return attributeFilter; }
925 void setAttributeFilter(vector<int>& filter) { inputFilter = filter; }
932 void checkComplete();
934 void loadMetaData(IFStreamBinary& input);
936 void loadMetaData(IFStreamAscii& input);
938 int getRefCount() {
return refCount; }
943 void addReference() { ++refCount; }
948 void removeReference()
950 if (isNotReferenced())
953 os << endl <<
"ERROR in GeoTessMetaData::removeReference" << endl
954 <<
"Reference count (" << refCount <<
") is already zero."
956 throw GeoTessException(os, __FILE__, __LINE__, 6005);
965 bool isNotReferenced() {
return (refCount == 0) ?
true :
false; }
970 void setNVertices(
const int& nvert) { nVertices = nvert; }
977 void setInputModelFile(
const string& imf) { inputModelFile = imf; }
984 void setInputGridFile(
const string& igf) { inputGridFile = igf; }
991 void setLoadTimeModel(
double ltm) { loadTimeModel = ltm; }
998 void setOutputModelFile(
const string& omf) { outputModelFile = omf; }
1005 void setOutputGridFile(
const string& ogf) { outputGridFile = ogf; }
1012 void setWriteTimeModel(
double wtm) { writeTimeModel = wtm; }
1021 #endif // GEOTESSMETADATA_OBJECT_H