38 #ifndef GEOTESSMETADATA_OBJECT_H
39 #define GEOTESSMETADATA_OBJECT_H
147 string* attributeNames;
153 string* attributeUnits;
160 bool boolAttributeFilter;
170 vector<int> attributeFilter;
177 vector<int> inputFilter;
183 string attributeFilterString;
188 string inputModelFile;
193 string inputGridFile;
198 double loadTimeModel;
203 string outputModelFile;
208 string outputGridFile;
214 double writeTimeModel;
229 string modelSoftwareVersion;
235 string modelGenerationDate;
257 : earthShape(), description(
""), nLayers(0), nVertices(0), layerNames(NULL), layerTessIds(
258 NULL), dataType(&
GeoTessDataType::NONE), nAttributes(-1), attributeNames(
259 NULL), attributeUnits(NULL), boolAttributeFilter(false),
260 inputModelFile(
"none"), inputGridFile(
"none"), loadTimeModel(-1.0),
261 outputModelFile(
"none"), outputGridFile(
"none"), writeTimeModel(-1.0),
262 refCount(0), reuseGrids(true), modelSoftwareVersion(
""), modelGenerationDate(
"")
300 return !(*
this == other);
321 memory += (
LONG_INT) (description.length() + attributeFilterString.length()
322 + inputModelFile.length() + inputGridFile.length() + outputModelFile.length()
323 + outputGridFile.length() + modelSoftwareVersion.length() + modelGenerationDate.length());
326 memory += nLayers * (
LONG_INT)
sizeof(
string);
327 for (
int i=0; i<nLayers; ++i)
328 memory += (
LONG_INT) layerNames[i].length();
331 memory += nLayers * (
LONG_INT)
sizeof(
int);
340 memory += 2 * nAttributes * (
LONG_INT)
sizeof(
string);
341 for (
int i=0; i<nAttributes; ++i)
343 memory += (
LONG_INT) attributeNames[i].length();
344 memory += (
LONG_INT) attributeUnits[i].length();
349 memory += (
LONG_INT) (attributeFilter.capacity() *
sizeof(int));
352 memory += (
LONG_INT) (inputFilter.capacity() *
sizeof(int));
451 return inputModelFile;
462 return inputGridFile;
472 return loadTimeModel;
482 return outputModelFile;
493 return outputGridFile;
504 return writeTimeModel;
527 description = CPPUtils::stringReplaceAll(
"\r\n",
"\n", description);
528 description = CPPUtils::stringReplaceAll(
"\r",
"\n", description);
533 CPPUtils::removeEOL(description);
534 description += CPPUtils::NEWLINE;
545 vector<string> layrNames;
546 CPPUtils::tokenizeString(lyrNms,
";", layrNames);
547 setLayerNames(layrNames);
594 for (
int i=0; i<nLayers; ++i)
595 layers.push_back(layerNames[i]);
615 if (layerIndex < 0 || layerIndex >= nLayers)
618 os << endl <<
"ERROR in GeoTessMetaData::getLayerName(int layerIndex)" << endl
619 <<
"attributeIndex (" << layerIndex <<
") is out of range (0-" << nLayers-1 <<
")"
624 return layerNames[layerIndex];
648 os <<
"Cannot call GeoTessMetaData::setLayerTessIds() "
649 <<
"before calling GeoTessMetaData::setLayerNames()" << endl;
653 if (layerTessIds != NULL)
654 delete[] layerTessIds;
655 layerTessIds =
new int[nLayers];
656 for (
int i=0; i<nLayers; ++i)
657 layerTessIds[i] = layrTsIds[i];
687 return layerTessIds[layer];
700 for (
int i=0; i<nLayers; ++i)
701 if (layerTessIds[i] == tessId)
714 for (
int i=0; i<nLayers; ++i)
715 if (layerTessIds[i] == tessId)
729 for (
int i=nLayers-1; i >= 0; --i)
730 if (layerTessIds[i] == tessId)
769 for (
int i = 0; i < nAttributes; ++i)
770 attributes.push_back(attributeNames[i]);
781 for (
int i = 0; i < nAttributes; ++i)
782 units.push_back(attributeUnits[i]);
792 return attributeNames;
802 return attributeUnits;
814 vector<string> names, units;
815 CPPUtils::tokenizeString(nms,
";", names);
816 CPPUtils::tokenizeString(unts,
";", units);
817 if (names.size() != units.size())
820 os <<
"Error in GeoTessMetaData::setAttributes(const string& nms, const string& unts)" << endl
821 <<
"Attribute names size (" << names.size()
822 <<
") is not equal to units size (" << units.size() <<
")" << endl;
823 names.clear(); units.clear();
826 setAttributes(names, units);
835 void setAttributes(
const vector<string>& names,
const vector<string>& units);
855 if (attributeIndex < 0 || attributeIndex >= nAttributes)
858 os << endl <<
"ERROR in GeoTessMetaData::getAttributeName(int attributeIndex)" << endl
859 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
864 return attributeNames[attributeIndex];
898 if (attributeIndex < 0 || attributeIndex >= nAttributes)
901 os << endl <<
"ERROR in GeoTessMetaData::getAttributeUnit(int attributeIndex)" << endl
902 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
906 return attributeUnits[attributeIndex];
917 if (attributeIndex < 0 || attributeIndex >= nAttributes)
920 os << endl <<
"ERROR in GeoTessMetaData::getAttributeUnit(int attributeIndex)" << endl
921 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
925 return attributeNames[attributeIndex] +
" (" + attributeUnits[attributeIndex]+
")";
957 {
return modelGenerationDate; }
965 { modelSoftwareVersion = swVersion; }
974 { modelGenerationDate = genDate; }
987 bool applyAttributeFilter() {
return boolAttributeFilter; }
997 vector<int>& getAttributeFilter() {
return attributeFilter; }
1004 void setAttributeFilter(vector<int>& filter) { inputFilter = filter; }
1011 void checkComplete();
1013 void loadMetaData(IFStreamBinary& input);
1015 void loadMetaData(IFStreamAscii& input);
1017 int getRefCount() {
return refCount; }
1022 void addReference() { ++refCount; }
1027 void removeReference()
1029 if (isNotReferenced())
1032 os << endl <<
"ERROR in GeoTessMetaData::removeReference" << endl
1033 <<
"Reference count (" << refCount <<
") is already zero."
1035 throw GeoTessException(os, __FILE__, __LINE__, 6005);
1044 bool isNotReferenced() {
return (refCount == 0) ? true :
false; }
1049 void setNVertices(
const int& nvert) { nVertices = nvert; }
1056 void setInputModelFile(
const string& imf) { inputModelFile = imf; }
1063 void setInputGridFile(
const string& igf) { inputGridFile = igf; }
1070 void setLoadTimeModel(
double ltm) { loadTimeModel = ltm; }
1077 void setOutputModelFile(
const string& omf) { outputModelFile = omf; }
1084 void setOutputGridFile(
const string& ogf) { outputGridFile = ogf; }
1091 void setWriteTimeModel(
double wtm) { writeTimeModel = wtm; }
1095 const GeoTessOptimizationType& getOptimizationType()
const {
return GeoTessOptimizationType::SPEED; }
1096 void setOptimizationType(
const GeoTessOptimizationType& ot);
1097 void setOptimizationType(
const string& ot);
1106 #endif // GEOTESSMETADATA_OBJECT_H