/usr/share/osgearth/maps/feature_scripted_styling.earth is in osgearth-data 2.4.0+dfsg-6.
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 | <!--
osgEarth Sample
This one demonstrates how to generate inline styles using JavaScript
and a custom selector.
-->
<map name="Inline styling" type="geocentric" version="2">
<options>
<lighting>false</lighting>
<overlay_blending>false</overlay_blending>
</options>
<image name="world" driver="gdal">
<url>/usr/share/osgearth/data/world.tif</url>
</image>
<model name="countries" driver="feature_geom" overlay="true">
<features name="states" driver="ogr">
<url>/usr/share/osgearth/data/world.shp</url>
<buffer distance="-0.05"/>
</features>
<styles>
<script language="javascript">
<![CDATA[
var g_styles = [];
// convert a number to a 2-char hex string
function hex(n) {
n = parseInt(n,10);
return "0123456789ABCDEF".charAt((n-n%16)/16) + "0123456789ABCDEF".charAt(n%16);
}
// generates a collection of styles with random color fill values
function initialize() {
for( var i=0; i<10; ++i ) {
var r = Math.floor(Math.random()*255);
var g = Math.floor(Math.random()*255);
var b = Math.floor(Math.random()*255);
g_styles.push( "{fill:#"+hex(r)+hex(g)+hex(b)+"6f;}" );
}
}
initialize();
// selects a color at random
function randomColor() {
var n = parseInt(Math.floor(Math.random()*10));
return g_styles[n];
}
]]>
</script>
<selector style_expr="randomColor()"/>
</styles>
</model>
</map>
|