From e77ef118ea234e92cbf22fb3e57848c14e35368f Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 17 Dec 2017 01:58:24 -0700 Subject: [PATCH] Rename _ol_format_KML_ to KML --- examples/drag-and-drop-image-vector.js | 4 +- examples/drag-and-drop.js | 4 +- examples/earthquake-clusters.js | 4 +- examples/earthquake-custom-symbol.js | 4 +- examples/heatmap-earthquakes.js | 4 +- examples/kml-earthquakes.js | 4 +- examples/kml-timezones.js | 4 +- examples/kml.js | 4 +- src/ol/format/KML.js | 891 ++++++++++++------------- test/spec/ol/format/kml.test.js | 76 +-- 10 files changed, 497 insertions(+), 502 deletions(-) diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index 52c62d9f73..117531e788 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -3,7 +3,7 @@ import _ol_View_ from '../src/ol/View.js'; import GPX from '../src/ol/format/GPX.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import IGC from '../src/ol/format/IGC.js'; -import _ol_format_KML_ from '../src/ol/format/KML.js'; +import KML from '../src/ol/format/KML.js'; import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js'; import _ol_interaction_ from '../src/ol/interaction.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; @@ -88,7 +88,7 @@ var dragAndDropInteraction = new DragAndDrop({ GPX, GeoJSON, IGC, - _ol_format_KML_, + KML, _ol_format_TopoJSON_ ] }); diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index 78486b7ed6..63b321c3dc 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -3,7 +3,7 @@ import _ol_View_ from '../src/ol/View.js'; import GPX from '../src/ol/format/GPX.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import IGC from '../src/ol/format/IGC.js'; -import _ol_format_KML_ from '../src/ol/format/KML.js'; +import KML from '../src/ol/format/KML.js'; import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js'; import _ol_interaction_ from '../src/ol/interaction.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; @@ -88,7 +88,7 @@ var dragAndDropInteraction = new DragAndDrop({ GPX, GeoJSON, IGC, - _ol_format_KML_, + KML, _ol_format_TopoJSON_ ] }); diff --git a/examples/earthquake-clusters.js b/examples/earthquake-clusters.js index 1940636b56..7296bbfe62 100644 --- a/examples/earthquake-clusters.js +++ b/examples/earthquake-clusters.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import * as _ol_extent_ from '../src/ol/extent.js'; -import _ol_format_KML_ from '../src/ol/format/KML.js'; +import KML from '../src/ol/format/KML.js'; import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; @@ -126,7 +126,7 @@ vector = new _ol_layer_Vector_({ distance: 40, source: new _ol_source_Vector_({ url: 'data/kml/2012_Earthquakes_Mag5.kml', - format: new _ol_format_KML_({ + format: new KML({ extractStyles: false }) }) diff --git a/examples/earthquake-custom-symbol.js b/examples/earthquake-custom-symbol.js index 64491102e1..c989bb341f 100644 --- a/examples/earthquake-custom-symbol.js +++ b/examples/earthquake-custom-symbol.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_KML_ from '../src/ol/format/KML.js'; +import KML from '../src/ol/format/KML.js'; import Polygon from '../src/ol/geom/Polygon.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -55,7 +55,7 @@ var styleFunction = function(feature) { var vector = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/kml/2012_Earthquakes_Mag5.kml', - format: new _ol_format_KML_({ + format: new KML({ extractStyles: false }) }), diff --git a/examples/heatmap-earthquakes.js b/examples/heatmap-earthquakes.js index 09ccb7cc90..8439a59ae7 100644 --- a/examples/heatmap-earthquakes.js +++ b/examples/heatmap-earthquakes.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_KML_ from '../src/ol/format/KML.js'; +import KML from '../src/ol/format/KML.js'; import _ol_layer_Heatmap_ from '../src/ol/layer/Heatmap.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; @@ -12,7 +12,7 @@ var radius = document.getElementById('radius'); var vector = new _ol_layer_Heatmap_({ source: new _ol_source_Vector_({ url: 'data/kml/2012_Earthquakes_Mag5.kml', - format: new _ol_format_KML_({ + format: new KML({ extractStyles: false }) }), diff --git a/examples/kml-earthquakes.js b/examples/kml-earthquakes.js index 5aefdb7491..a526641253 100644 --- a/examples/kml-earthquakes.js +++ b/examples/kml-earthquakes.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_KML_ from '../src/ol/format/KML.js'; +import KML from '../src/ol/format/KML.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; @@ -41,7 +41,7 @@ var styleFunction = function(feature) { var vector = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/kml/2012_Earthquakes_Mag5.kml', - format: new _ol_format_KML_({ + format: new KML({ extractStyles: false }) }), diff --git a/examples/kml-timezones.js b/examples/kml-timezones.js index 355076b149..0439f5e329 100644 --- a/examples/kml-timezones.js +++ b/examples/kml-timezones.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_KML_ from '../src/ol/format/KML.js'; +import KML from '../src/ol/format/KML.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_Stamen_ from '../src/ol/source/Stamen.js'; @@ -48,7 +48,7 @@ var styleFunction = function(feature) { var vector = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/kml/timezones.kml', - format: new _ol_format_KML_({ + format: new KML({ extractStyles: false }) }), diff --git a/examples/kml.js b/examples/kml.js index bc2da7bfa9..e8225d29c1 100644 --- a/examples/kml.js +++ b/examples/kml.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_KML_ from '../src/ol/format/KML.js'; +import KML from '../src/ol/format/KML.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; @@ -16,7 +16,7 @@ var raster = new _ol_layer_Tile_({ var vector = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/kml/2012-02-10.kml', - format: new _ol_format_KML_() + format: new KML() }) }); diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 50cddfb9bf..8831f83dcf 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -1,11 +1,6 @@ /** * @module ol/format/KML */ -// FIXME http://earth.google.com/kml/1.0 namespace? -// FIXME why does node.getAttribute return an unknown type? -// FIXME serialize arbitrary feature properties -// FIXME don't parse style if extractStyles is false - import {inherits} from '../index.js'; import _ol_Feature_ from '../Feature.js'; import _ol_array_ from '../array.js'; @@ -46,14 +41,14 @@ import _ol_xml_ from '../xml.js'; * @param {olx.format.KMLOptions=} opt_options Options. * @api */ -var _ol_format_KML_ = function(opt_options) { +var KML = function(opt_options) { var options = opt_options ? opt_options : {}; _ol_format_XMLFeature_.call(this); - if (!_ol_format_KML_.DEFAULT_STYLE_ARRAY_) { - _ol_format_KML_.createStyleDefaults_(); + if (!KML.DEFAULT_STYLE_ARRAY_) { + KML.createStyleDefaults_(); } /** @@ -66,7 +61,7 @@ var _ol_format_KML_ = function(opt_options) { * @type {Array.} */ this.defaultStyle_ = options.defaultStyle ? - options.defaultStyle : _ol_format_KML_.DEFAULT_STYLE_ARRAY_; + options.defaultStyle : KML.DEFAULT_STYLE_ARRAY_; /** * @private @@ -97,7 +92,7 @@ var _ol_format_KML_ = function(opt_options) { }; -inherits(_ol_format_KML_, _ol_format_XMLFeature_); +inherits(KML, _ol_format_XMLFeature_); /** @@ -105,7 +100,7 @@ inherits(_ol_format_KML_, _ol_format_XMLFeature_); * @type {Array.} * @private */ -_ol_format_KML_.GX_NAMESPACE_URIS_ = [ +KML.GX_NAMESPACE_URIS_ = [ 'http://www.google.com/kml/ext/2.2' ]; @@ -115,7 +110,7 @@ _ol_format_KML_.GX_NAMESPACE_URIS_ = [ * @type {Array.} * @private */ -_ol_format_KML_.NAMESPACE_URIS_ = [ +KML.NAMESPACE_URIS_ = [ null, 'http://earth.google.com/kml/2.0', 'http://earth.google.com/kml/2.1', @@ -129,7 +124,7 @@ _ol_format_KML_.NAMESPACE_URIS_ = [ * @type {string} * @private */ -_ol_format_KML_.SCHEMA_LOCATION_ = 'http://www.opengis.net/kml/2.2 ' + +KML.SCHEMA_LOCATION_ = 'http://www.opengis.net/kml/2.2 ' + 'https://developers.google.com/kml/schema/kml22gx.xsd'; @@ -137,21 +132,21 @@ _ol_format_KML_.SCHEMA_LOCATION_ = 'http://www.opengis.net/kml/2.2 ' + * @return {Array.} Default style. * @private */ -_ol_format_KML_.createStyleDefaults_ = function() { +KML.createStyleDefaults_ = function() { /** * @const * @type {ol.Color} * @private */ - _ol_format_KML_.DEFAULT_COLOR_ = [255, 255, 255, 1]; + KML.DEFAULT_COLOR_ = [255, 255, 255, 1]; /** * @const * @type {ol.style.Fill} * @private */ - _ol_format_KML_.DEFAULT_FILL_STYLE_ = new _ol_style_Fill_({ - color: _ol_format_KML_.DEFAULT_COLOR_ + KML.DEFAULT_FILL_STYLE_ = new _ol_style_Fill_({ + color: KML.DEFAULT_COLOR_ }); /** @@ -159,14 +154,14 @@ _ol_format_KML_.createStyleDefaults_ = function() { * @type {ol.Size} * @private */ - _ol_format_KML_.DEFAULT_IMAGE_STYLE_ANCHOR_ = [20, 2]; // FIXME maybe [8, 32] ? + KML.DEFAULT_IMAGE_STYLE_ANCHOR_ = [20, 2]; // FIXME maybe [8, 32] ? /** * @const * @type {ol.style.IconAnchorUnits} * @private */ - _ol_format_KML_.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ = + KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_ = _ol_style_IconAnchorUnits_.PIXELS; /** @@ -174,7 +169,7 @@ _ol_format_KML_.createStyleDefaults_ = function() { * @type {ol.style.IconAnchorUnits} * @private */ - _ol_format_KML_.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ = + KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_ = _ol_style_IconAnchorUnits_.PIXELS; /** @@ -182,14 +177,14 @@ _ol_format_KML_.createStyleDefaults_ = function() { * @type {ol.Size} * @private */ - _ol_format_KML_.DEFAULT_IMAGE_STYLE_SIZE_ = [64, 64]; + KML.DEFAULT_IMAGE_STYLE_SIZE_ = [64, 64]; /** * @const * @type {string} * @private */ - _ol_format_KML_.DEFAULT_IMAGE_STYLE_SRC_ = + KML.DEFAULT_IMAGE_STYLE_SRC_ = 'https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png'; /** @@ -197,23 +192,23 @@ _ol_format_KML_.createStyleDefaults_ = function() { * @type {number} * @private */ - _ol_format_KML_.DEFAULT_IMAGE_SCALE_MULTIPLIER_ = 0.5; + KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_ = 0.5; /** * @const * @type {ol.style.Image} * @private */ - _ol_format_KML_.DEFAULT_IMAGE_STYLE_ = new _ol_style_Icon_({ - anchor: _ol_format_KML_.DEFAULT_IMAGE_STYLE_ANCHOR_, + KML.DEFAULT_IMAGE_STYLE_ = new _ol_style_Icon_({ + anchor: KML.DEFAULT_IMAGE_STYLE_ANCHOR_, anchorOrigin: _ol_style_IconOrigin_.BOTTOM_LEFT, - anchorXUnits: _ol_format_KML_.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_, - anchorYUnits: _ol_format_KML_.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_, + anchorXUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_, + anchorYUnits: KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_, crossOrigin: 'anonymous', rotation: 0, - scale: _ol_format_KML_.DEFAULT_IMAGE_SCALE_MULTIPLIER_, - size: _ol_format_KML_.DEFAULT_IMAGE_STYLE_SIZE_, - src: _ol_format_KML_.DEFAULT_IMAGE_STYLE_SRC_ + scale: KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_, + size: KML.DEFAULT_IMAGE_STYLE_SIZE_, + src: KML.DEFAULT_IMAGE_STYLE_SRC_ }); /** @@ -221,15 +216,15 @@ _ol_format_KML_.createStyleDefaults_ = function() { * @type {string} * @private */ - _ol_format_KML_.DEFAULT_NO_IMAGE_STYLE_ = 'NO_IMAGE'; + KML.DEFAULT_NO_IMAGE_STYLE_ = 'NO_IMAGE'; /** * @const * @type {ol.style.Stroke} * @private */ - _ol_format_KML_.DEFAULT_STROKE_STYLE_ = new _ol_style_Stroke_({ - color: _ol_format_KML_.DEFAULT_COLOR_, + KML.DEFAULT_STROKE_STYLE_ = new _ol_style_Stroke_({ + color: KML.DEFAULT_COLOR_, width: 1 }); @@ -238,7 +233,7 @@ _ol_format_KML_.createStyleDefaults_ = function() { * @type {ol.style.Stroke} * @private */ - _ol_format_KML_.DEFAULT_TEXT_STROKE_STYLE_ = new _ol_style_Stroke_({ + KML.DEFAULT_TEXT_STROKE_STYLE_ = new _ol_style_Stroke_({ color: [51, 51, 51, 1], width: 2 }); @@ -248,10 +243,10 @@ _ol_format_KML_.createStyleDefaults_ = function() { * @type {ol.style.Text} * @private */ - _ol_format_KML_.DEFAULT_TEXT_STYLE_ = new _ol_style_Text_({ + KML.DEFAULT_TEXT_STYLE_ = new _ol_style_Text_({ font: 'bold 16px Helvetica', - fill: _ol_format_KML_.DEFAULT_FILL_STYLE_, - stroke: _ol_format_KML_.DEFAULT_TEXT_STROKE_STYLE_, + fill: KML.DEFAULT_FILL_STYLE_, + stroke: KML.DEFAULT_TEXT_STROKE_STYLE_, scale: 0.8 }); @@ -260,11 +255,11 @@ _ol_format_KML_.createStyleDefaults_ = function() { * @type {ol.style.Style} * @private */ - _ol_format_KML_.DEFAULT_STYLE_ = new _ol_style_Style_({ - fill: _ol_format_KML_.DEFAULT_FILL_STYLE_, - image: _ol_format_KML_.DEFAULT_IMAGE_STYLE_, - text: _ol_format_KML_.DEFAULT_TEXT_STYLE_, - stroke: _ol_format_KML_.DEFAULT_STROKE_STYLE_, + KML.DEFAULT_STYLE_ = new _ol_style_Style_({ + fill: KML.DEFAULT_FILL_STYLE_, + image: KML.DEFAULT_IMAGE_STYLE_, + text: KML.DEFAULT_TEXT_STYLE_, + stroke: KML.DEFAULT_STROKE_STYLE_, zIndex: 0 }); @@ -273,9 +268,9 @@ _ol_format_KML_.createStyleDefaults_ = function() { * @type {Array.} * @private */ - _ol_format_KML_.DEFAULT_STYLE_ARRAY_ = [_ol_format_KML_.DEFAULT_STYLE_]; + KML.DEFAULT_STYLE_ARRAY_ = [KML.DEFAULT_STYLE_]; - return _ol_format_KML_.DEFAULT_STYLE_ARRAY_; + return KML.DEFAULT_STYLE_ARRAY_; }; @@ -284,7 +279,7 @@ _ol_format_KML_.createStyleDefaults_ = function() { * @type {Object.} * @private */ -_ol_format_KML_.ICON_ANCHOR_UNITS_MAP_ = { +KML.ICON_ANCHOR_UNITS_MAP_ = { 'fraction': _ol_style_IconAnchorUnits_.FRACTION, 'pixels': _ol_style_IconAnchorUnits_.PIXELS, 'insetPixels': _ol_style_IconAnchorUnits_.PIXELS @@ -297,14 +292,14 @@ _ol_format_KML_.ICON_ANCHOR_UNITS_MAP_ = { * @return {ol.style.Style} style Style. * @private */ -_ol_format_KML_.createNameStyleFunction_ = function(foundStyle, name) { +KML.createNameStyleFunction_ = function(foundStyle, name) { var textStyle = null; var textOffset = [0, 0]; var textAlign = 'start'; if (foundStyle.getImage()) { var imageSize = foundStyle.getImage().getImageSize(); if (imageSize === null) { - imageSize = _ol_format_KML_.DEFAULT_IMAGE_STYLE_SIZE_; + imageSize = KML.DEFAULT_IMAGE_STYLE_SIZE_; } if (imageSize.length == 2) { var imageScale = foundStyle.getImage().getScale(); @@ -320,12 +315,12 @@ _ol_format_KML_.createNameStyleFunction_ = function(foundStyle, name) { // Note that kml does not support many text options that OpenLayers does (rotation, textBaseline). var foundText = foundStyle.getText(); textStyle = foundText.clone(); - textStyle.setFont(foundText.getFont() || _ol_format_KML_.DEFAULT_TEXT_STYLE_.getFont()); - textStyle.setScale(foundText.getScale() || _ol_format_KML_.DEFAULT_TEXT_STYLE_.getScale()); - textStyle.setFill(foundText.getFill() || _ol_format_KML_.DEFAULT_TEXT_STYLE_.getFill()); - textStyle.setStroke(foundText.getStroke() || _ol_format_KML_.DEFAULT_TEXT_STROKE_STYLE_); + textStyle.setFont(foundText.getFont() || KML.DEFAULT_TEXT_STYLE_.getFont()); + textStyle.setScale(foundText.getScale() || KML.DEFAULT_TEXT_STYLE_.getScale()); + textStyle.setFill(foundText.getFill() || KML.DEFAULT_TEXT_STYLE_.getFill()); + textStyle.setStroke(foundText.getStroke() || KML.DEFAULT_TEXT_STROKE_STYLE_); } else { - textStyle = _ol_format_KML_.DEFAULT_TEXT_STYLE_.clone(); + textStyle = KML.DEFAULT_TEXT_STYLE_.clone(); } textStyle.setText(name); textStyle.setOffsetX(textOffset[0]); @@ -350,7 +345,7 @@ _ol_format_KML_.createNameStyleFunction_ = function(foundStyle, name) { * @return {ol.FeatureStyleFunction} Feature style function. * @private */ -_ol_format_KML_.createFeatureStyleFunction_ = function(style, styleUrl, +KML.createFeatureStyleFunction_ = function(style, styleUrl, defaultStyle, sharedStyles, showPointNames) { return ( @@ -378,24 +373,24 @@ _ol_format_KML_.createFeatureStyleFunction_ = function(style, styleUrl, if (style) { if (drawName) { - nameStyle = _ol_format_KML_.createNameStyleFunction_(style[0], + nameStyle = KML.createNameStyleFunction_(style[0], name); return style.concat(nameStyle); } return style; } if (styleUrl) { - var foundStyle = _ol_format_KML_.findStyle_(styleUrl, defaultStyle, + var foundStyle = KML.findStyle_(styleUrl, defaultStyle, sharedStyles); if (drawName) { - nameStyle = _ol_format_KML_.createNameStyleFunction_(foundStyle[0], + nameStyle = KML.createNameStyleFunction_(foundStyle[0], name); return foundStyle.concat(nameStyle); } return foundStyle; } if (drawName) { - nameStyle = _ol_format_KML_.createNameStyleFunction_(defaultStyle[0], + nameStyle = KML.createNameStyleFunction_(defaultStyle[0], name); return defaultStyle.concat(nameStyle); } @@ -413,7 +408,7 @@ _ol_format_KML_.createFeatureStyleFunction_ = function(style, styleUrl, * @return {Array.} Style. * @private */ -_ol_format_KML_.findStyle_ = function(styleValue, defaultStyle, sharedStyles) { +KML.findStyle_ = function(styleValue, defaultStyle, sharedStyles) { if (Array.isArray(styleValue)) { return styleValue; } else if (typeof styleValue === 'string') { @@ -423,7 +418,7 @@ _ol_format_KML_.findStyle_ = function(styleValue, defaultStyle, sharedStyles) { if (!(styleValue in sharedStyles) && ('#' + styleValue in sharedStyles)) { styleValue = '#' + styleValue; } - return _ol_format_KML_.findStyle_( + return KML.findStyle_( sharedStyles[styleValue], defaultStyle, sharedStyles); } else { return defaultStyle; @@ -436,7 +431,7 @@ _ol_format_KML_.findStyle_ = function(styleValue, defaultStyle, sharedStyles) { * @private * @return {ol.Color|undefined} Color. */ -_ol_format_KML_.readColor_ = function(node) { +KML.readColor_ = function(node) { var s = _ol_xml_.getAllTextContent(node, false); // The KML specification states that colors should not include a leading `#` // but we tolerate them. @@ -461,7 +456,7 @@ _ol_format_KML_.readColor_ = function(node) { * @private * @return {Array.|undefined} Flat coordinates. */ -_ol_format_KML_.readFlatCoordinates_ = function(node) { +KML.readFlatCoordinates_ = function(node) { var s = _ol_xml_.getAllTextContent(node, false); var flatCoordinates = []; // The KML specification states that coordinate tuples should not include @@ -488,7 +483,7 @@ _ol_format_KML_.readFlatCoordinates_ = function(node) { * @private * @return {string} URI. */ -_ol_format_KML_.readURI_ = function(node) { +KML.readURI_ = function(node) { var s = _ol_xml_.getAllTextContent(node, false).trim(); var baseURI = node.baseURI; if (!baseURI || baseURI == 'about:blank') { @@ -508,7 +503,7 @@ _ol_format_KML_.readURI_ = function(node) { * @private * @return {ol.KMLVec2_} Vec2. */ -_ol_format_KML_.readVec2_ = function(node) { +KML.readVec2_ = function(node) { var xunits = node.getAttribute('xunits'); var yunits = node.getAttribute('yunits'); var origin; @@ -527,9 +522,9 @@ _ol_format_KML_.readVec2_ = function(node) { } return { x: parseFloat(node.getAttribute('x')), - xunits: _ol_format_KML_.ICON_ANCHOR_UNITS_MAP_[xunits], + xunits: KML.ICON_ANCHOR_UNITS_MAP_[xunits], y: parseFloat(node.getAttribute('y')), - yunits: _ol_format_KML_.ICON_ANCHOR_UNITS_MAP_[yunits], + yunits: KML.ICON_ANCHOR_UNITS_MAP_[yunits], origin: origin }; }; @@ -540,7 +535,7 @@ _ol_format_KML_.readVec2_ = function(node) { * @private * @return {number|undefined} Scale. */ -_ol_format_KML_.readScale_ = function(node) { +KML.readScale_ = function(node) { return _ol_format_XSD_.readDecimal(node); }; @@ -551,16 +546,16 @@ _ol_format_KML_.readScale_ = function(node) { * @private * @return {Array.|string|undefined} StyleMap. */ -_ol_format_KML_.readStyleMapValue_ = function(node, objectStack) { +KML.readStyleMapValue_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop(undefined, - _ol_format_KML_.STYLE_MAP_PARSERS_, node, objectStack); + KML.STYLE_MAP_PARSERS_, node, objectStack); }; /** * @param {Node} node Node. * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.IconStyleParser_ = function(node, objectStack) { +KML.IconStyleParser_ = function(node, objectStack) { // FIXME refreshMode // FIXME refreshInterval // FIXME viewRefreshTime @@ -568,7 +563,7 @@ _ol_format_KML_.IconStyleParser_ = function(node, objectStack) { // FIXME viewFormat // FIXME httpQuery var object = _ol_xml_.pushParseAndPop( - {}, _ol_format_KML_.ICON_STYLE_PARSERS_, node, objectStack); + {}, KML.ICON_STYLE_PARSERS_, node, objectStack); if (!object) { return; } @@ -581,7 +576,7 @@ _ol_format_KML_.IconStyleParser_ = function(node, objectStack) { if (href) { src = href; } else if (drawIcon) { - src = _ol_format_KML_.DEFAULT_IMAGE_STYLE_SRC_; + src = KML.DEFAULT_IMAGE_STYLE_SRC_; } var anchor, anchorXUnits, anchorYUnits; var anchorOrigin = _ol_style_IconOrigin_.BOTTOM_LEFT; @@ -592,10 +587,10 @@ _ol_format_KML_.IconStyleParser_ = function(node, objectStack) { anchorXUnits = hotSpot.xunits; anchorYUnits = hotSpot.yunits; anchorOrigin = hotSpot.origin; - } else if (src === _ol_format_KML_.DEFAULT_IMAGE_STYLE_SRC_) { - anchor = _ol_format_KML_.DEFAULT_IMAGE_STYLE_ANCHOR_; - anchorXUnits = _ol_format_KML_.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_; - anchorYUnits = _ol_format_KML_.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_; + } else if (src === KML.DEFAULT_IMAGE_STYLE_SRC_) { + anchor = KML.DEFAULT_IMAGE_STYLE_ANCHOR_; + anchorXUnits = KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_; + anchorYUnits = KML.DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS_; } else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) { anchor = [0.5, 0]; anchorXUnits = _ol_style_IconAnchorUnits_.FRACTION; @@ -631,10 +626,10 @@ _ol_format_KML_.IconStyleParser_ = function(node, objectStack) { (object['scale']); if (drawIcon) { - if (src == _ol_format_KML_.DEFAULT_IMAGE_STYLE_SRC_) { - size = _ol_format_KML_.DEFAULT_IMAGE_STYLE_SIZE_; + if (src == KML.DEFAULT_IMAGE_STYLE_SRC_) { + size = KML.DEFAULT_IMAGE_STYLE_SIZE_; if (scale === undefined) { - scale = _ol_format_KML_.DEFAULT_IMAGE_SCALE_MULTIPLIER_; + scale = KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_; } } @@ -654,7 +649,7 @@ _ol_format_KML_.IconStyleParser_ = function(node, objectStack) { styleObject['imageStyle'] = imageStyle; } else { // handle the case when we explicitly want to draw no icon. - styleObject['imageStyle'] = _ol_format_KML_.DEFAULT_NO_IMAGE_STYLE_; + styleObject['imageStyle'] = KML.DEFAULT_NO_IMAGE_STYLE_; } }; @@ -664,10 +659,10 @@ _ol_format_KML_.IconStyleParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.LabelStyleParser_ = function(node, objectStack) { +KML.LabelStyleParser_ = function(node, objectStack) { // FIXME colorMode var object = _ol_xml_.pushParseAndPop( - {}, _ol_format_KML_.LABEL_STYLE_PARSERS_, node, objectStack); + {}, KML.LABEL_STYLE_PARSERS_, node, objectStack); if (!object) { return; } @@ -675,7 +670,7 @@ _ol_format_KML_.LabelStyleParser_ = function(node, objectStack) { var textStyle = new _ol_style_Text_({ fill: new _ol_style_Fill_({ color: /** @type {ol.Color} */ - ('color' in object ? object['color'] : _ol_format_KML_.DEFAULT_COLOR_) + ('color' in object ? object['color'] : KML.DEFAULT_COLOR_) }), scale: /** @type {number|undefined} */ (object['scale']) @@ -689,21 +684,21 @@ _ol_format_KML_.LabelStyleParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.LineStyleParser_ = function(node, objectStack) { +KML.LineStyleParser_ = function(node, objectStack) { // FIXME colorMode // FIXME gx:outerColor // FIXME gx:outerWidth // FIXME gx:physicalWidth // FIXME gx:labelVisibility var object = _ol_xml_.pushParseAndPop( - {}, _ol_format_KML_.LINE_STYLE_PARSERS_, node, objectStack); + {}, KML.LINE_STYLE_PARSERS_, node, objectStack); if (!object) { return; } var styleObject = objectStack[objectStack.length - 1]; var strokeStyle = new _ol_style_Stroke_({ color: /** @type {ol.Color} */ - ('color' in object ? object['color'] : _ol_format_KML_.DEFAULT_COLOR_), + ('color' in object ? object['color'] : KML.DEFAULT_COLOR_), width: /** @type {number} */ ('width' in object ? object['width'] : 1) }); styleObject['strokeStyle'] = strokeStyle; @@ -715,17 +710,17 @@ _ol_format_KML_.LineStyleParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.PolyStyleParser_ = function(node, objectStack) { +KML.PolyStyleParser_ = function(node, objectStack) { // FIXME colorMode var object = _ol_xml_.pushParseAndPop( - {}, _ol_format_KML_.POLY_STYLE_PARSERS_, node, objectStack); + {}, KML.POLY_STYLE_PARSERS_, node, objectStack); if (!object) { return; } var styleObject = objectStack[objectStack.length - 1]; var fillStyle = new _ol_style_Fill_({ color: /** @type {ol.Color} */ - ('color' in object ? object['color'] : _ol_format_KML_.DEFAULT_COLOR_) + ('color' in object ? object['color'] : KML.DEFAULT_COLOR_) }); styleObject['fillStyle'] = fillStyle; var fill = /** @type {boolean|undefined} */ (object['fill']); @@ -746,9 +741,9 @@ _ol_format_KML_.PolyStyleParser_ = function(node, objectStack) { * @private * @return {Array.} LinearRing flat coordinates. */ -_ol_format_KML_.readFlatLinearRing_ = function(node, objectStack) { +KML.readFlatLinearRing_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop(null, - _ol_format_KML_.FLAT_LINEAR_RING_PARSERS_, node, objectStack); + KML.FLAT_LINEAR_RING_PARSERS_, node, objectStack); }; @@ -757,7 +752,7 @@ _ol_format_KML_.readFlatLinearRing_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.gxCoordParser_ = function(node, objectStack) { +KML.gxCoordParser_ = function(node, objectStack) { var gxTrackObject = /** @type {ol.KMLGxTrackObject_} */ (objectStack[objectStack.length - 1]); var flatCoordinates = gxTrackObject.flatCoordinates; @@ -782,9 +777,9 @@ _ol_format_KML_.gxCoordParser_ = function(node, objectStack) { * @private * @return {ol.geom.MultiLineString|undefined} MultiLineString. */ -_ol_format_KML_.readGxMultiTrack_ = function(node, objectStack) { +KML.readGxMultiTrack_ = function(node, objectStack) { var lineStrings = _ol_xml_.pushParseAndPop([], - _ol_format_KML_.GX_MULTITRACK_GEOMETRY_PARSERS_, node, objectStack); + KML.GX_MULTITRACK_GEOMETRY_PARSERS_, node, objectStack); if (!lineStrings) { return undefined; } @@ -800,12 +795,12 @@ _ol_format_KML_.readGxMultiTrack_ = function(node, objectStack) { * @private * @return {ol.geom.LineString|undefined} LineString. */ -_ol_format_KML_.readGxTrack_ = function(node, objectStack) { +KML.readGxTrack_ = function(node, objectStack) { var gxTrackObject = _ol_xml_.pushParseAndPop( /** @type {ol.KMLGxTrackObject_} */ ({ flatCoordinates: [], whens: [] - }), _ol_format_KML_.GX_TRACK_PARSERS_, node, objectStack); + }), KML.GX_TRACK_PARSERS_, node, objectStack); if (!gxTrackObject) { return undefined; } @@ -828,9 +823,9 @@ _ol_format_KML_.readGxTrack_ = function(node, objectStack) { * @private * @return {Object} Icon object. */ -_ol_format_KML_.readIcon_ = function(node, objectStack) { +KML.readIcon_ = function(node, objectStack) { var iconObject = _ol_xml_.pushParseAndPop( - {}, _ol_format_KML_.ICON_PARSERS_, node, objectStack); + {}, KML.ICON_PARSERS_, node, objectStack); if (iconObject) { return iconObject; } else { @@ -845,9 +840,9 @@ _ol_format_KML_.readIcon_ = function(node, objectStack) { * @private * @return {Array.} Flat coordinates. */ -_ol_format_KML_.readFlatCoordinatesFromNode_ = function(node, objectStack) { +KML.readFlatCoordinatesFromNode_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop(null, - _ol_format_KML_.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack); + KML.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack); }; @@ -857,12 +852,12 @@ _ol_format_KML_.readFlatCoordinatesFromNode_ = function(node, objectStack) { * @private * @return {ol.geom.LineString|undefined} LineString. */ -_ol_format_KML_.readLineString_ = function(node, objectStack) { +KML.readLineString_ = function(node, objectStack) { var properties = _ol_xml_.pushParseAndPop({}, - _ol_format_KML_.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, + KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, objectStack); var flatCoordinates = - _ol_format_KML_.readFlatCoordinatesFromNode_(node, objectStack); + KML.readFlatCoordinatesFromNode_(node, objectStack); if (flatCoordinates) { var lineString = new LineString(null); lineString.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates); @@ -880,12 +875,12 @@ _ol_format_KML_.readLineString_ = function(node, objectStack) { * @private * @return {ol.geom.Polygon|undefined} Polygon. */ -_ol_format_KML_.readLinearRing_ = function(node, objectStack) { +KML.readLinearRing_ = function(node, objectStack) { var properties = _ol_xml_.pushParseAndPop({}, - _ol_format_KML_.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, + KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, objectStack); var flatCoordinates = - _ol_format_KML_.readFlatCoordinatesFromNode_(node, objectStack); + KML.readFlatCoordinatesFromNode_(node, objectStack); if (flatCoordinates) { var polygon = new Polygon(null); polygon.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates, @@ -904,9 +899,9 @@ _ol_format_KML_.readLinearRing_ = function(node, objectStack) { * @private * @return {ol.geom.Geometry} Geometry. */ -_ol_format_KML_.readMultiGeometry_ = function(node, objectStack) { +KML.readMultiGeometry_ = function(node, objectStack) { var geometries = _ol_xml_.pushParseAndPop([], - _ol_format_KML_.MULTI_GEOMETRY_PARSERS_, node, objectStack); + KML.MULTI_GEOMETRY_PARSERS_, node, objectStack); if (!geometries) { return null; } @@ -938,15 +933,15 @@ _ol_format_KML_.readMultiGeometry_ = function(node, objectStack) { } multiGeometry = new MultiPoint(null); multiGeometry.setFlatCoordinates(layout, flatCoordinates); - _ol_format_KML_.setCommonGeometryProperties_(multiGeometry, geometries); + KML.setCommonGeometryProperties_(multiGeometry, geometries); } else if (type == GeometryType.LINE_STRING) { multiGeometry = new MultiLineString(null); multiGeometry.setLineStrings(geometries); - _ol_format_KML_.setCommonGeometryProperties_(multiGeometry, geometries); + KML.setCommonGeometryProperties_(multiGeometry, geometries); } else if (type == GeometryType.POLYGON) { multiGeometry = new MultiPolygon(null); multiGeometry.setPolygons(geometries); - _ol_format_KML_.setCommonGeometryProperties_(multiGeometry, geometries); + KML.setCommonGeometryProperties_(multiGeometry, geometries); } else if (type == GeometryType.GEOMETRY_COLLECTION) { multiGeometry = new GeometryCollection(geometries); } else { @@ -965,12 +960,12 @@ _ol_format_KML_.readMultiGeometry_ = function(node, objectStack) { * @private * @return {ol.geom.Point|undefined} Point. */ -_ol_format_KML_.readPoint_ = function(node, objectStack) { +KML.readPoint_ = function(node, objectStack) { var properties = _ol_xml_.pushParseAndPop({}, - _ol_format_KML_.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, + KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, objectStack); var flatCoordinates = - _ol_format_KML_.readFlatCoordinatesFromNode_(node, objectStack); + KML.readFlatCoordinatesFromNode_(node, objectStack); if (flatCoordinates) { var point = new Point(null); point.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates); @@ -988,12 +983,12 @@ _ol_format_KML_.readPoint_ = function(node, objectStack) { * @private * @return {ol.geom.Polygon|undefined} Polygon. */ -_ol_format_KML_.readPolygon_ = function(node, objectStack) { +KML.readPolygon_ = function(node, objectStack) { var properties = _ol_xml_.pushParseAndPop(/** @type {Object} */ ({}), - _ol_format_KML_.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, + KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, objectStack); var flatLinearRings = _ol_xml_.pushParseAndPop([null], - _ol_format_KML_.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack); + KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack); if (flatLinearRings && flatLinearRings[0]) { var polygon = new Polygon(null); var flatCoordinates = flatLinearRings[0]; @@ -1019,31 +1014,31 @@ _ol_format_KML_.readPolygon_ = function(node, objectStack) { * @private * @return {Array.} Style. */ -_ol_format_KML_.readStyle_ = function(node, objectStack) { +KML.readStyle_ = function(node, objectStack) { var styleObject = _ol_xml_.pushParseAndPop( - {}, _ol_format_KML_.STYLE_PARSERS_, node, objectStack); + {}, KML.STYLE_PARSERS_, node, objectStack); if (!styleObject) { return null; } var fillStyle = /** @type {ol.style.Fill} */ ('fillStyle' in styleObject ? - styleObject['fillStyle'] : _ol_format_KML_.DEFAULT_FILL_STYLE_); + styleObject['fillStyle'] : KML.DEFAULT_FILL_STYLE_); var fill = /** @type {boolean|undefined} */ (styleObject['fill']); if (fill !== undefined && !fill) { fillStyle = null; } var imageStyle = /** @type {ol.style.Image} */ ('imageStyle' in styleObject ? - styleObject['imageStyle'] : _ol_format_KML_.DEFAULT_IMAGE_STYLE_); - if (imageStyle == _ol_format_KML_.DEFAULT_NO_IMAGE_STYLE_) { + styleObject['imageStyle'] : KML.DEFAULT_IMAGE_STYLE_); + if (imageStyle == KML.DEFAULT_NO_IMAGE_STYLE_) { imageStyle = undefined; } var textStyle = /** @type {ol.style.Text} */ ('textStyle' in styleObject ? - styleObject['textStyle'] : _ol_format_KML_.DEFAULT_TEXT_STYLE_); + styleObject['textStyle'] : KML.DEFAULT_TEXT_STYLE_); var strokeStyle = /** @type {ol.style.Stroke} */ ('strokeStyle' in styleObject ? - styleObject['strokeStyle'] : _ol_format_KML_.DEFAULT_STROKE_STYLE_); + styleObject['strokeStyle'] : KML.DEFAULT_STROKE_STYLE_); var outline = /** @type {boolean|undefined} */ (styleObject['outline']); if (outline !== undefined && !outline) { @@ -1067,7 +1062,7 @@ _ol_format_KML_.readStyle_ = function(node, objectStack) { * @param {Array.} geometries List of geometries. * @private */ -_ol_format_KML_.setCommonGeometryProperties_ = function(multiGeometry, +KML.setCommonGeometryProperties_ = function(multiGeometry, geometries) { var ii = geometries.length; var extrudes = new Array(geometries.length); @@ -1101,9 +1096,9 @@ _ol_format_KML_.setCommonGeometryProperties_ = function(multiGeometry, * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.DataParser_ = function(node, objectStack) { +KML.DataParser_ = function(node, objectStack) { var name = node.getAttribute('name'); - _ol_xml_.parseNode(_ol_format_KML_.DATA_PARSERS_, node, objectStack); + _ol_xml_.parseNode(KML.DATA_PARSERS_, node, objectStack); var featureObject = /** @type {Object} */ (objectStack[objectStack.length - 1]); if (name !== null) { featureObject[name] = featureObject.value; @@ -1119,8 +1114,8 @@ _ol_format_KML_.DataParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.ExtendedDataParser_ = function(node, objectStack) { - _ol_xml_.parseNode(_ol_format_KML_.EXTENDED_DATA_PARSERS_, node, objectStack); +KML.ExtendedDataParser_ = function(node, objectStack) { + _ol_xml_.parseNode(KML.EXTENDED_DATA_PARSERS_, node, objectStack); }; /** @@ -1128,8 +1123,8 @@ _ol_format_KML_.ExtendedDataParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.RegionParser_ = function(node, objectStack) { - _ol_xml_.parseNode(_ol_format_KML_.REGION_PARSERS_, node, objectStack); +KML.RegionParser_ = function(node, objectStack) { + _ol_xml_.parseNode(KML.REGION_PARSERS_, node, objectStack); }; /** @@ -1137,9 +1132,9 @@ _ol_format_KML_.RegionParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.PairDataParser_ = function(node, objectStack) { +KML.PairDataParser_ = function(node, objectStack) { var pairObject = _ol_xml_.pushParseAndPop( - {}, _ol_format_KML_.PAIR_PARSERS_, node, objectStack); + {}, KML.PAIR_PARSERS_, node, objectStack); if (!pairObject) { return; } @@ -1165,8 +1160,8 @@ _ol_format_KML_.PairDataParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.PlacemarkStyleMapParser_ = function(node, objectStack) { - var styleMapValue = _ol_format_KML_.readStyleMapValue_(node, objectStack); +KML.PlacemarkStyleMapParser_ = function(node, objectStack) { + var styleMapValue = KML.readStyleMapValue_(node, objectStack); if (!styleMapValue) { return; } @@ -1186,8 +1181,8 @@ _ol_format_KML_.PlacemarkStyleMapParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.SchemaDataParser_ = function(node, objectStack) { - _ol_xml_.parseNode(_ol_format_KML_.SCHEMA_DATA_PARSERS_, node, objectStack); +KML.SchemaDataParser_ = function(node, objectStack) { + _ol_xml_.parseNode(KML.SCHEMA_DATA_PARSERS_, node, objectStack); }; @@ -1196,7 +1191,7 @@ _ol_format_KML_.SchemaDataParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.SimpleDataParser_ = function(node, objectStack) { +KML.SimpleDataParser_ = function(node, objectStack) { var name = node.getAttribute('name'); if (name !== null) { var data = _ol_format_XSD_.readString(node); @@ -1212,8 +1207,8 @@ _ol_format_KML_.SimpleDataParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.LatLonAltBoxParser_ = function(node, objectStack) { - var object = _ol_xml_.pushParseAndPop({}, _ol_format_KML_.LAT_LON_ALT_BOX_PARSERS_, node, objectStack); +KML.LatLonAltBoxParser_ = function(node, objectStack) { + var object = _ol_xml_.pushParseAndPop({}, KML.LAT_LON_ALT_BOX_PARSERS_, node, objectStack); if (!object) { return; } @@ -1236,8 +1231,8 @@ _ol_format_KML_.LatLonAltBoxParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.LodParser_ = function(node, objectStack) { - var object = _ol_xml_.pushParseAndPop({}, _ol_format_KML_.LOD_PARSERS_, node, objectStack); +KML.LodParser_ = function(node, objectStack) { + var object = _ol_xml_.pushParseAndPop({}, KML.LOD_PARSERS_, node, objectStack); if (!object) { return; } @@ -1254,10 +1249,10 @@ _ol_format_KML_.LodParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.innerBoundaryIsParser_ = function(node, objectStack) { +KML.innerBoundaryIsParser_ = function(node, objectStack) { /** @type {Array.|undefined} */ var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, - _ol_format_KML_.INNER_BOUNDARY_IS_PARSERS_, node, objectStack); + KML.INNER_BOUNDARY_IS_PARSERS_, node, objectStack); if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ (objectStack[objectStack.length - 1]); @@ -1271,10 +1266,10 @@ _ol_format_KML_.innerBoundaryIsParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.outerBoundaryIsParser_ = function(node, objectStack) { +KML.outerBoundaryIsParser_ = function(node, objectStack) { /** @type {Array.|undefined} */ var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, - _ol_format_KML_.OUTER_BOUNDARY_IS_PARSERS_, node, objectStack); + KML.OUTER_BOUNDARY_IS_PARSERS_, node, objectStack); if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ (objectStack[objectStack.length - 1]); @@ -1288,8 +1283,8 @@ _ol_format_KML_.outerBoundaryIsParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.LinkParser_ = function(node, objectStack) { - _ol_xml_.parseNode(_ol_format_KML_.LINK_PARSERS_, node, objectStack); +KML.LinkParser_ = function(node, objectStack) { + _ol_xml_.parseNode(KML.LINK_PARSERS_, node, objectStack); }; @@ -1298,7 +1293,7 @@ _ol_format_KML_.LinkParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.whenParser_ = function(node, objectStack) { +KML.whenParser_ = function(node, objectStack) { var gxTrackObject = /** @type {ol.KMLGxTrackObject_} */ (objectStack[objectStack.length - 1]); var whens = gxTrackObject.whens; @@ -1313,8 +1308,8 @@ _ol_format_KML_.whenParser_ = function(node, objectStack) { * @type {Object.>} * @private */ -_ol_format_KML_.DATA_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { +KML.DATA_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { 'displayName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'value': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) }); @@ -1325,10 +1320,10 @@ _ol_format_KML_.DATA_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.EXTENDED_DATA_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'Data': _ol_format_KML_.DataParser_, - 'SchemaData': _ol_format_KML_.SchemaDataParser_ +KML.EXTENDED_DATA_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Data': KML.DataParser_, + 'SchemaData': KML.SchemaDataParser_ }); @@ -1337,10 +1332,10 @@ _ol_format_KML_.EXTENDED_DATA_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.REGION_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'LatLonAltBox': _ol_format_KML_.LatLonAltBoxParser_, - 'Lod': _ol_format_KML_.LodParser_ +KML.REGION_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'LatLonAltBox': KML.LatLonAltBoxParser_, + 'Lod': KML.LodParser_ }); @@ -1349,8 +1344,8 @@ _ol_format_KML_.REGION_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.LAT_LON_ALT_BOX_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { +KML.LAT_LON_ALT_BOX_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { 'altitudeMode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'minAltitude': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'maxAltitude': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), @@ -1366,8 +1361,8 @@ _ol_format_KML_.LAT_LON_ALT_BOX_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.LOD_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { +KML.LOD_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { 'minLodPixels': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'maxLodPixels': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'minFadeExtent': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), @@ -1380,8 +1375,8 @@ _ol_format_KML_.LOD_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { +KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { 'extrude': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), 'tessellate': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), 'altitudeMode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) @@ -1393,9 +1388,9 @@ _ol_format_KML_.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.FLAT_LINEAR_RING_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'coordinates': _ol_xml_.makeReplacer(_ol_format_KML_.readFlatCoordinates_) +KML.FLAT_LINEAR_RING_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'coordinates': _ol_xml_.makeReplacer(KML.readFlatCoordinates_) }); @@ -1404,10 +1399,10 @@ _ol_format_KML_.FLAT_LINEAR_RING_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.FLAT_LINEAR_RINGS_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'innerBoundaryIs': _ol_format_KML_.innerBoundaryIsParser_, - 'outerBoundaryIs': _ol_format_KML_.outerBoundaryIsParser_ +KML.FLAT_LINEAR_RINGS_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'innerBoundaryIs': KML.innerBoundaryIsParser_, + 'outerBoundaryIs': KML.outerBoundaryIsParser_ }); @@ -1416,12 +1411,12 @@ _ol_format_KML_.FLAT_LINEAR_RINGS_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.GX_TRACK_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'when': _ol_format_KML_.whenParser_ +KML.GX_TRACK_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'when': KML.whenParser_ }, _ol_xml_.makeStructureNS( - _ol_format_KML_.GX_NAMESPACE_URIS_, { - 'coord': _ol_format_KML_.gxCoordParser_ + KML.GX_NAMESPACE_URIS_, { + 'coord': KML.gxCoordParser_ })); @@ -1430,9 +1425,9 @@ _ol_format_KML_.GX_TRACK_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.GEOMETRY_FLAT_COORDINATES_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'coordinates': _ol_xml_.makeReplacer(_ol_format_KML_.readFlatCoordinates_) +KML.GEOMETRY_FLAT_COORDINATES_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'coordinates': _ol_xml_.makeReplacer(KML.readFlatCoordinates_) }); @@ -1441,11 +1436,11 @@ _ol_format_KML_.GEOMETRY_FLAT_COORDINATES_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.ICON_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'href': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readURI_) +KML.ICON_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'href': _ol_xml_.makeObjectPropertySetter(KML.readURI_) }, _ol_xml_.makeStructureNS( - _ol_format_KML_.GX_NAMESPACE_URIS_, { + KML.GX_NAMESPACE_URIS_, { 'x': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'y': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'w': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), @@ -1458,12 +1453,12 @@ _ol_format_KML_.ICON_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.ICON_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'Icon': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readIcon_), +KML.ICON_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Icon': _ol_xml_.makeObjectPropertySetter(KML.readIcon_), 'heading': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'hotSpot': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readVec2_), - 'scale': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readScale_) + 'hotSpot': _ol_xml_.makeObjectPropertySetter(KML.readVec2_), + 'scale': _ol_xml_.makeObjectPropertySetter(KML.readScale_) }); @@ -1472,9 +1467,9 @@ _ol_format_KML_.ICON_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.INNER_BOUNDARY_IS_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'LinearRing': _ol_xml_.makeReplacer(_ol_format_KML_.readFlatLinearRing_) +KML.INNER_BOUNDARY_IS_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'LinearRing': _ol_xml_.makeReplacer(KML.readFlatLinearRing_) }); @@ -1483,10 +1478,10 @@ _ol_format_KML_.INNER_BOUNDARY_IS_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.LABEL_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'color': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readColor_), - 'scale': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readScale_) +KML.LABEL_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'color': _ol_xml_.makeObjectPropertySetter(KML.readColor_), + 'scale': _ol_xml_.makeObjectPropertySetter(KML.readScale_) }); @@ -1495,9 +1490,9 @@ _ol_format_KML_.LABEL_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.LINE_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'color': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readColor_), +KML.LINE_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'color': _ol_xml_.makeObjectPropertySetter(KML.readColor_), 'width': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal) }); @@ -1507,13 +1502,13 @@ _ol_format_KML_.LINE_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.MULTI_GEOMETRY_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'LineString': _ol_xml_.makeArrayPusher(_ol_format_KML_.readLineString_), - 'LinearRing': _ol_xml_.makeArrayPusher(_ol_format_KML_.readLinearRing_), - 'MultiGeometry': _ol_xml_.makeArrayPusher(_ol_format_KML_.readMultiGeometry_), - 'Point': _ol_xml_.makeArrayPusher(_ol_format_KML_.readPoint_), - 'Polygon': _ol_xml_.makeArrayPusher(_ol_format_KML_.readPolygon_) +KML.MULTI_GEOMETRY_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'LineString': _ol_xml_.makeArrayPusher(KML.readLineString_), + 'LinearRing': _ol_xml_.makeArrayPusher(KML.readLinearRing_), + 'MultiGeometry': _ol_xml_.makeArrayPusher(KML.readMultiGeometry_), + 'Point': _ol_xml_.makeArrayPusher(KML.readPoint_), + 'Polygon': _ol_xml_.makeArrayPusher(KML.readPolygon_) }); @@ -1522,9 +1517,9 @@ _ol_format_KML_.MULTI_GEOMETRY_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.GX_MULTITRACK_GEOMETRY_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.GX_NAMESPACE_URIS_, { - 'Track': _ol_xml_.makeArrayPusher(_ol_format_KML_.readGxTrack_) +KML.GX_MULTITRACK_GEOMETRY_PARSERS_ = _ol_xml_.makeStructureNS( + KML.GX_NAMESPACE_URIS_, { + 'Track': _ol_xml_.makeArrayPusher(KML.readGxTrack_) }); @@ -1533,11 +1528,11 @@ _ol_format_KML_.GX_MULTITRACK_GEOMETRY_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.NETWORK_LINK_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'ExtendedData': _ol_format_KML_.ExtendedDataParser_, - 'Region': _ol_format_KML_.RegionParser_, - 'Link': _ol_format_KML_.LinkParser_, +KML.NETWORK_LINK_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'ExtendedData': KML.ExtendedDataParser_, + 'Region': KML.RegionParser_, + 'Link': KML.LinkParser_, 'address': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'description': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), @@ -1552,9 +1547,9 @@ _ol_format_KML_.NETWORK_LINK_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.LINK_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'href': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readURI_) +KML.LINK_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'href': _ol_xml_.makeObjectPropertySetter(KML.readURI_) }); @@ -1563,9 +1558,9 @@ _ol_format_KML_.LINK_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.OUTER_BOUNDARY_IS_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'LinearRing': _ol_xml_.makeReplacer(_ol_format_KML_.readFlatLinearRing_) +KML.OUTER_BOUNDARY_IS_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'LinearRing': _ol_xml_.makeReplacer(KML.readFlatLinearRing_) }); @@ -1574,11 +1569,11 @@ _ol_format_KML_.OUTER_BOUNDARY_IS_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.PAIR_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'Style': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readStyle_), +KML.PAIR_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Style': _ol_xml_.makeObjectPropertySetter(KML.readStyle_), 'key': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'styleUrl': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readURI_) + 'styleUrl': _ol_xml_.makeObjectPropertySetter(KML.readURI_) }); @@ -1587,35 +1582,35 @@ _ol_format_KML_.PAIR_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.PLACEMARK_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'ExtendedData': _ol_format_KML_.ExtendedDataParser_, - 'Region': _ol_format_KML_.RegionParser_, +KML.PLACEMARK_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'ExtendedData': KML.ExtendedDataParser_, + 'Region': KML.RegionParser_, 'MultiGeometry': _ol_xml_.makeObjectPropertySetter( - _ol_format_KML_.readMultiGeometry_, 'geometry'), + KML.readMultiGeometry_, 'geometry'), 'LineString': _ol_xml_.makeObjectPropertySetter( - _ol_format_KML_.readLineString_, 'geometry'), + KML.readLineString_, 'geometry'), 'LinearRing': _ol_xml_.makeObjectPropertySetter( - _ol_format_KML_.readLinearRing_, 'geometry'), + KML.readLinearRing_, 'geometry'), 'Point': _ol_xml_.makeObjectPropertySetter( - _ol_format_KML_.readPoint_, 'geometry'), + KML.readPoint_, 'geometry'), 'Polygon': _ol_xml_.makeObjectPropertySetter( - _ol_format_KML_.readPolygon_, 'geometry'), - 'Style': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readStyle_), - 'StyleMap': _ol_format_KML_.PlacemarkStyleMapParser_, + KML.readPolygon_, 'geometry'), + 'Style': _ol_xml_.makeObjectPropertySetter(KML.readStyle_), + 'StyleMap': KML.PlacemarkStyleMapParser_, 'address': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'description': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'open': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), 'phoneNumber': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'styleUrl': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readURI_), + 'styleUrl': _ol_xml_.makeObjectPropertySetter(KML.readURI_), 'visibility': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean) }, _ol_xml_.makeStructureNS( - _ol_format_KML_.GX_NAMESPACE_URIS_, { + KML.GX_NAMESPACE_URIS_, { 'MultiTrack': _ol_xml_.makeObjectPropertySetter( - _ol_format_KML_.readGxMultiTrack_, 'geometry'), + KML.readGxMultiTrack_, 'geometry'), 'Track': _ol_xml_.makeObjectPropertySetter( - _ol_format_KML_.readGxTrack_, 'geometry') + KML.readGxTrack_, 'geometry') } )); @@ -1625,9 +1620,9 @@ _ol_format_KML_.PLACEMARK_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.POLY_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'color': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readColor_), +KML.POLY_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'color': _ol_xml_.makeObjectPropertySetter(KML.readColor_), 'fill': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), 'outline': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean) }); @@ -1638,9 +1633,9 @@ _ol_format_KML_.POLY_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.SCHEMA_DATA_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'SimpleData': _ol_format_KML_.SimpleDataParser_ +KML.SCHEMA_DATA_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'SimpleData': KML.SimpleDataParser_ }); @@ -1649,12 +1644,12 @@ _ol_format_KML_.SCHEMA_DATA_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'IconStyle': _ol_format_KML_.IconStyleParser_, - 'LabelStyle': _ol_format_KML_.LabelStyleParser_, - 'LineStyle': _ol_format_KML_.LineStyleParser_, - 'PolyStyle': _ol_format_KML_.PolyStyleParser_ +KML.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'IconStyle': KML.IconStyleParser_, + 'LabelStyle': KML.LabelStyleParser_, + 'LineStyle': KML.LineStyleParser_, + 'PolyStyle': KML.PolyStyleParser_ }); @@ -1663,9 +1658,9 @@ _ol_format_KML_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.STYLE_MAP_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'Pair': _ol_format_KML_.PairDataParser_ +KML.STYLE_MAP_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Pair': KML.PairDataParser_ }); @@ -1675,10 +1670,10 @@ _ol_format_KML_.STYLE_MAP_PARSERS_ = _ol_xml_.makeStructureNS( * @private * @return {Array.|undefined} Features. */ -_ol_format_KML_.prototype.readDocumentOrFolder_ = function(node, objectStack) { +KML.prototype.readDocumentOrFolder_ = function(node, objectStack) { // FIXME use scope somehow var parsersNS = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { + KML.NAMESPACE_URIS_, { 'Document': _ol_xml_.makeArrayExtender(this.readDocumentOrFolder_, this), 'Folder': _ol_xml_.makeArrayExtender(this.readDocumentOrFolder_, this), 'Placemark': _ol_xml_.makeArrayPusher(this.readPlacemark_, this), @@ -1701,9 +1696,9 @@ _ol_format_KML_.prototype.readDocumentOrFolder_ = function(node, objectStack) { * @private * @return {ol.Feature|undefined} Feature. */ -_ol_format_KML_.prototype.readPlacemark_ = function(node, objectStack) { +KML.prototype.readPlacemark_ = function(node, objectStack) { var object = _ol_xml_.pushParseAndPop({'geometry': null}, - _ol_format_KML_.PLACEMARK_PARSERS_, node, objectStack); + KML.PLACEMARK_PARSERS_, node, objectStack); if (!object) { return undefined; } @@ -1724,7 +1719,7 @@ _ol_format_KML_.prototype.readPlacemark_ = function(node, objectStack) { if (this.extractStyles_) { var style = object['Style']; var styleUrl = object['styleUrl']; - var styleFunction = _ol_format_KML_.createFeatureStyleFunction_( + var styleFunction = KML.createFeatureStyleFunction_( style, styleUrl, this.defaultStyle_, this.sharedStyles_, this.showPointNames_); feature.setStyle(styleFunction); @@ -1744,10 +1739,10 @@ _ol_format_KML_.prototype.readPlacemark_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.prototype.readSharedStyle_ = function(node, objectStack) { +KML.prototype.readSharedStyle_ = function(node, objectStack) { var id = node.getAttribute('id'); if (id !== null) { - var style = _ol_format_KML_.readStyle_(node, objectStack); + var style = KML.readStyle_(node, objectStack); if (style) { var styleUri; var baseURI = node.baseURI; @@ -1771,12 +1766,12 @@ _ol_format_KML_.prototype.readSharedStyle_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.prototype.readSharedStyleMap_ = function(node, objectStack) { +KML.prototype.readSharedStyleMap_ = function(node, objectStack) { var id = node.getAttribute('id'); if (id === null) { return; } - var styleMapValue = _ol_format_KML_.readStyleMapValue_(node, objectStack); + var styleMapValue = KML.readStyleMapValue_(node, objectStack); if (!styleMapValue) { return; } @@ -1806,14 +1801,14 @@ _ol_format_KML_.prototype.readSharedStyleMap_ = function(node, objectStack) { * @return {ol.Feature} Feature. * @api */ -_ol_format_KML_.prototype.readFeature; +KML.prototype.readFeature; /** * @inheritDoc */ -_ol_format_KML_.prototype.readFeatureFromNode = function(node, opt_options) { - if (!_ol_array_.includes(_ol_format_KML_.NAMESPACE_URIS_, node.namespaceURI)) { +KML.prototype.readFeatureFromNode = function(node, opt_options) { + if (!_ol_array_.includes(KML.NAMESPACE_URIS_, node.namespaceURI)) { return null; } var feature = this.readPlacemark_( @@ -1837,14 +1832,14 @@ _ol_format_KML_.prototype.readFeatureFromNode = function(node, opt_options) { * @return {Array.} Features. * @api */ -_ol_format_KML_.prototype.readFeatures; +KML.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_KML_.prototype.readFeaturesFromNode = function(node, opt_options) { - if (!_ol_array_.includes(_ol_format_KML_.NAMESPACE_URIS_, node.namespaceURI)) { +KML.prototype.readFeaturesFromNode = function(node, opt_options) { + if (!_ol_array_.includes(KML.NAMESPACE_URIS_, node.namespaceURI)) { return []; } var features; @@ -1888,7 +1883,7 @@ _ol_format_KML_.prototype.readFeaturesFromNode = function(node, opt_options) { * @return {string|undefined} Name. * @api */ -_ol_format_KML_.prototype.readName = function(source) { +KML.prototype.readName = function(source) { if (_ol_xml_.isDocument(source)) { return this.readNameFromDocument(/** @type {Document} */ (source)); } else if (_ol_xml_.isNode(source)) { @@ -1906,7 +1901,7 @@ _ol_format_KML_.prototype.readName = function(source) { * @param {Document} doc Document. * @return {string|undefined} Name. */ -_ol_format_KML_.prototype.readNameFromDocument = function(doc) { +KML.prototype.readNameFromDocument = function(doc) { var n; for (n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { @@ -1924,17 +1919,17 @@ _ol_format_KML_.prototype.readNameFromDocument = function(doc) { * @param {Node} node Node. * @return {string|undefined} Name. */ -_ol_format_KML_.prototype.readNameFromNode = function(node) { +KML.prototype.readNameFromNode = function(node) { var n; for (n = node.firstElementChild; n; n = n.nextElementSibling) { - if (_ol_array_.includes(_ol_format_KML_.NAMESPACE_URIS_, n.namespaceURI) && + if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) && n.localName == 'name') { return _ol_format_XSD_.readString(n); } } for (n = node.firstElementChild; n; n = n.nextElementSibling) { var localName = n.localName; - if (_ol_array_.includes(_ol_format_KML_.NAMESPACE_URIS_, n.namespaceURI) && + if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) && (localName == 'Document' || localName == 'Folder' || localName == 'Placemark' || @@ -1956,7 +1951,7 @@ _ol_format_KML_.prototype.readNameFromNode = function(node) { * @return {Array.} Network links. * @api */ -_ol_format_KML_.prototype.readNetworkLinks = function(source) { +KML.prototype.readNetworkLinks = function(source) { var networkLinks = []; if (_ol_xml_.isDocument(source)) { _ol_array_.extend(networkLinks, this.readNetworkLinksFromDocument( @@ -1976,7 +1971,7 @@ _ol_format_KML_.prototype.readNetworkLinks = function(source) { * @param {Document} doc Document. * @return {Array.} Network links. */ -_ol_format_KML_.prototype.readNetworkLinksFromDocument = function(doc) { +KML.prototype.readNetworkLinksFromDocument = function(doc) { var n, networkLinks = []; for (n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { @@ -1991,19 +1986,19 @@ _ol_format_KML_.prototype.readNetworkLinksFromDocument = function(doc) { * @param {Node} node Node. * @return {Array.} Network links. */ -_ol_format_KML_.prototype.readNetworkLinksFromNode = function(node) { +KML.prototype.readNetworkLinksFromNode = function(node) { var n, networkLinks = []; for (n = node.firstElementChild; n; n = n.nextElementSibling) { - if (_ol_array_.includes(_ol_format_KML_.NAMESPACE_URIS_, n.namespaceURI) && + if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) && n.localName == 'NetworkLink') { - var obj = _ol_xml_.pushParseAndPop({}, _ol_format_KML_.NETWORK_LINK_PARSERS_, + var obj = _ol_xml_.pushParseAndPop({}, KML.NETWORK_LINK_PARSERS_, n, []); networkLinks.push(obj); } } for (n = node.firstElementChild; n; n = n.nextElementSibling) { var localName = n.localName; - if (_ol_array_.includes(_ol_format_KML_.NAMESPACE_URIS_, n.namespaceURI) && + if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) && (localName == 'Document' || localName == 'Folder' || localName == 'kml')) { @@ -2021,7 +2016,7 @@ _ol_format_KML_.prototype.readNetworkLinksFromNode = function(node) { * @return {Array.} Regions. * @api */ -_ol_format_KML_.prototype.readRegion = function(source) { +KML.prototype.readRegion = function(source) { var regions = []; if (_ol_xml_.isDocument(source)) { _ol_array_.extend(regions, this.readRegionFromDocument( @@ -2041,7 +2036,7 @@ _ol_format_KML_.prototype.readRegion = function(source) { * @param {Document} doc Document. * @return {Array.} Region. */ -_ol_format_KML_.prototype.readRegionFromDocument = function(doc) { +KML.prototype.readRegionFromDocument = function(doc) { var n, regions = []; for (n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { @@ -2057,19 +2052,19 @@ _ol_format_KML_.prototype.readRegionFromDocument = function(doc) { * @return {Array.} Region. * @api */ -_ol_format_KML_.prototype.readRegionFromNode = function(node) { +KML.prototype.readRegionFromNode = function(node) { var n, regions = []; for (n = node.firstElementChild; n; n = n.nextElementSibling) { - if (_ol_array_.includes(_ol_format_KML_.NAMESPACE_URIS_, n.namespaceURI) && + if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) && n.localName == 'Region') { - var obj = _ol_xml_.pushParseAndPop({}, _ol_format_KML_.REGION_PARSERS_, + var obj = _ol_xml_.pushParseAndPop({}, KML.REGION_PARSERS_, n, []); regions.push(obj); } } for (n = node.firstElementChild; n; n = n.nextElementSibling) { var localName = n.localName; - if (_ol_array_.includes(_ol_format_KML_.NAMESPACE_URIS_, n.namespaceURI) && + if (_ol_array_.includes(KML.NAMESPACE_URIS_, n.namespaceURI) && (localName == 'Document' || localName == 'Folder' || localName == 'kml')) { @@ -2088,7 +2083,7 @@ _ol_format_KML_.prototype.readRegionFromNode = function(node) { * @return {ol.proj.Projection} Projection. * @api */ -_ol_format_KML_.prototype.readProjection; +KML.prototype.readProjection; /** @@ -2096,7 +2091,7 @@ _ol_format_KML_.prototype.readProjection; * @param {ol.Color|string} color Color. * @private */ -_ol_format_KML_.writeColorTextNode_ = function(node, color) { +KML.writeColorTextNode_ = function(node, color) { var rgba = _ol_color_.asArray(color); var opacity = (rgba.length == 4) ? rgba[3] : 1; var abgr = [opacity * 255, rgba[2], rgba[1], rgba[0]]; @@ -2115,7 +2110,7 @@ _ol_format_KML_.writeColorTextNode_ = function(node, color) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writeCoordinatesTextNode_ = function(node, coordinates, objectStack) { +KML.writeCoordinatesTextNode_ = function(node, coordinates, objectStack) { var context = objectStack[objectStack.length - 1]; var layout = context['layout']; @@ -2157,23 +2152,23 @@ _ol_format_KML_.writeCoordinatesTextNode_ = function(node, coordinates, objectSt * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writeDataNode_ = function(node, pair, objectStack) { +KML.writeDataNode_ = function(node, pair, objectStack) { node.setAttribute('name', pair.name); var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; var value = pair.value; if (typeof value == 'object') { if (value !== null && value.displayName) { - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.EXTENDEDDATA_NODE_SERIALIZERS_, + _ol_xml_.pushSerializeAndPop(context, KML.EXTENDEDDATA_NODE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, [value.displayName], objectStack, ['displayName']); } if (value !== null && value.value) { - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.EXTENDEDDATA_NODE_SERIALIZERS_, + _ol_xml_.pushSerializeAndPop(context, KML.EXTENDEDDATA_NODE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, [value.value], objectStack, ['value']); } } else { - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.EXTENDEDDATA_NODE_SERIALIZERS_, + _ol_xml_.pushSerializeAndPop(context, KML.EXTENDEDDATA_NODE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, [value], objectStack, ['value']); } }; @@ -2184,7 +2179,7 @@ _ol_format_KML_.writeDataNode_ = function(node, pair, objectStack) { * @param {string} name DisplayName. * @private */ -_ol_format_KML_.writeDataNodeName_ = function(node, name) { +KML.writeDataNodeName_ = function(node, name) { _ol_format_XSD_.writeCDATASection(node, name); }; @@ -2194,7 +2189,7 @@ _ol_format_KML_.writeDataNodeName_ = function(node, name) { * @param {string} value Value. * @private */ -_ol_format_KML_.writeDataNodeValue_ = function(node, value) { +KML.writeDataNodeValue_ = function(node, value) { _ol_format_XSD_.writeStringTextNode(node, value); }; @@ -2206,10 +2201,10 @@ _ol_format_KML_.writeDataNodeValue_ = function(node, value) { * @this {ol.format.KML} * @private */ -_ol_format_KML_.writeDocument_ = function(node, features, objectStack) { +KML.writeDocument_ = function(node, features, objectStack) { var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.DOCUMENT_SERIALIZERS_, - _ol_format_KML_.DOCUMENT_NODE_FACTORY_, features, objectStack, undefined, + _ol_xml_.pushSerializeAndPop(context, KML.DOCUMENT_SERIALIZERS_, + KML.DOCUMENT_NODE_FACTORY_, features, objectStack, undefined, this); }; @@ -2220,14 +2215,14 @@ _ol_format_KML_.writeDocument_ = function(node, features, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writeExtendedData_ = function(node, namesAndValues, objectStack) { +KML.writeExtendedData_ = function(node, namesAndValues, objectStack) { var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; var names = namesAndValues.names, values = namesAndValues.values; var length = names.length; for (var i = 0; i < length; i++) { - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.EXTENDEDDATA_NODE_SERIALIZERS_, - _ol_format_KML_.DATA_NODE_FACTORY_, [{name: names[i], value: values[i]}], objectStack); + _ol_xml_.pushSerializeAndPop(context, KML.EXTENDEDDATA_NODE_SERIALIZERS_, + KML.DATA_NODE_FACTORY_, [{name: names[i], value: values[i]}], objectStack); } }; @@ -2238,19 +2233,19 @@ _ol_format_KML_.writeExtendedData_ = function(node, namesAndValues, objectStack) * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writeIcon_ = function(node, icon, objectStack) { +KML.writeIcon_ = function(node, icon, objectStack) { var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = _ol_format_KML_.ICON_SEQUENCE_[parentNode.namespaceURI]; + var orderedKeys = KML.ICON_SEQUENCE_[parentNode.namespaceURI]; var values = _ol_xml_.makeSequence(icon, orderedKeys); _ol_xml_.pushSerializeAndPop(context, - _ol_format_KML_.ICON_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, + KML.ICON_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); orderedKeys = - _ol_format_KML_.ICON_SEQUENCE_[_ol_format_KML_.GX_NAMESPACE_URIS_[0]]; + KML.ICON_SEQUENCE_[KML.GX_NAMESPACE_URIS_[0]]; values = _ol_xml_.makeSequence(icon, orderedKeys); - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.ICON_SERIALIZERS_, - _ol_format_KML_.GX_NODE_FACTORY_, values, objectStack, orderedKeys); + _ol_xml_.pushSerializeAndPop(context, KML.ICON_SERIALIZERS_, + KML.GX_NODE_FACTORY_, values, objectStack, orderedKeys); }; @@ -2260,7 +2255,7 @@ _ol_format_KML_.writeIcon_ = function(node, icon, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writeIconStyle_ = function(node, style, objectStack) { +KML.writeIconStyle_ = function(node, style, objectStack) { var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; var properties = {}; var src = style.getSrc(); @@ -2305,9 +2300,9 @@ _ol_format_KML_.writeIconStyle_ = function(node, style, objectStack) { } var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = _ol_format_KML_.ICON_STYLE_SEQUENCE_[parentNode.namespaceURI]; + var orderedKeys = KML.ICON_STYLE_SEQUENCE_[parentNode.namespaceURI]; var values = _ol_xml_.makeSequence(properties, orderedKeys); - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.ICON_STYLE_SERIALIZERS_, + _ol_xml_.pushSerializeAndPop(context, KML.ICON_STYLE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); }; @@ -2318,7 +2313,7 @@ _ol_format_KML_.writeIconStyle_ = function(node, style, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writeLabelStyle_ = function(node, style, objectStack) { +KML.writeLabelStyle_ = function(node, style, objectStack) { var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; var properties = {}; var fill = style.getFill(); @@ -2331,9 +2326,9 @@ _ol_format_KML_.writeLabelStyle_ = function(node, style, objectStack) { } var parentNode = objectStack[objectStack.length - 1].node; var orderedKeys = - _ol_format_KML_.LABEL_STYLE_SEQUENCE_[parentNode.namespaceURI]; + KML.LABEL_STYLE_SEQUENCE_[parentNode.namespaceURI]; var values = _ol_xml_.makeSequence(properties, orderedKeys); - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.LABEL_STYLE_SERIALIZERS_, + _ol_xml_.pushSerializeAndPop(context, KML.LABEL_STYLE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); }; @@ -2344,16 +2339,16 @@ _ol_format_KML_.writeLabelStyle_ = function(node, style, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writeLineStyle_ = function(node, style, objectStack) { +KML.writeLineStyle_ = function(node, style, objectStack) { var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; var properties = { 'color': style.getColor(), 'width': style.getWidth() }; var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = _ol_format_KML_.LINE_STYLE_SEQUENCE_[parentNode.namespaceURI]; + var orderedKeys = KML.LINE_STYLE_SEQUENCE_[parentNode.namespaceURI]; var values = _ol_xml_.makeSequence(properties, orderedKeys); - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.LINE_STYLE_SERIALIZERS_, + _ol_xml_.pushSerializeAndPop(context, KML.LINE_STYLE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); }; @@ -2364,7 +2359,7 @@ _ol_format_KML_.writeLineStyle_ = function(node, style, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writeMultiGeometry_ = function(node, geometry, objectStack) { +KML.writeMultiGeometry_ = function(node, geometry, objectStack) { /** @type {ol.XmlNodeStackItem} */ var context = {node: node}; var type = geometry.getType(); @@ -2374,23 +2369,23 @@ _ol_format_KML_.writeMultiGeometry_ = function(node, geometry, objectStack) { var factory; if (type == GeometryType.GEOMETRY_COLLECTION) { geometries = /** @type {ol.geom.GeometryCollection} */ (geometry).getGeometries(); - factory = _ol_format_KML_.GEOMETRY_NODE_FACTORY_; + factory = KML.GEOMETRY_NODE_FACTORY_; } else if (type == GeometryType.MULTI_POINT) { geometries = /** @type {ol.geom.MultiPoint} */ (geometry).getPoints(); - factory = _ol_format_KML_.POINT_NODE_FACTORY_; + factory = KML.POINT_NODE_FACTORY_; } else if (type == GeometryType.MULTI_LINE_STRING) { geometries = (/** @type {ol.geom.MultiLineString} */ (geometry)).getLineStrings(); - factory = _ol_format_KML_.LINE_STRING_NODE_FACTORY_; + factory = KML.LINE_STRING_NODE_FACTORY_; } else if (type == GeometryType.MULTI_POLYGON) { geometries = (/** @type {ol.geom.MultiPolygon} */ (geometry)).getPolygons(); - factory = _ol_format_KML_.POLYGON_NODE_FACTORY_; + factory = KML.POLYGON_NODE_FACTORY_; } else { _ol_asserts_.assert(false, 39); // Unknown geometry type } _ol_xml_.pushSerializeAndPop(context, - _ol_format_KML_.MULTI_GEOMETRY_SERIALIZERS_, factory, + KML.MULTI_GEOMETRY_SERIALIZERS_, factory, geometries, objectStack); }; @@ -2401,11 +2396,11 @@ _ol_format_KML_.writeMultiGeometry_ = function(node, geometry, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writeBoundaryIs_ = function(node, linearRing, objectStack) { +KML.writeBoundaryIs_ = function(node, linearRing, objectStack) { var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; _ol_xml_.pushSerializeAndPop(context, - _ol_format_KML_.BOUNDARY_IS_SERIALIZERS_, - _ol_format_KML_.LINEAR_RING_NODE_FACTORY_, [linearRing], objectStack); + KML.BOUNDARY_IS_SERIALIZERS_, + KML.LINEAR_RING_NODE_FACTORY_, [linearRing], objectStack); }; @@ -2418,7 +2413,7 @@ _ol_format_KML_.writeBoundaryIs_ = function(node, linearRing, objectStack) { * @this {ol.format.KML} * @private */ -_ol_format_KML_.writePlacemark_ = function(node, feature, objectStack) { +KML.writePlacemark_ = function(node, feature, objectStack) { var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; // set id @@ -2440,8 +2435,8 @@ _ol_format_KML_.writePlacemark_ = function(node, feature, objectStack) { if (keys.length > 0) { var sequence = _ol_xml_.makeSequence(properties, keys); var namesAndValues = {names: keys, values: sequence}; - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.PLACEMARK_SERIALIZERS_, - _ol_format_KML_.EXTENDEDDATA_NODE_FACTORY_, [namesAndValues], objectStack); + _ol_xml_.pushSerializeAndPop(context, KML.PLACEMARK_SERIALIZERS_, + KML.EXTENDEDDATA_NODE_FACTORY_, [namesAndValues], objectStack); } var styleFunction = feature.getStyleFunction(); @@ -2461,9 +2456,9 @@ _ol_format_KML_.writePlacemark_ = function(node, feature, objectStack) { } } var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = _ol_format_KML_.PLACEMARK_SEQUENCE_[parentNode.namespaceURI]; + var orderedKeys = KML.PLACEMARK_SEQUENCE_[parentNode.namespaceURI]; var values = _ol_xml_.makeSequence(properties, orderedKeys); - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.PLACEMARK_SERIALIZERS_, + _ol_xml_.pushSerializeAndPop(context, KML.PLACEMARK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); // serialize geometry @@ -2473,8 +2468,8 @@ _ol_format_KML_.writePlacemark_ = function(node, feature, objectStack) { geometry = FeatureFormat.transformWithOptions(geometry, true, options); } - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.PLACEMARK_SERIALIZERS_, - _ol_format_KML_.GEOMETRY_NODE_FACTORY_, [geometry], objectStack); + _ol_xml_.pushSerializeAndPop(context, KML.PLACEMARK_SERIALIZERS_, + KML.GEOMETRY_NODE_FACTORY_, [geometry], objectStack); }; @@ -2484,7 +2479,7 @@ _ol_format_KML_.writePlacemark_ = function(node, feature, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writePrimitiveGeometry_ = function(node, geometry, objectStack) { +KML.writePrimitiveGeometry_ = function(node, geometry, objectStack) { var flatCoordinates = geometry.getFlatCoordinates(); var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; context['layout'] = geometry.getLayout(); @@ -2495,9 +2490,9 @@ _ol_format_KML_.writePrimitiveGeometry_ = function(node, geometry, objectStack) properties.coordinates = flatCoordinates; var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = _ol_format_KML_.PRIMITIVE_GEOMETRY_SEQUENCE_[parentNode.namespaceURI]; + var orderedKeys = KML.PRIMITIVE_GEOMETRY_SEQUENCE_[parentNode.namespaceURI]; var values = _ol_xml_.makeSequence(properties, orderedKeys); - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.PRIMITIVE_GEOMETRY_SERIALIZERS_, + _ol_xml_.pushSerializeAndPop(context, KML.PRIMITIVE_GEOMETRY_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); }; @@ -2508,19 +2503,19 @@ _ol_format_KML_.writePrimitiveGeometry_ = function(node, geometry, objectStack) * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writePolygon_ = function(node, polygon, objectStack) { +KML.writePolygon_ = function(node, polygon, objectStack) { var linearRings = polygon.getLinearRings(); var outerRing = linearRings.shift(); var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; // inner rings _ol_xml_.pushSerializeAndPop(context, - _ol_format_KML_.POLYGON_SERIALIZERS_, - _ol_format_KML_.INNER_BOUNDARY_NODE_FACTORY_, + KML.POLYGON_SERIALIZERS_, + KML.INNER_BOUNDARY_NODE_FACTORY_, linearRings, objectStack); // outer ring _ol_xml_.pushSerializeAndPop(context, - _ol_format_KML_.POLYGON_SERIALIZERS_, - _ol_format_KML_.OUTER_BOUNDARY_NODE_FACTORY_, + KML.POLYGON_SERIALIZERS_, + KML.OUTER_BOUNDARY_NODE_FACTORY_, [outerRing], objectStack); }; @@ -2531,10 +2526,10 @@ _ol_format_KML_.writePolygon_ = function(node, polygon, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writePolyStyle_ = function(node, style, objectStack) { +KML.writePolyStyle_ = function(node, style, objectStack) { var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.POLY_STYLE_SERIALIZERS_, - _ol_format_KML_.COLOR_NODE_FACTORY_, [style.getColor()], objectStack); + _ol_xml_.pushSerializeAndPop(context, KML.POLY_STYLE_SERIALIZERS_, + KML.COLOR_NODE_FACTORY_, [style.getColor()], objectStack); }; @@ -2543,7 +2538,7 @@ _ol_format_KML_.writePolyStyle_ = function(node, style, objectStack) { * @param {number|undefined} scale Scale. * @private */ -_ol_format_KML_.writeScaleTextNode_ = function(node, scale) { +KML.writeScaleTextNode_ = function(node, scale) { // the Math is to remove any excess decimals created by float arithmetic _ol_format_XSD_.writeDecimalTextNode(node, Math.round(scale * 1e6) / 1e6); @@ -2556,7 +2551,7 @@ _ol_format_KML_.writeScaleTextNode_ = function(node, scale) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_KML_.writeStyle_ = function(node, style, objectStack) { +KML.writeStyle_ = function(node, style, objectStack) { var /** @type {ol.XmlNodeStackItem} */ context = {node: node}; var properties = {}; var fillStyle = style.getFill(); @@ -2576,9 +2571,9 @@ _ol_format_KML_.writeStyle_ = function(node, style, objectStack) { properties['PolyStyle'] = fillStyle; } var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = _ol_format_KML_.STYLE_SEQUENCE_[parentNode.namespaceURI]; + var orderedKeys = KML.STYLE_SEQUENCE_[parentNode.namespaceURI]; var values = _ol_xml_.makeSequence(properties, orderedKeys); - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.STYLE_SERIALIZERS_, + _ol_xml_.pushSerializeAndPop(context, KML.STYLE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); }; @@ -2588,7 +2583,7 @@ _ol_format_KML_.writeStyle_ = function(node, style, objectStack) { * @param {ol.KMLVec2_} vec2 Vec2. * @private */ -_ol_format_KML_.writeVec2_ = function(node, vec2) { +KML.writeVec2_ = function(node, vec2) { node.setAttribute('x', vec2.x); node.setAttribute('y', vec2.y); node.setAttribute('xunits', vec2.xunits); @@ -2601,8 +2596,8 @@ _ol_format_KML_.writeVec2_ = function(node, vec2) { * @type {Object.>} * @private */ -_ol_format_KML_.KML_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, [ +KML.KML_SEQUENCE_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, [ 'Document', 'Placemark' ]); @@ -2612,10 +2607,10 @@ _ol_format_KML_.KML_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.KML_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'Document': _ol_xml_.makeChildAppender(_ol_format_KML_.writeDocument_), - 'Placemark': _ol_xml_.makeChildAppender(_ol_format_KML_.writePlacemark_) +KML.KML_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Document': _ol_xml_.makeChildAppender(KML.writeDocument_), + 'Placemark': _ol_xml_.makeChildAppender(KML.writePlacemark_) }); @@ -2624,9 +2619,9 @@ _ol_format_KML_.KML_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.DOCUMENT_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'Placemark': _ol_xml_.makeChildAppender(_ol_format_KML_.writePlacemark_) +KML.DOCUMENT_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Placemark': _ol_xml_.makeChildAppender(KML.writePlacemark_) }); @@ -2635,11 +2630,11 @@ _ol_format_KML_.DOCUMENT_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.EXTENDEDDATA_NODE_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'Data': _ol_xml_.makeChildAppender(_ol_format_KML_.writeDataNode_), - 'value': _ol_xml_.makeChildAppender(_ol_format_KML_.writeDataNodeValue_), - 'displayName': _ol_xml_.makeChildAppender(_ol_format_KML_.writeDataNodeName_) +KML.EXTENDEDDATA_NODE_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Data': _ol_xml_.makeChildAppender(KML.writeDataNode_), + 'value': _ol_xml_.makeChildAppender(KML.writeDataNodeValue_), + 'displayName': _ol_xml_.makeChildAppender(KML.writeDataNodeName_) }); @@ -2648,7 +2643,7 @@ _ol_format_KML_.EXTENDEDDATA_NODE_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.} * @private */ -_ol_format_KML_.GEOMETRY_TYPE_TO_NODENAME_ = { +KML.GEOMETRY_TYPE_TO_NODENAME_ = { 'Point': 'Point', 'LineString': 'LineString', 'LinearRing': 'LinearRing', @@ -2664,11 +2659,11 @@ _ol_format_KML_.GEOMETRY_TYPE_TO_NODENAME_ = { * @type {Object.>} * @private */ -_ol_format_KML_.ICON_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, [ +KML.ICON_SEQUENCE_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, [ 'href' ], - _ol_xml_.makeStructureNS(_ol_format_KML_.GX_NAMESPACE_URIS_, [ + _ol_xml_.makeStructureNS(KML.GX_NAMESPACE_URIS_, [ 'x', 'y', 'w', 'h' ])); @@ -2678,11 +2673,11 @@ _ol_format_KML_.ICON_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.ICON_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { +KML.ICON_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { 'href': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) }, _ol_xml_.makeStructureNS( - _ol_format_KML_.GX_NAMESPACE_URIS_, { + KML.GX_NAMESPACE_URIS_, { 'x': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), 'y': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), 'w': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), @@ -2695,8 +2690,8 @@ _ol_format_KML_.ICON_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.ICON_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, [ +KML.ICON_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, [ 'scale', 'heading', 'Icon', 'hotSpot' ]); @@ -2706,12 +2701,12 @@ _ol_format_KML_.ICON_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.ICON_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'Icon': _ol_xml_.makeChildAppender(_ol_format_KML_.writeIcon_), +KML.ICON_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Icon': _ol_xml_.makeChildAppender(KML.writeIcon_), 'heading': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'hotSpot': _ol_xml_.makeChildAppender(_ol_format_KML_.writeVec2_), - 'scale': _ol_xml_.makeChildAppender(_ol_format_KML_.writeScaleTextNode_) + 'hotSpot': _ol_xml_.makeChildAppender(KML.writeVec2_), + 'scale': _ol_xml_.makeChildAppender(KML.writeScaleTextNode_) }); @@ -2720,8 +2715,8 @@ _ol_format_KML_.ICON_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.LABEL_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, [ +KML.LABEL_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, [ 'color', 'scale' ]); @@ -2731,10 +2726,10 @@ _ol_format_KML_.LABEL_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.LABEL_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'color': _ol_xml_.makeChildAppender(_ol_format_KML_.writeColorTextNode_), - 'scale': _ol_xml_.makeChildAppender(_ol_format_KML_.writeScaleTextNode_) +KML.LABEL_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'color': _ol_xml_.makeChildAppender(KML.writeColorTextNode_), + 'scale': _ol_xml_.makeChildAppender(KML.writeScaleTextNode_) }); @@ -2743,8 +2738,8 @@ _ol_format_KML_.LABEL_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.LINE_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, [ +KML.LINE_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, [ 'color', 'width' ]); @@ -2754,9 +2749,9 @@ _ol_format_KML_.LINE_STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.LINE_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'color': _ol_xml_.makeChildAppender(_ol_format_KML_.writeColorTextNode_), +KML.LINE_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'color': _ol_xml_.makeChildAppender(KML.writeColorTextNode_), 'width': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode) }); @@ -2766,10 +2761,10 @@ _ol_format_KML_.LINE_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.BOUNDARY_IS_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { +KML.BOUNDARY_IS_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { 'LinearRing': _ol_xml_.makeChildAppender( - _ol_format_KML_.writePrimitiveGeometry_) + KML.writePrimitiveGeometry_) }); @@ -2778,15 +2773,15 @@ _ol_format_KML_.BOUNDARY_IS_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.MULTI_GEOMETRY_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { +KML.MULTI_GEOMETRY_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { 'LineString': _ol_xml_.makeChildAppender( - _ol_format_KML_.writePrimitiveGeometry_), + KML.writePrimitiveGeometry_), 'Point': _ol_xml_.makeChildAppender( - _ol_format_KML_.writePrimitiveGeometry_), - 'Polygon': _ol_xml_.makeChildAppender(_ol_format_KML_.writePolygon_), + KML.writePrimitiveGeometry_), + 'Polygon': _ol_xml_.makeChildAppender(KML.writePolygon_), 'GeometryCollection': _ol_xml_.makeChildAppender( - _ol_format_KML_.writeMultiGeometry_) + KML.writeMultiGeometry_) }); @@ -2795,8 +2790,8 @@ _ol_format_KML_.MULTI_GEOMETRY_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.PLACEMARK_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, [ +KML.PLACEMARK_SEQUENCE_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, [ 'name', 'open', 'visibility', 'address', 'phoneNumber', 'description', 'styleUrl', 'Style' ]); @@ -2807,20 +2802,20 @@ _ol_format_KML_.PLACEMARK_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.PLACEMARK_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { +KML.PLACEMARK_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { 'ExtendedData': _ol_xml_.makeChildAppender( - _ol_format_KML_.writeExtendedData_), + KML.writeExtendedData_), 'MultiGeometry': _ol_xml_.makeChildAppender( - _ol_format_KML_.writeMultiGeometry_), + KML.writeMultiGeometry_), 'LineString': _ol_xml_.makeChildAppender( - _ol_format_KML_.writePrimitiveGeometry_), + KML.writePrimitiveGeometry_), 'LinearRing': _ol_xml_.makeChildAppender( - _ol_format_KML_.writePrimitiveGeometry_), + KML.writePrimitiveGeometry_), 'Point': _ol_xml_.makeChildAppender( - _ol_format_KML_.writePrimitiveGeometry_), - 'Polygon': _ol_xml_.makeChildAppender(_ol_format_KML_.writePolygon_), - 'Style': _ol_xml_.makeChildAppender(_ol_format_KML_.writeStyle_), + KML.writePrimitiveGeometry_), + 'Polygon': _ol_xml_.makeChildAppender(KML.writePolygon_), + 'Style': _ol_xml_.makeChildAppender(KML.writeStyle_), 'address': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'description': _ol_xml_.makeChildAppender( _ol_format_XSD_.writeStringTextNode), @@ -2839,8 +2834,8 @@ _ol_format_KML_.PLACEMARK_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.PRIMITIVE_GEOMETRY_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, [ +KML.PRIMITIVE_GEOMETRY_SEQUENCE_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, [ 'extrude', 'tessellate', 'altitudeMode', 'coordinates' ]); @@ -2850,13 +2845,13 @@ _ol_format_KML_.PRIMITIVE_GEOMETRY_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.PRIMITIVE_GEOMETRY_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { +KML.PRIMITIVE_GEOMETRY_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { 'extrude': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeBooleanTextNode), 'tessellate': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeBooleanTextNode), 'altitudeMode': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'coordinates': _ol_xml_.makeChildAppender( - _ol_format_KML_.writeCoordinatesTextNode_) + KML.writeCoordinatesTextNode_) }); @@ -2865,12 +2860,12 @@ _ol_format_KML_.PRIMITIVE_GEOMETRY_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.POLYGON_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { +KML.POLYGON_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { 'outerBoundaryIs': _ol_xml_.makeChildAppender( - _ol_format_KML_.writeBoundaryIs_), + KML.writeBoundaryIs_), 'innerBoundaryIs': _ol_xml_.makeChildAppender( - _ol_format_KML_.writeBoundaryIs_) + KML.writeBoundaryIs_) }); @@ -2879,9 +2874,9 @@ _ol_format_KML_.POLYGON_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.POLY_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'color': _ol_xml_.makeChildAppender(_ol_format_KML_.writeColorTextNode_) +KML.POLY_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'color': _ol_xml_.makeChildAppender(KML.writeColorTextNode_) }); @@ -2890,8 +2885,8 @@ _ol_format_KML_.POLY_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, [ +KML.STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, [ 'IconStyle', 'LabelStyle', 'LineStyle', 'PolyStyle' ]); @@ -2901,12 +2896,12 @@ _ol_format_KML_.STYLE_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'IconStyle': _ol_xml_.makeChildAppender(_ol_format_KML_.writeIconStyle_), - 'LabelStyle': _ol_xml_.makeChildAppender(_ol_format_KML_.writeLabelStyle_), - 'LineStyle': _ol_xml_.makeChildAppender(_ol_format_KML_.writeLineStyle_), - 'PolyStyle': _ol_xml_.makeChildAppender(_ol_format_KML_.writePolyStyle_) +KML.STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'IconStyle': _ol_xml_.makeChildAppender(KML.writeIconStyle_), + 'LabelStyle': _ol_xml_.makeChildAppender(KML.writeLabelStyle_), + 'LineStyle': _ol_xml_.makeChildAppender(KML.writeLineStyle_), + 'PolyStyle': _ol_xml_.makeChildAppender(KML.writePolyStyle_) }); @@ -2918,8 +2913,8 @@ _ol_format_KML_.STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @return {Node|undefined} Node. * @private */ -_ol_format_KML_.GX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { - return _ol_xml_.createElementNS(_ol_format_KML_.GX_NAMESPACE_URIS_[0], +KML.GX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { + return _ol_xml_.createElementNS(KML.GX_NAMESPACE_URIS_[0], 'gx:' + opt_nodeName); }; @@ -2932,7 +2927,7 @@ _ol_format_KML_.GX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { * @return {Node|undefined} Node. * @private */ -_ol_format_KML_.DOCUMENT_NODE_FACTORY_ = function(value, objectStack, +KML.DOCUMENT_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var parentNode = objectStack[objectStack.length - 1].node; return _ol_xml_.createElementNS(parentNode.namespaceURI, 'Placemark'); @@ -2947,12 +2942,12 @@ _ol_format_KML_.DOCUMENT_NODE_FACTORY_ = function(value, objectStack, * @return {Node|undefined} Node. * @private */ -_ol_format_KML_.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, +KML.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { if (value) { var parentNode = objectStack[objectStack.length - 1].node; return _ol_xml_.createElementNS(parentNode.namespaceURI, - _ol_format_KML_.GEOMETRY_TYPE_TO_NODENAME_[/** @type {ol.geom.Geometry} */ (value).getType()]); + KML.GEOMETRY_TYPE_TO_NODENAME_[/** @type {ol.geom.Geometry} */ (value).getType()]); } }; @@ -2963,7 +2958,7 @@ _ol_format_KML_.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, * @type {function(*, Array.<*>, string=): (Node|undefined)} * @private */ -_ol_format_KML_.COLOR_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('color'); +KML.COLOR_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('color'); /** @@ -2972,7 +2967,7 @@ _ol_format_KML_.COLOR_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('color'); * @type {function(*, Array.<*>): (Node|undefined)} * @private */ -_ol_format_KML_.DATA_NODE_FACTORY_ = +KML.DATA_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('Data'); @@ -2982,7 +2977,7 @@ _ol_format_KML_.DATA_NODE_FACTORY_ = * @type {function(*, Array.<*>): (Node|undefined)} * @private */ -_ol_format_KML_.EXTENDEDDATA_NODE_FACTORY_ = +KML.EXTENDEDDATA_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('ExtendedData'); @@ -2992,7 +2987,7 @@ _ol_format_KML_.EXTENDEDDATA_NODE_FACTORY_ = * @type {function(*, Array.<*>, string=): (Node|undefined)} * @private */ -_ol_format_KML_.INNER_BOUNDARY_NODE_FACTORY_ = +KML.INNER_BOUNDARY_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('innerBoundaryIs'); @@ -3002,7 +2997,7 @@ _ol_format_KML_.INNER_BOUNDARY_NODE_FACTORY_ = * @type {function(*, Array.<*>, string=): (Node|undefined)} * @private */ -_ol_format_KML_.POINT_NODE_FACTORY_ = +KML.POINT_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('Point'); @@ -3012,7 +3007,7 @@ _ol_format_KML_.POINT_NODE_FACTORY_ = * @type {function(*, Array.<*>, string=): (Node|undefined)} * @private */ -_ol_format_KML_.LINE_STRING_NODE_FACTORY_ = +KML.LINE_STRING_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('LineString'); @@ -3022,7 +3017,7 @@ _ol_format_KML_.LINE_STRING_NODE_FACTORY_ = * @type {function(*, Array.<*>, string=): (Node|undefined)} * @private */ -_ol_format_KML_.LINEAR_RING_NODE_FACTORY_ = +KML.LINEAR_RING_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('LinearRing'); @@ -3032,7 +3027,7 @@ _ol_format_KML_.LINEAR_RING_NODE_FACTORY_ = * @type {function(*, Array.<*>, string=): (Node|undefined)} * @private */ -_ol_format_KML_.POLYGON_NODE_FACTORY_ = +KML.POLYGON_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('Polygon'); @@ -3042,7 +3037,7 @@ _ol_format_KML_.POLYGON_NODE_FACTORY_ = * @type {function(*, Array.<*>, string=): (Node|undefined)} * @private */ -_ol_format_KML_.OUTER_BOUNDARY_NODE_FACTORY_ = +KML.OUTER_BOUNDARY_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('outerBoundaryIs'); @@ -3056,7 +3051,7 @@ _ol_format_KML_.OUTER_BOUNDARY_NODE_FACTORY_ = * @return {string} Result. * @api */ -_ol_format_KML_.prototype.writeFeatures; +KML.prototype.writeFeatures; /** @@ -3069,16 +3064,16 @@ _ol_format_KML_.prototype.writeFeatures; * @override * @api */ -_ol_format_KML_.prototype.writeFeaturesNode = function(features, opt_options) { +KML.prototype.writeFeaturesNode = function(features, opt_options) { opt_options = this.adaptOptions(opt_options); - var kml = _ol_xml_.createElementNS(_ol_format_KML_.NAMESPACE_URIS_[4], 'kml'); + var kml = _ol_xml_.createElementNS(KML.NAMESPACE_URIS_[4], 'kml'); var xmlnsUri = 'http://www.w3.org/2000/xmlns/'; var xmlSchemaInstanceUri = 'http://www.w3.org/2001/XMLSchema-instance'; _ol_xml_.setAttributeNS(kml, xmlnsUri, 'xmlns:gx', - _ol_format_KML_.GX_NAMESPACE_URIS_[0]); + KML.GX_NAMESPACE_URIS_[0]); _ol_xml_.setAttributeNS(kml, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri); _ol_xml_.setAttributeNS(kml, xmlSchemaInstanceUri, 'xsi:schemaLocation', - _ol_format_KML_.SCHEMA_LOCATION_); + KML.SCHEMA_LOCATION_); var /** @type {ol.XmlNodeStackItem} */ context = {node: kml}; var properties = {}; @@ -3087,11 +3082,11 @@ _ol_format_KML_.prototype.writeFeaturesNode = function(features, opt_options) { } else if (features.length == 1) { properties['Placemark'] = features[0]; } - var orderedKeys = _ol_format_KML_.KML_SEQUENCE_[kml.namespaceURI]; + var orderedKeys = KML.KML_SEQUENCE_[kml.namespaceURI]; var values = _ol_xml_.makeSequence(properties, orderedKeys); - _ol_xml_.pushSerializeAndPop(context, _ol_format_KML_.KML_SERIALIZERS_, + _ol_xml_.pushSerializeAndPop(context, KML.KML_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, [opt_options], orderedKeys, this); return kml; }; -export default _ol_format_KML_; +export default KML; diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 90d871112c..b9a48642d9 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -1,7 +1,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_array_ from '../../../../src/ol/array.js'; import GeoJSON from '../../../../src/ol/format/GeoJSON.js'; -import _ol_format_KML_ from '../../../../src/ol/format/KML.js'; +import KML from '../../../../src/ol/format/KML.js'; import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js'; @@ -33,13 +33,13 @@ describe('ol.format.KML', function() { var dfltStyle = new _ol_style_Style_(); beforeEach(function() { - format = new _ol_format_KML_({ + format = new KML({ defaultStyle: [dfltStyle] }); }); it('set constant variables', function() { - expect(_ol_format_KML_.DEFAULT_STYLE_ARRAY_).to.be.an(Array); + expect(KML.DEFAULT_STYLE_ARRAY_).to.be.an(Array); }); describe('#readFeatures', function() { @@ -70,11 +70,11 @@ describe('ol.format.KML', function() { describe('without parameters', function() { beforeEach(function() { - format = new _ol_format_KML_(); + format = new KML(); }); it('set constant variables', function() { - expect(_ol_format_KML_.DEFAULT_STYLE_ARRAY_).to.be.an(Array); + expect(KML.DEFAULT_STYLE_ARRAY_).to.be.an(Array); }); describe('#readProjection', function() { @@ -1720,11 +1720,11 @@ describe('ol.format.KML', function() { expect(styleArray).to.have.length(1); var style = styleArray[0]; expect(style).to.be.an(_ol_style_Style_); - expect(style.getFill()).to.be(_ol_format_KML_.DEFAULT_FILL_STYLE_); + expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); expect(style.getFill().getColor()).to.eql([255, 255, 255, 1]); - expect(style.getImage()).to.be(_ol_format_KML_.DEFAULT_IMAGE_STYLE_); + expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); // FIXME check image style - expect(style.getStroke()).to.be(_ol_format_KML_.DEFAULT_STROKE_STYLE_); + expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); expect(style.getStroke().getColor()).to.eql([255, 255, 255, 1]); expect(style.getStroke().getWidth()).to.be(1); }); @@ -1753,8 +1753,8 @@ describe('ol.format.KML', function() { expect(styleArray).to.have.length(1); var style = styleArray[0]; expect(style).to.be.an(_ol_style_Style_); - expect(style.getFill()).to.be(_ol_format_KML_.DEFAULT_FILL_STYLE_); - expect(style.getStroke()).to.be(_ol_format_KML_.DEFAULT_STROKE_STYLE_); + expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); + expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var imageStyle = style.getImage(); expect(imageStyle).to.be.an(_ol_style_Icon_); expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://foo.png').href); @@ -1763,7 +1763,7 @@ describe('ol.format.KML', function() { expect(imageStyle.getRotation()).to.eql(0); expect(imageStyle.getSize()).to.be(null); expect(imageStyle.getScale()).to.be(1); - expect(style.getText()).to.be(_ol_format_KML_.DEFAULT_TEXT_STYLE_); + expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); expect(style.getZIndex()).to.be(undefined); }); @@ -1833,8 +1833,8 @@ describe('ol.format.KML', function() { expect(styleArray).to.have.length(1); var style = styleArray[0]; expect(style).to.be.an(_ol_style_Style_); - expect(style.getFill()).to.be(_ol_format_KML_.DEFAULT_FILL_STYLE_); - expect(style.getStroke()).to.be(_ol_format_KML_.DEFAULT_STROKE_STYLE_); + expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); + expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var imageStyle = style.getImage(); expect(imageStyle).to.be.an(_ol_style_Icon_); expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://foo.png').href); @@ -1867,7 +1867,7 @@ describe('ol.format.KML', function() { expect(imageStyle.getRotation()).to.eql(0); expect(imageStyle.getSize()).to.be(null); expect(imageStyle.getScale()).to.be(1); - expect(style.getText()).to.be(_ol_format_KML_.DEFAULT_TEXT_STYLE_); + expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); expect(style.getZIndex()).to.be(undefined); }); }); @@ -1904,8 +1904,8 @@ describe('ol.format.KML', function() { expect(styleArray).to.have.length(1); var style = styleArray[0]; expect(style).to.be.an(_ol_style_Style_); - expect(style.getFill()).to.be(_ol_format_KML_.DEFAULT_FILL_STYLE_); - expect(style.getStroke()).to.be(_ol_format_KML_.DEFAULT_STROKE_STYLE_); + expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); + expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var imageStyle = style.getImage(); imageStyle.iconImage_.size_ = [144, 192]; expect(imageStyle.getSize()).to.eql([48, 48]); @@ -1913,7 +1913,7 @@ describe('ol.format.KML', function() { expect(imageStyle.getOrigin()).to.eql([24, 108]); expect(imageStyle.getRotation()).to.eql(0); expect(imageStyle.getScale()).to.eql(3.0); - expect(style.getText()).to.be(_ol_format_KML_.DEFAULT_TEXT_STYLE_); + expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); expect(style.getZIndex()).to.be(undefined); }); @@ -1940,9 +1940,9 @@ describe('ol.format.KML', function() { expect(styleArray).to.have.length(1); var style = styleArray[0]; expect(style).to.be.an(_ol_style_Style_); - expect(style.getFill()).to.be(_ol_format_KML_.DEFAULT_FILL_STYLE_); - expect(style.getImage()).to.be(_ol_format_KML_.DEFAULT_IMAGE_STYLE_); - expect(style.getStroke()).to.be(_ol_format_KML_.DEFAULT_STROKE_STYLE_); + expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); + expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); + expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); var textStyle = style.getText(); expect(textStyle).to.be.an(_ol_style_Text_); expect(textStyle.getScale()).to.be(0.25); @@ -1975,13 +1975,13 @@ describe('ol.format.KML', function() { expect(styleArray).to.have.length(1); var style = styleArray[0]; expect(style).to.be.an(_ol_style_Style_); - expect(style.getFill()).to.be(_ol_format_KML_.DEFAULT_FILL_STYLE_); - expect(style.getImage()).to.be(_ol_format_KML_.DEFAULT_IMAGE_STYLE_); + expect(style.getFill()).to.be(KML.DEFAULT_FILL_STYLE_); + expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); expect(strokeStyle).to.be.an(_ol_style_Stroke_); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getWidth()).to.be(9); - expect(style.getText()).to.be(_ol_format_KML_.DEFAULT_TEXT_STYLE_); + expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); expect(style.getZIndex()).to.be(undefined); }); @@ -2010,9 +2010,9 @@ describe('ol.format.KML', function() { var fillStyle = style.getFill(); expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); - expect(style.getImage()).to.be(_ol_format_KML_.DEFAULT_IMAGE_STYLE_); - expect(style.getStroke()).to.be(_ol_format_KML_.DEFAULT_STROKE_STYLE_); - expect(style.getText()).to.be(_ol_format_KML_.DEFAULT_TEXT_STYLE_); + expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); + expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_); + expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); expect(style.getZIndex()).to.be(undefined); }); @@ -2047,12 +2047,12 @@ describe('ol.format.KML', function() { var fillStyle = style.getFill(); expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); - expect(style.getImage()).to.be(_ol_format_KML_.DEFAULT_IMAGE_STYLE_); + expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); expect(strokeStyle).to.be.an(_ol_style_Stroke_); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getWidth()).to.be(9); - expect(style.getText()).to.be(_ol_format_KML_.DEFAULT_TEXT_STYLE_); + expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); expect(style.getZIndex()).to.be(undefined); }); @@ -2084,12 +2084,12 @@ describe('ol.format.KML', function() { var style = styleArray[0]; expect(style).to.be.an(_ol_style_Style_); expect(style.getFill()).to.be(null); - expect(style.getImage()).to.be(_ol_format_KML_.DEFAULT_IMAGE_STYLE_); + expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); var strokeStyle = style.getStroke(); expect(strokeStyle).to.be.an(_ol_style_Stroke_); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getWidth()).to.be(9); - expect(style.getText()).to.be(_ol_format_KML_.DEFAULT_TEXT_STYLE_); + expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); expect(style.getZIndex()).to.be(undefined); }); @@ -2123,9 +2123,9 @@ describe('ol.format.KML', function() { var fillStyle = style.getFill(); expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); - expect(style.getImage()).to.be(_ol_format_KML_.DEFAULT_IMAGE_STYLE_); + expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); expect(style.getStroke()).to.be(null); - expect(style.getText()).to.be(_ol_format_KML_.DEFAULT_TEXT_STYLE_); + expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); expect(style.getZIndex()).to.be(undefined); }); @@ -2159,9 +2159,9 @@ describe('ol.format.KML', function() { var style = styleArray[0]; expect(style).to.be.an(_ol_style_Style_); expect(style.getFill()).to.be(null); - expect(style.getImage()).to.be(_ol_format_KML_.DEFAULT_IMAGE_STYLE_); + expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_); expect(style.getStroke()).to.be(null); - expect(style.getText()).to.be(_ol_format_KML_.DEFAULT_TEXT_STYLE_); + expect(style.getText()).to.be(KML.DEFAULT_TEXT_STYLE_); expect(style.getZIndex()).to.be(undefined); }); @@ -2312,7 +2312,7 @@ describe('ol.format.KML', function() { }); it('does not write styles when writeStyles option is false', function() { - format = new _ol_format_KML_({writeStyles: false}); + format = new KML({writeStyles: false}); var style = new _ol_style_Style_({ image: new _ol_style_Icon_({ src: 'http://foo.png' @@ -2547,7 +2547,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.have.length(1); var s = styleArray[0]; expect(s).to.be.an(_ol_style_Style_); - expect(s).to.be(_ol_format_KML_.DEFAULT_STYLE_); + expect(s).to.be(KML.DEFAULT_STYLE_); }); @@ -2656,7 +2656,7 @@ describe('ol.format.KML', function() { expect(styleArray).to.have.length(1); var s = styleArray[0]; expect(s).to.be.an(_ol_style_Style_); - expect(s).to.be(_ol_format_KML_.DEFAULT_STYLE_); + expect(s).to.be(KML.DEFAULT_STYLE_); }); it('can use Styles in StyleMaps before they are defined', function() { @@ -3018,7 +3018,7 @@ describe('ol.format.KML', function() { it('should ignore invalid coordinates', function() { var doc = new DOMParser().parseFromString('INVALID', 'application/xml'); var node = doc.firstChild; - expect(_ol_format_KML_.readFlatCoordinates_(node)).to.be(undefined); + expect(KML.readFlatCoordinates_(node)).to.be(undefined); }); it('should ignore Points with invalid coordinates', function() {