-
Notifications
You must be signed in to change notification settings - Fork 790
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add inline style selection to stylesheets
- Loading branch information
Showing
4 changed files
with
188 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!-- | ||
osgEarth Sample | ||
Demonstrates how to select a style name using javascript. | ||
--> | ||
|
||
<map name="Demo: style selectors"> | ||
|
||
<options> | ||
<terrain color="#004d8f"/> | ||
</options> | ||
|
||
<OGRFeatures name="country-data"> | ||
<url>../data/world.shp</url> | ||
<filters> | ||
<buffer distance="-0.05"/> | ||
</filters> | ||
</OGRFeatures> | ||
|
||
<FeatureModel name="countries" features="country-data" pickable="true"> | ||
<styles> | ||
<style type="text/css"> | ||
base { | ||
altitude-clamping: terrain-drape; | ||
render-backface-culling: false; | ||
} | ||
|
||
p1 : base { | ||
select: between(feature.properties.pop, 0, 14045470); | ||
fill: #ff3f3f; | ||
} | ||
|
||
p2 : base { | ||
select: between(feature.properties.pop, 14045470, 43410900); | ||
fill: #3fff3f; | ||
} | ||
|
||
p3 : base { | ||
select: between(feature.properties.pop, 43410900, 97228750); | ||
fill: #ff8f00; | ||
} | ||
|
||
p4 : base { | ||
select: between(feature.properties.pop, 97228750, 258833000); | ||
fill: #ff3fff; | ||
} | ||
|
||
default : base { | ||
fill: #ffff3f; | ||
} | ||
</style> | ||
|
||
<script language="javascript"> | ||
<![CDATA[ | ||
function between(val_as_string, low, high) { | ||
var v = parseFloat(val_as_string); | ||
return low <= v && v < high; | ||
} | ||
]]> | ||
</script> | ||
</styles> | ||
</FeatureModel> | ||
|
||
</map> |