OpenSceneGraph 3.6.5
Layer
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_LAYER
15#define OSGTERRAIN_LAYER 1
16
17#include <osg/Image>
18#include <osg/Shape>
19#include <osg/Array>
20#include <osg/TransferFunction>
21
22#include <osgTerrain/Locator>
24
25namespace osgTerrain {
26
27#define MAXIMUM_NUMBER_OF_LEVELS 30
28
31extern OSGTERRAIN_EXPORT void extractSetNameAndFileName(const std::string& compoundstring, std::string& setname, std::string& filename);
32
34extern OSGTERRAIN_EXPORT std::string createCompoundSetNameAndFileName(const std::string& setname, const std::string& filename);
35
37{
38 public:
39
41
44
46
48 void setSetName(const std::string& setname) { setName(setname); }
49
51 const std::string& getSetName() const { return getName(); }
52
54 virtual void setFileName(const std::string& filename) { _filename = filename; }
55
57 virtual const std::string& getFileName() const { return _filename; }
58
61
62 void setLocator(Locator* locator) { _locator = locator; }
63
64 template<class T> void setLocator(const osg::ref_ptr<T>& locator) { setLocator(locator.get()); }
65
66 Locator* getLocator() { return _locator.get(); }
67 const Locator* getLocator() const { return _locator.get(); }
68
69 void setMinLevel(unsigned int minLevel) { _minLevel = minLevel; }
70 unsigned int getMinLevel() const { return _minLevel; }
71
72 void setMaxLevel(unsigned int maxLevel) { _maxLevel = maxLevel; }
73 unsigned int getMaxLevel() const { return _maxLevel; }
74
76 void setValidDataOperator(ValidDataOperator* validDataOp) { _validDataOperator = validDataOp; }
77
80
83
84
86 virtual unsigned int getNumColumns() const { return 0; }
87
89 virtual unsigned int getNumRows() const { return 0; }
90
91 void setDefaultValue(const osg::Vec4& value) { _defaultValue = value; }
92 const osg::Vec4& getDefaultValue() const { return _defaultValue; }
93
94
97
100
101
104
107
108
109
111 virtual osg::Image* getImage() { return 0; }
112
114 virtual const osg::Image* getImage() const { return 0; }
115
116
117 virtual bool transform(float /*offset*/, float /*scale*/) { return false; }
118
126 virtual bool getValue(unsigned int /*i*/, unsigned int /*j*/, float& /*value*/) const { return false; }
127 virtual bool getValue(unsigned int /*i*/, unsigned int /*j*/, osg::Vec2& /*value*/) const { return false; }
128 virtual bool getValue(unsigned int /*i*/, unsigned int /*j*/, osg::Vec3& /*value*/) const { return false; }
129 virtual bool getValue(unsigned int /*i*/, unsigned int /*j*/, osg::Vec4& /*value*/) const { return false; }
130
131 inline bool getValidValue(unsigned int i, unsigned int j, float& value) const
132 {
133 if (getValue(i,j,value)) return _validDataOperator.valid() ? (*_validDataOperator)(value) : true;
134 return false;
135 }
136
137 inline bool getValidValue(unsigned int i, unsigned int j, osg::Vec2& value) const
138 {
139 if (getValue(i,j,value)) return _validDataOperator.valid() ? (*_validDataOperator)(value) : true;
140 return false;
141 }
142
143 inline bool getValidValue(unsigned int i, unsigned int j, osg::Vec3& value) const
144 {
145 if (getValue(i,j,value)) return _validDataOperator.valid() ? (*_validDataOperator)(value) : true;
146 return false;
147 }
148
149 inline bool getValidValue(unsigned int i, unsigned int j, osg::Vec4& value) const
150 {
151 if (getValue(i,j,value)) return _validDataOperator.valid() ? (*_validDataOperator)(value) : true;
152 return false;
153 }
154
155
165 inline void computeIndices(double ndc_x, double ndc_y, unsigned int& i, unsigned int& j, double& ir, double& jr) const
166 {
167 ndc_x *= double(getNumColumns()-1);
168 ndc_y *= double(getNumRows()-1);
169 i = (unsigned int)(ndc_x);
170 j = (unsigned int)(ndc_y);
171 ir = ndc_x - double(i);
172 jr = ndc_y - double(j);
173 }
174
182 inline bool getInterpolatedValue(double ndc_x, double ndc_y, float& value) const
183 {
184 unsigned int i,j;
185 double ir, jr;
186 computeIndices(ndc_x, ndc_y, i, j, ir, jr);
187 value = 0.0f;
188 double div = 0.0f;
189 float v,r;
190
191 r = (1.0f-ir)*(1.0f-jr);
192 if (r>0.0 && getValue(i,j,v))
193 {
194 value += v*r;
195 div += r;
196 }
197
198 r = (ir)*(1.0f-jr);
199 if (r>0.0 && getValue(i+1,j,v))
200 {
201 value += v*r;
202 div += r;
203 }
204
205 r = (ir)*(jr);
206 if (r>0.0 && getValue(i+1,j+1,v))
207 {
208 value += v*r;
209 div += r;
210 }
211
212 r = (1.0f-ir)*(jr);
213 if (r>0.0 && getValue(i,j+1,v))
214 {
215 value += v*r;
216 div += r;
217 }
218
219 if (div != 0.0)
220 {
221 value /= div;
222 return true;
223 }
224
225 value = 0.0;
226 return false;
227 }
228
229 inline bool getInterpolatedValidValue(double ndc_x, double ndc_y, float& value) const
230 {
231 unsigned int i,j;
232 double ir, jr;
233 computeIndices(ndc_x, ndc_y, i, j, ir, jr);
234 value = 0.0f;
235 double div = 0.0f;
236 float v,r;
237
238 r = (1.0f-ir)*(1.0f-jr);
239 if (r>0.0 && getValidValue(i,j,v))
240 {
241 value += v*r;
242 div += r;
243 }
244
245 r = (ir)*(1.0f-jr);
246 if (r>0.0 && getValidValue(i+1,j,v))
247 {
248 value += v*r;
249 div += r;
250 }
251
252 r = (ir)*(jr);
253 if (r>0.0 && getValidValue(i+1,j+1,v))
254 {
255 value += v*r;
256 div += r;
257 }
258
259 r = (1.0f-ir)*(jr);
260 if (r>0.0 && getValidValue(i,j+1,v))
261 {
262 value += v*r;
263 div += r;
264 }
265
266 if (div != 0.0)
267 {
268 value /= div;
269 return true;
270 }
271
272 value = 0.0;
273 return false;
274 }
275
277 virtual void dirty() {}
278
280 virtual void setModifiedCount(unsigned int /*value*/) {}
281
283 virtual unsigned int getModifiedCount() const { return 0; }
284
285 virtual osg::BoundingSphere computeBound(bool treatAsElevationLayer) const;
286
287 protected:
288
289 virtual ~Layer();
290
291 std::string _filename;
293 unsigned int _minLevel;
294 unsigned int _maxLevel;
299
300};
301
303{
304 public:
305
307
310
312
313 void setFileName(const std::string& filename) { _filename = filename; if (_image.valid()) _image->setFileName(filename); }
314 virtual const std::string& getFileName() const { return _image.get() ? _image->getFileName() : _filename; }
315
316 virtual bool transform(float offset, float scale);
317
318 void setImage(osg::Image* image);
319
320 template<class T> void setImage(const osg::ref_ptr<T>& image) { return setImage(image.get()); }
321
323 virtual osg::Image* getImage() { return _image.get(); }
324
326 virtual const osg::Image* getImage() const { return _image.get(); }
327
328 virtual unsigned int getNumColumns() const { return _image.valid() ? _image->s() : 0; }
329 virtual unsigned int getNumRows() const { return _image.valid() ? _image->t() : 0; }
330
331 virtual bool getValue(unsigned int i, unsigned int j, float& value) const;
332 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec2& value) const;
333 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec3& value) const;
334 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec4& value) const;
335
336 virtual void dirty();
337 virtual void setModifiedCount(unsigned int value);
338 virtual unsigned int getModifiedCount() const;
339
340 protected:
341
342 virtual ~ImageLayer() {}
343
345
346};
347
349{
350 public:
351
353
356
358
359 virtual bool transform(float offset, float scale);
360
362
363 template<class T> void setTransferFunction(const osg::ref_ptr<T>& tf) { return setTransferFunction(tf.get()); }
364
366 const osg::TransferFunction1D* getTransferFunction() const { return _tf.get(); }
367
369 virtual osg::Image* getImage() { return _tf.valid() ? _tf->getImage() : 0; }
370
372 virtual const osg::Image* getImage() const { return _tf.valid() ? _tf->getImage() : 0; }
373
374
375 virtual unsigned int getNumColumns() const { return _tf.valid() ? _tf->getNumberImageCells() : 0; }
376 virtual unsigned int getNumRows() const { return _tf.valid() ? 1 : 0; }
377
378 virtual bool getValue(unsigned int i, unsigned int j, float& value) const;
379 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec2& value) const;
380 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec3& value) const;
381 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec4& value) const;
382
383 virtual void dirty();
384 virtual void setModifiedCount(unsigned int value);
385 virtual unsigned int getModifiedCount() const;
386
387 protected:
388
389 virtual ~ContourLayer() {}
390
392
393};
394
396{
397 public:
398
400
403
405
406 void setFileName(const std::string& filename) { _filename = filename; }
407 virtual const std::string& getFileName() const { return _filename; }
408
409 virtual bool transform(float offset, float scale);
410
412
413 template<class T> void setHeightField(const osg::ref_ptr<T>& hf) { return setHeightField(hf.get()); }
414
416 const osg::HeightField* getHeightField() const { return _heightField.get(); }
417
418 virtual unsigned int getNumColumns() const { return _heightField.valid() ? _heightField->getNumColumns() : 0; }
419 virtual unsigned int getNumRows() const { return _heightField.valid() ? _heightField->getNumRows() : 0; }
420
421 virtual bool getValue(unsigned int i, unsigned int j, float& value) const;
422 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec2& value) const;
423 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec3& value) const;
424 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec4& value) const;
425
426 virtual void dirty();
427 virtual void setModifiedCount(unsigned int value);
428 virtual unsigned int getModifiedCount() const;
429
430 protected:
431
432 virtual ~HeightFieldLayer() {}
433
434 unsigned int _modifiedCount;
436
437};
438
439
441{
442 public:
443
445
448
450
453 {
454 return _implementation.valid() ? _implementation->getImage() : 0;
455 }
456
458 virtual const osg::Image* getImage() const
459 {
460 return _implementation.valid() ? _implementation->getImage() : 0;
461 }
462
464 void setImplementation(Layer* layer) { _implementation = layer; }
465
468
470 const Layer* getImplementation() const { return _implementation.get(); }
471
472 virtual void setFileName(const std::string& filename);
473 virtual const std::string& getFileName() const { return _filename; }
474
475 virtual unsigned int getNumColumns() const;
476 virtual unsigned int getNumRows() const;
477
478 virtual bool transform(float offset, float scale);
479
480 virtual bool getValue(unsigned int i, unsigned int j, float& value) const;
481 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec2& value) const;
482 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec3& value) const;
483 virtual bool getValue(unsigned int i, unsigned int j, osg::Vec4& value) const;
484
485 virtual void dirty();
486 virtual void setModifiedCount(unsigned int value);
487 virtual unsigned int getModifiedCount() const;
488
489 virtual osg::BoundingSphere computeBound(bool treatAsElevationLayer) const;
490
491 protected:
492
493 virtual ~ProxyLayer();
494
496
497
498};
499
501{
502 public:
503
505
508
510
511 void clear();
512
514 void setSetName(unsigned int i, const std::string& setname) { _layers[i].setname = setname; if (_layers[i].layer.valid()) _layers[i].layer->setName(setname); }
515
517 const std::string& getSetName(unsigned int i) const { return _layers[i].layer.valid() ? _layers[i].layer->getName() : _layers[i].setname; }
518
520 void setFileName(unsigned int i, const std::string& filename) { _layers[i].filename = filename; if (_layers[i].layer.valid()) _layers[i].layer->setFileName(filename); }
521
523 const std::string& getFileName(unsigned int i) const { return _layers[i].layer.valid() ? _layers[i].layer->getFileName() : _layers[i].filename; }
524
525 void setCompoundName(unsigned int i, const std::string& compoundname);
526 std::string getCompoundName(unsigned int i) const;
527
528
529 void setLayer(unsigned int i, Layer* layer) { if (i>=_layers.size()) _layers.resize(i+1); _layers[i].layer = layer; }
530
531 template<class T> void setLayer(unsigned int i, const osg::ref_ptr<T>& layer) { setLayer(i, layer.get()); }
532
533 Layer* getLayer(unsigned int i) { return i<_layers.size() ? _layers[i].layer.get() : 0; }
534
535 const Layer* getLayer(unsigned int i) const { return i<_layers.size() ? _layers[i].layer.get() : 0; }
536
537 void addLayer(const std::string& compoundname);
538
539 void addLayer(const std::string& setname, const std::string& filename);
540
541 void addLayer(Layer* layer) { _layers.push_back(CompoundNameLayer(layer->getName(),layer->getFileName(),layer)); }
542
543 template<class T> void addLayer(const osg::ref_ptr<T>& layer) { return addLayer(layer.get()); }
544
545 void removeLayer(unsigned int i) { _layers.erase(_layers.begin()+i); }
546
547 unsigned int getNumLayers() const { return static_cast<unsigned int>(_layers.size()); }
548
549 protected:
550
551 virtual ~CompositeLayer() {}
552
554 {
556
558 setname(cnl.setname),
559 filename(cnl.filename),
560 layer(cnl.layer) {}
561
562 CompoundNameLayer(const std::string& sn, const std::string& fn, Layer* l):
563 setname(sn),
564 filename(fn),
565 layer(l) {}
566
567 CompoundNameLayer& operator = (const CompoundNameLayer& cnl)
568 {
569 if (&cnl==this) return *this;
570
571 setname = cnl.setname;
572 filename = cnl.filename;
573 layer = cnl.layer;
574 return *this;
575 }
576
577 std::string setname;
578 std::string filename;
580 };
581
582 typedef std::vector< CompoundNameLayer > Layers;
583
585};
586
587
589{
590 public:
591
593
596
598
599 void setActiveLayer(int i) { _activeLayer = i; }
600 int getActiveLayer() const { return _activeLayer; }
601
604 {
605 if (_activeLayer < 0) return 0;
606 if (_activeLayer >= static_cast<int>(getNumLayers())) return 0;
607 return _layers[_activeLayer].layer->getImage();
608 }
609
611 virtual const osg::Image* getImage() const
612 {
613 if (_activeLayer < 0) return 0;
614 if (_activeLayer >= static_cast<int>(getNumLayers())) return 0;
615 return _layers[_activeLayer].layer->getImage();
616 }
617
618 protected:
619
620 virtual ~SwitchLayer() {}
621
623};
624
625
626
627}
628
629#endif
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
Definition Shape:483
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 &copyop=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 &copyop=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 &copyop=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 &copyop=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 &copyop=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 &copyop=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(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 &copyop=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 Locator:26
Definition ValidDataOperator:26
#define OSGTERRAIN_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.