/usr/include/osgEarthUtil/SimpleOceanLayer is in libosgearth-dev 2.9.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2016 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTH_UTIL_SIMPLE_OCEAN_LAYER
#define OSGEARTH_UTIL_SIMPLE_OCEAN_LAYER 1
#include <osgEarthUtil/Common>
#include <osgEarth/Layer>
#include <osgEarth/LayerListener>
#include <osgEarthSymbology/Color>
namespace osgEarth {
class ImageLayer;
}
namespace osgEarth { namespace Util
{
using namespace osgEarth::Symbology;
/**
* Serializable configuation options for the SimpleOceanLayer.
*/
class OSGEARTHUTIL_EXPORT SimpleOceanLayerOptions : public VisibleLayerOptions
{
public:
/** Color of the ocean surface */
optional<Color>& color() { return _color; }
const optional<Color>& color() const { return _color; }
/** Maximum altitude at which the ocean is visible */
optional<float>& maxAltitude() { return _maxAltitude; }
const optional<float>& maxAltitude() const { return _maxAltitude; }
/** Name of a Map Layer to use as an ocean mask. */
optional<std::string>& maskLayer() { return _maskLayer; }
const optional<std::string>& maskLayer() const { return _maskLayer; }
/** Whether to sample the terrain bathymetry and only draw the ocean
where it's negative (default = true) */
optional<bool>& useBathymetry() { return _useBathymetry; }
const optional<bool>& useBathymetry() const { return _useBathymetry; }
public:
SimpleOceanLayerOptions(const ConfigOptions& op =ConfigOptions()) : VisibleLayerOptions(op) {
_color.init(Color("#1D2C4FE7"));
_maxAltitude.init(500000.f);
_useBathymetry.init(false);
mergeConfig(_conf);
}
void mergeConfig(const Config& conf) {
conf.getIfSet("color", _color);
conf.getIfSet("max_altitude", _maxAltitude);
conf.getIfSet("mask_layer", _maskLayer);
conf.getIfSet("use_bathymetry", _useBathymetry);
}
Config getConfig() const {
Config conf;
conf.addIfSet("color", _color);
conf.addIfSet("max_altitude", _maxAltitude);
conf.addIfSet("mask_layer", _maskLayer);
conf.addIfSet("use_bathymetry", _useBathymetry);
return conf;
}
private:
optional<Color> _color;
optional<float> _maxAltitude;
optional<std::string> _maskLayer;
optional<bool> _useBathymetry;
};
/**
* A Rex map layer that renders a simple ocean surface.
* This layer requires that the map include bathymetric data (ocean floor).
*/
class OSGEARTHUTIL_EXPORT SimpleOceanLayer : public VisibleLayer
{
public:
META_Layer(osgEarth, SimpleOceanLayer, SimpleOceanLayerOptions);
/** Constructs a new ocean layer */
SimpleOceanLayer();
/** Constructs a new layer from an options structure. */
SimpleOceanLayer(const SimpleOceanLayerOptions& options);
public:
/** Ocean surface color (including transparency in the alpha channel) */
void setColor(const Color& color);
const Color& getColor() const;
/** Maximum altitude at which the ocean layer is visible */
void setMaxAltitude(float altitude_m);
float getMaxAltitude() const;
/** Sets a masking layer, or pass NULL to clear the masking layer. Returns true upon success */
void setMaskLayer(const ImageLayer* layer);
public: // Layer
/** serialize */
virtual Config getConfig() const;
/** callback that ensures proper culling */
void modifyTileBoundingBox(const TileKey& key, osg::BoundingBox& box) const;
protected: // Layer
virtual void addedToMap(const class Map*);
virtual void removedFromMap(const class Map*);
virtual void init();
protected:
virtual ~SimpleOceanLayer() { }
private:
LayerListener<SimpleOceanLayer, const ImageLayer> _layerListener;
};
} } // namespace osgEarth::Util
#endif // OSGEARTH_UTIL_SIMPLE_OCEAN_LAYER
|