38 #ifndef PROFILE_OBJECT_H
39 #define PROFILE_OBJECT_H
64 class GeoTessInterpolatorType;
65 class GeoTessMetaData;
105 static int aClassCount;
163 if (nNodes < 1 && nRadii == 2)
164 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
169 d[0] = GeoTessData::getData(values[0], nAttributes);
170 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
174 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
175 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
182 if (nNodes < 1 && nRadii == 2)
183 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
188 d[0] = GeoTessData::getData(values[0], nAttributes);
189 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
193 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
194 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
201 if (nNodes < 1 && nRadii == 2)
202 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
207 d[0] = GeoTessData::getData(values[0], nAttributes);
208 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
212 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
213 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
220 if (nNodes < 1 && nRadii == 2)
221 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
226 d[0] = GeoTessData::getData(values[0], nAttributes);
227 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
231 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
232 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
239 if (nNodes < 1 && nRadii == 2)
240 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
245 d[0] = GeoTessData::getData(values[0], nAttributes);
246 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
250 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
251 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
258 if (nNodes < 1 && nRadii == 2)
259 return GeoTessProfile::newProfile(radii, nRadii, NULL, 0);
264 d[0] = GeoTessData::getData(values[0], nAttributes);
265 return GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
269 for (
int i=0; i<nNodes; ++i) d[i] = GeoTessData::getData(values[i], nAttributes);
270 GeoTessProfile* profile = GeoTessProfile::newProfile(radii, nRadii, d, nNodes);
310 int attributeIndex,
double radius,
bool allowRadiusOutOfRange)
const =
ABSTRACT;
317 const vector<double>& coefficients,
int attributeIndex)
const
320 for (
int i=0; i<(int)nodeIds.size(); ++i)
321 value += getValue(attributeIndex, nodeIds[i])*coefficients[i];
363 return getValue(attributeIndex, 0);
475 {
return getRadiusIndex(radius, -1); }
507 bool allowOutOfRange)
const
509 if (!allowOutOfRange && (radius < getRadiusBottom() || radius > getRadiusTop()))
539 virtual void getWeights(map<int, double>& weights,
540 double dkm,
double radius,
double hcoefficient)
const
544 int index = getPointIndex(0);
550 map<int, double>::iterator it = weights.find(index);
551 if (it == weights.end())
552 weights[index] = dkm * hcoefficient;
554 it->second += dkm * hcoefficient;
563 virtual void getCoefficients(map<int, double>& coefficients,
double radius,
564 double horizontalCoefficient)
const
569 coefficients[getPointIndex(0)] = horizontalCoefficient;
575 GeoTessProfile() { ++aClassCount; };
580 virtual ~GeoTessProfile() { --aClassCount; };
585 static GeoTessProfile* newProfile(IFStreamBinary& ifs, GeoTessMetaData& gtmd);
590 static GeoTessProfile* newProfile(IFStreamAscii& ifs, GeoTessMetaData& gtmd);
595 virtual void write(IFStreamBinary& ofs) =
ABSTRACT;
600 virtual void write(IFStreamAscii& ofs) =
ABSTRACT;
609 virtual void setPointIndex(
int nodeIndex,
int pointIndex) =
ABSTRACT;
618 virtual void resetPointIndices() =
ABSTRACT;
620 virtual void setInterpolationCoefficients(
const GeoTessInterpolatorType& interpType,
621 vector<int>& nodeIndexes, vector<double>& coefficients,
622 double& radius,
bool& allowOutOfRange)
626 nodeIndexes.push_back(0);
627 if (!allowOutOfRange && (radius < getRadiusBottom() || radius > getRadiusTop()))
628 coefficients.push_back(NaN_DOUBLE);
630 coefficients.push_back(1.);
636 virtual GeoTessProfile* copy() =
ABSTRACT;
644 #endif // PROFILE_OBJECT_H