36 #ifndef PROFILETHIN_OBJECT_H
37 #define PROFILETHIN_OBJECT_H
62 class GeoTessMetaData;
126 {
return GeoTessProfileType::THIN; };
132 {
return (GeoTessProfile::operator==(p) && (radius == p.
getRadius(0)) && (*data == p.
getData(0))); }
142 virtual double getValue(
int attributeIndex,
int nodeIndex)
const
143 {
return nodeIndex == 0 ? data->
getDouble(attributeIndex) : NaN_DOUBLE; }
155 int attributeIndex,
double r,
bool allowRadiusOutOfRange)
const
157 if (!allowRadiusOutOfRange &&
158 ((r < getRadiusBottom()) || (r > getRadiusTop())))
167 return getValue(attributeIndex, 0);
177 {
return data->
getDouble(attributeIndex); }
189 virtual bool isNaN(
int nodeIndex,
int attributeIndex)
191 return nodeIndex != 0 || data->
isNaN(attributeIndex);
198 virtual float getRadius(
int i)
const {
return radius; };
214 {
float* fa =
new float [1]; fa[0] = radius;
return fa; };
235 virtual void setData(
const vector<GeoTessData*>& inData)
236 {
delete data; data = inData[0]; }
241 virtual void setRadii(
const vector<float>& newRadii)
242 { radius = newRadii[0]; }
245 {
if (index == 0) radius = newRadius; }
251 {
delete data; data = inData; }
289 radius(-1.0), data(NULL), pointIndex(-1)
290 { radius = ifs.
readFloat(); data = GeoTessData::getData(ifs, gtmd); };
295 GeoTessProfileThin(IFStreamAscii& ifs, GeoTessMetaData& gtmd) : GeoTessProfile(),
296 radius(-1.0), data(NULL), pointIndex(-1)
297 { radius = ifs.readFloat(); data = GeoTessData::getData(ifs, gtmd); };
303 virtual ~GeoTessProfileThin() {
if (data != NULL)
delete data; };
308 virtual void write(IFStreamBinary& ofs)
309 { ofs.writeByte((
byte) GeoTessProfileType::THIN.ordinal());
310 ofs.writeFloat(radius); data->write(ofs); };
315 virtual void write(IFStreamAscii& ofs)
316 { ofs.writeInt(GeoTessProfileType::THIN.ordinal());
317 ofs.writeString(
" ");
318 ofs.writeFloat(radius);
330 virtual int findClosestRadiusIndex(
double r)
const
340 virtual void setPointIndex(
int nodeIndex,
int pntIndex)
341 { pointIndex = pntIndex; }
350 virtual void resetPointIndices() { pointIndex = -1; }
359 virtual int getPointIndex(
int nodeIndex)
const
360 {
return pointIndex; }
365 virtual GeoTessProfile* copy()
367 return new GeoTessProfileThin(radius, data->copy());
376 #endif // PROFILETHIN_OBJECT_H
virtual double getValue(int attributeIndex, int nodeIndex) const
Retrieve the value of the specified attribute from this profile at the specified node index...
Definition: GeoTessProfileThin.h:142
virtual float getRadius(int i) const
Get the i'th radius value in this profile in km.
Definition: GeoTessProfileThin.h:198
virtual void setData(const vector< GeoTessData * > &inData)
Resets the data object to the new input data.
Definition: GeoTessProfileThin.h:235
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 void setRadii(const vector< float > &newRadii)
Replace the radii currently associated with this Profile with new values.
Definition: GeoTessProfileThin.h:241
virtual void setRadius(int index, float newRadius)
Replace the radius at the specified nodeIndex.
Definition: GeoTessProfileThin.h:244
virtual GeoTessData * getDataTop()
Get the Data object at the top of the profile.
Definition: GeoTessProfileThin.h:266
virtual int class_size() const
Returns the class size.
Definition: GeoTessProfileThin.h:115
virtual double getValueTop(int attributeIndex) const
Retrieve the value of the specified attribute at the top of the layer.
Definition: GeoTessProfileThin.h:176
virtual float * getRadii()
Retrieve a deeep copy of the radii values in km.
Definition: GeoTessProfileThin.h:213
Definition: ArrayReuse.h:55
virtual float getRadiusTop() const
Get the radius at the top of the profile, in km.
Definition: GeoTessProfileThin.h:256
Opens a file for binary read and write access.
Definition: IFStreamBinary.h:79
static string class_name()
Returns the class name.
Definition: GeoTessProfileThin.h:110
GeoTessProfileThin(float rad, GeoTessData *dat)
Default constructor.
Definition: GeoTessProfileThin.h:103
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()
Retrieve a shallow copy of the array of Data objects associated with this Profile.
virtual LONG_INT getMemory()
Definition: GeoTessProfileThin.h:118
virtual int getNRadii() const
Get the number of radii that comprise this profile.
Definition: GeoTessProfileThin.h:203
virtual void setData(int index, GeoTessData *inData)
Resets the data object at index to the new input data.
Definition: GeoTessProfileThin.h:250
virtual float getRadiusBottom() const
Get the radius at the bottom of the profile, in km.
Definition: GeoTessProfileThin.h:271
virtual bool isNaN(int attributeIndex) const
Returns true if the specified attribute is NaN.
#define byte
signed-byte typedef
Definition: CPPGlobals.h:94
float readFloat()
Read float data.
Definition: IFStreamBinary.h:1117
virtual GeoTessData * getDataBottom()
Get the Data object at the bottom of the profile.
Definition: GeoTessProfileThin.h:281
#define LONG_INT
Definition: CPPGlobals.h:111
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
virtual const GeoTessData & getDataBottom() const
Get the Data object at the bottom of the profile.
Definition: GeoTessProfileThin.h:276
virtual int getNData() const
Get the number of Data objects that comprise this profile.
Definition: GeoTessProfileThin.h:208
virtual const GeoTessData & getData(int i) const
Retrieve a reference the i'th Data object.
Definition: GeoTessProfileThin.h:230
virtual bool isNaN(int nodeIndex, int attributeIndex)
Return true if the specified Data value is NaN.
Definition: GeoTessProfileThin.h:189
virtual const GeoTessProfileType & getType() const
Returns ProfileType (THIN).
Definition: GeoTessProfileThin.h:125
virtual GeoTessData * getData(int i)
Retrieve a reference the i'th Data object.
Definition: GeoTessProfileThin.h:225
virtual GeoTessData ** getData()
Retrieve a shallow copy of all of the Data objects associated with thisProfile.
Definition: GeoTessProfileThin.h:219
virtual double getValue(const GeoTessInterpolatorType &rInterpType, int attributeIndex, double r, bool allowRadiusOutOfRange) const
Retrieve the value of the specified attribute interpolated at the specified radius.
Definition: GeoTessProfileThin.h:154
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71
virtual float getRadius(int i) const
Get the i'th radius value in this profile in km.
virtual const GeoTessData & getDataTop() const
Get the Data object at the top of the profile.
Definition: GeoTessProfileThin.h:261
A Profile object consiting of a single radius value and a single Data object.
Definition: GeoTessProfileThin.h:73