GeoTessCPP  2.6.1
Software to facilitate storage and retrieval of 3D information about the Earth.
GeoTessHorizonRadius.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 HORIZONRADIUS_H_
37 #define HORIZONRADIUS_H_
38 
39 // **** _SYSTEM INCLUDES_ ******************************************************
40 
41 #include <iostream>
42 #include <fstream>
43 #include <string>
44 #include <climits>
45 
46 // use standard library objects
47 using namespace std;
48 
49 // **** _LOCAL INCLUDES_ *******************************************************
50 
51 #include "GeoTessHorizon.h"
52 #include "GeoTessProfile.h"
53 #include "GeoTessPosition.h"
54 
55 // **** _BEGIN GEOTESS NAMESPACE_ *********************************************
56 
57 namespace geotess {
58 
59 // **** _FORWARD REFERENCES_ ***************************************************
60 
61 // **** _CLASS DEFINITION_ *****************************************************
62 
72 {
73 
74 private:
75 
79  double radius;
80 
81 public:
82 
90  GeoTessHorizonRadius(const double& r) : GeoTessHorizon(-1), radius(r)
91  {};
92 
102  GeoTessHorizonRadius(const double& r, const int& lyrIndex) : GeoTessHorizon(lyrIndex), radius(r)
103  {};
104 
108  virtual ~GeoTessHorizonRadius() {};
109 
113  GeoTessHorizonRadius(GeoTessHorizonRadius& other) : GeoTessHorizon(other.getLayerIndex()), radius(other.radius)
114  {
115  }
116 
121  {
122  layerIndex = other.layerIndex;
123  radius = other.radius;
124  return *this;
125  }
126 
127  virtual string class_name() { return "HorizonRadius"; };
128 
129  virtual double getValue() { return radius; };
130 
131  virtual double getRadius(const double* position, GeoTessProfile** profiles)
132  {
133  if (layerIndex < 0)
134  return radius;
135  double bottom = profiles[layerIndex]->getRadiusBottom();
136  if (radius <= bottom)
137  return bottom;
138  double top = profiles[layerIndex]->getRadiusTop();
139  if (radius >= top)
140  return top;
141  return radius;
142  }
143 
144  virtual double getRadius(GeoTessPosition& position)
145  {
146  if (layerIndex < 0)
147  return radius;
148  double bottom = position.getRadiusBottom(layerIndex);
149  if (radius <= bottom)
150  return bottom;
151  double top = position.getRadiusTop(layerIndex);
152  if (radius >= top)
153  return top;
154  return radius;
155  }
156 
157  virtual string str()
158  {
159  string s = "radius " + CPPUtils::dtos(radius) + " " + CPPUtils::itos(layerIndex);
160  return s;
161  }
162 
163 }; // end class DataValue
164 
165 } // end namespace geotess
166 
167 #endif /* HORIZONRADIUS_H_ */
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71
An abstract class that represents a single "surface" within a model.
Defines a "surface" in a model that resides at a constant radius.
GeoTessHorizonRadius(const double &r, const int &lyrIndex)
virtual double getRadius(GeoTessPosition &position)
GeoTessHorizonRadius(GeoTessHorizonRadius &other)
GeoTessHorizonRadius & operator=(const GeoTessHorizonRadius &other)
virtual double getRadius(const double *position, GeoTessProfile **profiles)
Information about an interpolated point at an arbitrary position in a model.
double getRadiusTop(int layid)
double getRadiusBottom(int layid)
Abstract class that manages the radii and data values that span a single layer associated with a sing...
virtual float getRadiusTop() const
virtual float getRadiusBottom() const