14#ifndef OSGTERRAIN_LAYER
15#define OSGTERRAIN_LAYER 1
27#define MAXIMUM_NUMBER_OF_LEVELS 30
117 virtual bool transform(
float ,
float ) {
return false; }
126 virtual bool getValue(
unsigned int ,
unsigned int ,
float& )
const {
return false; }
131 inline bool getValidValue(
unsigned int i,
unsigned int j,
float& value)
const
165 inline void computeIndices(
double ndc_x,
double ndc_y,
unsigned int& i,
unsigned int& j,
double& ir,
double& jr)
const
169 i = (
unsigned int)(ndc_x);
170 j = (
unsigned int)(ndc_y);
171 ir = ndc_x - double(i);
172 jr = ndc_y - double(j);
191 r = (1.0f-ir)*(1.0f-jr);
238 r = (1.0f-ir)*(1.0f-jr);
331 virtual bool getValue(
unsigned int i,
unsigned int j,
float& value)
const;
378 virtual bool getValue(
unsigned int i,
unsigned int j,
float& value)
const;
421 virtual bool getValue(
unsigned int i,
unsigned int j,
float& value)
const;
480 virtual bool getValue(
unsigned int i,
unsigned int j,
float& value)
const;
539 void addLayer(
const std::string& setname,
const std::string& filename);
569 if (&cnl==
this)
return *
this;
582 typedef std::vector< CompoundNameLayer >
Layers;
Vec2f Vec2
Definition Vec2:21
Vec3f Vec3
Definition Vec3:21
BoundingSphered BoundingSphere
Definition BoundingSphere:308
Vec4f Vec4
Definition Vec4:21
The osgTerrain library is a NodeKit that provides geospecifc terrain rendering support.
Definition Node:29
OSGTERRAIN_EXPORT void extractSetNameAndFileName(const std::string &compoundstring, std::string &setname, std::string &filename)
Extact the setname and filename from a compound string in the from set:setname:filename".
OSGTERRAIN_EXPORT std::string createCompoundSetNameAndFileName(const std::string &setname, const std::string &filename)
Create a compound string in the form set:setname:filename, or just filename if setname is "".
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Image class for encapsulating the storage texture image data.
Definition Image:179
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
virtual void setName(const std::string &name)
Set the name of object using C++ style string.
Definition Object:203
const std::string & getName() const
Get the name of object.
Definition Object:213
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
FilterMode
Definition Texture:499
1D variant of TransferFunction.
Definition TransferFunction:56
const osg::Vec4 & getDefaultValue() const
Definition Layer:92
const ValidDataOperator * getValidDataOperator() const
Get the const data validation operator.
Definition Layer:82
unsigned int getMaxLevel() const
Definition Layer:73
bool getInterpolatedValidValue(double ndc_x, double ndc_y, float &value) const
Definition Layer:229
const Locator * getLocator() const
Definition Layer:67
virtual unsigned int getModifiedCount() const
Get modified count value.
Definition Layer:283
void setSetName(const std::string &setname)
Set the name of this layer.
Definition Layer:48
virtual bool transform(float, float)
Definition Layer:117
virtual unsigned int getNumRows() const
Get the number of rows.
Definition Layer:89
unsigned int _minLevel
Definition Layer:293
virtual osg::Image * getImage()
Return image associated with layer if supported.
Definition Layer:111
virtual bool getValue(unsigned int, unsigned int, osg::Vec2 &) const
Definition Layer:127
Layer(const Layer &, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
void setMagFilter(osg::Texture::FilterMode filter)
Set the magnification texture filter to use when a texture is associated with this layer.
Definition Layer:103
virtual bool getValue(unsigned int, unsigned int, osg::Vec3 &) const
Definition Layer:128
unsigned int getMinLevel() const
Definition Layer:70
virtual void dirty()
increment the modified count.
Definition Layer:277
virtual void setModifiedCount(unsigned int)
Set the modified count value.
Definition Layer:280
META_Object(osgTerrain, Layer)
osg::ref_ptr< ValidDataOperator > _validDataOperator
Definition Layer:295
void setMinLevel(unsigned int minLevel)
Definition Layer:69
std::string getCompoundName() const
Return the compound name of the layer in the form set::name::filename string.
Definition Layer:60
unsigned int _maxLevel
Definition Layer:294
bool getValidValue(unsigned int i, unsigned int j, osg::Vec3 &value) const
Definition Layer:143
virtual void setFileName(const std::string &filename)
Set the file name of the data associated with this layer.
Definition Layer:54
void setMinFilter(osg::Texture::FilterMode filter)
Set the minification texture filter to use when a texture is associated with this layer.
Definition Layer:96
bool getValidValue(unsigned int i, unsigned int j, osg::Vec2 &value) const
Definition Layer:137
void setMaxLevel(unsigned int maxLevel)
Definition Layer:72
bool getInterpolatedValue(double ndc_x, double ndc_y, float &value) const
Calculate the interpolated layer value at the given normalized coordinates.
Definition Layer:182
bool getValidValue(unsigned int i, unsigned int j, float &value) const
Definition Layer:131
void setValidDataOperator(ValidDataOperator *validDataOp)
Set the data validation operator.
Definition Layer:76
const std::string & getSetName() const
Get the name of this layer.
Definition Layer:51
virtual bool getValue(unsigned int, unsigned int, osg::Vec4 &) const
Definition Layer:129
osg::Texture::FilterMode getMagFilter() const
Get the magnification texture filter to use when a texture is associated with this layer.
Definition Layer:106
osg::Texture::FilterMode _minFilter
Definition Layer:297
virtual osg::BoundingSphere computeBound(bool treatAsElevationLayer) const
osg::Texture::FilterMode getMinFilter() const
Get the minification texture filter to use when a texture is associated with this layer.
Definition Layer:99
void setDefaultValue(const osg::Vec4 &value)
Definition Layer:91
ValidDataOperator * getValidDataOperator()
Get the data validation operator.
Definition Layer:79
std::string _filename
Definition Layer:291
void computeIndices(double ndc_x, double ndc_y, unsigned int &i, unsigned int &j, double &ir, double &jr) const
Compute column,row indices from normalized coordinates.
Definition Layer:165
virtual const osg::Image * getImage() const
Return const image associated with layer if supported.
Definition Layer:114
virtual const std::string & getFileName() const
Get the file name of the layer.
Definition Layer:57
virtual bool getValue(unsigned int, unsigned int, float &) const
Get the layer value at position i,j.
Definition Layer:126
virtual unsigned int getNumColumns() const
Get the number of columns.
Definition Layer:86
void setLocator(const osg::ref_ptr< T > &locator)
Definition Layer:64
osg::Texture::FilterMode _magFilter
Definition Layer:298
bool getValidValue(unsigned int i, unsigned int j, osg::Vec4 &value) const
Definition Layer:149
Locator * getLocator()
Definition Layer:66
osg::Vec4 _defaultValue
Definition Layer:296
void setLocator(Locator *locator)
Definition Layer:62
osg::ref_ptr< Locator > _locator
Definition Layer:292
void setImage(const osg::ref_ptr< T > &image)
Definition Layer:320
virtual unsigned int getNumRows() const
Get the number of rows.
Definition Layer:329
virtual const osg::Image * getImage() const
Return const image associated with layer.
Definition Layer:326
ImageLayer(const ImageLayer &imageLayer, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
virtual unsigned int getNumColumns() const
Get the number of columns.
Definition Layer:328
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec4 &value) const
virtual bool transform(float offset, float scale)
virtual void dirty()
increment the modified count.
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec2 &value) const
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec3 &value) const
virtual ~ImageLayer()
Definition Layer:342
virtual bool getValue(unsigned int i, unsigned int j, float &value) const
Get the layer value at position i,j.
void setImage(osg::Image *image)
META_Object(osgTerrain, ImageLayer)
void setFileName(const std::string &filename)
Set the file name of the data associated with this layer.
Definition Layer:313
osg::ref_ptr< osg::Image > _image
Definition Layer:344
ImageLayer(osg::Image *image=0)
virtual unsigned int getModifiedCount() const
Get modified count value.
virtual void setModifiedCount(unsigned int value)
Set the modified count value.
virtual osg::Image * getImage()
Return image associated with layer.
Definition Layer:323
virtual const std::string & getFileName() const
Get the file name of the layer.
Definition Layer:314
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec3 &value) const
virtual unsigned int getNumColumns() const
Get the number of columns.
Definition Layer:375
const osg::TransferFunction1D * getTransferFunction() const
Definition Layer:366
virtual unsigned int getModifiedCount() const
Get modified count value.
osg::TransferFunction1D * getTransferFunction()
Definition Layer:365
virtual void dirty()
increment the modified count.
void setTransferFunction(osg::TransferFunction1D *tf)
ContourLayer(const ContourLayer &tfLayer, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
virtual osg::Image * getImage()
Return image associated with layer.
Definition Layer:369
virtual unsigned int getNumRows() const
Get the number of rows.
Definition Layer:376
virtual bool getValue(unsigned int i, unsigned int j, float &value) const
Get the layer value at position i,j.
virtual bool transform(float offset, float scale)
virtual void setModifiedCount(unsigned int value)
Set the modified count value.
ContourLayer(osg::TransferFunction1D *tf=0)
virtual ~ContourLayer()
Definition Layer:389
void setTransferFunction(const osg::ref_ptr< T > &tf)
Definition Layer:363
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec4 &value) const
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec2 &value) const
virtual const osg::Image * getImage() const
Return const image associated with layer.
Definition Layer:372
META_Object(osgTerrain, ContourLayer)
osg::ref_ptr< osg::TransferFunction1D > _tf
Definition Layer:391
virtual void dirty()
increment the modified count.
void setHeightField(osg::HeightField *hf)
virtual unsigned int getNumRows() const
Get the number of rows.
Definition Layer:419
virtual unsigned int getNumColumns() const
Get the number of columns.
Definition Layer:418
void setFileName(const std::string &filename)
Set the file name of the data associated with this layer.
Definition Layer:406
virtual ~HeightFieldLayer()
Definition Layer:432
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec3 &value) const
virtual void setModifiedCount(unsigned int value)
Set the modified count value.
virtual unsigned int getModifiedCount() const
Get modified count value.
osg::HeightField * getHeightField()
Definition Layer:415
osg::ref_ptr< osg::HeightField > _heightField
Definition Layer:435
virtual const std::string & getFileName() const
Get the file name of the layer.
Definition Layer:407
META_Object(osgTerrain, HeightFieldLayer)
virtual bool transform(float offset, float scale)
HeightFieldLayer(const HeightFieldLayer &hfLayer, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
unsigned int _modifiedCount
Definition Layer:434
const osg::HeightField * getHeightField() const
Definition Layer:416
HeightFieldLayer(osg::HeightField *hf=0)
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec4 &value) const
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec2 &value) const
void setHeightField(const osg::ref_ptr< T > &hf)
Definition Layer:413
virtual bool getValue(unsigned int i, unsigned int j, float &value) const
Get the layer value at position i,j.
virtual bool getValue(unsigned int i, unsigned int j, float &value) const
Get the layer value at position i,j.
virtual void dirty()
increment the modified count.
virtual const std::string & getFileName() const
Get the file name of the layer.
Definition Layer:473
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec3 &value) const
virtual unsigned int getNumRows() const
Get the number of rows.
META_Object(osgTerrain, ProxyLayer)
virtual unsigned int getNumColumns() const
Get the number of columns.
void setImplementation(Layer *layer)
Set the implementation layer that does the actual work.
Definition Layer:464
virtual bool transform(float offset, float scale)
Layer * getImplementation()
Get the implementation layer that does the actual work.
Definition Layer:467
virtual osg::BoundingSphere computeBound(bool treatAsElevationLayer) const
ProxyLayer(const ProxyLayer &proxyLayer, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
const Layer * getImplementation() const
Get the const implementation layer that does the actual work.
Definition Layer:470
virtual unsigned int getModifiedCount() const
Get modified count value.
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec2 &value) const
virtual osg::Image * getImage()
Return image associated with layer if supported.
Definition Layer:452
virtual void setModifiedCount(unsigned int value)
Set the modified count value.
virtual void setFileName(const std::string &filename)
Set the file name of the data associated with this layer.
virtual bool getValue(unsigned int i, unsigned int j, osg::Vec4 &value) const
osg::ref_ptr< Layer > _implementation
Definition Layer:495
virtual const osg::Image * getImage() const
Return const image associated with layer if supported.
Definition Layer:458
Layer * getLayer(unsigned int i)
Definition Layer:533
META_Object(osgTerrain, CompositeLayer)
const std::string & getFileName(unsigned int i) const
Get the file name of the data associated with layer 'i'.
Definition Layer:523
std::vector< CompoundNameLayer > Layers
Definition Layer:582
void addLayer(const std::string &compoundname)
CompositeLayer(const CompositeLayer &compositeLayer, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
void setSetName(unsigned int i, const std::string &setname)
Set the set name of layer 'i'.
Definition Layer:514
void setCompoundName(unsigned int i, const std::string &compoundname)
virtual ~CompositeLayer()
Definition Layer:551
const std::string & getSetName(unsigned int i) const
Get the set name of layer 'i'.
Definition Layer:517
Layers _layers
Definition Layer:584
unsigned int getNumLayers() const
Definition Layer:547
void setLayer(unsigned int i, Layer *layer)
Definition Layer:529
void removeLayer(unsigned int i)
Definition Layer:545
std::string getCompoundName(unsigned int i) const
void addLayer(Layer *layer)
Definition Layer:541
void setLayer(unsigned int i, const osg::ref_ptr< T > &layer)
Definition Layer:531
const Layer * getLayer(unsigned int i) const
Definition Layer:535
void setFileName(unsigned int i, const std::string &filename)
Set the file name of the data associated with layer 'i'.
Definition Layer:520
void addLayer(const std::string &setname, const std::string &filename)
void addLayer(const osg::ref_ptr< T > &layer)
Definition Layer:543
CompoundNameLayer()
Definition Layer:555
CompoundNameLayer(const std::string &sn, const std::string &fn, Layer *l)
Definition Layer:562
osg::ref_ptr< Layer > layer
Definition Layer:579
std::string setname
Definition Layer:577
std::string filename
Definition Layer:578
CompoundNameLayer(const CompoundNameLayer &cnl)
Definition Layer:557
virtual osg::Image * getImage()
Return image associated with layer if supported.
Definition Layer:603
int getActiveLayer() const
Definition Layer:600
void setActiveLayer(int i)
Definition Layer:599
SwitchLayer(const SwitchLayer &switchLayer, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
META_Object(osgTerrain, SwitchLayer)
int _activeLayer
Definition Layer:622
virtual ~SwitchLayer()
Definition Layer:620
virtual const osg::Image * getImage() const
Return const image associated with layer if supported.
Definition Layer:611
Definition ValidDataOperator:26
#define OSGTERRAIN_EXPORT
Definition Export:39