/usr/include/osgEarthSymbology/Style is in libosgearth-dev 2.7.0+dfsg-2+b3.
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 161 162 163 164 165 166 167 168 169 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2015 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 OSGEARTHSYMBOLOGY_STYLE_H
#define OSGEARTHSYMBOLOGY_STYLE_H 1
#include <osgEarthSymbology/Common>
#include <osgEarthSymbology/Color>
#include <osgEarthSymbology/Query>
#include <osgEarthSymbology/IconSymbol>
#include <osgEarthSymbology/PointSymbol>
#include <osgEarthSymbology/LineSymbol>
#include <osgEarthSymbology/PolygonSymbol>
#include <osgEarthSymbology/MarkerSymbol>
#include <osgEarthSymbology/ModelSymbol>
#include <osgEarthSymbology/ExtrusionSymbol>
#include <osgEarthSymbology/AltitudeSymbol>
#include <osgEarthSymbology/TextSymbol>
#include <osgEarthSymbology/Skins>
#include <osgEarthSymbology/RenderSymbol>
#include <osgEarthSymbology/CoverageSymbol>
#include <osgEarth/Config>
#include <osg/Object>
#include <vector>
namespace osgEarth { namespace Symbology
{
/**
* Style is an unordered collection of Symbols that describes how to render
* geometry and other objects.
*/
class OSGEARTHSYMBOLOGY_EXPORT Style
{
public:
/** Constructs a new, empty style. */
Style( const std::string& name = "" );
/** Constructs a style by deserializing it from a Config. */
Style(const Config& conf);
/** Copy constructor. By default, duplicates all the symbols; but if you
specify SHALLOW_COPY, the new one will point to the same symbols. */
Style(const Style& rhs, const osg::CopyOp& op =osg::CopyOp::DEEP_COPY_ALL );
/** assignment operator */
Style& operator = (const Style& rhs);
/** virtual dtor */
virtual ~Style() { }
/** Gets the name of this style */
const std::string& getName() const { return _name; }
/** Sets the name of this style */
void setName( const std::string& value ) { _name = value; }
/** Starts with this style, merges in all the symbols from the other style, and
returns a new style */
Style combineWith( const Style& rhs ) const;
/** Test whether the style is empty */
bool empty() const { return _symbols.empty(); }
/** Adds a symbol to the collection. */
void addSymbol(Symbol* symbol);
void add(Symbol* symbol) { addSymbol(symbol); }
/** Remove a symbol from the collection */
bool removeSymbol (Symbol* symbol);
void copySymbols(const Style& style);
/** Remove a symbol by type */
template<typename T>
bool remove()
{
Symbol* s = get<T>();
return s ? removeSymbol(s) : false;
}
/** Gets a typed symbol from the style (the first one found). */
template<typename T>
T* getSymbol()
{
for (SymbolList::const_iterator it = _symbols.begin(); it != _symbols.end(); ++it)
{
Symbol* symbol = (*it).get();
T* s = dynamic_cast<T*>(symbol);
if (s)
return s;
}
return 0L;
}
template<typename T> T* get() { return getSymbol<T>(); } // alias
/** Whether the style contains a symbol of the template type */
template<typename T> bool has() { return get<T>() != 0L; }
template<typename T> bool has() const { return get<T>() != 0L; }
/** Gets a typed symbol from the style (the first one found) */
template<typename T>
const T* getSymbol() const
{
for (SymbolList::const_iterator it = _symbols.begin(); it != _symbols.end(); ++it)
{
Symbol* symbol = (*it).get();
const T* s = dynamic_cast<const T*>(symbol);
if (s)
return s;
}
return 0L;
}
template<typename T> const T* get() const { return getSymbol<T>(); } // alias
/** Gets a typed symbol from the style (first one found), or creates/adds/returns one of
that type if it doesn't already exist. */
template<typename T>
T* getOrCreateSymbol()
{
T* sym = getSymbol<T>();
if ( !sym )
{
sym = new T();
addSymbol( sym );
}
return sym;
}
template<typename T> T* getOrCreate() { return getOrCreateSymbol<T>(); } // alias
/** Serializes this object into a Config. */
virtual Config getConfig( bool keepOrigType =true ) const;
void mergeConfig( const Config& conf );
void fromSLD(const Config&);
protected:
std::string _name;
SymbolList _symbols;
std::string _origType;
std::string _origData;
optional<URI> _uri;
};
typedef std::vector<Style> StyleList;
typedef std::map<std::string, Style> StyleMap;
} } // namespace osgEarth::Symbology
#endif // OSGEARTHSYMBOLOGY_STYLE_H
|