1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
14#ifndef OSGTERRAIN_VALIDDATAOPERATOR
15#define OSGTERRAIN_VALIDDATAOPERATOR 1
17#include <osg/Referenced>
21#include <osgTerrain/Export>
25struct ValidDataOperator : public osg::Referenced
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()); }
33struct ValidRange : public ValidDataOperator
35 ValidRange(float minValue, float maxValue):
37 _maxValue(maxValue) {}
39 void setRange(float minValue, float maxValue)
45 void setMinValue(float minValue) { _minValue = minValue; }
46 float getMinValue() const { return _minValue; }
48 void setMaxValue(float maxValue) { _maxValue = maxValue; }
49 float getMaxValue() const { return _maxValue; }
51 virtual bool operator() (float value) const { return value>=_minValue && value<=_maxValue; }
53 float _minValue, _maxValue;
57struct NoDataValue : public ValidDataOperator
59 NoDataValue(float value):
62 void setNoDataValue(float value) { _value = value; }
63 float getValue() const { return _value; }
65 virtual bool operator() (float value) const { return value!=_value; }