GeoTessCPP  2.2.3
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 National Technology & Engineering Solutions of Sandia, LLC
4 //- (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
5 //- Government 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 //- 1. Redistributions of source code must retain the above copyright notice,
14 //- this list of conditions and the following disclaimer.
15 //-
16 //- 2. Redistributions in binary form must reproduce the above copyright
17 //- notice, this list of conditions and the following disclaimer in the
18 //- documentation and/or other materials provided with the distribution.
19 //-
20 //- 3. Neither the name of the copyright holder nor the names of its
21 //- contributors may be used to endorse or promote products derived from
22 //- this software without specific prior written permission.
23 //-
24 //- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 //- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 //- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 //- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28 //- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 //- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 //- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 //- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 //- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 //- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 //- POSSIBILITY OF SUCH DAMAGE.
35 //-
36 //- ****************************************************************************
37 
38 #ifndef HORIZONRADIUS_H_
39 #define HORIZONRADIUS_H_
40 
41 // **** _SYSTEM INCLUDES_ ******************************************************
42 
43 #include <iostream>
44 #include <fstream>
45 #include <string>
46 #include <climits>
47 
48 // use standard library objects
49 using namespace std;
50 
51 // **** _LOCAL INCLUDES_ *******************************************************
52 
53 #include "GeoTessHorizon.h"
54 #include "GeoTessProfile.h"
55 #include "GeoTessPosition.h"
56 
57 // **** _BEGIN GEOTESS NAMESPACE_ *********************************************
58 
59 namespace geotess {
60 
61 // **** _FORWARD REFERENCES_ ***************************************************
62 
63 // **** _CLASS DEFINITION_ *****************************************************
64 
74 {
75 
76 private:
77 
81  double radius;
82 
83 public:
84 
92  GeoTessHorizonRadius(const double& r) : GeoTessHorizon(-1), radius(r)
93  {};
94 
104  GeoTessHorizonRadius(const double& r, const int& lyrIndex) : GeoTessHorizon(lyrIndex), radius(r)
105  {};
106 
110  virtual ~GeoTessHorizonRadius() {};
111 
115  GeoTessHorizonRadius(GeoTessHorizonRadius& other) : GeoTessHorizon(other.getLayerIndex()), radius(other.radius)
116  {
117  }
118 
123  {
124  layerIndex = other.layerIndex;
125  radius = other.radius;
126  return *this;
127  }
128 
129  virtual string class_name() { return "HorizonRadius"; };
130 
131  virtual double getValue() { return radius; };
132 
133  virtual double getRadius(const double* position, GeoTessProfile** profiles)
134  {
135  if (layerIndex < 0)
136  return radius;
137  double bottom = profiles[layerIndex]->getRadiusBottom();
138  if (radius <= bottom)
139  return bottom;
140  double top = profiles[layerIndex]->getRadiusTop();
141  if (radius >= top)
142  return top;
143  return radius;
144  }
145 
146  virtual double getRadius(GeoTessPosition& position)
147  {
148  if (layerIndex < 0)
149  return radius;
150  double bottom = position.getRadiusBottom(layerIndex);
151  if (radius <= bottom)
152  return bottom;
153  double top = position.getRadiusTop(layerIndex);
154  if (radius >= top)
155  return top;
156  return radius;
157  }
158 
159  virtual string str()
160  {
161  string s = "radius " + CPPUtils::dtos(radius) + " " + CPPUtils::itos(layerIndex);
162  return s;
163  }
164 
165 }; // end class DataValue
166 
167 } // end namespace geotess
168 
169 #endif /* HORIZONRADIUS_H_ */
geotess
Definition: ArrayReuse.h:57
geotess::GeoTessProfile
Abstract class that manages the radii and data values that span a single layer associated with a sing...
Definition: GeoTessProfile.h:99
geotess::GeoTessProfile::getRadiusTop
virtual float getRadiusTop() const
GeoTessProfile.h
geotess::GeoTessHorizonRadius::operator=
GeoTessHorizonRadius & operator=(const GeoTessHorizonRadius &other)
Definition: GeoTessHorizonRadius.h:122
geotess::GeoTessHorizonRadius::getValue
virtual double getValue()
Definition: GeoTessHorizonRadius.h:131
geotess::GeoTessHorizon
An abstract class that represents a single "surface" within a model.
Definition: GeoTessHorizon.h:82
geotess::GeoTessProfile::getRadiusBottom
virtual float getRadiusBottom() const
geotess::GeoTessHorizonRadius::getRadius
virtual double getRadius(const double *position, GeoTessProfile **profiles)
Definition: GeoTessHorizonRadius.h:133
GEOTESS_EXP_IMP
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:73
GeoTessPosition.h
geotess::GeoTessPosition
Information about an interpolated point at an arbitrary position in a model.
Definition: GeoTessPosition.h:104
geotess::GeoTessHorizonRadius::~GeoTessHorizonRadius
virtual ~GeoTessHorizonRadius()
Definition: GeoTessHorizonRadius.h:110
geotess::GeoTessHorizonRadius::GeoTessHorizonRadius
GeoTessHorizonRadius(GeoTessHorizonRadius &other)
Definition: GeoTessHorizonRadius.h:115
GeoTessHorizon.h
geotess::GeoTessHorizon::layerIndex
int layerIndex
Definition: GeoTessHorizon.h:94
geotess::GeoTessHorizonRadius::class_name
virtual string class_name()
Definition: GeoTessHorizonRadius.h:129
geotess::GeoTessPosition::getRadiusTop
double getRadiusTop(int layid)
geotess::GeoTessHorizonRadius
Defines a "surface" in a model that resides at a constant radius.
Definition: GeoTessHorizonRadius.h:74
geotess::GeoTessPosition::getRadiusBottom
double getRadiusBottom(int layid)
geotess::GeoTessHorizonRadius::getRadius
virtual double getRadius(GeoTessPosition &position)
Definition: GeoTessHorizonRadius.h:146
geotess::GeoTessHorizonRadius::str
virtual string str()
Definition: GeoTessHorizonRadius.h:159
geotess::GeoTessHorizonRadius::GeoTessHorizonRadius
GeoTessHorizonRadius(const double &r)
Definition: GeoTessHorizonRadius.h:92
geotess::GeoTessHorizonRadius::GeoTessHorizonRadius
GeoTessHorizonRadius(const double &r, const int &lyrIndex)
Definition: GeoTessHorizonRadius.h:104