Fix nodes order in Placemark and IconStyle
This commit is contained in:
@@ -1943,11 +1943,6 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
||||
node.setAttribute('id', feature.getId());
|
||||
}
|
||||
|
||||
// serialize geometry
|
||||
ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_,
|
||||
ol.format.KML.GEOMETRY_NODE_FACTORY_,
|
||||
[feature.getGeometry()], objectStack);
|
||||
|
||||
// serialize properties (properties unknown to KML are not serialized)
|
||||
var properties = feature.getProperties();
|
||||
var styleFunction = feature.getStyleFunction();
|
||||
@@ -1968,6 +1963,11 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
||||
var values = ol.xml.makeSequence(properties, orderedKeys);
|
||||
ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_,
|
||||
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys);
|
||||
|
||||
// serialize geometry
|
||||
ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_,
|
||||
ol.format.KML.GEOMETRY_NODE_FACTORY_,
|
||||
[feature.getGeometry()], objectStack);
|
||||
};
|
||||
|
||||
|
||||
@@ -2187,7 +2187,7 @@ ol.format.KML.ICON_SERIALIZERS_ = ol.xml.makeStructureNS(
|
||||
*/
|
||||
ol.format.KML.ICON_STYLE_SEQUENCE_ = ol.xml.makeStructureNS(
|
||||
ol.format.KML.NAMESPACE_URIS_, [
|
||||
'Icon', 'heading', 'hotSpot', 'scale'
|
||||
'scale', 'heading', 'Icon', 'hotSpot'
|
||||
]);
|
||||
|
||||
|
||||
@@ -2285,8 +2285,8 @@ ol.format.KML.MULTI_GEOMETRY_SERIALIZERS_ = ol.xml.makeStructureNS(
|
||||
*/
|
||||
ol.format.KML.PLACEMARK_SEQUENCE_ = ol.xml.makeStructureNS(
|
||||
ol.format.KML.NAMESPACE_URIS_, [
|
||||
'Style', 'address', 'description', 'name', 'open',
|
||||
'phoneNumber', 'styleUrl', 'visibility'
|
||||
'name', 'open', 'visibility', 'address', 'phoneNumber', 'description',
|
||||
'styleUrl', 'Style'
|
||||
]);
|
||||
|
||||
|
||||
|
||||
@@ -1027,10 +1027,10 @@ describe('ol.format.KML', function() {
|
||||
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
|
||||
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
|
||||
' <Placemark>' +
|
||||
' <address>My address</address>' +
|
||||
' <description>My description</description>' +
|
||||
' <name>My name</name>' +
|
||||
' <address>My address</address>' +
|
||||
' <phoneNumber>My phone number</phoneNumber>' +
|
||||
' <description>My description</description>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(ol.xml.load(text));
|
||||
@@ -1451,6 +1451,8 @@ describe('ol.format.KML', function() {
|
||||
' <Placemark>' +
|
||||
' <Style>' +
|
||||
' <IconStyle>' +
|
||||
' <scale>0.25</scale>' +
|
||||
' <heading>45</heading>' +
|
||||
' <Icon>' +
|
||||
' <href>http://foo.png</href>' +
|
||||
' <gx:x>96</gx:x>' +
|
||||
@@ -1458,10 +1460,8 @@ describe('ol.format.KML', function() {
|
||||
' <gx:w>48</gx:w>' +
|
||||
' <gx:h>48</gx:h>' +
|
||||
' </Icon>' +
|
||||
' <heading>45</heading>' +
|
||||
' <hotSpot x="12" y="12" xunits="pixels" ' +
|
||||
' yunits="pixels"/>' +
|
||||
' <scale>0.25</scale>' +
|
||||
' </IconStyle>' +
|
||||
' </Style>' +
|
||||
' </Placemark>' +
|
||||
@@ -1489,13 +1489,13 @@ describe('ol.format.KML', function() {
|
||||
' xsi:schemaLocation="http://www.opengis.net/kml/2.2' +
|
||||
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
|
||||
' <Placemark>' +
|
||||
' <name>foo</name>' +
|
||||
' <Style>' +
|
||||
' <LabelStyle>' +
|
||||
' <color>ffdf220c</color>' +
|
||||
' <scale>0.25</scale>' +
|
||||
' </LabelStyle>' +
|
||||
' </Style>' +
|
||||
' <name>foo</name>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(ol.xml.load(text));
|
||||
|
||||
Reference in New Issue
Block a user