36 #ifndef PROFILE_OBJECT_H
37 #define PROFILE_OBJECT_H
62 class GeoTessInterpolatorType;
63 class GeoTessMetaData;
103 static int aClassCount;
161 if (nNodes < 1 && nRadii == 2)
162 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
167 d[0] = GeoTessData::getData(values[0], nAttributes);
168 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
172 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
173 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
180 if (nNodes < 1 && nRadii == 2)
181 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
186 d[0] = GeoTessData::getData(values[0], nAttributes);
187 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
191 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
192 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
199 if (nNodes < 1 && nRadii == 2)
200 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
205 d[0] = GeoTessData::getData(values[0], nAttributes);
206 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
210 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
211 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
218 if (nNodes < 1 && nRadii == 2)
219 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
224 d[0] = GeoTessData::getData(values[0], nAttributes);
225 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
229 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
230 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
237 if (nNodes < 1 && nRadii == 2)
238 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
243 d[0] = GeoTessData::getData(values[0], nAttributes);
244 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
248 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
249 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
256 if (nNodes < 1 && nRadii == 2)
257 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
262 d[0] = GeoTessData::getData(values[0], nAttributes);
263 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
267 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
268 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
308 int attributeIndex,
double radius,
bool allowRadiusOutOfRange)
const =
ABSTRACT;
315 const vector<double>& coefficients,
int attributeIndex)
const
318 for (
int i=0; i<(int)nodeIds.size(); ++i)
319 value += getValue(attributeIndex, nodeIds[i])*coefficients[i];
361 return getValue(attributeIndex, 0);
473 {
return getRadiusIndex(radius, -1); }
505 bool allowOutOfRange)
const
507 if (!allowOutOfRange && (radius < getRadiusBottom() || radius > getRadiusTop()))
537 virtual void getWeights(map<int, double>& weights,
538 double dkm,
double radius,
double hcoefficient)
const
542 int index = getPointIndex(0);
548 map<int, double>::iterator it = weights.find(index);
549 if (it == weights.end())
550 weights[index] = dkm * hcoefficient;
552 it->second += dkm * hcoefficient;
561 virtual void getCoefficients(map<int, double>& coefficients,
double radius,
562 double horizontalCoefficient)
const
567 coefficients[getPointIndex(0)] = horizontalCoefficient;
573 GeoTessProfile() { ++aClassCount; };
578 virtual ~GeoTessProfile() { --aClassCount; };
583 static GeoTessProfile* newProfile(IFStreamBinary& ifs, GeoTessMetaData& gtmd);
588 static GeoTessProfile* newProfile(IFStreamAscii& ifs, GeoTessMetaData& gtmd);
593 virtual void write(IFStreamBinary& ofs) =
ABSTRACT;
598 virtual void write(IFStreamAscii& ofs) =
ABSTRACT;
607 virtual void setPointIndex(
int nodeIndex,
int pointIndex) =
ABSTRACT;
616 virtual void resetPointIndices() =
ABSTRACT;
618 virtual void setInterpolationCoefficients(
const GeoTessInterpolatorType& interpType,
619 vector<int>& nodeIndexes, vector<double>& coefficients,
620 double& radius,
bool& allowOutOfRange)
624 nodeIndexes.push_back(0);
625 if (!allowOutOfRange && (radius < getRadiusBottom() || radius > getRadiusTop()))
626 coefficients.push_back(NaN_DOUBLE);
628 coefficients.push_back(1.);
634 virtual GeoTessProfile* copy() =
ABSTRACT;
#define ABSTRACT
Global constant used to make pure virtual functions readable.
Abstract base class that manages the data values attached to a single grid point.
Enumeration of the interpolation algorithms supported by GeoTess including LINEAR,...
Abstract class that manages the radii and data values that span a single layer associated with a sing...
virtual float getRadiusTop() const
virtual const GeoTessData & getDataBottom() const
static GeoTessProfile * newProfile(float *radii, const int &nRadii, byte **values, const int &nNodes, const int &nAttributes)
virtual int getNRadii() const
static GeoTessProfile * newProfile(float *radii, const int &nRadii, short **values, const int &nNodes, const int &nAttributes)
virtual const GeoTessProfileType & getType() const
virtual LONG_INT getMemory()
static GeoTessProfile * newProfile(const vector< float > &radii, vector< vector< short > > &data)
virtual const GeoTessData & getDataTop() const
virtual int getRadiusIndex(double radius, int jlo) const
static GeoTessProfile * newProfile(const vector< float > &radii, vector< vector< byte > > &data)
double getValue(const vector< int > &nodeIds, const vector< double > &coefficients, int attributeIndex) const
virtual int findClosestRadiusIndex(double radius) const
static GeoTessProfile * newProfile(float *radii, const int &nRadii, GeoTessData **data, const int &nData)
virtual GeoTessData * getData(int i)
virtual float getRadius(int i) const
virtual void setRadii(const vector< float > &newRadii)
virtual float getRadiusBottom() const
virtual const GeoTessData & getData(int i) const
virtual void setRadius(int index, float radius)
static GeoTessProfile * newProfile(const vector< float > &radii, vector< vector< LONG_INT > > &data)
virtual void setData(const vector< GeoTessData * > &inData)
virtual int class_size() const
virtual int getNData() const
virtual double getValueBottom(int attributeIndex) const
virtual double getInterpolationCoefficient(int i, double radius, bool allowOutOfRange) const
static GeoTessProfile * newProfile(float *radii, const int &nRadii, int **values, const int &nNodes, const int &nAttributes)
virtual bool isNaN(int nodeIndex, int attributeIndex)
virtual void setData(int index, GeoTessData *data)
virtual GeoTessData * getDataTop()
static GeoTessProfile * newProfile(float *radii, const int &nRadii, double **values, const int &nNodes, const int &nAttributes)
static GeoTessProfile * newProfile(float *radii, const int &nRadii, LONG_INT **values, const int &nNodes, const int &nAttributes)
virtual double getValueTop(int attributeIndex) const
static GeoTessProfile * newProfile(const vector< float > &radii, vector< vector< int > > &data)
static GeoTessProfile * newProfile(float *radii, const int &nRadii, float **values, const int &nNodes, const int &nAttributes)
static GeoTessProfile * newProfile(const vector< float > &radii, vector< GeoTessData * > &data)
static string class_name()
virtual float * getRadii()
virtual GeoTessData ** getData()
int getRadiusIndex(double radius) const
virtual GeoTessData * getDataBottom()
virtual int getPointIndex(int nodeIndex) const
virtual double getValue(int attributeIndex, int nodeIndex) const
static GeoTessProfile * newProfile(const vector< float > &radii, vector< vector< float > > &data)
virtual double getValue(const GeoTessInterpolatorType &rInterpType, int attributeIndex, double radius, bool allowRadiusOutOfRange) const
static GeoTessProfile * newProfile(const vector< float > &radii, vector< vector< double > > &data)
Enumeration of the valid Profile types, including EMPTY, THIN, CONSTANT, NPOINT and SURFACE.