GeoTessCPP  2.2
Software to facilitate storage and retrieval of 3D information about the Earth.
GeoTessProfileSurfaceEmpty.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 PROFILESURFACE_EMPTY_OBJECT_H
37 #define PROFILESURFACE_EMPTY_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 "GeoTessUtils.h"
51 #include "GeoTessData.h"
52 #include "GeoTessProfile.h"
53 #include "GeoTessProfileType.h"
54 #include "IFStreamAscii.h"
55 #include "IFStreamBinary.h"
56 #include "GeoTessDataValue.h"
57 
58 // **** _BEGIN GEOTESS NAMESPACE_ **********************************************
59 
60 namespace geotess {
61 
62 // **** _FORWARD REFERENCES_ ***************************************************
63 
64 class GeoTessMetaData;
65 
66 // **** _CLASS DEFINITION_ *****************************************************
67 
78 public:
79 
81 
85  static string class_name() { return "ProfileSurfaceEmpty"; }
86 
90  virtual int class_size() const { return (int) sizeof(GeoTessProfileSurfaceEmpty); }
91 
92  virtual LONG_INT getMemory() { return (LONG_INT)sizeof(GeoTessProfileSurfaceEmpty); }
93 
99  virtual const GeoTessProfileType& getType() const { return GeoTessProfileType::SURFACE_EMPTY; }
100 
104  virtual bool operator ==(const GeoTessProfile& p) const { return p.getType() == GeoTessProfileType::SURFACE_EMPTY; }
105 
114  virtual double getValue(int attributeIndex, int nodeIndex) const { return NaN_DOUBLE; }
115 
122  virtual double getValueTop(int attributeIndex) const { return NaN_DOUBLE; }
123 
134  virtual bool isNaN(int nodeIndex, int attributeIndex) { return true; }
135 
140  virtual double getValue(const GeoTessInterpolatorType& rInterpType,
141  int attributeIndex, double radius,
142  bool allowRadiusOutOfRange) const
143  { return NaN_DOUBLE; }
144 
148  virtual void setData(const vector<GeoTessData*>& inData) { }
149 
153  virtual void setData(int index, GeoTessData* inData) { }
154 
159  virtual GeoTessData** getData()
160  {
161  ostringstream os;
162  os << endl << "ERROR in ProfileSurfaceEmpty::getData" << endl
163  << "Unsupported method call." << endl;
164  throw GeoTessException(os, __FILE__, __LINE__, 4201);
165  return (GeoTessData**) NULL;
166  }
167 
171  virtual GeoTessData* getData(int i)
172  {
173  ostringstream os;
174  os << endl << "ERROR in ProfileSurfaceEmpty::getData" << endl
175  << "Unsupported method call." << endl;
176  throw GeoTessException(os, __FILE__, __LINE__, 4201);
177  return (GeoTessData*) NULL;
178  }
179 
183  virtual const GeoTessData& getData(int i) const
184  {
185  ostringstream os;
186  os << endl << "ERROR in ProfileSurfaceEmpty::getData" << endl
187  << "Unsupported method call." << endl;
188  throw GeoTessException(os, __FILE__, __LINE__, 4201);
189  return *(new GeoTessDataValue<int>());
190  }
195  {
196  ostringstream os;
197  os << endl << "ERROR in ProfileSurfaceEmpty::getDataBottom" << endl
198  << "Unsupported method call." << endl;
199  throw GeoTessException(os, __FILE__, __LINE__, 4201);
200  return (GeoTessData*) NULL;
201  }
202 
206  virtual const GeoTessData& getDataTop() const
207  {
208  ostringstream os;
209  os << endl << "ERROR in ProfileSurfaceEmpty::getDataTop" << endl
210  << "Unsupported method call." << endl;
211  throw GeoTessException(os, __FILE__, __LINE__, 4201);
212  return *(new GeoTessDataValue<int>());
213  }
214 
219  {
220  ostringstream os;
221  os << endl << "ERROR in ProfileSurfaceEmpty::getDataBottom" << endl
222  << "Unsupported method call." << endl;
223  throw GeoTessException(os, __FILE__, __LINE__, 4201);
224  return (GeoTessData*) NULL;
225  }
226 
230  virtual const GeoTessData& getDataBottom() const
231  {
232  ostringstream os;
233  os << endl << "ERROR in ProfileSurfaceEmpty::getDataBottom" << endl
234  << "Unsupported method call." << endl;
235  throw GeoTessException(os, __FILE__, __LINE__, 4201);
236  return *(new GeoTessDataValue<int>());
237  }
238 
243  virtual float getRadius(int i) const { return NaN_FLOAT; }
244 
248  virtual void setRadii(const vector<float>& newRadii) { }
249 
250  virtual void setRadius(int index, float radius)
251  { /* do nothing */ }
252 
256  virtual float getRadiusTop() const { return NaN_FLOAT; }
257 
261  virtual float getRadiusBottom() const { return NaN_FLOAT; }
262 
266  virtual int getNRadii() const { return 0; }
267 
271  virtual int getNData() const { return 0; }
272 
276  virtual float* getRadii() { return (float*) NULL; }
277 
279 
284 
288  GeoTessProfileSurfaceEmpty(IFStreamAscii& ifs, GeoTessMetaData& gtmd) : GeoTessProfile() { }
289 
294  virtual ~GeoTessProfileSurfaceEmpty() { }
295 
299  virtual void write(IFStreamBinary& ofs)
300  { ofs.writeByte((byte) GeoTessProfileType::SURFACE_EMPTY.ordinal()); }
301 
305  virtual void write(IFStreamAscii& ofs)
306  { ofs.writeInt(GeoTessProfileType::SURFACE_EMPTY.ordinal()); ofs.writeNL();}
307 
316  virtual int findClosestRadiusIndex(double radius) const { return -1; }
317 
325  virtual void setPointIndex(int nodeIndex, int pntIndex) { }
326 
334  virtual void resetPointIndices() { }
335 
343  virtual int getPointIndex(int nodeIndex) const { return -1; }
344 
348  virtual GeoTessProfile* copy() { return new GeoTessProfileSurfaceEmpty(); }
349 
351 
352 };
353 // end class ProfileSurfaceEmpty
354 
355 }// end namespace geotess
356 
357 #endif // PROFILESURFACE_EMPTY_OBJECT_H
static string class_name()
Returns the class name.
Definition: GeoTessProfileSurfaceEmpty.h:85
virtual float getRadiusBottom() const
Get the radius at the bottom of the profile, in km.
Definition: GeoTessProfileSurfaceEmpty.h:261
virtual LONG_INT getMemory()
Definition: GeoTessProfileSurfaceEmpty.h:92
A Profile object that defines a single Data object and no radius value.
Definition: GeoTessProfileSurfaceEmpty.h:77
virtual int getNData() const
Get the number of Data objects that comprise this profile.
Definition: GeoTessProfileSurfaceEmpty.h:271
virtual GeoTessData ** getData()
Retrieve a reference to all of the Data obects associated with this Profile.
Definition: GeoTessProfileSurfaceEmpty.h:159
virtual void setData(int index, GeoTessData *inData)
Resets the data object at index to the new input data.
Definition: GeoTessProfileSurfaceEmpty.h:153
virtual const GeoTessData & getDataBottom() const
Get the Data object at the bottom of the profile.
Definition: GeoTessProfileSurfaceEmpty.h:230
virtual double getValue(int attributeIndex, int nodeIndex) const
Retrieve the value of the specified attribute from this profile at the specified node index...
Definition: GeoTessProfileSurfaceEmpty.h:114
virtual float getRadius(int i) const
Get the i'th radius value in this profile in km.
Definition: GeoTessProfileSurfaceEmpty.h:243
Definition: ArrayReuse.h:55
Opens a file for binary read and write access.
Definition: IFStreamBinary.h:79
virtual float getRadiusTop() const
Get the radius at the top of the profile, in km.
Definition: GeoTessProfileSurfaceEmpty.h:256
Enumeration of the interpolation algorithms supported by GeoTess including LINEAR, NATURAL_NEIGHBOR and CUBIC_SPLINE.
Definition: GeoTessInterpolatorType.h:71
virtual bool isNaN(int nodeIndex, int attributeIndex)
Return true if the specified Data value is NaN.
Definition: GeoTessProfileSurfaceEmpty.h:134
Enumeration of the valid Profile types, including EMPTY, THIN, CONSTANT, NPOINT and SURFACE...
Definition: GeoTessProfileType.h:69
virtual const GeoTessProfileType & getType() const
One of EMPTY, THIN, CONSTANT, NPOINT, SURFACE.
virtual void setRadius(int index, float radius)
Replace the radius at the specified nodeIndex.
Definition: GeoTessProfileSurfaceEmpty.h:250
virtual int getNRadii() const
Get the number of radii that comprise this profile.
Definition: GeoTessProfileSurfaceEmpty.h:266
Manages a single data value attached to a grid node.
Definition: GeoTessData.h:63
virtual GeoTessData * getDataBottom()
Get the Data object at the bottom of the profile.
Definition: GeoTessProfileSurfaceEmpty.h:218
virtual const GeoTessProfileType & getType() const
Returns ProfileType (SURFACE).
Definition: GeoTessProfileSurfaceEmpty.h:99
virtual GeoTessData * getData(int i)
Retrieve a reference the i'th Data object.
Definition: GeoTessProfileSurfaceEmpty.h:171
An exception class for all GeoTess objects.
Definition: GeoTessException.h:65
virtual const GeoTessData & getDataTop() const
Get the Data object at the top of the profile.
Definition: GeoTessProfileSurfaceEmpty.h:206
#define byte
signed-byte typedef
Definition: CPPGlobals.h:94
virtual int class_size() const
Returns the class size.
Definition: GeoTessProfileSurfaceEmpty.h:90
virtual void setRadii(const vector< float > &newRadii)
Replace the radii currently associated with this Profile with new values.
Definition: GeoTessProfileSurfaceEmpty.h:248
virtual void setData(const vector< GeoTessData * > &inData)
Resets the data object to the new input data.
Definition: GeoTessProfileSurfaceEmpty.h:148
#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 & getData(int i) const
Retrieve a reference the i'th Data object.
Definition: GeoTessProfileSurfaceEmpty.h:183
virtual double getValueTop(int attributeIndex) const
Retrieve the value of the specified attribute at the top of the layer.
Definition: GeoTessProfileSurfaceEmpty.h:122
virtual float * getRadii()
Returns NULL.
Definition: GeoTessProfileSurfaceEmpty.h:276
Basic metadata information about a GeoTessModel.
Definition: GeoTessMetaData.h:95
GeoTessProfileSurfaceEmpty()
Definition: GeoTessProfileSurfaceEmpty.h:80
virtual GeoTessData * getDataTop()
Get the Data object at the top of the profile.
Definition: GeoTessProfileSurfaceEmpty.h:194
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71
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: GeoTessProfileSurfaceEmpty.h:140