~ubuntu-branches/debian/sid/osgearth/sid

« back to all changes in this revision

Viewing changes to tests/feature_stencil_polygon_draping.earth

  • Committer: Bazaar Package Importer
  • Author(s): Pirmin Kalberer
  • Date: 2011-07-14 22:13:36 UTC
  • Revision ID: james.westby@ubuntu.com-20110714221336-94igk9rskxveh794
Tags: upstream-2.0+dfsg
ImportĀ upstreamĀ versionĀ 2.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!--
 
2
osgEarth Sample
 
3
 
 
4
This one demonstrates how to read feature data from a shapefile and "drape" it
 
5
on the map using a stenciling technique. This technique is more compute-intensive
 
6
than the overlay technique, but it is much more flexible and it works in a 
 
7
whole-earth environment.
 
8
 
 
9
This demo loads a shapefile of the world, and colors each country based
 
10
on its population count using feature style classes.
 
11
 
 
12
Note the use of the XML CDATA tag in the expressions. This is only required if
 
13
you use XML special characters in the expression (in this case, the less-than
 
14
and greater-than symbols). CDATA "escapes out" of XML parsing within the CDATA
 
15
block.
 
16
-->
 
17
 
 
18
<map name="Feature Stencil Demo" type="geocentric" version="2">
 
19
    
 
20
    <options lighting="false"/>
 
21
 
 
22
    <image name="world" driver="gdal">
 
23
        <url>../data/world.tif</url>
 
24
    </image>
 
25
    
 
26
    <model name="countries" driver="feature_stencil">
 
27
 
 
28
        <!-- Configure the OGR feature driver to read the shapefile.
 
29
             Applying a slight negative buffer will "erode" the
 
30
             shapes, highlighting the borders between countries. -->
 
31
                          
 
32
        <features name="states" driver="ogr">
 
33
            <url>../data/world.shp</url>
 
34
            <ogr_driver>ESRI Shapefile</ogr_driver>
 
35
            <buffer distance="-0.05"/>
 
36
        </features>
 
37
        
 
38
        <!-- Since some countries span large areas on the globe, we need to
 
39
             use a larger-than-normal extrusion distance on the stencil
 
40
             volumes. (300000 is the default for a geocentric map.) -->
 
41
             
 
42
        <extrusion_distance>400000</extrusion_distance>
 
43
        
 
44
        <!-- Define a feature style class for each category: -->
 
45
        
 
46
        <styles>
 
47
        
 
48
            <style type="text/css">
 
49
                p1 {
 
50
                   fill: #ffff80;
 
51
                   fill-opacity: 0.4;
 
52
                }       
 
53
                p2 {
 
54
                   fill: #fad155;
 
55
                   fill-opacity: 0.4;
 
56
                }   
 
57
                p3 {
 
58
                   fill: #f2a82f;
 
59
                   fill-opacity: 0.4;
 
60
                }       
 
61
                p4 {
 
62
                   fill: #b3520d;
 
63
                   fill-opacity: 0.4;
 
64
                }     
 
65
                p5 {
 
66
                   fill: #6a0000;
 
67
                   fill-opacity: 0.4;
 
68
                }                                      
 
69
            </style>
 
70
        
 
71
            <selector name="p1">
 
72
                <query>
 
73
                    <expr><![CDATA[ POP_CNTRY <= 14045470 ]]></expr>
 
74
                </query>
 
75
            </selector>
 
76
        
 
77
            <selector name="p2">
 
78
                <query>
 
79
                    <expr><![CDATA[ POP_CNTRY > 14045470 and POP_CNTRY <= 43410900 ]]></expr>
 
80
                </query>
 
81
            </selector>
 
82
            
 
83
            <selector name="p3">
 
84
                <query>
 
85
                    <expr><![CDATA[ POP_CNTRY > 43410900 and POP_CNTRY <= 97228750 ]]></expr>
 
86
                </query>
 
87
            </selector>
 
88
            
 
89
            <selector name="p4">
 
90
                <query>
 
91
                    <expr><![CDATA[ POP_CNTRY > 97228750 and POP_CNTRY <= 258833000 ]]></expr>
 
92
                </query>
 
93
            </selector>
 
94
            
 
95
            <selector name="p5">
 
96
                <query>
 
97
                    <expr><![CDATA[ POP_CNTRY > 258833000 ]]></expr>
 
98
                </query>
 
99
            </selector>
 
100
            
 
101
        </styles>
 
102
        
 
103
    </model>
 
104
</map>