/usr/include/osgEarthSplat/RoadSurfaceLayer 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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | /* -*-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_SPLAT_ROAD_SURFACE_LAYER
#define OSGEARTH_SPLAT_ROAD_SURFACE_LAYER 1
#include <osgEarth/ImageLayer>
#include <osgEarth/TileRasterizer>
#include <osgEarth/LayerListener>
#include <osgEarthFeatures/FeatureSource>
#include <osgEarthFeatures/FeatureSourceLayer>
#include <osgEarthSymbology/StyleSheet>
#include "Export"
namespace osgEarth { namespace Splat
{
using namespace osgEarth;
using namespace osgEarth::Features;
/**
* Configuration options for the land use tile source
*/
class OSGEARTHSPLAT_EXPORT RoadSurfaceLayerOptions : public ImageLayerOptions
{
public:
RoadSurfaceLayerOptions(const ConfigOptions& options = ConfigOptions())
: ImageLayerOptions(options)
{
fromConfig(_conf);
}
public:
//! Inline feature specification
optional<FeatureSourceOptions>& features() { return _featureSourceOptions; }
const optional<FeatureSourceOptions>& features() const { return _featureSourceOptions; }
//! Name of feature source layer containing features
optional<std::string>& featureSourceLayer() { return _featureSourceLayer; }
const optional<std::string>& featureSourceLayer() const { return _featureSourceLayer; }
//! Buffer around the road vector for querying linear data (should be at least road width/2)
optional<Distance>& featureBufferWidth() { return _bufferWidth; }
const optional<Distance>& featureBufferWidth() const { return _bufferWidth; }
//! Style for rendering the road
osg::ref_ptr<StyleSheet>& styles() { return _styles; }
const osg::ref_ptr<StyleSheet>& styles() const { return _styles; }
public:
Config getConfig() const
{
Config conf = ImageLayerOptions::getConfig();
conf.key() = "road_surface";
conf.addObjIfSet("features", _featureSourceOptions);
conf.addIfSet("feature_source", _featureSourceLayer);
conf.addIfSet("buffer_width", _bufferWidth);
conf.addObjIfSet("styles", _styles);
return conf;
}
protected:
void mergeConfig( const Config& conf ) {
ImageLayerOptions::mergeConfig( conf );
fromConfig( conf );
}
private:
void fromConfig( const Config& conf )
{
conf.getObjIfSet("features", _featureSourceOptions);
conf.getIfSet("feature_source", _featureSourceLayer);
conf.getIfSet("buffer_width", _bufferWidth);
conf.getObjIfSet("styles", _styles);
}
private:
optional<FeatureSourceOptions> _featureSourceOptions;
optional<std::string> _featureSourceLayer;
optional<Distance> _bufferWidth;
osg::ref_ptr<StyleSheet> _styles;
};
/**
* Tile source that will read from ANOTHER tile source and perform
* various pre-processing syntheses operations like warping and detailing.
*/
class OSGEARTHSPLAT_EXPORT RoadSurfaceLayer : public osgEarth::ImageLayer
{
public:
META_Layer(osgEarth, RoadSurfaceLayer, RoadSurfaceLayerOptions);
//! Create a blank layer to be configured with options()
RoadSurfaceLayer();
//! Create a layer from deserialized options
RoadSurfaceLayer(const RoadSurfaceLayerOptions& options);
public:
//! Sets the map layer from which to pull feature data. Call either
//! This or setFeatureSource
void setFeatureSourceLayer(FeatureSourceLayer* layer);
//! Sets the feature source to get road data from; call either this
//! or setFeatureSourceLayer
void setFeatureSource(FeatureSource* source);
public: // ImageLayer
// Opens the layer and returns a status
virtual const Status& open();
// Creates an image for a tile key
virtual GeoImage createImageImplementation(const TileKey& key, ProgressCallback* progress);
protected: // Layer
// Called by Map when it adds this layer
virtual void addedToMap(const class Map*);
// Called by Map when it removes this layer
virtual void removedFromMap(const class Map*);
// post-ctor initialization
virtual void init();
// A node to add to the scene graph for this layer.
virtual osg::Node* getOrCreateNode();
protected:
virtual ~RoadSurfaceLayer() { }
private:
osg::ref_ptr<FeatureSource> _features;
osg::ref_ptr<Session> _session;
osg::observer_ptr<TileRasterizer> _rasterizer;
LayerListener<RoadSurfaceLayer, FeatureSourceLayer> _layerListener;
};
} } // namespace osgEarth::Splat
#endif // OSGEARTH_SPLAT_ROAD_SURFACE_LAYER
|