36 #ifndef GEOTESSMETADATA_OBJECT_H
37 #define GEOTESSMETADATA_OBJECT_H
146 string* attributeNames;
152 string* attributeUnits;
159 bool boolAttributeFilter;
169 vector<int> attributeFilter;
176 vector<int> inputFilter;
182 string attributeFilterString;
208 string inputModelFile;
213 string inputGridFile;
218 double loadTimeModel;
223 string outputModelFile;
228 string outputGridFile;
234 double writeTimeModel;
249 string modelSoftwareVersion;
255 string modelGenerationDate;
278 : earthShape(), description(
""), nLayers(0), nVertices(0), layerNames(NULL), layerTessIds(
279 NULL), dataType(&
GeoTessDataType::NONE), nAttributes(-1), attributeNames(
280 NULL), attributeUnits(NULL), boolAttributeFilter(false),
281 inputModelFile(
"none"), inputGridFile(
"none"), loadTimeModel(-1.0),
282 outputModelFile(
"none"), outputGridFile(
"none"), writeTimeModel(-1.0),
283 refCount(0), reuseGrids(true), modelSoftwareVersion(
""), modelGenerationDate(
"")
321 return !(*
this == other);
360 void setEarthShape(
const string& earthShapeName) { earthShape.setEarthShape(earthShapeName); }
369 return inputModelFile;
380 return inputGridFile;
390 return loadTimeModel;
400 return outputModelFile;
411 return outputGridFile;
422 return writeTimeModel;
445 description = CPPUtils::stringReplaceAll(
"\r\n",
"\n", description);
446 description = CPPUtils::stringReplaceAll(
"\r",
"\n", description);
451 CPPUtils::removeEOL(description);
452 description += CPPUtils::NEWLINE;
463 vector<string> layrNames;
464 CPPUtils::tokenizeString(lyrNms,
";", layrNames);
465 setLayerNames(layrNames);
473 void setLayerNames(vector<string>& layrNms);
502 int getLayerIndex(
const string& layerName)
const;
512 for (
int i=0; i<nLayers; ++i)
513 layers.push_back(layerNames[i]);
533 if (layerIndex < 0 || layerIndex >= nLayers)
536 os << endl <<
"ERROR in GeoTessMetaData::getLayerName(int layerIndex)" << endl
537 <<
"attributeIndex (" << layerIndex <<
") is out of range (0-" << nLayers-1 <<
")"
542 return layerNames[layerIndex];
551 string getLayerNamesString();
566 os <<
"Cannot call GeoTessMetaData::setLayerTessIds() "
567 <<
"before calling GeoTessMetaData::setLayerNames()" << endl;
571 if (layerTessIds != NULL)
572 delete[] layerTessIds;
573 layerTessIds =
new int[nLayers];
574 for (
int i=0; i<nLayers; ++i)
575 layerTessIds[i] = layrTsIds[i];
583 void setLayerTessIds(vector<int>& layrTsIds);
605 return layerTessIds[layer];
618 for (
int i=0; i<nLayers; ++i)
619 if (layerTessIds[i] == tessId)
632 for (
int i=0; i<nLayers; ++i)
633 if (layerTessIds[i] == tessId)
647 for (
int i=nLayers-1; i >= 0; --i)
648 if (layerTessIds[i] == tessId)
677 void setDataType(
const string& dt);
746 void setOptimizationType(
const string& ot);
756 for (
int i = 0; i < nAttributes; ++i)
757 attributes.push_back(attributeNames[i]);
768 for (
int i = 0; i < nAttributes; ++i)
769 units.push_back(attributeUnits[i]);
779 return attributeNames;
789 return attributeUnits;
801 vector<string> names, units;
802 CPPUtils::tokenizeString(nms,
";", names);
803 CPPUtils::tokenizeString(unts,
";", units);
804 if (names.size() != units.size())
807 os <<
"Error in GeoTessMetaData::setAttributes(const string& nms, const string& unts)" << endl
808 <<
"Attribute names size (" << names.size()
809 <<
") is not equal to units size (" << units.size() <<
")" << endl;
810 names.clear(); units.clear();
813 setAttributes(names, units);
822 void setAttributes(
const vector<string>& names,
const vector<string>& units);
842 if (attributeIndex < 0 || attributeIndex >= nAttributes)
845 os << endl <<
"ERROR in GeoTessMetaData::getAttributeName(int attributeIndex)" << endl
846 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
851 return attributeNames[attributeIndex];
859 int getAttributeIndex(
string name);
867 string getAttributeNamesString()
const;
875 string getAttributeUnitsString()
const;
885 if (attributeIndex < 0 || attributeIndex >= nAttributes)
888 os << endl <<
"ERROR in GeoTessMetaData::getAttributeUnit(int attributeIndex)" << endl
889 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
893 return attributeUnits[attributeIndex];
904 if (attributeIndex < 0 || attributeIndex >= nAttributes)
907 os << endl <<
"ERROR in GeoTessMetaData::getAttributeUnit(int attributeIndex)" << endl
908 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
912 return attributeNames[attributeIndex] +
" (" + attributeUnits[attributeIndex]+
")";
919 string toString()
const;
938 {
return modelGenerationDate; }
946 { modelSoftwareVersion = swVersion; }
955 { modelGenerationDate = genDate; }
968 bool applyAttributeFilter() {
return boolAttributeFilter; }
978 vector<int>& getAttributeFilter() {
return attributeFilter; }
985 void setAttributeFilter(vector<int>& filter) { inputFilter = filter; }
992 void checkComplete();
994 void loadMetaData(IFStreamBinary& input);
996 void loadMetaData(IFStreamAscii& input);
998 int getRefCount() {
return refCount; }
1003 void addReference() { ++refCount; }
1008 void removeReference()
1010 if (isNotReferenced())
1013 os << endl <<
"ERROR in GeoTessMetaData::removeReference" << endl
1014 <<
"Reference count (" << refCount <<
") is already zero."
1016 throw GeoTessException(os, __FILE__, __LINE__, 6005);
1025 bool isNotReferenced() {
return (refCount == 0) ?
true :
false; }
1030 void setNVertices(
const int& nvert) { nVertices = nvert; }
1037 void setInputModelFile(
const string& imf) { inputModelFile = imf; }
1044 void setInputGridFile(
const string& igf) { inputGridFile = igf; }
1051 void setLoadTimeModel(
double ltm) { loadTimeModel = ltm; }
1058 void setOutputModelFile(
const string& omf) { outputModelFile = omf; }
1065 void setOutputGridFile(
const string& ogf) { outputGridFile = ogf; }
1072 void setWriteTimeModel(
double wtm) { writeTimeModel = wtm; }
1081 #endif // GEOTESSMETADATA_OBJECT_H
Enumeration of supported DataType including DOUBLE, FLOAT, LONG, INT, SHORT and BYTE.
Definition: GeoTessDataType.h:67
An exception class for all GeoTess objects.
Definition: GeoTessException.h:65
Enumeration of the optimization strategies supported by GeoTess including OptimizationType::SPEED and...
Definition: GeoTessOptimizationType.h:66
Definition: EarthShape.h:64
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71