Followup to r8519; fix styleurl parsing as well. Includes new KML modifications
to examples to show styleurls in action. r=me (Closes #1796) git-svn-id: http://svn.openlayers.org/trunk/openlayers@8882 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -19,7 +19,8 @@
|
||||
format: OpenLayers.Format.KML,
|
||||
formatOptions: {
|
||||
extractStyles: true,
|
||||
extractAttributes: true
|
||||
extractAttributes: true,
|
||||
maxDepth: 2
|
||||
}
|
||||
}));
|
||||
map.zoomToExtent(new OpenLayers.Bounds(-112.306698,36.017792,-112.03204,36.18087));
|
||||
|
||||
@@ -262,6 +262,14 @@
|
||||
-112.2626894973474,36.10149062823369,630 </coordinates>
|
||||
</LineString>
|
||||
</Placemark>
|
||||
<Placemark>
|
||||
<name>Blue Icon</name>
|
||||
<description>Just another blue icon.</description>
|
||||
<styleUrl>kml/styles.kml#blueIcons</styleUrl>
|
||||
<Point>
|
||||
<coordinates>-112.292238941097,36.09520916122063,630</coordinates>
|
||||
</Point>
|
||||
</Placemark>
|
||||
</Folder>
|
||||
</Document>
|
||||
</kml>
|
||||
|
||||
21
examples/kml/styles.kml
Normal file
21
examples/kml/styles.kml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
This file contains styles referenced by other KML files in this project.
|
||||
http://kml-samples.googlecode.com/svn/trunk/kml/Style/styles.kml
|
||||
|
||||
-->
|
||||
<kml xmlns="http://earth.google.com/kml/2.1">
|
||||
<Document id="globalStyles">
|
||||
|
||||
<Style id="blueIcons">
|
||||
<IconStyle>
|
||||
<color>ffff0000</color>
|
||||
<Icon>
|
||||
<href>http://maps.google.com/mapfiles/kml/shapes/sunny.png</href>
|
||||
</Icon>
|
||||
</IconStyle>
|
||||
</Style>
|
||||
|
||||
</Document>
|
||||
</kml>
|
||||
@@ -543,7 +543,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
// Create reference to styleUrl
|
||||
if (this.extractStyles && feature.attributes &&
|
||||
feature.attributes.styleUrl) {
|
||||
feature.style = this.getStyle(feature.attributes.styleUrl);
|
||||
feature.style = this.getStyle(feature.attributes.styleUrl, options);
|
||||
}
|
||||
|
||||
if (this.extractStyles) {
|
||||
|
||||
Reference in New Issue
Block a user