36 #ifndef PROFILECONSTANT_OBJECT_H
37 #define PROFILECONSTANT_OBJECT_H
62 class GeoTessMetaData;
104 data(NULL), pointIndex(-1) {};
113 data(dat), pointIndex(-1) {};
134 {
return GeoTessProfileType::CONSTANT; };
140 {
return (GeoTessProfile::operator==(p) &&
151 {
return i == 0 ? radiusBottom : radiusTop; };
167 {
float* fa =
new float [2]; fa[0] = radiusBottom; fa[1] = radiusTop;
return fa; };
188 virtual void setData(
const vector<GeoTessData*>& inData)
189 {
delete data; data = inData[0]; }
195 {
delete data; data = inData; }
205 virtual double getValue(
int attributeIndex,
int nodeIndex)
const
206 {
return nodeIndex <= 1 ? data->
getDouble(attributeIndex) : NaN_DOUBLE; }
218 int attributeIndex,
double radius,
bool allowRadiusOutOfRange)
const
220 if (!allowRadiusOutOfRange &&
221 ((radius < getRadiusBottom()) || (radius > getRadiusTop())))
230 return getValue(attributeIndex, 0);
240 {
return data->
getDouble(attributeIndex); }
252 virtual bool isNaN(
int nodeIndex,
int attributeIndex)
254 return nodeIndex != 0 || data->
isNaN(attributeIndex);
260 virtual void setRadii(
const vector<float>& newRadii)
261 { radiusBottom = newRadii[0]; radiusTop = newRadii[1]; }
268 radiusBottom = radius;
313 data = GeoTessData::getData(ifs, gtmd); };
318 GeoTessProfileConstant(IFStreamAscii& ifs, GeoTessMetaData& gtmd) : GeoTessProfile()
319 { radiusBottom = ifs.readFloat();
320 radiusTop = ifs.readFloat();
321 data = GeoTessData::getData(ifs, gtmd); };
327 virtual ~GeoTessProfileConstant() {
if (data != NULL)
delete data; };
332 virtual void write(IFStreamBinary& ofs)
334 ofs.writeByte((
byte) GeoTessProfileType::CONSTANT.ordinal());
335 ofs.writeFloat(radiusBottom);
336 ofs.writeFloat(radiusTop);
343 virtual void write(IFStreamAscii& ofs)
344 { ofs.writeInt(GeoTessProfileType::CONSTANT.ordinal());
345 ofs.writeString(
" ");
346 ofs.writeFloat(radiusBottom);
347 ofs.writeString(
" ");
348 ofs.writeFloat(radiusTop);
361 virtual int findClosestRadiusIndex(
double radius)
const
362 {
return abs(radiusTop - radius) < abs(radiusBottom - radius) ? 1 : 0; }
371 virtual void setPointIndex(
int nodeIndex,
int pntIndex)
372 { pointIndex = pntIndex; }
381 virtual void resetPointIndices() { pointIndex = -1; }
390 virtual int getPointIndex(
int nodeIndex)
const
391 {
return pointIndex; }
396 virtual GeoTessProfile* copy()
398 return new GeoTessProfileConstant(radiusBottom, radiusTop, data->copy());
407 #endif // PROFILECONSTANT_OBJECT_H
virtual float getRadiusBottom() const
Get the radius at the bottom of the profile, in km.
Definition: GeoTessProfileConstant.h:294
virtual double getDouble(int attributeIndex) const
Retrieve the value of the attribute at the specified attribute index as a double value.
virtual LONG_INT getMemory()
virtual double getValue(const GeoTessInterpolatorType &rInterpType, int attributeIndex, double radius, bool allowRadiusOutOfRange) const
Retrieve the value of the specified attribute interpolated at the specified radius.
Definition: GeoTessProfileConstant.h:217
Definition: ArrayReuse.h:55
Opens a file for binary read and write access.
Definition: IFStreamBinary.h:79
Enumeration of the interpolation algorithms supported by GeoTess including LINEAR, NATURAL_NEIGHBOR and CUBIC_SPLINE.
Definition: GeoTessInterpolatorType.h:71
Enumeration of the valid Profile types, including EMPTY, THIN, CONSTANT, NPOINT and SURFACE...
Definition: GeoTessProfileType.h:69
virtual GeoTessData * getData(int i)
Retrieve a reference the i'th Data object.
Definition: GeoTessProfileConstant.h:178
virtual GeoTessData * getDataBottom()
Get the Data object at the bottom of the profile.
Definition: GeoTessProfileConstant.h:304
virtual GeoTessData ** getData()
Retrieve a shallow copy of the array of Data objects associated with this Profile.
virtual int getNData() const
Get the number of Data objects that comprise this profile.
Definition: GeoTessProfileConstant.h:161
static string class_name()
Returns the class name.
Definition: GeoTessProfileConstant.h:118
virtual const GeoTessProfileType & getType() const
Returns ProfileType (CONSTANT).
Definition: GeoTessProfileConstant.h:133
virtual int class_size() const
Returns the class size.
Definition: GeoTessProfileConstant.h:123
virtual bool isNaN(int nodeIndex, int attributeIndex)
Return true if the specified Data value is NaN.
Definition: GeoTessProfileConstant.h:252
virtual void setData(const vector< GeoTessData * > &inData)
Resets the data object to the new input data.
Definition: GeoTessProfileConstant.h:188
A Profile object that defines two radii at the bottom and top of the associated layer, and a single Data object that represents the model values throughout the layer.
Definition: GeoTessProfileConstant.h:76
virtual bool isNaN(int attributeIndex) const
Returns true if the specified attribute is NaN.
virtual float getRadiusTop() const
Get the radius at the top of the profile, in km.
virtual GeoTessData ** getData()
Retrieve a shallow copy of all of the Data objects associated with this Profile.
Definition: GeoTessProfileConstant.h:172
virtual GeoTessData * getDataTop()
Get the Data object at the top of the profile.
Definition: GeoTessProfileConstant.h:289
#define byte
signed-byte typedef
Definition: CPPGlobals.h:94
virtual double getValueTop(int attributeIndex) const
Retrieve the value of the specified attribute at the top of the layer.
Definition: GeoTessProfileConstant.h:239
float readFloat()
Read float data.
Definition: IFStreamBinary.h:1117
virtual float * getRadii()
Retrieve a deep copy of the radii values in km.
Definition: GeoTessProfileConstant.h:166
#define LONG_INT
Definition: CPPGlobals.h:111
virtual float getRadius(int i) const
Get the i'th radius value in this profile in km.
Definition: GeoTessProfileConstant.h:150
Abstract class that manages the radii and data values that span a single layer associated with a sing...
Definition: GeoTessProfile.h:96
Abstract base class that manages the data values attached to a single grid point. ...
Definition: GeoTessData.h:75
GeoTessProfileConstant(float radBot, float radTop, GeoTessData *dat)
Default constructor.
Definition: GeoTessProfileConstant.h:111
virtual void setRadii(const vector< float > &newRadii)
Replace the radii currently associated with this Profile with new values.
Definition: GeoTessProfileConstant.h:260
virtual void setData(int index, GeoTessData *inData)
Resets the data object at index to the new input data.
Definition: GeoTessProfileConstant.h:194
virtual float getRadiusTop() const
Get the radius at the top of the profile, in km.
Definition: GeoTessProfileConstant.h:279
virtual const GeoTessData & getDataBottom() const
Get the Data object at the bottom of the profile.
Definition: GeoTessProfileConstant.h:299
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71
virtual int getNRadii() const
Get the number of radii that comprise this profile.
Definition: GeoTessProfileConstant.h:156
virtual double getValue(int attributeIndex, int nodeIndex) const
Retrieve the value of the specified attribute interpolated from this profile at the specified radius ...
Definition: GeoTessProfileConstant.h:205
virtual const GeoTessData & getData(int i) const
Retrieve a reference the i'th Data object.
Definition: GeoTessProfileConstant.h:183
virtual const GeoTessData & getDataTop() const
Get the Data object at the top of the profile.
Definition: GeoTessProfileConstant.h:284
virtual void setRadius(int index, float radius)
Replace the radius at the specified nodeIndex.
Definition: GeoTessProfileConstant.h:263
virtual LONG_INT getMemory()
Definition: GeoTessProfileConstant.h:126
virtual float getRadiusBottom() const
Get the radius at the bottom of the profile, in km.