/* -*-c++-*- */ /* osgEarth - Geospatial SDK for OpenSceneGraph * Copyright 2020 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/> */ #pragma once #include <osgEarth/Common> #include <osgEarth/Symbol> #include <osgEarth/Expression> namespace osgEarth { using namespace osgEarth; /** * Symbol that directs the GeometryCompiler to create extruded 3D geometry * from 2D vector data. */ class OSGEARTH_EXPORT ExtrusionSymbol : public Symbol { public: META_Object(osgEarth, ExtrusionSymbol); ExtrusionSymbol(const ExtrusionSymbol& rhs,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); ExtrusionSymbol( const Config& conf =Config() ); /** dtor */ virtual ~ExtrusionSymbol() { } /** Height to which to extrude geometry above the footprint (for HEIGHT_REFERENCE_Z) or above MSL (for HEIGHT_REFERENCE_MSL) */ optional<float>& height() { return _height; } const optional<float>& height() const { return _height; } /** Simple expression to evaluate to get height */ optional<NumericExpression>& heightExpression() { return _heightExpr; } const optional<NumericExpression>& heightExpression() const { return _heightExpr; } /** Whether the top cap of the extruded geometry should be flat (default=true) */ optional<bool>& flatten() { return _flatten; } const optional<bool>& flatten() const { return _flatten; } /** Name of a style describing how to symbolize the extruded walls */ optional<std::string>& wallStyleName() { return _wallStyleName; } const optional<std::string>& wallStyleName() const { return _wallStyleName; } /** Name of a style describing how to symbolize the elevated rooftop */ optional<std::string>& roofStyleName() { return _roofStyleName; } const optional<std::string>& roofStyleName() const { return _roofStyleName; } /** Percentage by which to darken the color of the bottom of the walls relative to the main wall color (default = 0.0, range = [0..1]) */ optional<float>& wallGradientPercentage() { return _wallGradientPercentage; } const optional<float>& wallGradientPercentage() const { return _wallGradientPercentage; } /** Percentage by which to shade the wells to simulate lighting [0..1] */ optional<float>& wallShadePercentage() { return _wallShadePercentage; } const optional<float>& wallShadePercentage() const { return _wallShadePercentage; } public: virtual Config getConfig() const; virtual void mergeConfig( const Config& conf ); static void parseSLD(const Config& c, class Style& style); protected: optional<float> _height; optional<bool> _flatten; optional<NumericExpression> _heightExpr; optional<std::string> _wallStyleName; optional<std::string> _roofStyleName; optional<float> _wallGradientPercentage; optional<float> _wallShadePercentage; }; } // namespace osgEarth