36 #ifndef GEOTESSMETADATA_OBJECT_H
37 #define GEOTESSMETADATA_OBJECT_H
145 string* attributeNames;
151 string* attributeUnits;
158 bool boolAttributeFilter;
168 vector<int> attributeFilter;
175 vector<int> inputFilter;
181 string attributeFilterString;
186 string inputModelFile;
191 string inputGridFile;
196 double loadTimeModel;
201 string outputModelFile;
206 string outputGridFile;
212 double writeTimeModel;
227 string modelSoftwareVersion;
233 string modelGenerationDate;
255 : earthShape(), description(
""), nLayers(0), nVertices(0), layerNames(NULL), layerTessIds(
256 NULL), dataType(&
GeoTessDataType::NONE), nAttributes(-1), attributeNames(
257 NULL), attributeUnits(NULL), boolAttributeFilter(false),
258 inputModelFile(
"none"), inputGridFile(
"none"), loadTimeModel(-1.0),
259 outputModelFile(
"none"), outputGridFile(
"none"), writeTimeModel(-1.0),
260 refCount(0), reuseGrids(true), modelSoftwareVersion(
""), modelGenerationDate(
"")
298 return !(*
this == other);
319 memory += (
LONG_INT) (description.length() + attributeFilterString.length()
320 + inputModelFile.length() + inputGridFile.length() + outputModelFile.length()
321 + outputGridFile.length() + modelSoftwareVersion.length() + modelGenerationDate.length());
324 memory += nLayers * (
LONG_INT)
sizeof(
string);
325 for (
int i=0; i<nLayers; ++i)
326 memory += (
LONG_INT) layerNames[i].length();
329 memory += nLayers * (
LONG_INT)
sizeof(
int);
338 memory += 2 * nAttributes * (
LONG_INT)
sizeof(
string);
339 for (
int i=0; i<nAttributes; ++i)
341 memory += (
LONG_INT) attributeNames[i].length();
342 memory += (
LONG_INT) attributeUnits[i].length();
347 memory += (
LONG_INT) (attributeFilter.capacity() *
sizeof(int));
350 memory += (
LONG_INT) (inputFilter.capacity() *
sizeof(int));
449 return inputModelFile;
460 return inputGridFile;
470 return loadTimeModel;
480 return outputModelFile;
491 return outputGridFile;
502 return writeTimeModel;
525 description = CPPUtils::stringReplaceAll(
"\r\n",
"\n", description);
526 description = CPPUtils::stringReplaceAll(
"\r",
"\n", description);
531 CPPUtils::removeEOL(description);
532 description += CPPUtils::NEWLINE;
543 vector<string> layrNames;
544 CPPUtils::tokenizeString(lyrNms,
";", layrNames);
545 setLayerNames(layrNames);
553 void setLayerNames(vector<string>& layrNms);
582 int getLayerIndex(
const string& layerName)
const;
592 for (
int i=0; i<nLayers; ++i)
593 layers.push_back(layerNames[i]);
613 if (layerIndex < 0 || layerIndex >= nLayers)
616 os << endl <<
"ERROR in GeoTessMetaData::getLayerName(int layerIndex)" << endl
617 <<
"attributeIndex (" << layerIndex <<
") is out of range (0-" << nLayers-1 <<
")"
622 return layerNames[layerIndex];
631 string getLayerNamesString();
646 os <<
"Cannot call GeoTessMetaData::setLayerTessIds() "
647 <<
"before calling GeoTessMetaData::setLayerNames()" << endl;
651 if (layerTessIds != NULL)
652 delete[] layerTessIds;
653 layerTessIds =
new int[nLayers];
654 for (
int i=0; i<nLayers; ++i)
655 layerTessIds[i] = layrTsIds[i];
663 void setLayerTessIds(vector<int>& layrTsIds);
685 return layerTessIds[layer];
698 for (
int i=0; i<nLayers; ++i)
699 if (layerTessIds[i] == tessId)
712 for (
int i=0; i<nLayers; ++i)
713 if (layerTessIds[i] == tessId)
727 for (
int i=nLayers-1; i >= 0; --i)
728 if (layerTessIds[i] == tessId)
757 void setDataType(
const string& dt);
767 for (
int i = 0; i < nAttributes; ++i)
768 attributes.push_back(attributeNames[i]);
779 for (
int i = 0; i < nAttributes; ++i)
780 units.push_back(attributeUnits[i]);
790 return attributeNames;
800 return attributeUnits;
812 vector<string> names, units;
813 CPPUtils::tokenizeString(nms,
";", names);
814 CPPUtils::tokenizeString(unts,
";", units);
815 if (names.size() != units.size())
818 os <<
"Error in GeoTessMetaData::setAttributes(const string& nms, const string& unts)" << endl
819 <<
"Attribute names size (" << names.size()
820 <<
") is not equal to units size (" << units.size() <<
")" << endl;
821 names.clear(); units.clear();
824 setAttributes(names, units);
833 void setAttributes(
const vector<string>& names,
const vector<string>& units);
853 if (attributeIndex < 0 || attributeIndex >= nAttributes)
856 os << endl <<
"ERROR in GeoTessMetaData::getAttributeName(int attributeIndex)" << endl
857 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
862 return attributeNames[attributeIndex];
870 int getAttributeIndex(
string name);
878 string getAttributeNamesString()
const;
886 string getAttributeUnitsString()
const;
896 if (attributeIndex < 0 || attributeIndex >= nAttributes)
899 os << endl <<
"ERROR in GeoTessMetaData::getAttributeUnit(int attributeIndex)" << endl
900 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
904 return attributeUnits[attributeIndex];
915 if (attributeIndex < 0 || attributeIndex >= nAttributes)
918 os << endl <<
"ERROR in GeoTessMetaData::getAttributeUnit(int attributeIndex)" << endl
919 <<
"attributeIndex (" << attributeIndex <<
") is out of range (0-" << nAttributes-1 <<
")"
923 return attributeNames[attributeIndex] +
" (" + attributeUnits[attributeIndex]+
")";
930 string toString(
const string& className,
LONG_INT memory)
const;
936 string toString()
const;
955 {
return modelGenerationDate; }
963 { modelSoftwareVersion = swVersion; }
972 { modelGenerationDate = genDate; }
985 bool applyAttributeFilter() {
return boolAttributeFilter; }
995 vector<int>& getAttributeFilter() {
return attributeFilter; }
1002 void setAttributeFilter(vector<int>& filter) { inputFilter = filter; }
1009 void checkComplete();
1011 void loadMetaData(IFStreamBinary& input);
1013 void loadMetaData(IFStreamAscii& input);
1015 int getRefCount() {
return refCount; }
1020 void addReference() { ++refCount; }
1025 void removeReference()
1027 if (isNotReferenced())
1030 os << endl <<
"ERROR in GeoTessMetaData::removeReference" << endl
1031 <<
"Reference count (" << refCount <<
") is already zero."
1033 throw GeoTessException(os, __FILE__, __LINE__, 6005);
1042 bool isNotReferenced() {
return (refCount == 0) ?
true :
false; }
1047 void setNVertices(
const int& nvert) { nVertices = nvert; }
1054 void setInputModelFile(
const string& imf) { inputModelFile = imf; }
1061 void setInputGridFile(
const string& igf) { inputGridFile = igf; }
1068 void setLoadTimeModel(
double ltm) { loadTimeModel = ltm; }
1075 void setOutputModelFile(
const string& omf) { outputModelFile = omf; }
1082 void setOutputGridFile(
const string& ogf) { outputGridFile = ogf; }
1089 void setWriteTimeModel(
double wtm) { writeTimeModel = wtm; }
1093 const GeoTessOptimizationType& getOptimizationType()
const {
return GeoTessOptimizationType::SPEED; }
1094 void setOptimizationType(
const GeoTessOptimizationType& ot);
1095 void setOptimizationType(
const string& ot);
1104 #endif // GEOTESSMETADATA_OBJECT_H
Definition: ArrayReuse.h:55
Enumeration of supported DataType including DOUBLE, FLOAT, LONG, INT, SHORT and BYTE.
Definition: GeoTessDataType.h:67
void setEarthShape(const string &earthShape)
Define the shape of the Earth that is to be used to convert between geocentric and geographic latitud...
Definition: EarthShape.h:185
An exception class for all GeoTess objects.
Definition: GeoTessException.h:65
Defines the ellipsoid that is to be used to convert between geocentric and geographic latitude and be...
Definition: EarthShape.h:85
#define LONG_INT
Definition: CPPGlobals.h:111
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71