GeoTessCPP 2.6.1 Software to facilitate storage and retrieval of 3D information about the Earth.

Loading...
Searching...
No Matches
GeoTessProfileEmpty.h
Go to the documentation of this file.
1//- ****************************************************************************
2//-
3//- Copyright 2009 Sandia Corporation. Under the terms of Contract
4//- DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
5//- retains certain rights in this software.
6//-
7//- BSD Open Source License.
8//- All rights reserved.
9//-
10//- Redistribution and use in source and binary forms, with or without
11//- modification, are permitted provided that the following conditions are met:
12//-
13//- * Redistributions of source code must retain the above copyright notice,
14//- this list of conditions and the following disclaimer.
15//- * Redistributions in binary form must reproduce the above copyright
16//- notice, this list of conditions and the following disclaimer in the
17//- documentation and/or other materials provided with the distribution.
18//- * Neither the name of Sandia National Laboratories nor the names of its
19//- contributors may be used to endorse or promote products derived from
20//- this software without specific prior written permission.
21//-
22//- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23//- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24//- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25//- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26//- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27//- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28//- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29//- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30//- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31//- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32//- POSSIBILITY OF SUCH DAMAGE.
33//-
34//- ****************************************************************************
35
36#ifndef PROFILEEMPTY_OBJECT_H
37#define PROFILEEMPTY_OBJECT_H
38
39// **** _SYSTEM INCLUDES_ ******************************************************
40
41#include <iostream>
42#include <string>
43#include <fstream>
44
45// use standard library objects
46 using namespace std;
47
48// **** _LOCAL INCLUDES_ *******************************************************
49
50#include "GeoTessProfile.h"
51#include "GeoTessProfileType.h"
52#include "IFStreamAscii.h"
53#include "IFStreamBinary.h"
54
55// **** _BEGIN GEOTESS NAMESPACE_ **********************************************
56
57 namespace geotess {
58
59// **** _FORWARD REFERENCES_ ***************************************************
60
61 class GeoTessData;
62
63// **** _CLASS DEFINITION_ *****************************************************
64
74 class GEOTESS_EXP_IMP GeoTessProfileEmpty : virtual public GeoTessProfile
75{
76 private:
77
81 float radiusTop;
82
86 float radiusBottom;
87
91 GeoTessProfileEmpty() : GeoTessProfile(), radiusTop(0.0), radiusBottom(0.0) {};
92
93 public:
94
98 GeoTessProfileEmpty(float radBot, float radTop) : GeoTessProfile(),
99 radiusTop(radTop), radiusBottom(radBot)
100 {}
101
105 GeoTessProfileEmpty(IFStreamBinary& ifs) : GeoTessProfile()
106 { radiusBottom = ifs.readFloat();
107 radiusTop = ifs.readFloat();
108 }
109
113 GeoTessProfileEmpty(IFStreamAscii& ifs) : GeoTessProfile()
114 { radiusBottom = ifs.readFloat();
115 radiusTop = ifs.readFloat();
116 }
117
121 GeoTessProfileEmpty(float radii[], int &rIndex) : GeoTessProfile()
122 { radiusBottom = radii[rIndex++];
123 radiusTop = radii[rIndex++];
124 }
125
129 virtual ~GeoTessProfileEmpty() {};
130
134 static string class_name() { return "ProfileEmpty"; };
135
139 virtual int class_size() const
140 { return (int) sizeof(GeoTessProfileEmpty); };
141
142 virtual LONG_INT getMemory() { return (LONG_INT)(sizeof(GeoTessProfileEmpty)); };
143
149 virtual const GeoTessProfileType& getType() const
150 { return GeoTessProfileType::EMPTY; };
151
155 virtual bool operator == (const GeoTessProfile& p) const
156 { return (GeoTessProfile::operator==(p) &&
157 (radiusBottom == p.getRadiusBottom()) &&
158 (radiusTop == p.getRadiusTop()));
159 }
160
165 virtual double getValue(const GeoTessInterpolatorType& rInterpType,
166 int attributeIndex, double radius,
167 bool allowRadiusOutOfRange) const;
168
177 virtual double getValue(int attributeIndex, int nodeIndex) const
178 { return NaN_DOUBLE; }
179
190 virtual bool isNaN(int nodeIndex, int attributeIndex)
191 {
192 return true;
193 }
194
195 // *** TODO added 7/20/2012
202 virtual double getValueTop(int attributeIndex) const
203 {
204 return NaN_DOUBLE;
205 }
206
207 // *** TODO added 7/20/2012
214 virtual double getValueBottom(int attributeIndex) const
215 {
216 return NaN_DOUBLE;
217 }
218
223 virtual float getRadius(int i) const
224 { return i == 0 ? radiusBottom : radiusTop; };
225
229 virtual int getNRadii() const { return 2; };
230
234 virtual int getNData() const { return 0; };
235
239 virtual float* getRadii()
240 { float* fa = new float [2]; fa[0] = radiusBottom; fa[1] = radiusTop; return fa; };
241
246 virtual GeoTessData** getData();
247
251 virtual GeoTessData* getData(int i);
252
256 virtual const GeoTessData& getData(int i) const;
257
261 virtual void setData(const vector<GeoTessData*>& inData)
262 {/* do nothing*/ };
263
264 // TODO: added by sb 9/27/2012
268 virtual void setRadii(const vector<float>& newRadii)
269 { radiusBottom = newRadii[0]; radiusTop = newRadii[1]; }
270
271 virtual void setRadius(int index, float radius)
272 {
273 switch (index)
274 {
275 case 0:
276 radiusBottom = radius;
277 break;
278 case 1:
279 radiusTop = radius;
280 break;
281 }
282 }
283 // *** TODO added 7/19/2012
287 virtual void setData(int index, GeoTessData* inData)
288 { /* do nothing*/ };
289
293 virtual float getRadiusTop() const { return radiusTop; };
294
298 virtual const GeoTessData& getDataTop() const;
299
303 virtual GeoTessData* getDataTop() { return NULL; }
304
308 virtual float getRadiusBottom() const { return radiusBottom; };
309
313 virtual const GeoTessData& getDataBottom() const;
314
318 virtual GeoTessData* getDataBottom() { return NULL; }
319
323 virtual void write(IFStreamBinary& ofs)
324 { ofs.writeByte((byte) GeoTessProfileType::EMPTY.ordinal());
325 ofs.writeFloat(radiusBottom);
326 ofs.writeFloat(radiusTop); };
327
331 virtual void write(IFStreamAscii& ofs)
332 { ofs.writeInt(GeoTessProfileType::EMPTY.ordinal());
333 ofs.writeString(" ");
334 ofs.writeFloat(radiusBottom);
335 ofs.writeString(" ");
336 ofs.writeFloatNL(radiusTop); };
337
338 // *** TODO added 7/20/2012
347 virtual int findClosestRadiusIndex(double radius) const
348 { return abs(radiusTop - radius) < abs(radiusBottom - radius) ? 1 : 0; }
349
350 // *** TODO added 7/20/2012
358 virtual void setPointIndex(int nodeIndex, int pointIndex)
359 {
360 // do nothing. empty profiles have no data, hence pointIndex is always -1.
361 }
362
363 // *** TODO added 10/14/2012
371 virtual void resetPointIndices() { /* empty profiles have no data, hence pointIndex is always -1. */ }
372
373 // *** TODO added 7/20/2012
381 virtual int getPointIndex(int nodeIndex) const
382 { return -1; }
383
384 // *** TODO added 7/20/2012
391 virtual void getWeights(map<int, double>& weights,
392 double dkm, double radius, double hcoefficient) const
393 {
394 // do nothing.
395 }
396
397 // *** TODO added 7/26/2012
401 virtual void getCoefficients(map<int, double>& coefficients, double radius,
402 double horizontalCoefficient) const
403 {
404 // do nothing.
405 }
406
407 virtual void setInterpolationCoefficients(const GeoTessInterpolatorType& interpType,
408 vector<int>& nodeIndexes, vector<double>& coefficients,
409 double& radius, bool& allowOutOfRange)
410 {
411 // POISON!
412 nodeIndexes.push_back(0);
413 coefficients.push_back(NaN_DOUBLE);
414 }
415
416 // *** TODO added 8/20/2012
420 virtual GeoTessProfile* copy()
421 {
422 return new GeoTessProfileEmpty(radiusBottom, radiusTop);
423 }
424
426
428
429}; // end class ProfileEmpty
430
431} // end namespace geotess
432
433#endif // PROFILEEMPTY_OBJECT_H
GEOTESS_EXP_IMP
#define GEOTESS_EXP_IMP
Definition CPPGlobals.h:71
LONG_INT
#define LONG_INT
Definition CPPGlobals.h:111
GeoTessProfile.h
GeoTessProfileType.h
IFStreamAscii.h
IFStreamBinary.h
geotess::GeoTessData
Abstract base class that manages the data values attached to a single grid point.
Definition GeoTessData.h:76
geotess::GeoTessInterpolatorType
Enumeration of the interpolation algorithms supported by GeoTess including LINEAR,...
Definition GeoTessInterpolatorType.h:72
geotess::GeoTessProfileEmpty::getValueTop
virtual double getValueTop(int attributeIndex) const
Definition GeoTessProfileEmpty.h:202
geotess::GeoTessProfileEmpty::getRadius
virtual float getRadius(int i) const
Definition GeoTessProfileEmpty.h:223
geotess::GeoTessProfileEmpty::GeoTessProfileEmpty
GeoTessProfileEmpty(float radBot, float radTop)
Definition GeoTessProfileEmpty.h:98
geotess::GeoTessProfileEmpty::setRadii
virtual void setRadii(const vector< float > &newRadii)
Definition GeoTessProfileEmpty.h:268
geotess::GeoTessProfileEmpty::GeoTessProfileEmpty
GeoTessProfileEmpty(float radii[], int &rIndex)
Definition GeoTessProfileEmpty.h:121
geotess::GeoTessProfileEmpty::GeoTessProfileEmpty
GeoTessProfileEmpty(IFStreamBinary &ifs)
Definition GeoTessProfileEmpty.h:105
geotess::GeoTessProfileEmpty::getValueBottom
virtual double getValueBottom(int attributeIndex) const
Definition GeoTessProfileEmpty.h:214
geotess::GeoTessProfileEmpty::setPointIndex
virtual void setPointIndex(int nodeIndex, int pointIndex)
Definition GeoTessProfileEmpty.h:358
geotess::GeoTessProfileEmpty::findClosestRadiusIndex
virtual int findClosestRadiusIndex(double radius) const
Definition GeoTessProfileEmpty.h:347
geotess::GeoTessProfileEmpty::resetPointIndices
virtual void resetPointIndices()
Definition GeoTessProfileEmpty.h:371
geotess::GeoTessProfileEmpty::getWeights
virtual void getWeights(map< int, double > &weights, double dkm, double radius, double hcoefficient) const
Definition GeoTessProfileEmpty.h:391
geotess::GeoTessProfileEmpty::getRadiusBottom
virtual float getRadiusBottom() const
Definition GeoTessProfileEmpty.h:308
geotess::GeoTessProfileEmpty::getValue
virtual double getValue(int attributeIndex, int nodeIndex) const
Definition GeoTessProfileEmpty.h:177
geotess::GeoTessProfileEmpty::getNData
virtual int getNData() const
Definition GeoTessProfileEmpty.h:234
geotess::GeoTessProfileEmpty::getDataTop
virtual GeoTessData * getDataTop()
Definition GeoTessProfileEmpty.h:303
geotess::GeoTessProfileEmpty::getData
virtual GeoTessData ** getData()
geotess::GeoTessProfileEmpty::getData
virtual const GeoTessData & getData(int i) const
geotess::GeoTessProfileEmpty::class_name
static string class_name()
Definition GeoTessProfileEmpty.h:134
geotess::GeoTessProfileEmpty::getDataTop
virtual const GeoTessData & getDataTop() const
geotess::GeoTessProfileEmpty::getRadiusTop
virtual float getRadiusTop() const
Definition GeoTessProfileEmpty.h:293
geotess::GeoTessProfileEmpty::copy
virtual GeoTessProfile * copy()
Definition GeoTessProfileEmpty.h:420
geotess::GeoTessProfileEmpty::setInterpolationCoefficients
virtual void setInterpolationCoefficients(const GeoTessInterpolatorType &interpType, vector< int > &nodeIndexes, vector< double > &coefficients, double &radius, bool &allowOutOfRange)
Definition GeoTessProfileEmpty.h:407
geotess::GeoTessProfileEmpty::getRadii
virtual float * getRadii()
Definition GeoTessProfileEmpty.h:239
geotess::GeoTessProfileEmpty::getDataBottom
virtual GeoTessData * getDataBottom()
Definition GeoTessProfileEmpty.h:318
geotess::GeoTessProfileEmpty::setRadius
virtual void setRadius(int index, float radius)
Definition GeoTessProfileEmpty.h:271
geotess::GeoTessProfileEmpty::class_size
virtual int class_size() const
Definition GeoTessProfileEmpty.h:139
geotess::GeoTessProfileEmpty::getCoefficients
virtual void getCoefficients(map< int, double > &coefficients, double radius, double horizontalCoefficient) const
Definition GeoTessProfileEmpty.h:401
geotess::GeoTessProfileEmpty::getType
virtual const GeoTessProfileType & getType() const
Definition GeoTessProfileEmpty.h:149
geotess::GeoTessProfileEmpty::getNRadii
virtual int getNRadii() const
Definition GeoTessProfileEmpty.h:229
geotess::GeoTessProfileEmpty::getDataBottom
virtual const GeoTessData & getDataBottom() const
geotess::GeoTessProfileEmpty::setData
virtual void setData(const vector< GeoTessData * > &inData)
Definition GeoTessProfileEmpty.h:261
geotess::GeoTessProfileEmpty::isNaN
virtual bool isNaN(int nodeIndex, int attributeIndex)
Definition GeoTessProfileEmpty.h:190
geotess::GeoTessProfileEmpty::getPointIndex
virtual int getPointIndex(int nodeIndex) const
Definition GeoTessProfileEmpty.h:381
geotess::GeoTessProfileEmpty::~GeoTessProfileEmpty
virtual ~GeoTessProfileEmpty()
Definition GeoTessProfileEmpty.h:129
geotess::GeoTessProfileEmpty::GeoTessProfileEmpty
GeoTessProfileEmpty(IFStreamAscii &ifs)
Definition GeoTessProfileEmpty.h:113
geotess::GeoTessProfileEmpty::write
virtual void write(IFStreamAscii &ofs)
Definition GeoTessProfileEmpty.h:331
geotess::GeoTessProfileEmpty::getMemory
virtual LONG_INT getMemory()
Definition GeoTessProfileEmpty.h:142
geotess::GeoTessProfileEmpty::getData
virtual GeoTessData * getData(int i)
geotess::GeoTessProfileEmpty::getValue
virtual double getValue(const GeoTessInterpolatorType &rInterpType, int attributeIndex, double radius, bool allowRadiusOutOfRange) const
geotess::GeoTessProfileEmpty::write
virtual void write(IFStreamBinary &ofs)
Definition GeoTessProfileEmpty.h:323
geotess::GeoTessProfileEmpty::setData
virtual void setData(int index, GeoTessData *inData)
Definition GeoTessProfileEmpty.h:287
geotess::GeoTessProfile
Abstract class that manages the radii and data values that span a single layer associated with a sing...
Definition GeoTessProfile.h:97
geotess::GeoTessProfile::getRadiusTop
virtual float getRadiusTop() const
geotess::GeoTessProfile::getRadiusBottom
virtual float getRadiusBottom() const
geotess::GeoTessProfileType
Enumeration of the valid Profile types, including EMPTY, THIN, CONSTANT, NPOINT and SURFACE.
Definition GeoTessProfileType.h:70
geotess::GeoTessProfileType::EMPTY
static const GeoTessProfileType EMPTY
Definition GeoTessProfileType.h:115
geotess::IFStreamAscii
Opens ascii file for read and write access.
Definition IFStreamAscii.h:81
geotess::IFStreamAscii::readFloat
float readFloat()
Definition IFStreamAscii.h:741
geotess::IFStreamAscii::writeInt
void writeInt(int i)
Definition IFStreamAscii.h:500
geotess::IFStreamAscii::writeFloat
void writeFloat(float f)
Definition IFStreamAscii.h:508
geotess::IFStreamAscii::writeFloatNL
void writeFloatNL(float f)
Definition IFStreamAscii.h:509
geotess::IFStreamAscii::writeString
void writeString(const string &s)
Definition IFStreamAscii.h:484
geotess::IFStreamBinary
Opens a file for binary read and write access.
Definition IFStreamBinary.h:80
geotess::IFStreamBinary::writeByte
void writeByte(byte b)
Definition IFStreamBinary.h:1408
geotess::IFStreamBinary::readFloat
float readFloat()
Definition IFStreamBinary.h:1117
geotess::IFStreamBinary::writeFloat
void writeFloat(float f)
Definition IFStreamBinary.h:1716
geotess
Definition ArrayReuse.h:55