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

Loading...
Searching...
No Matches
GeoTessProfileSurface.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_OBJECT_H
37#define PROFILESURFACE_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
57// **** _BEGIN GEOTESS NAMESPACE_ **********************************************
58
59 namespace geotess {
60
61// **** _FORWARD REFERENCES_ ***************************************************
62
63 class GeoTessMetaData;
64
65// **** _CLASS DEFINITION_ *****************************************************
66
76 class GEOTESS_EXP_IMP GeoTessProfileSurface: virtual public GeoTessProfile
77{
78 private:
79
83 GeoTessData* data;
84
88 int pointIndex;
89
93 GeoTessProfileSurface() : GeoTessProfile(), data(NULL),
94 pointIndex(-1) {};
95
96 public:
97
101 GeoTessProfileSurface(GeoTessData* dat) : GeoTessProfile(), data(dat),
102 pointIndex(-1) {};
103
107 static string class_name() { return "ProfileSurface"; };
108
112 virtual int class_size() const
113 { return (int) sizeof(GeoTessProfileSurface); };
114
115 virtual LONG_INT getMemory()
116 { return (LONG_INT)(sizeof(GeoTessProfileSurface) + data->getMemory()); }
117
123 virtual const GeoTessProfileType& getType() const
124 { return GeoTessProfileType::SURFACE; };
125
129 virtual bool operator == (const GeoTessProfile& p) const
130 { return (GeoTessProfile::operator==(p) &&
131 (*data == p.getData(0)));
132 }
133
142 virtual double getValue(int attributeIndex, int nodeIndex) const
143 {
144 return nodeIndex == 0 ? data->getDouble(attributeIndex) : NaN_DOUBLE;
145 }
146
153 virtual double getValueTop(int attributeIndex) const
154 { return data->getDouble(attributeIndex); }
155
166 virtual bool isNaN(int nodeIndex, int attributeIndex)
167 {
168 return nodeIndex != 0 || data->isNaN(attributeIndex);
169 }
170
175 virtual double getValue(const GeoTessInterpolatorType& rInterpType,
176 int attributeIndex, double radius,
177 bool allowRadiusOutOfRange) const
178 {
179 return getData(0).getDouble(attributeIndex);
180 }
181
186 virtual float getRadius(int i) const
187 { return NaN_FLOAT; };
188
192 virtual int getNRadii() const { return 0; };
193
197 virtual int getNData() const { return 1; };
198
202 virtual float* getRadii() { return NULL; };
203
207 virtual GeoTessData** getData()
208 { GeoTessData** da = new GeoTessData* [1]; da[0] = data; return da; };
209
213 virtual GeoTessData* getData(int i) { return data; };
214
218 virtual const GeoTessData& getData(int i) const { return *data; };
219
223 virtual void setData(const vector<GeoTessData*>& inData)
224 { delete data; data = inData[0]; }
225
229 virtual void setData(int index, GeoTessData* inData)
230 { delete data; data = inData; }
231
232 // TODO: added by sb 9/27/2012
236 virtual void setRadii(const vector<float>& newRadii)
237 { /* do nothing */ };
238
239 virtual void setRadius(int index, float radius)
240 { /* do nothing */ }
241
245 virtual float getRadiusTop() const
246 { return NaN_FLOAT; };
247
251 virtual const GeoTessData& getDataTop() const { return *data; };
252
256 virtual GeoTessData* getDataTop() { return data; };
257
261 virtual float getRadiusBottom() const
262 { return NaN_FLOAT; };
263
267 virtual const GeoTessData& getDataBottom() const { return *data; };
268
272 virtual GeoTessData* getDataBottom() { return data; };
273
275
279 GeoTessProfileSurface(IFStreamBinary& ifs, GeoTessMetaData& gtmd) : GeoTessProfile(),
280 data(NULL), pointIndex(-1)
281 { data = GeoTessData::getData(ifs, gtmd); };
282
286 GeoTessProfileSurface(IFStreamAscii& ifs, GeoTessMetaData& gtmd) : GeoTessProfile(),
287 data(NULL), pointIndex(-1)
288 { data = GeoTessData::getData(ifs, gtmd); };
289
294 virtual ~GeoTessProfileSurface() { if (data != NULL) delete data; };
295
299 virtual void write(IFStreamBinary& ofs)
300 { ofs.writeByte((byte) GeoTessProfileType::SURFACE.ordinal());
301 data->write(ofs); };
302
306 virtual void write(IFStreamAscii& ofs)
307 { ofs.writeInt(GeoTessProfileType::SURFACE.ordinal());
308 data->write(ofs);
309 ofs.writeNL(); };
310
311 // *** TODO added 7/20/2012
320 virtual int findClosestRadiusIndex(double radius) const
321 { return -1; }
322
323 // *** TODO added 7/20/2012
331 virtual void setPointIndex(int nodeIndex, int pntIndex)
332 { pointIndex = pntIndex; }
333
334 // *** TODO added 10/14/2012
342 virtual void resetPointIndices() { pointIndex = -1; }
343
344 // *** TODO added 7/20/2012
352 virtual int getPointIndex(int nodeIndex) const
353 { return pointIndex; }
354
355 // *** TODO added 8/20/2012
359 virtual GeoTessProfile* copy()
360 {
361 return new GeoTessProfileSurface(data->copy());
362 }
363
365
366}; // end class ProfileSurface
367
368} // end namespace geotess
369
370#endif // PROFILESURFACE_OBJECT_H
GEOTESS_EXP_IMP
#define GEOTESS_EXP_IMP
Definition CPPGlobals.h:71
LONG_INT
#define LONG_INT
Definition CPPGlobals.h:111
GeoTessData.h
GeoTessProfile.h
GeoTessProfileType.h
GeoTessUtils.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::GeoTessData::getData
static GeoTessData * getData(const GeoTessDataType &dataType, int nAttributes)
geotess::GeoTessInterpolatorType
Enumeration of the interpolation algorithms supported by GeoTess including LINEAR,...
Definition GeoTessInterpolatorType.h:72
geotess::GeoTessMetaData
Basic metadata information about a GeoTessModel.
Definition GeoTessMetaData.h:97
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::getData
virtual GeoTessData ** getData()
geotess::GeoTessProfileSurface
A Profile object that defines a single Data object and no radius value.
Definition GeoTessProfileSurface.h:77
geotess::GeoTessProfileSurface::setRadii
virtual void setRadii(const vector< float > &newRadii)
Definition GeoTessProfileSurface.h:236
geotess::GeoTessProfileSurface::getValueTop
virtual double getValueTop(int attributeIndex) const
Definition GeoTessProfileSurface.h:153
geotess::GeoTessProfileSurface::isNaN
virtual bool isNaN(int nodeIndex, int attributeIndex)
Definition GeoTessProfileSurface.h:166
geotess::GeoTessProfileSurface::getRadiusTop
virtual float getRadiusTop() const
Definition GeoTessProfileSurface.h:245
geotess::GeoTessProfileSurface::getDataBottom
virtual const GeoTessData & getDataBottom() const
Definition GeoTessProfileSurface.h:267
geotess::GeoTessProfileSurface::getRadius
virtual float getRadius(int i) const
Definition GeoTessProfileSurface.h:186
geotess::GeoTessProfileSurface::getValue
virtual double getValue(const GeoTessInterpolatorType &rInterpType, int attributeIndex, double radius, bool allowRadiusOutOfRange) const
Definition GeoTessProfileSurface.h:175
geotess::GeoTessProfileSurface::setRadius
virtual void setRadius(int index, float radius)
Definition GeoTessProfileSurface.h:239
geotess::GeoTessProfileSurface::getDataTop
virtual GeoTessData * getDataTop()
Definition GeoTessProfileSurface.h:256
geotess::GeoTessProfileSurface::getNData
virtual int getNData() const
Definition GeoTessProfileSurface.h:197
geotess::GeoTessProfileSurface::getData
virtual GeoTessData * getData(int i)
Definition GeoTessProfileSurface.h:213
geotess::GeoTessProfileSurface::getData
virtual GeoTessData ** getData()
Definition GeoTessProfileSurface.h:207
geotess::GeoTessProfileSurface::getDataTop
virtual const GeoTessData & getDataTop() const
Definition GeoTessProfileSurface.h:251
geotess::GeoTessProfileSurface::GeoTessProfileSurface
GeoTessProfileSurface(GeoTessData *dat)
Definition GeoTessProfileSurface.h:101
geotess::GeoTessProfileSurface::setData
virtual void setData(const vector< GeoTessData * > &inData)
Definition GeoTessProfileSurface.h:223
geotess::GeoTessProfileSurface::getNRadii
virtual int getNRadii() const
Definition GeoTessProfileSurface.h:192
geotess::GeoTessProfileSurface::class_size
virtual int class_size() const
Definition GeoTessProfileSurface.h:112
geotess::GeoTessProfileSurface::getRadiusBottom
virtual float getRadiusBottom() const
Definition GeoTessProfileSurface.h:261
geotess::GeoTessProfileSurface::getData
virtual const GeoTessData & getData(int i) const
Definition GeoTessProfileSurface.h:218
geotess::GeoTessProfileSurface::getMemory
virtual LONG_INT getMemory()
Definition GeoTessProfileSurface.h:115
geotess::GeoTessProfileSurface::getValue
virtual double getValue(int attributeIndex, int nodeIndex) const
Definition GeoTessProfileSurface.h:142
geotess::GeoTessProfileSurface::class_name
static string class_name()
Definition GeoTessProfileSurface.h:107
geotess::GeoTessProfileSurface::getDataBottom
virtual GeoTessData * getDataBottom()
Definition GeoTessProfileSurface.h:272
geotess::GeoTessProfileSurface::setData
virtual void setData(int index, GeoTessData *inData)
Definition GeoTessProfileSurface.h:229
geotess::GeoTessProfileSurface::getType
virtual const GeoTessProfileType & getType() const
Definition GeoTessProfileSurface.h:123
geotess::GeoTessProfileSurface::getRadii
virtual float * getRadii()
Definition GeoTessProfileSurface.h:202
geotess::GeoTessProfileType
Enumeration of the valid Profile types, including EMPTY, THIN, CONSTANT, NPOINT and SURFACE.
Definition GeoTessProfileType.h:70
geotess::GeoTessProfileType::SURFACE
static const GeoTessProfileType SURFACE
Definition GeoTessProfileType.h:119
geotess::IFStreamBinary
Opens a file for binary read and write access.
Definition IFStreamBinary.h:80
geotess
Definition ArrayReuse.h:55