36 #ifndef GEOTESSMETADATA_OBJECT_H
37 #define GEOTESSMETADATA_OBJECT_H
148 string* attributeNames;
154 string* attributeUnits;
161 bool boolAttributeFilter;
171 vector<int> attributeFilter;
178 vector<int> inputFilter;
184 string attributeFilterString;
189 string inputModelFile;
194 string inputGridFile;
199 double loadTimeModel;
204 string outputModelFile;
209 string outputGridFile;
215 double writeTimeModel;
230 string modelSoftwareVersion;
236 string modelGenerationDate;
238 map<string, string> properties;
260 : earthShape(), description(
""), nLayers(0), nVertices(0), layerNames(NULL), layerTessIds(
261 NULL), dataType(&
GeoTessDataType::NONE), nAttributes(-1), attributeNames(
262 NULL), attributeUnits(NULL), boolAttributeFilter(false),
263 inputModelFile(
"none"), inputGridFile(
"none"), loadTimeModel(-1.0),
264 outputModelFile(
"none"), outputGridFile(
"none"), writeTimeModel(-1.0),
265 refCount(0), reuseGrids(true), modelSoftwareVersion(
""), modelGenerationDate(
"")
303 return !(*
this == other);
324 memory += (
LONG_INT) (description.length() + attributeFilterString.length()
325 + inputModelFile.length() + inputGridFile.length() + outputModelFile.length()
326 + outputGridFile.length() + modelSoftwareVersion.length() + modelGenerationDate.length());
329 memory += nLayers * (
LONG_INT)
sizeof(
string);
330 for (
int i=0; i<nLayers; ++i)
331 memory += (
LONG_INT) layerNames[i].length();
334 memory += nLayers * (
LONG_INT)
sizeof(
int);
343 memory += 2 * nAttributes * (
LONG_INT)
sizeof(
string);
344 for (
int i=0; i<nAttributes; ++i)
346 memory += (
LONG_INT) attributeNames[i].length();
347 memory += (
LONG_INT) attributeUnits[i].length();
352 memory += (
LONG_INT) (attributeFilter.capacity() *
sizeof(int));
355 memory += (
LONG_INT) (inputFilter.capacity() *
sizeof(int));
454 return inputModelFile;
464 return inputGridFile;
474 return loadTimeModel;
484 return outputModelFile;
495 return outputGridFile;
506 return writeTimeModel;
529 description = CPPUtils::stringReplaceAll(
"\r\n",
"\n", description);
530 description = CPPUtils::stringReplaceAll(
"\r",
"\n", description);
535 CPPUtils::removeEOL(description);
536 description += CPPUtils::NEWLINE;
547 vector<string> layrNames;
548 CPPUtils::tokenizeString(lyrNms,
";", layrNames);
549 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);
828 properties[
"attributeNames"] = nms;
829 properties[
"attributeUnits"] = unts;
838 void setAttributes(
const vector<string>& names,
const vector<string>& units);
858 if (attributeIndex < 0 || attributeIndex >= nAttributes)
861 os << endl <<
"ERROR in GeoTessMetaData::getAttributeName(int attributeIndex)" << endl
862 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
867 return attributeNames[attributeIndex];
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 attributeUnits[attributeIndex];
920 if (attributeIndex < 0 || attributeIndex >= nAttributes)
923 os << endl <<
"ERROR in GeoTessMetaData::getAttributeUnit(int attributeIndex)" << endl
924 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
928 return attributeNames[attributeIndex] +
" (" + attributeUnits[attributeIndex]+
")";
960 {
return modelGenerationDate; }
968 { modelSoftwareVersion = swVersion; }
977 { modelGenerationDate = genDate; }
990 bool applyAttributeFilter() {
return boolAttributeFilter; }
1000 vector<int>& getAttributeFilter() {
return attributeFilter; }
1007 void setAttributeFilter(vector<int>& filter) { inputFilter = filter; }
1014 void checkComplete();
1016 void loadMetaData(IFStreamBinary& input);
1018 void loadMetaData(IFStreamAscii& input);
1020 void writeMetaData(IFStreamAscii& output,
const string& modelClassName,
1023 void writeMetaData(IFStreamBinary& output,
const string& modelClassName,
1026 int getRefCount() {
return refCount; }
1031 void addReference() { ++refCount; }
1036 void removeReference()
1038 if (isNotReferenced())
1041 os << endl <<
"ERROR in GeoTessMetaData::removeReference" << endl
1042 <<
"Reference count (" << refCount <<
") is already zero."
1044 throw GeoTessException(os, __FILE__, __LINE__, 6005);
1053 bool isNotReferenced() {
return (refCount == 0) ? true :
false; }
1055 const map<string, string>& getProperties() {
return properties; }
1060 void setNVertices(
const int& nvert) { nVertices = nvert; }
1067 void setInputModelFile(
const string& imf) { inputModelFile = imf; }
1074 void setInputGridFile(
const string& igf) { inputGridFile = igf; }
1081 void setLoadTimeModel(
double ltm) { loadTimeModel = ltm; }
1088 void setOutputModelFile(
const string& omf) { outputModelFile = omf; }
1095 void setOutputGridFile(
const string& ogf) { outputGridFile = ogf; }
1102 void setWriteTimeModel(
double wtm) { writeTimeModel = wtm; }
1104 int getModelFileFormat() {
return modelFileFormat; }
1106 void setModelFileFormat(
int version) { modelFileFormat = version; }
Defines the ellipsoid that is to be used to convert between geocentric and geographic latitude and be...
void setEarthShape(const string &earthShape)
Enumeration of supported DataType including DOUBLE, FLOAT, LONG, INT, SHORT and BYTE.
An exception class for all GeoTess objects.