forked from gwaldron/osgearth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeature_scripted_styling_2.earth
52 lines (42 loc) · 1.7 KB
/
feature_scripted_styling_2.earth
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
<!--
osgEarth Sample
Demonstrates how to select a style name using javascript.
-->
<map name="Feature Overlay Demo" type="geocentric" version="2">
<options>
<lighting>false</lighting>
<overlay_blending>false</overlay_blending>
</options>
<image name="world" driver="gdal">
<url>../data/world.tif</url>
</image>
<model name="countries" driver="feature_geom">
<features name="states" driver="ogr">
<url>../data/world.shp</url>
<buffer distance="-0.05"/>
</features>
<styles>
<style type="text/css">
p1 { fill: #ffff8066; altitude-clamping: terrain-drape; }
p2 { fill: #80ffff66; altitude-clamping: terrain-drape; }
p3 { fill: #ff80ff66; altitude-clamping: terrain-drape; }
p4 { fill: #ff808066; altitude-clamping: terrain-drape; }
p5 { fill: #80ff8066; altitude-clamping: terrain-drape; }
</style>
<script language="javascript">
<![CDATA[
function getStyleClass()
{
var pop = parseInt(feature.properties.pop_cntry);
if ( pop <= 14045470 ) return "p1";
else if ( pop <= 43410900 ) return "p2";
else if ( pop <= 97228750 ) return "p3";
else if ( pop <= 258833000 ) return "p4";
else return "p5";
}
]]>
</script>
<selector class_expr="getStyleClass()"/>
</styles>
</model>
</map>