/usr/include/osgEarthSymbology/StyleSheet 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 | /* -*-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 OSGEARTHSYMBOLOGY_STYLE_SHEET_H
#define OSGEARTHSYMBOLOGY_STYLE_SHEET_H 1
#include <osgEarthSymbology/Common>
#include <osgEarthSymbology/Style>
#include <osgEarthSymbology/StyleSelector>
#include <osgEarthSymbology/Skins>
#include <osgEarthSymbology/ResourceLibrary>
namespace osgEarth { namespace Symbology
{
/**
* A complete definition of style information.
*/
class OSGEARTHSYMBOLOGY_EXPORT StyleSheet : public osg::Referenced
{
public:
/**
* A simple representation of a script used locally
*/
struct ScriptDef : osg::Referenced
{
ScriptDef() { }
ScriptDef(const std::string& code, const std::string& language="javascript", const std::string& name="") :
code(code), language(language), name(name) { }
std::string code;
std::string language;
std::string name;
std::string profile;
optional<URI> uri;
};
public:
/** Constructs an empty style sheet. */
StyleSheet();
/** Constructs a new style sheet */
StyleSheet( const Config& conf );
/** Optional name of the style sheet */
optional<std::string>& name() { return _name; }
const optional<std::string>& name() const { return _name; }
/** Gets the context for relative path resolution */
const URIContext& uriContext() const { return _uriContext; }
/** Adds a style to this sheet. */
void addStyle( const Style& style );
/** Removes a style from this sheet. */
void removeStyle( const std::string& name );
/** Gets a named style from this sheet. If the name isn't found, optionally falls back on the
"default" style. Note: if the name has a hashtag prefix (e.g., "#name") it will search for
the name with and without the hash. (they are considered equivalent) */
Style* getStyle( const std::string& name, bool fallBackOnDefault =true );
const Style* getStyle( const std::string& name, bool fallBackOnDefault =true ) const;
/** Gets the default style in this sheet. */
Style* getDefaultStyle();
const Style* getDefaultStyle() const;
/** Get access to styles for manual configuration */
StyleMap& styles() { return _styles; }
const StyleMap& styles() const { return _styles; }
/** Selectors pick a style from the sheet based on some criteria. */
StyleSelectorList& selectors() { return _selectors; }
const StyleSelectorList& selectors() const { return _selectors; }
const StyleSelector* getSelector( const std::string& name ) const;
/** Adds a resource library. */
void addResourceLibrary( ResourceLibrary* library );
/** Gets a resource library by name. */
ResourceLibrary* getResourceLibrary( const std::string& name ) const;
/** Gets the first library. */
ResourceLibrary* getDefaultResourceLibrary() const;
/** Script accessors */
void setScript( ScriptDef* script );
ScriptDef* script() const { return _script.get(); }
public: // serialization functions
virtual Config getConfig() const;
virtual void mergeConfig( const Config& conf );
protected:
optional<std::string> _name;
URIContext _uriContext;
osg::ref_ptr<ScriptDef> _script;
StyleSelectorList _selectors;
StyleMap _styles;
Style _emptyStyle;
typedef std::map<std::string, osg::ref_ptr<ResourceLibrary> > ResourceLibraries;
ResourceLibraries _resLibs;
Threading::ReadWriteMutex _resLibsMutex;
};
} } // namespace osgEarth::Symbology
#endif // OSGEARTHSYMBOLOGY_STYLE_SHEET_H
|