OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ValidDataOperator.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 
14 #ifndef OSGTERRAIN_VALIDDATAOPERATOR
15 #define OSGTERRAIN_VALIDDATAOPERATOR 1
16 
17 #include <osg/Referenced>
18 #include <osg/Vec2>
19 #include <osg/Vec3>
20 #include <osg/Vec4>
21 #include <osgTerrain/Export>
22 
23 namespace osgTerrain {
24 
26 {
27  virtual bool operator() (float /*value*/) const { return true; }
28  virtual bool operator() (const osg::Vec2& value) const { return operator()(value.x()) && operator()(value.y()) ; }
29  virtual bool operator() (const osg::Vec3& value) const { return operator()(value.x()) && operator()(value.y()) && operator()(value.z()); }
30  virtual bool operator() (const osg::Vec4& value) const { return operator()(value.x()) && operator()(value.y()) && operator()(value.z()) && operator()(value.w()); }
31 };
32 
34 {
35  ValidRange(float minValue, float maxValue):
36  _minValue(minValue),
37  _maxValue(maxValue) {}
38 
39  void setRange(float minValue, float maxValue)
40  {
41  _minValue = minValue;
42  _maxValue = maxValue;
43  }
44 
45  void setMinValue(float minValue) { _minValue = minValue; }
46  float getMinValue() const { return _minValue; }
47 
48  void setMaxValue(float maxValue) { _maxValue = maxValue; }
49  float getMaxValue() const { return _maxValue; }
50 
51  virtual bool operator() (float value) const { return value>=_minValue && value<=_maxValue; }
52 
54 };
55 
56 
58 {
59  NoDataValue(float value):
60  _value(value) {}
61 
62  void setNoDataValue(float value) { _value = value; }
63  float getValue() const { return _value; }
64 
65  virtual bool operator() (float value) const { return value!=_value; }
66 
67  float _value;
68 };
69 
70 }
71 
72 #endif
73 
74 
void setRange(float minValue, float maxValue)
virtual bool operator()(float value) const
value_type & y()
Definition: Vec2f.h:68
void setNoDataValue(float value)
value_type & x()
Definition: Vec3f.h:80
virtual bool operator()(const osg::Vec4 &value) const
value_type & z()
Definition: Vec3f.h:82
virtual bool operator()(const osg::Vec3 &value) const
virtual bool operator()(float) const
value_type & x()
Definition: Vec2f.h:67
value_type & y()
Definition: Vec4f.h:88
float getMaxValue() const
value_type & y()
Definition: Vec3f.h:81
void setMaxValue(float maxValue)
float getMinValue() const
virtual bool operator()(float value) const
value_type & w()
Definition: Vec4f.h:90
ValidRange(float minValue, float maxValue)
void setMinValue(float minValue)
value_type & z()
Definition: Vec4f.h:89
value_type & x()
Definition: Vec4f.h:87
virtual bool operator()(const osg::Vec2 &value) const