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(&
GeoTessDataType::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(
"")
319 return !(*
this == other);
351 void setReuseGrids(
bool rg)
361 const string& getInputModelFile()
const
363 return inputModelFile;
372 const string& getInputGridFile()
const
374 return inputGridFile;
382 double getLoadTimeModel()
const
384 return loadTimeModel;
392 const string& getOutputModelFile()
const
394 return outputModelFile;
403 const string& getOutputGridFile()
const
405 return outputGridFile;
414 double getWriteTimeModel()
const
416 return writeTimeModel;
425 const string& getDescription()
const
436 void setDescription(
const string& dscr)
439 description = CPPUtils::stringReplaceAll(
"\r\n",
"\n", description);
440 description = CPPUtils::stringReplaceAll(
"\r",
"\n", description);
445 CPPUtils::removeEOL(description);
446 description += CPPUtils::NEWLINE;
455 void setLayerNames(
const string& lyrNms)
457 vector<string> layrNames;
458 CPPUtils::tokenizeString(lyrNms,
";", layrNames);
459 setLayerNames(layrNames);
467 void setLayerNames(vector<string>& layrNms);
474 int getNVertices()
const
485 int getNLayers()
const
496 int getLayerIndex(
const string& layerName)
const;
503 void getLayerNames(vector<string>& layers)
506 for (
int i=0; i<nLayers; ++i)
507 layers.push_back(layerNames[i]);
515 const string*
const getLayerNames()
525 string getLayerName(
const int& layerIndex)
527 if (layerIndex < 0 || layerIndex >= nLayers)
530 os << endl <<
"ERROR in GeoTessMetaData::getLayerName(int layerIndex)" << endl
531 <<
"attributeIndex (" << layerIndex <<
") is out of range (0-" << nLayers-1 <<
")"
536 return layerNames[layerIndex];
545 string getLayerNamesString();
555 void setLayerTessIds(
int layrTsIds[])
560 os <<
"Cannot call GeoTessMetaData::setLayerTessIds() "
561 <<
"before calling GeoTessMetaData::setLayerNames()" << endl;
565 if (layerTessIds != NULL)
566 delete[] layerTessIds;
567 layerTessIds =
new int[nLayers];
568 for (
int i=0; i<nLayers; ++i)
569 layerTessIds[i] = layrTsIds[i];
577 void setLayerTessIds(vector<int>& layrTsIds);
585 const int* getLayerTessIds()
const
597 int getTessellation(
int layer)
const
599 return layerTessIds[layer];
609 void getLayers(
const int& tessId, vector<int>& layers)
612 for (
int i=0; i<nLayers; ++i)
613 if (layerTessIds[i] == tessId)
624 int getFirstLayer(
const int& tessId)
626 for (
int i=0; i<nLayers; ++i)
627 if (layerTessIds[i] == tessId)
639 int getLastLayer(
const int& tessId)
641 for (
int i=nLayers-1; i >= 0; --i)
642 if (layerTessIds[i] == tessId)
671 void setDataType(
const string& dt);
696 return *optimization;
743 void setOptimizationType(
const string& ot);
750 void getAttributeNames(vector<string>& attributes)
753 for (
int i = 0; i < nAttributes; ++i)
754 attributes.push_back(attributeNames[i]);
762 void getAttributeUnits(vector<string>& units)
765 for (
int i = 0; i < nAttributes; ++i)
766 units.push_back(attributeUnits[i]);
774 const string*
const getAttributeNames()
776 return attributeNames;
784 const string*
const getAttributeUnits()
786 return attributeUnits;
796 void setAttributes(
const string& nms,
const string& unts)
798 vector<string> names, units;
799 CPPUtils::tokenizeString(nms,
";", names);
800 CPPUtils::tokenizeString(unts,
";", units);
801 if (names.size() != units.size())
804 os <<
"Error in GeoTessMetaData::setAttributes(const string& nms, const string& unts)" << endl
805 <<
"Attribute names size (" << names.size()
806 <<
") is not equal to units size (" << units.size() <<
")" << endl;
807 names.clear(); units.clear();
810 setAttributes(names, units);
819 void setAttributes(
const vector<string>& names,
const vector<string>& units);
826 int getNAttributes()
const
837 const string& getAttributeName(
int attributeIndex)
const
839 if (attributeIndex < 0 || attributeIndex >= nAttributes)
842 os << endl <<
"ERROR in GeoTessMetaData::getAttributeName(int attributeIndex)" << endl
843 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
848 return attributeNames[attributeIndex];
856 int getAttributeIndex(
string name);
864 string getAttributeNamesString()
const;
872 string getAttributeUnitsString()
const;
880 const string& getAttributeUnit(
int attributeIndex)
const
882 if (attributeIndex < 0 || attributeIndex >= nAttributes)
885 os << endl <<
"ERROR in GeoTessMetaData::getAttributeUnit(int attributeIndex)" << endl
886 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
890 return attributeUnits[attributeIndex];
899 string getAttributeString(
int attributeIndex)
const
901 if (attributeIndex < 0 || attributeIndex >= nAttributes)
904 os << endl <<
"ERROR in GeoTessMetaData::getAttributeUnit(int attributeIndex)" << endl
905 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
909 return attributeNames[attributeIndex] +
" (" + attributeUnits[attributeIndex]+
")";
916 string toString()
const;
934 const string& getModelGenerationDate()
935 {
return modelGenerationDate; }
942 void setModelSoftwareVersion(
const string& swVersion)
943 { modelSoftwareVersion = swVersion; }
951 void setModelGenerationDate(
const string& genDate)
952 { modelGenerationDate = genDate; }
965 bool applyAttributeFilter() {
return boolAttributeFilter; }
975 vector<int>& getAttributeFilter() {
return attributeFilter; }
982 void setAttributeFilter(vector<int>& filter) { inputFilter = filter; }
989 void checkComplete();
991 void loadMetaData(IFStreamBinary& input);
993 void loadMetaData(IFStreamAscii& input);
995 int getRefCount() {
return refCount; }
1000 void addReference() { ++refCount; }
1005 void removeReference()
1007 if (isNotReferenced())
1010 os << endl <<
"ERROR in GeoTessMetaData::removeReference" << endl
1011 <<
"Reference count (" << refCount <<
") is already zero."
1013 throw GeoTessException(os, __FILE__, __LINE__, 6005);
1022 bool isNotReferenced() {
return (refCount == 0) ?
true :
false; }
1027 void setNVertices(
const int& nvert) { nVertices = nvert; }
1034 void setInputModelFile(
const string& imf) { inputModelFile = imf; }
1041 void setInputGridFile(
const string& igf) { inputGridFile = igf; }
1048 void setLoadTimeModel(
double ltm) { loadTimeModel = ltm; }
1055 void setOutputModelFile(
const string& omf) { outputModelFile = omf; }
1062 void setOutputGridFile(
const string& ogf) { outputGridFile = ogf; }
1069 void setWriteTimeModel(
double wtm) { writeTimeModel = wtm; }
1078 #endif // GEOTESSMETADATA_OBJECT_H