/* -*-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 */ #ifndef OSGEARTH_DRIVER_KML_OPTIONS #define OSGEARTH_DRIVER_KML_OPTIONS 1 #include #include #include #include namespace osgEarth { namespace KML { using namespace osgEarth; /** * Options for the KML loader. You can pass an instance of this class * to KML::load() */ class KMLOptions // NO EXPORT; header only { public: /** TextSymbol to use when no styles are set in the KML. */ osg::ref_ptr& defaultTextSymbol() { return _defaultTextSymbol; } const osg::ref_ptr& defaultTextSymbol() const { return _defaultTextSymbol; } /** Default IconSymbol to use for placemarks that don't specify an icon or a model */ osg::ref_ptr& defaultIconSymbol() { return _defaultIconSymbol; } const osg::ref_ptr& defaultIconSymbol() const { return _defaultIconSymbol; } /** Default base scale to apply to marker Icons. */ optional& iconBaseScale() { return _iconBaseScale; } const optional& iconBaseScale() const { return _iconBaseScale; } /** Maximum size (either dimension) of placemarks icons */ optional& iconMaxSize() { return _iconMaxSize; } const optional& iconMaxSize() const { return _iconMaxSize; } /** Automatically assign KML icons and labels to a decluttering bin */ optional& declutter() { return _declutter; } const optional& declutter() const { return _declutter; } /** Specify a group to which to add screen-space items (2D icons and labels) */ osg::ref_ptr iconAndLabelGroup() { return _iconAndLabelGroup; } const osg::ref_ptr iconAndLabelGroup() const { return _iconAndLabelGroup; } /** Default scale factor to apply to embedded 3D models */ optional& modelScale() { return _modelScale; } const optional& modelScale() const { return _modelScale; } /** Default rotation to apply to embedded 3D models */ optional& modelRotation() { return _modelRotation; } const optional& modelRotation() const { return _modelRotation; } public: KMLOptions() : _declutter(true), _iconBaseScale(1.0f), _iconMaxSize(32), _modelScale(1.0f) { _defaultTextSymbol = new TextSymbol(); _defaultTextSymbol->size() = 18.0f; _defaultTextSymbol->halo() = Stroke(0.3f, 0.3f, 0.3f, 1.0f); _defaultIconSymbol = new IconSymbol(); _defaultIconSymbol->url().mutable_value().setLiteral("https://github.com/gwaldron/osgearth/blob/master/data/placemark32.png?raw=true"); } virtual ~KMLOptions() { } protected: osg::ref_ptr _defaultIconSymbol; osg::ref_ptr _defaultTextSymbol; optional _declutter; optional _iconBaseScale; optional _iconMaxSize; optional _modelScale; optional _modelRotation; osg::ref_ptr _iconAndLabelGroup; }; } } // namespace osgEarth::KML #endif // OSGEARTH_DRIVER_KML_OPTIONS