[osgearth] 02/08: New upstream version 2.9~rc2+dfsg

Bas Couwenberg sebastic at debian.org
Thu Jan 25 08:48:42 UTC 2018


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch experimental
in repository osgearth.

commit a78a71164dc50200431f38849e532c8b5e780990
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Jan 25 07:32:15 2018 +0100

    New upstream version 2.9~rc2+dfsg
---
 .../drivers/feature/mapnikvectortiles.rst          |  22 ++
 docs/source/references/drivers/terrain/mp.rst      |   2 +-
 .../drivers/terrain/terrain_options_shared.rst     |   2 +-
 docs/source/references/earthfile.rst               |   4 +-
 .../osgearth_tilesource/osgearth_tilesource.cpp    |  36 +++-
 src/osgEarth/ElevationPool.cpp                     |   2 +-
 src/osgEarth/TerrainLayer.cpp                      |   8 +-
 src/osgEarth/Units                                 |  10 +-
 src/osgEarth/Version                               |   2 +-
 src/osgEarth/catch.hpp                             |   2 +-
 .../agglite/AGGLiteRasterizerTileSource.cpp        |  18 +-
 .../engine_mp/MPEngine.NormalMap.vert.glsl         |   2 +-
 .../engine_mp/MPEngine.vert.model.glsl             |   2 +-
 .../engine_rex/RexEngine.NormalMap.vert.glsl       |   4 +-
 src/osgEarthDrivers/fastdxt/CMakeLists.txt         |   2 +-
 src/osgEarthSymbology/Color.cpp                    |   2 +-
 src/osgEarthSymbology/StyleSheet                   |   5 +
 src/osgEarthSymbology/StyleSheet.cpp               |   3 +
 src/osgEarthUtil/MouseCoordsTool.cpp               |  29 +--
 tests/feature_mapnikvectortiles.earth              | 221 +++++++++++++++++++++
 20 files changed, 311 insertions(+), 67 deletions(-)

diff --git a/docs/source/references/drivers/feature/mapnikvectortiles.rst b/docs/source/references/drivers/feature/mapnikvectortiles.rst
new file mode 100644
index 0000000..ffc87d6
--- /dev/null
+++ b/docs/source/references/drivers/feature/mapnikvectortiles.rst
@@ -0,0 +1,22 @@
+Mapnik Vector Tiles
+===========================
+This plugin reads vector data from an `MBTiles`_ file which contains `vector tiles<https://github.com/mapbox/vector-tile-spec>`_.
+
+Note:  This driver does not currently support multi-level mbtiles files.  It will only load the maximum level in the database.  This will change in the future when
+osgEarth has better support for non-additive feature datasources.
+
+This driver requires that you build osgEarth with SQLite3 support and Protobuf support.
+
+Example usage::
+
+    <model driver="feature_geom">
+        <features name="osm" driver="mapnikvectortiles">
+            <url>../data/osm.mbtiles</url>
+        </features>
+        ...
+
+Properties:
+
+    :url:      Location of the mbtiles file.
+
+.. _MBTiles:  https://www.mapbox.com/developers/mbtiles/
diff --git a/docs/source/references/drivers/terrain/mp.rst b/docs/source/references/drivers/terrain/mp.rst
index 7d90c70..bcb6433 100644
--- a/docs/source/references/drivers/terrain/mp.rst
+++ b/docs/source/references/drivers/terrain/mp.rst
@@ -13,7 +13,7 @@ Example usage::
                      normalize_edges          = "false"
                      incremental_update       = "false"
                      quick_release_gl_objects = "true"
-                     min_tile_range_factor    = "6.0"
+                     min_tile_range_factor    = "7.0"
                      cluster_culling          = "true" />
 
 Properties:
diff --git a/docs/source/references/drivers/terrain/terrain_options_shared.rst b/docs/source/references/drivers/terrain/terrain_options_shared.rst
index 3619f14..1d99017 100644
--- a/docs/source/references/drivers/terrain/terrain_options_shared.rst
+++ b/docs/source/references/drivers/terrain/terrain_options_shared.rst
@@ -2,7 +2,7 @@ Common Properties:
 
     :min_tile_range_factor:     The "maximum visible distance" ratio for all tiles. The 
                                 maximum visible distance is computed as tile radius * 
-                                this value. (default = 6.0)
+                                this value. (default = 7.0)
     :cluster_culling:           Cluster culling discards back-facing tiles by default. You
                                 can disable it be setting this to ``false``, for example if
                                 you want to go underground and look up at the surface.
diff --git a/docs/source/references/earthfile.rst b/docs/source/references/earthfile.rst
index 7333a01..943fd62 100644
--- a/docs/source/references/earthfile.rst
+++ b/docs/source/references/earthfile.rst
@@ -117,8 +117,8 @@ These options control the rendering of the terrain surface.
 +-----------------------+--------------------------------------------------------------------+
 | min_tile_range_factor | Determines how close you need to be to a terrain tile for it to    |
 |                       | display. The value is the ratio of a tile's extent to its          |
-|                       | For example, if a tile has a 10km radius, and the MTRF=6, then the |
-|                       | tile will become visible at a range of about 60km.                 |
+|                       | For example, if a tile has a 10km radius, and the MTRF=7, then the |
+|                       | tile will become visible at a range of about 70km.                 |
 +-----------------------+--------------------------------------------------------------------+
 | min_lod               | The lowest level of detail that the terrain is guaranteed to       |
 |                       | display, even if no source data is available at that LOD. The      |
diff --git a/src/applications/osgearth_tilesource/osgearth_tilesource.cpp b/src/applications/osgearth_tilesource/osgearth_tilesource.cpp
index aa3ae1a..42a1cba 100644
--- a/src/applications/osgearth_tilesource/osgearth_tilesource.cpp
+++ b/src/applications/osgearth_tilesource/osgearth_tilesource.cpp
@@ -56,6 +56,7 @@ public:
     // Constructor that takes the user-provided options.
     CustomTileSource() : TileSource(TileSourceOptions())
     {
+        // Create a shape that we will use to render tile images.
         _geom = new Ring();
         _geom->push_back( osg::Vec3(5, 5, 0) );
         _geom->push_back( osg::Vec3(250, 5, 0) );
@@ -68,12 +69,25 @@ public:
     {
         if ( !getProfile() )
         {
+            // Set the profile for this tile source. The profile defines the 
+            // tiling scheme native to this tile source. The terrain engine will
+            // call createImage or createHeightField with TileKeys according to
+            // the profile you set here.
             setProfile( Registry::instance()->getGlobalGeodeticProfile() );
+
+            // Create custom data extents. This is optional, but giving the terrain
+            // engine information about the extents of your dataset will improve
+            // performance in most cases. In this case, the data covers the
+            // entire profile, but we want to tell the terrain engine that this
+            // tile source only has data up to LOD 15:
+            getDataExtents().push_back(DataExtent(getProfile()->getExtent(), 0u, 15u));
         }
         return STATUS_OK;
     }
 
     // Tells the layer not to cache data from this tile source.
+    // Overriding this function is optional - by default it will inherit the 
+    // caching policy from the Layer.
     CachePolicy getCachePolicyHint(const Profile* profile) const 
     {
         return CachePolicy::NO_CACHE;
@@ -94,18 +108,26 @@ public:
 int main(int argc, char** argv)
 {
     osg::ArgumentParser arguments(&argc,argv);
-
     osgViewer::Viewer viewer(arguments);
 
-    // Start by creating the map:
-    MapOptions mapOptions;
-    mapOptions.cachePolicy() = CachePolicy::NO_CACHE;
-    Map* map = new Map( mapOptions );
+    // Start by creating an empty map:
+    Map* map = new Map();
 
     // Create out image layer with a custom tile source.
-    ImageLayerOptions options( "custom" );
     CustomTileSource* tileSource = new CustomTileSource();
-    tileSource->open();
+
+    // Open the tile source. If you don't do this, the Map will automatically try to 
+    // open it when you add the Layer later on. But doing so here allows us to check
+    // for any errors beforehand.
+    Status status = tileSource->open();
+    if (status.isError())
+    {
+        OE_WARN << "Error opening the tile source; message = " << status.message() << std::endl;
+        return -1;
+    }
+
+    // Add a new ImageLayer to the map with our custom tile source.
+    ImageLayerOptions options( "My custom ImageLayer" );
     map->addLayer( new ImageLayer(options, tileSource) );
 
     // That's it, the map is ready; now create a MapNode to render the Map:
diff --git a/src/osgEarth/ElevationPool.cpp b/src/osgEarth/ElevationPool.cpp
index 4606fb7..4faeb69 100644
--- a/src/osgEarth/ElevationPool.cpp
+++ b/src/osgEarth/ElevationPool.cpp
@@ -307,7 +307,7 @@ ElevationPool::getTile(const TileKey& key, MapFrame& frame, osg::ref_ptr<Elevati
     if ( !tile.valid() && OE_GET_TIMER(get) >= timeout )
     {
         // this means we timed out trying to fetch the map tile.
-        OE_TEST << LC << "Timout fetching tile " << key.str() << std::endl;
+        OE_TEST << LC << "Timeout fetching tile " << key.str() << std::endl;
     }
 
     if ( tile.valid() )
diff --git a/src/osgEarth/TerrainLayer.cpp b/src/osgEarth/TerrainLayer.cpp
index 8fa92ea..6e94015 100644
--- a/src/osgEarth/TerrainLayer.cpp
+++ b/src/osgEarth/TerrainLayer.cpp
@@ -380,12 +380,8 @@ TerrainLayer::open()
         }
         else
         {
-            // User supplied the tile source, so attempt to get its profile:
-            setProfile(_tileSource->getProfile() );
-            if (!_profile.valid())
-            {
-                setStatus( Status::Error(getName(), "Cannot establish profile") );
-            }
+            // User supplied the tile source, so attempt to initialize it:
+            _tileSource = createAndOpenTileSource();
         }
 
         // Finally, open and activate a caching bin for this layer if it
diff --git a/src/osgEarth/Units b/src/osgEarth/Units
index 0c8259f..56629cb 100644
--- a/src/osgEarth/Units
+++ b/src/osgEarth/Units
@@ -23,14 +23,6 @@
 #include <osgEarth/Config>
 #include <ostream>
 
-#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-
-#if GCC_VERSION >= 50300
-#define OPTIMIZE __attribute__((optimize("no-ipa-sra")))
-#else
-#define OPTIMIZE
-#endif
-
 namespace osgEarth
 {
     class Registry;
@@ -113,7 +105,7 @@ namespace osgEarth
             return false;
         }
 
-        static OPTIMIZE double convert( const Units& from, const Units& to, double input ) {
+        static double convert( const Units& from, const Units& to, double input ) {
             double output = input;
             convert( from, to, input, output );
             return output;
diff --git a/src/osgEarth/Version b/src/osgEarth/Version
index 2005429..b31fdc1 100644
--- a/src/osgEarth/Version
+++ b/src/osgEarth/Version
@@ -31,7 +31,7 @@ extern "C" {
 #define OSGEARTH_MINOR_VERSION    9
 #define OSGEARTH_PATCH_VERSION    0
 #define OSGEARTH_SOVERSION        0
-#define OSGEARTH_RC_VERSION       1
+#define OSGEARTH_RC_VERSION       2
 #define OSGEARTH_DEVEL_VERSION    0     // 0 = release; >0 = interim devel version
 
 /* Convenience macro that can be used to decide whether a feature is present or not i.e.
diff --git a/src/osgEarth/catch.hpp b/src/osgEarth/catch.hpp
index 6bcdd04..f1b283d 100644
--- a/src/osgEarth/catch.hpp
+++ b/src/osgEarth/catch.hpp
@@ -4751,7 +4751,7 @@ namespace Catch {
             ss << seed;
             ss >> config.rngSeed;
             if( ss.fail() )
-                throw std::runtime_error( "Argment to --rng-seed should be the word 'time' or a number" );
+                throw std::runtime_error( "Argument to --rng-seed should be the word 'time' or a number" );
         }
     }
     inline void setVerbosity( ConfigData& config, int level ) {
diff --git a/src/osgEarthDrivers/agglite/AGGLiteRasterizerTileSource.cpp b/src/osgEarthDrivers/agglite/AGGLiteRasterizerTileSource.cpp
index f366afc..e2029f7 100644
--- a/src/osgEarthDrivers/agglite/AGGLiteRasterizerTileSource.cpp
+++ b/src/osgEarthDrivers/agglite/AGGLiteRasterizerTileSource.cpp
@@ -189,13 +189,21 @@ public:
 
                 if ( masterLine || f->get()->style()->has<LineSymbol>() )
                 {
-                    Feature* newFeature = new Feature( *f->get() );
-                    if ( !newFeature->getGeometry()->isLinear() )
+                    // Use the GeometryIterator to get all the geometries so we can clone them as rings
+                    GeometryIterator gi(f->get()->getGeometry());
+                    while (gi.hasMore())
                     {
-                        newFeature->setGeometry( newFeature->getGeometry()->cloneAs(Geometry::TYPE_RING) );
+                        Geometry* geom = gi.next();
+                        // Create a new feature for each geometry
+                        Feature* newFeature = new Feature(*f->get());
+                        newFeature->setGeometry(geom);
+                        if (!newFeature->getGeometry()->isLinear())
+                        {
+                            newFeature->setGeometry(newFeature->getGeometry()->cloneAs(Geometry::TYPE_RING));
+                        }
+                        lines.push_back( newFeature );
+                        hasLine = true;
                     }
-                    lines.push_back( newFeature );
-                    hasLine = true;
                 }
 
                 // if there are no geometry symbols but there is a coverage symbol, default to polygons.
diff --git a/src/osgEarthDrivers/engine_mp/MPEngine.NormalMap.vert.glsl b/src/osgEarthDrivers/engine_mp/MPEngine.NormalMap.vert.glsl
index c7afe67..6dfd7ad 100644
--- a/src/osgEarthDrivers/engine_mp/MPEngine.NormalMap.vert.glsl
+++ b/src/osgEarthDrivers/engine_mp/MPEngine.NormalMap.vert.glsl
@@ -20,5 +20,5 @@ void oe_mp_NormalMap_vertex(inout vec4 unused)
     oe_normalMapCoords = (oe_tile_normalTexMatrix * oe_layer_tilec).st;
 
     // send the bi-normal vector to the fragment shader.
-    oe_normalMapBinormal = gl_NormalMatrix * vec3(0,1,0);
+    oe_normalMapBinormal = normalize(gl_NormalMatrix * vec3(0,1,0));
 }
diff --git a/src/osgEarthDrivers/engine_mp/MPEngine.vert.model.glsl b/src/osgEarthDrivers/engine_mp/MPEngine.vert.model.glsl
index 7fcae7c..d41f24c 100644
--- a/src/osgEarthDrivers/engine_mp/MPEngine.vert.model.glsl
+++ b/src/osgEarthDrivers/engine_mp/MPEngine.vert.model.glsl
@@ -17,7 +17,7 @@ void oe_mp_vertModel(inout vec4 vertexModel)
     oe_layer_texc  = gl_MultiTexCoord$MP_PRIMARY_UNIT;
     oe_layer_tilec = gl_MultiTexCoord$MP_SECONDARY_UNIT;
 
-    oe_UpVectorView = gl_NormalMatrix * oe_terrain_attr.xyz;
+    oe_UpVectorView = normalize(gl_NormalMatrix * oe_terrain_attr.xyz);
 
     // internal variable to support the oe_terrain_getElevation() SDK method
     // in the fragment shader stage
diff --git a/src/osgEarthDrivers/engine_rex/RexEngine.NormalMap.vert.glsl b/src/osgEarthDrivers/engine_rex/RexEngine.NormalMap.vert.glsl
index 54fc492..bf8b271 100644
--- a/src/osgEarthDrivers/engine_rex/RexEngine.NormalMap.vert.glsl
+++ b/src/osgEarthDrivers/engine_rex/RexEngine.NormalMap.vert.glsl
@@ -23,7 +23,7 @@ void oe_normalMapVertex(inout vec4 unused)
 #endif
 
     // calculate the sampling coordinates for the normal texture
-//    oe_normalMapCoords = (oe_tile_normalTexMatrix * oe_layer_tilec).st;
+    //oe_normalMapCoords = (oe_tile_normalTexMatrix * oe_layer_tilec).st;
     
     oe_normalMapCoords = oe_layer_tilec.st
         * oe_tile_elevTexelCoeff.x * oe_tile_normalTexMatrix[0][0]
@@ -31,5 +31,5 @@ void oe_normalMapVertex(inout vec4 unused)
         + oe_tile_elevTexelCoeff.y;
 
     // send the bi-normal to the fragment shader
-    oe_normalMapBinormal = gl_NormalMatrix * vec3(0,1,0);
+    oe_normalMapBinormal = normalize(gl_NormalMatrix * vec3(0,1,0));
 }
diff --git a/src/osgEarthDrivers/fastdxt/CMakeLists.txt b/src/osgEarthDrivers/fastdxt/CMakeLists.txt
index c90e8a4..fb35fc3 100644
--- a/src/osgEarthDrivers/fastdxt/CMakeLists.txt
+++ b/src/osgEarthDrivers/fastdxt/CMakeLists.txt
@@ -1,4 +1,4 @@
-OPTION(OSGEARTH_ENABLE_FASTDXT "Set to ON to build optional FastDXT image compressor." ON)
+OPTION(OSGEARTH_ENABLE_FASTDXT "Set to ON to build optional FastDXT image compressor." OFF)
 IF(OSGEARTH_ENABLE_FASTDXT)
 
 OPTION(CURL_IS_STATIC "on if curl is a static lib " ON)
diff --git a/src/osgEarthSymbology/Color.cpp b/src/osgEarthSymbology/Color.cpp
index ea0db27..48f9903 100644
--- a/src/osgEarthSymbology/Color.cpp
+++ b/src/osgEarthSymbology/Color.cpp
@@ -140,7 +140,7 @@ Color::Color( const std::string& input, Format format )
         c.g() |= t[e+3]<='9' ? (t[e+3]-'0')    : (10+(t[e+3]-'a'));
         c.b() |= t[e+4]<='9' ? (t[e+4]-'0')<<4 : (10+(t[e+4]-'a'))<<4;
         c.b() |= t[e+5]<='9' ? (t[e+5]-'0')    : (10+(t[e+5]-'a'));
-        if ( t.length() >= 8 ) {
+        if ( len >= 8 ) {
             c.a() = 0;
             c.a() |= t[e+6]<='9' ? (t[e+6]-'0')<<4 : (10+(t[e+6]-'a'))<<4;
             c.a() |= t[e+7]<='9' ? (t[e+7]-'0')    : (10+(t[e+7]-'a'));
diff --git a/src/osgEarthSymbology/StyleSheet b/src/osgEarthSymbology/StyleSheet
index 32d427c..ab188bb 100644
--- a/src/osgEarthSymbology/StyleSheet
+++ b/src/osgEarthSymbology/StyleSheet
@@ -56,6 +56,10 @@ namespace osgEarth { namespace Symbology
         /** 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; }
 
@@ -103,6 +107,7 @@ namespace osgEarth { namespace Symbology
         virtual void mergeConfig( const Config& conf );
 
     protected:
+        optional<std::string>        _name;
         URIContext                   _uriContext;
         osg::ref_ptr<ScriptDef>      _script;
         StyleSelectorList            _selectors;
diff --git a/src/osgEarthSymbology/StyleSheet.cpp b/src/osgEarthSymbology/StyleSheet.cpp
index 9f3a293..4ece9b0 100644
--- a/src/osgEarthSymbology/StyleSheet.cpp
+++ b/src/osgEarthSymbology/StyleSheet.cpp
@@ -178,6 +178,7 @@ Config
 StyleSheet::getConfig() const
 {
     Config conf;
+    conf.set("name", _name);
 
     for( StyleSelectorList::const_iterator i = _selectors.begin(); i != _selectors.end(); ++i )
     {
@@ -226,6 +227,8 @@ StyleSheet::getConfig() const
 void
 StyleSheet::mergeConfig( const Config& conf )
 {
+    conf.getIfSet("name", _name);
+
     _uriContext = URIContext( conf.referrer() );
 
     // read in any resource library references
diff --git a/src/osgEarthUtil/MouseCoordsTool.cpp b/src/osgEarthUtil/MouseCoordsTool.cpp
index 5b2d348..837ad10 100644
--- a/src/osgEarthUtil/MouseCoordsTool.cpp
+++ b/src/osgEarthUtil/MouseCoordsTool.cpp
@@ -67,25 +67,6 @@ MouseCoordsTool::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapt
             for( Callbacks::iterator i = _callbacks.begin(); i != _callbacks.end(); ++i )
                 i->get()->reset( aa.asView(), _mapNode );
         }
-
-#if 1 // testing AGL, Dist to Point
-        osg::Vec3d eye, center, up;
-        aa.asView()->getCamera()->getViewMatrixAsLookAt(eye, center, up);
-        osgUtil::LineSegmentIntersector* lsi = new osgUtil::LineSegmentIntersector(eye, osg::Vec3d(0,0,0));
-        osgUtil::IntersectionVisitor iv(lsi);
-        lsi->setIntersectionLimit(lsi->LIMIT_NEAREST);
-        //iv.setUserData( new Map() );
-        _mapNode->accept(iv);
-
-        if ( !lsi->getIntersections().empty() )
-        {            
-            double agl = (eye - lsi->getFirstIntersection().getWorldIntersectPoint()).length();
-            double dtp = (eye - world).length();
-            //OE_NOTICE << "AGL = " << agl << "m; DPT = " << dtp << "m" << std::endl;
-            Registry::instance()->startActivity("AGL", Stringify() << agl << " m");
-            Registry::instance()->startActivity("Range", Stringify() << dtp << " m");
-        }
-#endif
     }
 
     return false;
@@ -97,14 +78,7 @@ MouseCoordsLabelCallback::MouseCoordsLabelCallback( LabelControl* label, Formatt
 _label    ( label ),
 _formatter( formatter )
 {
-#if 0
-    if ( !formatter )
-    {
-        LatLongFormatter* formatter = new LatLongFormatter( LatLongFormatter::FORMAT_DECIMAL_DEGREES );
-        formatter->setPrecision( 5 );
-        _formatter = formatter;
-    }
-#endif
+    //nop
 }
 
 void
@@ -139,6 +113,7 @@ MouseCoordsLabelCallback::reset( osg::View* view, MapNode* mapNode )
     if ( _label.valid() )
     {
         _label->setText( "" );
+        _label->setText(Stringify() << "No data  |  " << mapNode->getMapSRS()->getName() );
     }
 }
 
diff --git a/tests/feature_mapnikvectortiles.earth b/tests/feature_mapnikvectortiles.earth
new file mode 100644
index 0000000..4a65c61
--- /dev/null
+++ b/tests/feature_mapnikvectortiles.earth
@@ -0,0 +1,221 @@
+<!--
+osgEarth Sample - Feature Mapnik Vector Tiles
+
+This example shows how to load a local mbtiles file that contains vector tiles.
+
+You must have the mapnik vector tiles driver built by including the protobuf libraries in cmake.
+
+For reference, the honolulu.mbtiles file was generated using the extract at https://mapzen.com/data/metro-extracts/metro/honolulu_hawaii/
+
+This was the command line used:
+
+osmium export -f geojsonseq --config=config.json honolulu_hawaii.osm.pbf | tippecanoe -f -pf -pk -ps -Z14 -z14 -d12 --no-tile-stats -b0 -l osm -n honolulu -o honolulu.mbtiles
+
+config.json was:
+{
+    "attributes": {
+        "type":      false,
+        "id":        false,
+        "version":   false,
+        "changeset": false,
+        "timestamp": false,
+        "uid":       false,
+        "user":      false,
+        "way_nodes": false
+    },
+    "linear_tags":  ["highway", "barrier", "natural=coastline"],
+    "area_tags":    ["aeroway", "amenity", "building", "landuse", "leisure", "man_made", "natural!=coastline"],
+    "exclude_tags": ["created_by", "source", "source:*"],
+    "include_tags": []
+}
+-->
+<map type="geocentric" version="2">
+
+    <feature_model name="osm">
+
+        <features name="osm" driver="mapnikvectortiles">
+            <url>../data/honolulu.mbtiles</url>
+        </features>
+
+        <instancing>true</instancing>
+
+        <feature_indexing enabled="false"></feature_indexing>
+
+        <styles>
+
+            <library name="us_resources">
+                <url>../data/resources/textures_us/catalog.xml</url>
+            </library>
+
+            <style type="text/css">
+                hospital {
+                     icon: "../data/hospital.png";
+                     icon-align:    center-center;
+                     icon-declutter: true;
+                     text-content:  getName();
+                     altitude-clamping:       terrain;
+                }
+
+                school {
+                     icon: "../data/school.png";
+                     icon-align:    center-center;
+                     icon-declutter: true;
+                     text-content:  getName();
+                     altitude-clamping:       terrain;
+                }
+
+                bank {
+                     icon: "../data/bank.png";
+                     icon-align:    center-center;
+                     icon-declutter: true;
+                     text-content:  getName();
+                     altitude-clamping:       terrain;
+                }
+
+                forest {
+                   model:               "../data/tree.ive";
+                   model-placement:     random;
+                   model-density:       10000;
+                   model-scale:         2.5;
+                   model-random-seed:   1;
+                   altitude-clamping:       terrain;
+                }
+
+                grass {
+                   model:               "../data/tree.ive";
+                   model-placement:     random;
+                   model-density:       10000;
+                   model-scale:         2.5;
+                   model-random-seed:   1;
+                   altitude-clamping:       terrain;
+                }
+
+                water {
+                   fill:               #6BA8FF;
+                   render-depth-test:  false;
+                   altitude-clamping:  terrain-drape;
+                }
+
+                buildings {
+                  extrusion-height:      getBuildingHeight();
+                  extrusion-flatten:     true;
+                  extrusion-wall-style:  building-wall;
+                  extrusion-roof-style:  building-rooftop;
+                  altitude-clamping:     terrain;
+                }
+
+                building-wall {
+                  skin-library:     us_resources;
+                  skin-tags:        building;
+                  skin-random-seed: 1;
+                  fill:             #ffffff;
+                }
+                building-rooftop {
+                  skin-library:     us_resources;
+                  skin-tags:        rooftop;
+                  skin-tiled:       true;
+                  skin-random-seed: 1;
+                  fill:             #ffffff;
+                }
+
+            </style>
+
+            <selector name="default" style_expr="selectStyle()"/>
+
+            <script language="javascript">
+                <![CDATA[
+
+                function selectStyle() {
+                    if ("building" in feature.properties) {
+                        return "buildings";
+                    }
+                    else if ("landuse" in feature.properties) {
+                        var landuse = feature.properties["landuse"];
+                        if ( landuse == "forest" ||
+                             landuse == "grass" ||
+                             landuse == "meadow"
+                            ) {
+                                return "forest";
+                            }
+                        else if (landuse == "reservoir") {
+                            return "water";
+                        }
+                    }
+                    else if ("natural" in feature.properties) {
+                        var natural = feature.properties["natural"];
+                        if (natural == "wood" || natural == "tree") {
+                            return "forest"
+                        }
+                        else if (natural == "water") {
+                            return "water";
+                        }
+                    }
+                    else if ("surface" in feature.properties) {
+                        var surface = feature.properties["surface"];
+                        if (surface == "grass") {
+                            return "grass";
+                        }
+                    }
+                    else if ("amenity" in feature.properties) {
+                        var amenity = feature.properties["amenity"];
+                        if (amenity == "hospital") {
+                            return "hospital";
+                        }
+                        else if (amenity == "school") {
+                            return "school";
+                        }
+                        else if (amenity == "bank") {
+                            return "bank";
+                        }
+                    }
+                    return null;
+                }
+
+                function getName() {
+                    if ("name" in feature.properties) {
+                        return feature.properties["name"];
+                    }
+                    return "";
+                }
+
+                function getBuildingHeight() {
+					if ("height" in feature.properties) {
+						var h = feature.properties["height"].replace('m','');
+						return Math.max(h, 4.0);
+					} else if ("building:height" in feature.properties) {
+						var h = feature.properties["building:height"].replace('m','');
+						return Math.max(h, 4.0);
+					} else if ("building:levels" in feature.properties){
+						var l = feature.properties["building:levels"];
+						return Math.max(l * 4.0, 4.0);
+					}
+					return Math.floor((Math.random() * 5.0) + 4.0);
+                }
+              ]]>
+            </script>
+
+        </styles>
+    </feature_model>
+
+    <image name="esri imagery" driver="arcgis">
+        <url>http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer</url>
+        <nodata_image>http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/100/0/0.jpeg</nodata_image>
+    </image>
+
+    <elevation name="readymap_elevation" driver="tms">
+        <url>http://readymap.org/readymap/tiles/1.0.0/116/</url>
+    </elevation>
+
+    <viewpoints>
+      <viewpoint>
+        <name>Honolulu</name>
+        <heading>-22.7465</heading>
+        <pitch>-5.28948</pitch>
+        <range>7310.49m</range>
+        <long>-157.8255773676917</long>
+        <lat>21.28116313649227</lat>
+        <height>10.88873224053532</height>
+      </viewpoint>
+    </viewpoints>
+
+</map>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osgearth.git



More information about the Pkg-grass-devel mailing list