diff --git a/examples/box-selection.js b/examples/box-selection.js index 80140cc52a..958c565db2 100644 --- a/examples/box-selection.js +++ b/examples/box-selection.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_events_condition_ from '../src/ol/events/condition.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import DragBox from '../src/ol/interaction/DragBox.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; @@ -12,7 +12,7 @@ import _ol_source_Vector_ from '../src/ol/source/Vector.js'; var vectorSource = new _ol_source_Vector_({ url: 'data/geojson/countries.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }); diff --git a/examples/canvas-gradient-pattern.js b/examples/canvas-gradient-pattern.js index 4cdfec729f..76f22d58a7 100644 --- a/examples/canvas-gradient-pattern.js +++ b/examples/canvas-gradient-pattern.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_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_has_ from '../src/ol/has.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; @@ -84,7 +84,7 @@ var getStackedStyle = function(feature, resolution) { var vectorLayer = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/countries.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }), style: getStackedStyle }); diff --git a/examples/center.js b/examples/center.js index 36a5b1c3df..7c1c32d509 100644 --- a/examples/center.js +++ b/examples/center.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_control_ from '../src/ol/control.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; @@ -13,7 +13,7 @@ import _ol_style_Style_ from '../src/ol/style/Style.js'; var source = new _ol_source_Vector_({ url: 'data/geojson/switzerland.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }); var style = new _ol_style_Style_({ fill: new _ol_style_Fill_({ diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index 44fdd05d59..683bfa987b 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -1,10 +1,10 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GPX_ from '../src/ol/format/GPX.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; -import _ol_format_IGC_ from '../src/ol/format/IGC.js'; -import _ol_format_KML_ from '../src/ol/format/KML.js'; -import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.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 KML from '../src/ol/format/KML.js'; +import TopoJSON from '../src/ol/format/TopoJSON.js'; import _ol_interaction_ from '../src/ol/interaction.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -85,11 +85,11 @@ var styleFunction = function(feature, resolution) { var dragAndDropInteraction = new DragAndDrop({ formatConstructors: [ - _ol_format_GPX_, - _ol_format_GeoJSON_, - _ol_format_IGC_, - _ol_format_KML_, - _ol_format_TopoJSON_ + GPX, + GeoJSON, + IGC, + KML, + TopoJSON ] }); diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index 222efea03b..7b92870ef4 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -1,10 +1,10 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GPX_ from '../src/ol/format/GPX.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; -import _ol_format_IGC_ from '../src/ol/format/IGC.js'; -import _ol_format_KML_ from '../src/ol/format/KML.js'; -import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.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 KML from '../src/ol/format/KML.js'; +import TopoJSON from '../src/ol/format/TopoJSON.js'; import _ol_interaction_ from '../src/ol/interaction.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; @@ -85,11 +85,11 @@ var styleFunction = function(feature, resolution) { var dragAndDropInteraction = new DragAndDrop({ formatConstructors: [ - _ol_format_GPX_, - _ol_format_GeoJSON_, - _ol_format_IGC_, - _ol_format_KML_, - _ol_format_TopoJSON_ + GPX, + GeoJSON, + IGC, + KML, + 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/export-map.js b/examples/export-map.js index d0d9323f1e..df03f94c81 100644 --- a/examples/export-map.js +++ b/examples/export-map.js @@ -3,7 +3,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_control_ from '../src/ol/control.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; @@ -17,7 +17,7 @@ var map = new _ol_Map_({ new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/countries.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }) }) ], diff --git a/examples/export-pdf.js b/examples/export-pdf.js index 18397ef3c8..e12cf7a5ea 100644 --- a/examples/export-pdf.js +++ b/examples/export-pdf.js @@ -2,7 +2,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_control_ from '../src/ol/control.js'; -import _ol_format_WKT_ from '../src/ol/format/WKT.js'; +import WKT from '../src/ol/format/WKT.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; @@ -12,7 +12,7 @@ var raster = new _ol_layer_Tile_({ source: new _ol_source_OSM_() }); -var format = new _ol_format_WKT_(); +var format = new WKT(); var feature = format.readFeature( 'POLYGON((10.689697265625 -25.0927734375, 34.595947265625 ' + '-20.1708984375, 38.814697265625 -35.6396484375, 13.502197265625 ' + diff --git a/examples/extent-interaction.js b/examples/extent-interaction.js index b2bb3f2457..655bb9e138 100644 --- a/examples/extent-interaction.js +++ b/examples/extent-interaction.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_events_condition_ from '../src/ol/events/condition.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_interaction_Extent_ from '../src/ol/interaction/Extent.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -10,7 +10,7 @@ import _ol_source_Vector_ from '../src/ol/source/Vector.js'; var vectorSource = new _ol_source_Vector_({ url: 'data/geojson/countries.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }); var map = new _ol_Map_({ diff --git a/examples/feature-move-animation.js b/examples/feature-move-animation.js index 875d30323c..644b9425e5 100644 --- a/examples/feature-move-animation.js +++ b/examples/feature-move-animation.js @@ -1,7 +1,7 @@ import _ol_Feature_ from '../src/ol/Feature.js'; import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_Polyline_ from '../src/ol/format/Polyline.js'; +import Polyline from '../src/ol/format/Polyline.js'; import Point from '../src/ol/geom/Point.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -57,7 +57,7 @@ var polyline = [ '~@ym@yjA??a@cFd@kBrCgDbAUnAcBhAyAdk@et@??kF}D??OL' ].join(''); -var route = /** @type {ol.geom.LineString} */ (new _ol_format_Polyline_({ +var route = /** @type {ol.geom.LineString} */ (new Polyline({ factor: 1e6 }).readGeometry(polyline, { dataProjection: 'EPSG:4326', diff --git a/examples/geojson-vt.js b/examples/geojson-vt.js index 57a5f7d959..fad9a58d3c 100644 --- a/examples/geojson-vt.js +++ b/examples/geojson-vt.js @@ -1,7 +1,7 @@ // NOCOMPILE import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; @@ -75,7 +75,7 @@ fetch(url).then(function(response) { debug: 1 }); var vectorSource = new _ol_source_VectorTile_({ - format: new _ol_format_GeoJSON_(), + format: new GeoJSON(), tileLoadFunction: function(tile) { var format = tile.getFormat(); var tileCoord = tile.getTileCoord(); diff --git a/examples/geojson.js b/examples/geojson.js index e8c9db2d8f..a3d548526a 100644 --- a/examples/geojson.js +++ b/examples/geojson.js @@ -2,7 +2,7 @@ import _ol_Feature_ from '../src/ol/Feature.js'; import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_control_ from '../src/ol/control.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import Circle from '../src/ol/geom/Circle.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -161,7 +161,7 @@ var geojsonObject = { }; var vectorSource = new _ol_source_Vector_({ - features: (new _ol_format_GeoJSON_()).readFeatures(geojsonObject) + features: (new GeoJSON()).readFeatures(geojsonObject) }); vectorSource.addFeature(new _ol_Feature_(new Circle([5e6, 7e6], 1e6))); diff --git a/examples/getfeatureinfo-layers.js b/examples/getfeatureinfo-layers.js index 67458d5c72..c93c6103a3 100644 --- a/examples/getfeatureinfo-layers.js +++ b/examples/getfeatureinfo-layers.js @@ -1,21 +1,21 @@ -import _ol_format_WMSGetFeatureInfo_ from '../src/ol/format/WMSGetFeatureInfo.js'; +import WMSGetFeatureInfo from '../src/ol/format/WMSGetFeatureInfo.js'; fetch('data/wmsgetfeatureinfo/osm-restaurant-hotel.xml').then(function(response) { return response.text(); }).then(function(response) { // this is the standard way to read the features - var allFeatures = new _ol_format_WMSGetFeatureInfo_().readFeatures(response); + var allFeatures = new WMSGetFeatureInfo().readFeatures(response); document.getElementById('all').innerText = allFeatures.length.toString(); // when specifying the 'layers' options, only the features of those // layers are returned by the format - var hotelFeatures = new _ol_format_WMSGetFeatureInfo_({ + var hotelFeatures = new WMSGetFeatureInfo({ layers: ['hotel'] }).readFeatures(response); document.getElementById('hotel').innerText = hotelFeatures.length.toString(); - var restaurantFeatures = new _ol_format_WMSGetFeatureInfo_({ + var restaurantFeatures = new WMSGetFeatureInfo({ layers: ['restaurant'] }).readFeatures(response); document.getElementById('restaurant').innerText = restaurantFeatures.length.toString(); diff --git a/examples/gpx.js b/examples/gpx.js index 3d263bfd1a..c0def97c58 100644 --- a/examples/gpx.js +++ b/examples/gpx.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GPX_ from '../src/ol/format/GPX.js'; +import GPX from '../src/ol/format/GPX.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'; @@ -47,7 +47,7 @@ var style = { var vector = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/gpx/fells_loop.gpx', - format: new _ol_format_GPX_() + format: new GPX() }), style: function(feature) { return style[feature.getGeometry().getType()]; 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/igc.js b/examples/igc.js index 5ccba4d407..4b8c617f72 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -2,7 +2,7 @@ import _ol_Feature_ from '../src/ol/Feature.js'; import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_control_ from '../src/ol/control.js'; -import _ol_format_IGC_ from '../src/ol/format/IGC.js'; +import IGC from '../src/ol/format/IGC.js'; import LineString from '../src/ol/geom/LineString.js'; import Point from '../src/ol/geom/Point.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; @@ -58,7 +58,7 @@ function get(url, callback) { client.send(); } -var igcFormat = new _ol_format_IGC_(); +var igcFormat = new IGC(); for (var i = 0; i < igcUrls.length; ++i) { get(igcUrls[i], function(data) { var features = igcFormat.readFeatures(data, diff --git a/examples/image-vector-layer.js b/examples/image-vector-layer.js index 199c0fe46d..5af586662b 100644 --- a/examples/image-vector-layer.js +++ b/examples/image-vector-layer.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_Vector_ from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; @@ -26,7 +26,7 @@ var map = new _ol_Map_({ renderMode: 'image', source: new _ol_source_Vector_({ url: 'data/geojson/countries.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }), style: function(feature) { style.getText().setText(feature.get('name')); diff --git a/examples/jsts.js b/examples/jsts.js index 99a430373b..038f2e6294 100644 --- a/examples/jsts.js +++ b/examples/jsts.js @@ -2,7 +2,7 @@ // this example uses JSTS for which we don't have an externs file. import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; @@ -14,7 +14,7 @@ var source = new _ol_source_Vector_(); fetch('data/geojson/roads-seoul.geojson').then(function(response) { return response.json(); }).then(function(json) { - var format = new _ol_format_GeoJSON_(); + var format = new GeoJSON(); var features = format.readFeatures(json, {featureProjection: 'EPSG:3857'}); var parser = new jsts.io.OL3Parser(); 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/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index 03db877aaf..32eeb82390 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_MVT_ from '../src/ol/format/MVT.js'; +import MVT from '../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import {get as getProjection} from '../src/ol/proj.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; @@ -37,7 +37,7 @@ var map = new _ol_Map_({ attributions: '© Mapbox ' + '© ' + 'OpenStreetMap contributors', - format: new _ol_format_MVT_(), + format: new MVT(), tileGrid: new _ol_tilegrid_TileGrid_({ extent: getProjection('EPSG:3857').getExtent(), resolutions: resolutions, diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index 8b2e67ae64..4ce08ba421 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_MVT_ from '../src/ol/format/MVT.js'; +import MVT from '../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; @@ -20,7 +20,7 @@ var map = new _ol_Map_({ attributions: '© Mapbox ' + '© ' + 'OpenStreetMap contributors', - format: new _ol_format_MVT_(), + format: new MVT(), url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' + '{z}/{x}/{y}.vector.pbf?access_token=' + key }), diff --git a/examples/modify-features.js b/examples/modify-features.js index e8db4f57cd..d03a795b1d 100644 --- a/examples/modify-features.js +++ b/examples/modify-features.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; @@ -17,7 +17,7 @@ var raster = new _ol_layer_Tile_({ var vector = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/countries.geojson', - format: new _ol_format_GeoJSON_(), + format: new GeoJSON(), wrapX: false }) }); diff --git a/examples/modify-test.js b/examples/modify-test.js index 8553ac8fa9..a9002fa77b 100644 --- a/examples/modify-test.js +++ b/examples/modify-test.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; @@ -145,7 +145,7 @@ var geojsonObject = { }; var source = new _ol_source_Vector_({ - features: (new _ol_format_GeoJSON_()).readFeatures(geojsonObject) + features: (new GeoJSON()).readFeatures(geojsonObject) }); var layer = new _ol_layer_Vector_({ diff --git a/examples/osm-vector-tiles.js b/examples/osm-vector-tiles.js index 2d879efcef..78eec202b8 100644 --- a/examples/osm-vector-tiles.js +++ b/examples/osm-vector-tiles.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js'; +import TopoJSON from '../src/ol/format/TopoJSON.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import {fromLonLat} from '../src/ol/proj.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; @@ -64,7 +64,7 @@ var map = new _ol_Map_({ source: new _ol_source_VectorTile_({ attributions: '© OpenStreetMap contributors, Who’s On First, ' + 'Natural Earth, and openstreetmapdata.com', - format: new _ol_format_TopoJSON_({ + format: new TopoJSON({ layerName: 'layer', layers: ['water', 'roads', 'buildings'] }), diff --git a/examples/polygon-styles.js b/examples/polygon-styles.js index 80629d2423..32c1b0442f 100644 --- a/examples/polygon-styles.js +++ b/examples/polygon-styles.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import MultiPoint from '../src/ol/geom/MultiPoint.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_Vector_ from '../src/ol/source/Vector.js'; @@ -81,7 +81,7 @@ var geojsonObject = { }; var source = new _ol_source_Vector_({ - features: (new _ol_format_GeoJSON_()).readFeatures(geojsonObject) + features: (new GeoJSON()).readFeatures(geojsonObject) }); var layer = new _ol_layer_Vector_({ diff --git a/examples/select-features.js b/examples/select-features.js index c2a8a4a934..6d1a0d8039 100644 --- a/examples/select-features.js +++ b/examples/select-features.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_events_condition_ from '../src/ol/events/condition.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -15,7 +15,7 @@ var raster = new _ol_layer_Tile_({ var vector = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/countries.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }) }); diff --git a/examples/sphere-mollweide.js b/examples/sphere-mollweide.js index 13cb008b6c..c317e1f479 100644 --- a/examples/sphere-mollweide.js +++ b/examples/sphere-mollweide.js @@ -1,7 +1,7 @@ import Graticule from '../src/ol/Graticule.js'; import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; import _ol_source_Vector_ from '../src/ol/source/Vector.js'; @@ -28,7 +28,7 @@ var map = new _ol_Map_({ new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/countries-110m.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }) }) ], diff --git a/examples/street-labels.js b/examples/street-labels.js index aee202b175..acc7330bbf 100644 --- a/examples/street-labels.js +++ b/examples/street-labels.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_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.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'; @@ -30,7 +30,7 @@ var map = new _ol_Map_({ }), new _ol_layer_Vector_({ declutter: true, source: new _ol_source_Vector_({ - format: new _ol_format_GeoJSON_(), + format: new GeoJSON(), url: 'data/geojson/vienna-streets.geojson' }), style: function(feature) { diff --git a/examples/topojson.js b/examples/topojson.js index 2d302eaa4c..e38db9bbbd 100644 --- a/examples/topojson.js +++ b/examples/topojson.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js'; +import TopoJSON from '../src/ol/format/TopoJSON.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.js'; @@ -29,7 +29,7 @@ var style = new _ol_style_Style_({ var vector = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/topojson/world-110m.json', - format: new _ol_format_TopoJSON_({ + format: new TopoJSON({ // don't want to render the full world polygon (stored as 'land' layer), // which repeats all countries layers: ['countries'] diff --git a/examples/translate-features.js b/examples/translate-features.js index 54cecc4e4c..23d8d50ec9 100644 --- a/examples/translate-features.js +++ b/examples/translate-features.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Translate_ from '../src/ol/interaction/Translate.js'; @@ -17,7 +17,7 @@ var raster = new _ol_layer_Tile_({ var vector = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/countries.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }) }); diff --git a/examples/turf.js b/examples/turf.js index a4a8f59c7d..d53aa6a293 100644 --- a/examples/turf.js +++ b/examples/turf.js @@ -2,7 +2,7 @@ // this example uses turf.js for which we don't have an externs file. import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import {fromLonLat} from '../src/ol/proj.js'; @@ -14,7 +14,7 @@ var source = new _ol_source_Vector_(); fetch('data/geojson/roads-seoul.geojson').then(function(response) { return response.json(); }).then(function(json) { - var format = new _ol_format_GeoJSON_(); + var format = new GeoJSON(); var features = format.readFeatures(json); var street = features[0]; diff --git a/examples/vector-esri-edit.js b/examples/vector-esri-edit.js index 67efdf147e..8525e7272f 100644 --- a/examples/vector-esri-edit.js +++ b/examples/vector-esri-edit.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_EsriJSON_ from '../src/ol/format/EsriJSON.js'; +import EsriJSON from '../src/ol/format/EsriJSON.js'; import _ol_interaction_ from '../src/ol/interaction.js'; import Draw from '../src/ol/interaction/Draw.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; @@ -18,7 +18,7 @@ var serviceUrl = 'https://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/' + 'services/PDX_Pedestrian_Districts/FeatureServer/'; var layer = '0'; -var esrijsonFormat = new _ol_format_EsriJSON_(); +var esrijsonFormat = new EsriJSON(); var vectorSource = new _ol_source_Vector_({ loader: function(extent, resolution, projection) { diff --git a/examples/vector-esri.js b/examples/vector-esri.js index 6f92b77c10..830455b844 100644 --- a/examples/vector-esri.js +++ b/examples/vector-esri.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_EsriJSON_ from '../src/ol/format/EsriJSON.js'; +import EsriJSON from '../src/ol/format/EsriJSON.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; @@ -17,7 +17,7 @@ var serviceUrl = 'https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/' 'Petroleum/KSFields/FeatureServer/'; var layer = '0'; -var esrijsonFormat = new _ol_format_EsriJSON_(); +var esrijsonFormat = new EsriJSON(); var styleCache = { 'ABANDONED': new _ol_style_Style_({ diff --git a/examples/vector-label-decluttering.js b/examples/vector-label-decluttering.js index d7b95b515f..dc1a1c92ca 100644 --- a/examples/vector-label-decluttering.js +++ b/examples/vector-label-decluttering.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_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_Vector_ from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; @@ -61,7 +61,7 @@ var style = [countryStyle, labelStyle]; var vectorLayer = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/countries.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }), style: function(feature) { labelStyle.getText().setText(feature.get('name')); diff --git a/examples/vector-labels.js b/examples/vector-labels.js index e39e1d8630..ffe12c6d68 100644 --- a/examples/vector-labels.js +++ b/examples/vector-labels.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; @@ -143,7 +143,7 @@ function polygonStyleFunction(feature, resolution) { var vectorPolygons = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/polygon-samples.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }), style: polygonStyleFunction }); @@ -163,7 +163,7 @@ function lineStyleFunction(feature, resolution) { var vectorLines = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/line-samples.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }), style: lineStyleFunction }); @@ -184,7 +184,7 @@ function pointStyleFunction(feature, resolution) { var vectorPoints = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/point-samples.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }), style: pointStyleFunction }); diff --git a/examples/vector-layer.js b/examples/vector-layer.js index 14d340e96a..53b340a584 100644 --- a/examples/vector-layer.js +++ b/examples/vector-layer.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_Vector_ from '../src/ol/source/Vector.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js'; @@ -32,7 +32,7 @@ var style = new _ol_style_Style_({ var vectorLayer = new _ol_layer_Vector_({ source: new _ol_source_Vector_({ url: 'data/geojson/countries.geojson', - format: new _ol_format_GeoJSON_() + format: new GeoJSON() }), style: function(feature) { style.getText().setText(feature.get('name')); diff --git a/examples/vector-osm.js b/examples/vector-osm.js index 394ef3e564..3b0c2de29e 100644 --- a/examples/vector-osm.js +++ b/examples/vector-osm.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_control_ from '../src/ol/control.js'; -import _ol_format_OSMXML_ from '../src/ol/format/OSMXML.js'; +import OSMXML from '../src/ol/format/OSMXML.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; @@ -78,13 +78,13 @@ var styles = { }; var vectorSource = new _ol_source_Vector_({ - format: new _ol_format_OSMXML_(), + format: new OSMXML(), loader: function(extent, resolution, projection) { var epsg4326Extent = transformExtent(extent, projection, 'EPSG:4326'); var client = new XMLHttpRequest(); client.open('POST', 'https://overpass-api.de/api/interpreter'); client.addEventListener('load', function() { - var features = new _ol_format_OSMXML_().readFeatures(client.responseText, { + var features = new OSMXML().readFeatures(client.responseText, { featureProjection: map.getView().getProjection() }); vectorSource.addFeatures(features); diff --git a/examples/vector-tile-info.js b/examples/vector-tile-info.js index b43407df8f..c1dcaee573 100644 --- a/examples/vector-tile-info.js +++ b/examples/vector-tile-info.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_MVT_ from '../src/ol/format/MVT.js'; +import MVT from '../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; @@ -12,7 +12,7 @@ var map = new _ol_Map_({ }), layers: [new _ol_layer_VectorTile_({ source: new _ol_source_VectorTile_({ - format: new _ol_format_MVT_(), + format: new MVT(), url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf' }) })] diff --git a/examples/vector-wfs-getfeature.js b/examples/vector-wfs-getfeature.js index 3473a2fb08..88ed061556 100644 --- a/examples/vector-wfs-getfeature.js +++ b/examples/vector-wfs-getfeature.js @@ -1,8 +1,8 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_format_filter_ from '../src/ol/format/filter.js'; -import _ol_format_WFS_ from '../src/ol/format/WFS.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import WFS from '../src/ol/format/WFS.js'; +import GeoJSON from '../src/ol/format/GeoJSON.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'; @@ -40,7 +40,7 @@ var map = new _ol_Map_({ }); // generate a GetFeature request -var featureRequest = new _ol_format_WFS_().writeGetFeature({ +var featureRequest = new WFS().writeGetFeature({ srsName: 'EPSG:3857', featureNS: 'http://openstreemap.org', featurePrefix: 'osm', @@ -59,7 +59,7 @@ fetch('https://ahocevar.com/geoserver/wfs', { }).then(function(response) { return response.json(); }).then(function(json) { - var features = new _ol_format_GeoJSON_().readFeatures(json); + var features = new GeoJSON().readFeatures(json); vectorSource.addFeatures(features); map.getView().fit(vectorSource.getExtent()); }); diff --git a/examples/vector-wfs.js b/examples/vector-wfs.js index 64114664b8..8e242b28f9 100644 --- a/examples/vector-wfs.js +++ b/examples/vector-wfs.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; +import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; @@ -11,7 +11,7 @@ import _ol_style_Style_ from '../src/ol/style/Style.js'; var vectorSource = new _ol_source_Vector_({ - format: new _ol_format_GeoJSON_(), + format: new GeoJSON(), url: function(extent) { return 'https://ahocevar.com/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + diff --git a/examples/wkt.js b/examples/wkt.js index 428460b16a..d53364658d 100644 --- a/examples/wkt.js +++ b/examples/wkt.js @@ -1,6 +1,6 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; -import _ol_format_WKT_ from '../src/ol/format/WKT.js'; +import WKT from '../src/ol/format/WKT.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; @@ -14,7 +14,7 @@ var wkt = 'POLYGON((10.689 -25.092, 34.595 ' + '-20.170, 38.814 -35.639, 13.502 ' + '-39.155, 10.689 -25.092))'; -var format = new _ol_format_WKT_(); +var format = new WKT(); var feature = format.readFeature(wkt, { dataProjection: 'EPSG:4326', diff --git a/examples/wms-capabilities.js b/examples/wms-capabilities.js index 5b673fe42e..53ab1cafc8 100644 --- a/examples/wms-capabilities.js +++ b/examples/wms-capabilities.js @@ -1,6 +1,6 @@ -import _ol_format_WMSCapabilities_ from '../src/ol/format/WMSCapabilities.js'; +import WMSCapabilities from '../src/ol/format/WMSCapabilities.js'; -var parser = new _ol_format_WMSCapabilities_(); +var parser = new WMSCapabilities(); fetch('data/ogcsample.xml').then(function(response) { return response.text(); diff --git a/src/ol/format/EsriJSON.js b/src/ol/format/EsriJSON.js index 2c2ae83e76..f91049d7fb 100644 --- a/src/ol/format/EsriJSON.js +++ b/src/ol/format/EsriJSON.js @@ -5,8 +5,8 @@ import {inherits} from '../index.js'; import _ol_Feature_ from '../Feature.js'; import _ol_asserts_ from '../asserts.js'; import {containsExtent} from '../extent.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_JSONFeature_ from '../format/JSONFeature.js'; +import FeatureFormat from '../format/Feature.js'; +import JSONFeature from '../format/JSONFeature.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryType from '../geom/GeometryType.js'; import LineString from '../geom/LineString.js'; @@ -30,11 +30,11 @@ import {get as getProjection} from '../proj.js'; * @param {olx.format.EsriJSONOptions=} opt_options Options. * @api */ -var _ol_format_EsriJSON_ = function(opt_options) { +var EsriJSON = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_format_JSONFeature_.call(this); + JSONFeature.call(this); /** * Name of the geometry attribute for features. @@ -45,7 +45,7 @@ var _ol_format_EsriJSON_ = function(opt_options) { }; -inherits(_ol_format_EsriJSON_, _ol_format_JSONFeature_); +inherits(EsriJSON, JSONFeature); /** @@ -54,7 +54,7 @@ inherits(_ol_format_EsriJSON_, _ol_format_JSONFeature_); * @private * @return {ol.geom.Geometry} Geometry. */ -_ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) { +EsriJSON.readGeometry_ = function(object, opt_options) { if (!object) { return null; } @@ -71,8 +71,8 @@ _ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) { type = GeometryType.MULTI_LINE_STRING; } } else if (object.rings) { - var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); - var rings = _ol_format_EsriJSON_.convertRings_(object.rings, layout); + var layout = EsriJSON.getGeometryLayout_(object); + var rings = EsriJSON.convertRings_(object.rings, layout); object = /** @type {EsriJSONGeometry} */(_ol_obj_.assign({}, object)); if (rings.length === 1) { type = GeometryType.POLYGON; @@ -82,9 +82,9 @@ _ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) { object.rings = rings; } } - var geometryReader = _ol_format_EsriJSON_.GEOMETRY_READERS_[type]; + var geometryReader = EsriJSON.GEOMETRY_READERS_[type]; return ( - /** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions( + /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions( geometryReader(object), false, opt_options) ); }; @@ -100,7 +100,7 @@ _ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) { * @private * @return {Array.>>} Transformed rings. */ -_ol_format_EsriJSON_.convertRings_ = function(rings, layout) { +EsriJSON.convertRings_ = function(rings, layout) { var flatRing = []; var outerRings = []; var holes = []; @@ -149,7 +149,7 @@ _ol_format_EsriJSON_.convertRings_ = function(rings, layout) { * @private * @return {ol.geom.Geometry} Point. */ -_ol_format_EsriJSON_.readPointGeometry_ = function(object) { +EsriJSON.readPointGeometry_ = function(object) { var point; if (object.m !== undefined && object.z !== undefined) { point = new Point([object.x, object.y, object.z, object.m], @@ -172,8 +172,8 @@ _ol_format_EsriJSON_.readPointGeometry_ = function(object) { * @private * @return {ol.geom.Geometry} LineString. */ -_ol_format_EsriJSON_.readLineStringGeometry_ = function(object) { - var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); +EsriJSON.readLineStringGeometry_ = function(object) { + var layout = EsriJSON.getGeometryLayout_(object); return new LineString(object.paths[0], layout); }; @@ -183,8 +183,8 @@ _ol_format_EsriJSON_.readLineStringGeometry_ = function(object) { * @private * @return {ol.geom.Geometry} MultiLineString. */ -_ol_format_EsriJSON_.readMultiLineStringGeometry_ = function(object) { - var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); +EsriJSON.readMultiLineStringGeometry_ = function(object) { + var layout = EsriJSON.getGeometryLayout_(object); return new MultiLineString(object.paths, layout); }; @@ -194,7 +194,7 @@ _ol_format_EsriJSON_.readMultiLineStringGeometry_ = function(object) { * @private * @return {ol.geom.GeometryLayout} The geometry layout to use. */ -_ol_format_EsriJSON_.getGeometryLayout_ = function(object) { +EsriJSON.getGeometryLayout_ = function(object) { var layout = GeometryLayout.XY; if (object.hasZ === true && object.hasM === true) { layout = GeometryLayout.XYZM; @@ -212,8 +212,8 @@ _ol_format_EsriJSON_.getGeometryLayout_ = function(object) { * @private * @return {ol.geom.Geometry} MultiPoint. */ -_ol_format_EsriJSON_.readMultiPointGeometry_ = function(object) { - var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); +EsriJSON.readMultiPointGeometry_ = function(object) { + var layout = EsriJSON.getGeometryLayout_(object); return new MultiPoint(object.points, layout); }; @@ -223,8 +223,8 @@ _ol_format_EsriJSON_.readMultiPointGeometry_ = function(object) { * @private * @return {ol.geom.Geometry} MultiPolygon. */ -_ol_format_EsriJSON_.readMultiPolygonGeometry_ = function(object) { - var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); +EsriJSON.readMultiPolygonGeometry_ = function(object) { + var layout = EsriJSON.getGeometryLayout_(object); return new MultiPolygon( /** @type {Array.>>>} */(object.rings), layout); @@ -236,8 +236,8 @@ _ol_format_EsriJSON_.readMultiPolygonGeometry_ = function(object) { * @private * @return {ol.geom.Geometry} Polygon. */ -_ol_format_EsriJSON_.readPolygonGeometry_ = function(object) { - var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); +EsriJSON.readPolygonGeometry_ = function(object) { + var layout = EsriJSON.getGeometryLayout_(object); return new Polygon(object.rings, layout); }; @@ -248,7 +248,7 @@ _ol_format_EsriJSON_.readPolygonGeometry_ = function(object) { * @private * @return {EsriJSONGeometry} EsriJSON geometry. */ -_ol_format_EsriJSON_.writePointGeometry_ = function(geometry, opt_options) { +EsriJSON.writePointGeometry_ = function(geometry, opt_options) { var coordinates = /** @type {ol.geom.Point} */ (geometry).getCoordinates(); var esriJSON; var layout = /** @type {ol.geom.Point} */ (geometry).getLayout(); @@ -288,7 +288,7 @@ _ol_format_EsriJSON_.writePointGeometry_ = function(geometry, opt_options) { * @private * @return {Object} Object with boolean hasZ and hasM keys. */ -_ol_format_EsriJSON_.getHasZM_ = function(geometry) { +EsriJSON.getHasZM_ = function(geometry) { var layout = geometry.getLayout(); return { hasZ: (layout === GeometryLayout.XYZ || @@ -305,8 +305,8 @@ _ol_format_EsriJSON_.getHasZM_ = function(geometry) { * @private * @return {EsriJSONPolyline} EsriJSON geometry. */ -_ol_format_EsriJSON_.writeLineStringGeometry_ = function(geometry, opt_options) { - var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.LineString} */(geometry)); +EsriJSON.writeLineStringGeometry_ = function(geometry, opt_options) { + var hasZM = EsriJSON.getHasZM_(/** @type {ol.geom.LineString} */(geometry)); return /** @type {EsriJSONPolyline} */ ({ hasZ: hasZM.hasZ, hasM: hasZM.hasM, @@ -323,9 +323,9 @@ _ol_format_EsriJSON_.writeLineStringGeometry_ = function(geometry, opt_options) * @private * @return {EsriJSONPolygon} EsriJSON geometry. */ -_ol_format_EsriJSON_.writePolygonGeometry_ = function(geometry, opt_options) { +EsriJSON.writePolygonGeometry_ = function(geometry, opt_options) { // Esri geometries use the left-hand rule - var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.Polygon} */(geometry)); + var hasZM = EsriJSON.getHasZM_(/** @type {ol.geom.Polygon} */(geometry)); return /** @type {EsriJSONPolygon} */ ({ hasZ: hasZM.hasZ, hasM: hasZM.hasM, @@ -340,8 +340,8 @@ _ol_format_EsriJSON_.writePolygonGeometry_ = function(geometry, opt_options) { * @private * @return {EsriJSONPolyline} EsriJSON geometry. */ -_ol_format_EsriJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_options) { - var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiLineString} */(geometry)); +EsriJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options) { + var hasZM = EsriJSON.getHasZM_(/** @type {ol.geom.MultiLineString} */(geometry)); return /** @type {EsriJSONPolyline} */ ({ hasZ: hasZM.hasZ, hasM: hasZM.hasM, @@ -356,8 +356,8 @@ _ol_format_EsriJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_opti * @private * @return {EsriJSONMultipoint} EsriJSON geometry. */ -_ol_format_EsriJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) { - var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiPoint} */(geometry)); +EsriJSON.writeMultiPointGeometry_ = function(geometry, opt_options) { + var hasZM = EsriJSON.getHasZM_(/** @type {ol.geom.MultiPoint} */(geometry)); return /** @type {EsriJSONMultipoint} */ ({ hasZ: hasZM.hasZ, hasM: hasZM.hasM, @@ -372,9 +372,9 @@ _ol_format_EsriJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) * @private * @return {EsriJSONPolygon} EsriJSON geometry. */ -_ol_format_EsriJSON_.writeMultiPolygonGeometry_ = function(geometry, +EsriJSON.writeMultiPolygonGeometry_ = function(geometry, opt_options) { - var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiPolygon} */(geometry)); + var hasZM = EsriJSON.getHasZM_(/** @type {ol.geom.MultiPolygon} */(geometry)); var coordinates = /** @type {ol.geom.MultiPolygon} */ (geometry).getCoordinates(false); var output = []; for (var i = 0; i < coordinates.length; i++) { @@ -395,19 +395,19 @@ _ol_format_EsriJSON_.writeMultiPolygonGeometry_ = function(geometry, * @private * @type {Object.} */ -_ol_format_EsriJSON_.GEOMETRY_READERS_ = {}; -_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.POINT] = - _ol_format_EsriJSON_.readPointGeometry_; -_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.LINE_STRING] = - _ol_format_EsriJSON_.readLineStringGeometry_; -_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.POLYGON] = - _ol_format_EsriJSON_.readPolygonGeometry_; -_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_POINT] = - _ol_format_EsriJSON_.readMultiPointGeometry_; -_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_LINE_STRING] = - _ol_format_EsriJSON_.readMultiLineStringGeometry_; -_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_POLYGON] = - _ol_format_EsriJSON_.readMultiPolygonGeometry_; +EsriJSON.GEOMETRY_READERS_ = {}; +EsriJSON.GEOMETRY_READERS_[GeometryType.POINT] = + EsriJSON.readPointGeometry_; +EsriJSON.GEOMETRY_READERS_[GeometryType.LINE_STRING] = + EsriJSON.readLineStringGeometry_; +EsriJSON.GEOMETRY_READERS_[GeometryType.POLYGON] = + EsriJSON.readPolygonGeometry_; +EsriJSON.GEOMETRY_READERS_[GeometryType.MULTI_POINT] = + EsriJSON.readMultiPointGeometry_; +EsriJSON.GEOMETRY_READERS_[GeometryType.MULTI_LINE_STRING] = + EsriJSON.readMultiLineStringGeometry_; +EsriJSON.GEOMETRY_READERS_[GeometryType.MULTI_POLYGON] = + EsriJSON.readMultiPolygonGeometry_; /** @@ -415,19 +415,19 @@ _ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_POLYGON] = * @private * @type {Object.} */ -_ol_format_EsriJSON_.GEOMETRY_WRITERS_ = {}; -_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.POINT] = - _ol_format_EsriJSON_.writePointGeometry_; -_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.LINE_STRING] = - _ol_format_EsriJSON_.writeLineStringGeometry_; -_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.POLYGON] = - _ol_format_EsriJSON_.writePolygonGeometry_; -_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_POINT] = - _ol_format_EsriJSON_.writeMultiPointGeometry_; -_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_LINE_STRING] = - _ol_format_EsriJSON_.writeMultiLineStringGeometry_; -_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_POLYGON] = - _ol_format_EsriJSON_.writeMultiPolygonGeometry_; +EsriJSON.GEOMETRY_WRITERS_ = {}; +EsriJSON.GEOMETRY_WRITERS_[GeometryType.POINT] = + EsriJSON.writePointGeometry_; +EsriJSON.GEOMETRY_WRITERS_[GeometryType.LINE_STRING] = + EsriJSON.writeLineStringGeometry_; +EsriJSON.GEOMETRY_WRITERS_[GeometryType.POLYGON] = + EsriJSON.writePolygonGeometry_; +EsriJSON.GEOMETRY_WRITERS_[GeometryType.MULTI_POINT] = + EsriJSON.writeMultiPointGeometry_; +EsriJSON.GEOMETRY_WRITERS_[GeometryType.MULTI_LINE_STRING] = + EsriJSON.writeMultiLineStringGeometry_; +EsriJSON.GEOMETRY_WRITERS_[GeometryType.MULTI_POLYGON] = + EsriJSON.writeMultiPolygonGeometry_; /** @@ -440,7 +440,7 @@ _ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_POLYGON] = * @return {ol.Feature} Feature. * @api */ -_ol_format_EsriJSON_.prototype.readFeature; +EsriJSON.prototype.readFeature; /** @@ -453,16 +453,16 @@ _ol_format_EsriJSON_.prototype.readFeature; * @return {Array.} Features. * @api */ -_ol_format_EsriJSON_.prototype.readFeatures; +EsriJSON.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_EsriJSON_.prototype.readFeatureFromObject = function( +EsriJSON.prototype.readFeatureFromObject = function( object, opt_options) { var esriJSONFeature = /** @type {EsriJSONFeature} */ (object); - var geometry = _ol_format_EsriJSON_.readGeometry_(esriJSONFeature.geometry, + var geometry = EsriJSON.readGeometry_(esriJSONFeature.geometry, opt_options); var feature = new _ol_Feature_(); if (this.geometryName_) { @@ -484,7 +484,7 @@ _ol_format_EsriJSON_.prototype.readFeatureFromObject = function( /** * @inheritDoc */ -_ol_format_EsriJSON_.prototype.readFeaturesFromObject = function( +EsriJSON.prototype.readFeaturesFromObject = function( object, opt_options) { var esriJSONObject = /** @type {EsriJSONObject} */ (object); var options = opt_options ? opt_options : {}; @@ -516,15 +516,15 @@ _ol_format_EsriJSON_.prototype.readFeaturesFromObject = function( * @return {ol.geom.Geometry} Geometry. * @api */ -_ol_format_EsriJSON_.prototype.readGeometry; +EsriJSON.prototype.readGeometry; /** * @inheritDoc */ -_ol_format_EsriJSON_.prototype.readGeometryFromObject = function( +EsriJSON.prototype.readGeometryFromObject = function( object, opt_options) { - return _ol_format_EsriJSON_.readGeometry_( + return EsriJSON.readGeometry_( /** @type {EsriJSONGeometry} */(object), opt_options); }; @@ -537,13 +537,13 @@ _ol_format_EsriJSON_.prototype.readGeometryFromObject = function( * @return {ol.proj.Projection} Projection. * @api */ -_ol_format_EsriJSON_.prototype.readProjection; +EsriJSON.prototype.readProjection; /** * @inheritDoc */ -_ol_format_EsriJSON_.prototype.readProjectionFromObject = function(object) { +EsriJSON.prototype.readProjectionFromObject = function(object) { var esriJSONObject = /** @type {EsriJSONObject} */ (object); if (esriJSONObject.spatialReference && esriJSONObject.spatialReference.wkid) { var crs = esriJSONObject.spatialReference.wkid; @@ -560,10 +560,10 @@ _ol_format_EsriJSON_.prototype.readProjectionFromObject = function(object) { * @private * @return {EsriJSONGeometry} EsriJSON geometry. */ -_ol_format_EsriJSON_.writeGeometry_ = function(geometry, opt_options) { - var geometryWriter = _ol_format_EsriJSON_.GEOMETRY_WRITERS_[geometry.getType()]; +EsriJSON.writeGeometry_ = function(geometry, opt_options) { + var geometryWriter = EsriJSON.GEOMETRY_WRITERS_[geometry.getType()]; return geometryWriter(/** @type {ol.geom.Geometry} */( - _ol_format_Feature_.transformWithOptions(geometry, true, opt_options)), + FeatureFormat.transformWithOptions(geometry, true, opt_options)), opt_options); }; @@ -577,7 +577,7 @@ _ol_format_EsriJSON_.writeGeometry_ = function(geometry, opt_options) { * @return {string} EsriJSON. * @api */ -_ol_format_EsriJSON_.prototype.writeGeometry; +EsriJSON.prototype.writeGeometry; /** @@ -589,9 +589,9 @@ _ol_format_EsriJSON_.prototype.writeGeometry; * @override * @api */ -_ol_format_EsriJSON_.prototype.writeGeometryObject = function(geometry, +EsriJSON.prototype.writeGeometryObject = function(geometry, opt_options) { - return _ol_format_EsriJSON_.writeGeometry_(geometry, + return EsriJSON.writeGeometry_(geometry, this.adaptOptions(opt_options)); }; @@ -605,7 +605,7 @@ _ol_format_EsriJSON_.prototype.writeGeometryObject = function(geometry, * @return {string} EsriJSON. * @api */ -_ol_format_EsriJSON_.prototype.writeFeature; +EsriJSON.prototype.writeFeature; /** @@ -617,14 +617,14 @@ _ol_format_EsriJSON_.prototype.writeFeature; * @override * @api */ -_ol_format_EsriJSON_.prototype.writeFeatureObject = function( +EsriJSON.prototype.writeFeatureObject = function( feature, opt_options) { opt_options = this.adaptOptions(opt_options); var object = {}; var geometry = feature.getGeometry(); if (geometry) { object['geometry'] = - _ol_format_EsriJSON_.writeGeometry_(geometry, opt_options); + EsriJSON.writeGeometry_(geometry, opt_options); if (opt_options && opt_options.featureProjection) { object['geometry']['spatialReference'] = /** @type {EsriJSONCRS} */({ wkid: getProjection(opt_options.featureProjection).getCode().split(':').pop() @@ -651,7 +651,7 @@ _ol_format_EsriJSON_.prototype.writeFeatureObject = function( * @return {string} EsriJSON. * @api */ -_ol_format_EsriJSON_.prototype.writeFeatures; +EsriJSON.prototype.writeFeatures; /** @@ -663,7 +663,7 @@ _ol_format_EsriJSON_.prototype.writeFeatures; * @override * @api */ -_ol_format_EsriJSON_.prototype.writeFeaturesObject = function(features, opt_options) { +EsriJSON.prototype.writeFeaturesObject = function(features, opt_options) { opt_options = this.adaptOptions(opt_options); var objects = []; var i, ii; @@ -674,4 +674,4 @@ _ol_format_EsriJSON_.prototype.writeFeaturesObject = function(features, opt_opti 'features': objects }); }; -export default _ol_format_EsriJSON_; +export default EsriJSON; diff --git a/src/ol/format/Feature.js b/src/ol/format/Feature.js index baaf9a1f3b..8bdd170b00 100644 --- a/src/ol/format/Feature.js +++ b/src/ol/format/Feature.js @@ -18,7 +18,7 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten * @abstract * @api */ -var _ol_format_Feature_ = function() { +var FeatureFormat = function() { /** * @protected @@ -42,7 +42,7 @@ var _ol_format_Feature_ = function() { * @return {olx.format.ReadOptions|undefined} Options. * @protected */ -_ol_format_Feature_.prototype.getReadOptions = function(source, opt_options) { +FeatureFormat.prototype.getReadOptions = function(source, opt_options) { var options; if (opt_options) { options = { @@ -64,7 +64,7 @@ _ol_format_Feature_.prototype.getReadOptions = function(source, opt_options) { * @return {olx.format.WriteOptions|olx.format.ReadOptions|undefined} * Updated options. */ -_ol_format_Feature_.prototype.adaptOptions = function(options) { +FeatureFormat.prototype.adaptOptions = function(options) { return _ol_obj_.assign({ dataProjection: this.defaultDataProjection, featureProjection: this.defaultFeatureProjection @@ -76,7 +76,7 @@ _ol_format_Feature_.prototype.adaptOptions = function(options) { * Get the extent from the source of the last {@link readFeatures} call. * @return {ol.Extent} Tile extent. */ -_ol_format_Feature_.prototype.getLastExtent = function() { +FeatureFormat.prototype.getLastExtent = function() { return null; }; @@ -85,7 +85,7 @@ _ol_format_Feature_.prototype.getLastExtent = function() { * @abstract * @return {ol.format.FormatType} Format. */ -_ol_format_Feature_.prototype.getType = function() {}; +FeatureFormat.prototype.getType = function() {}; /** @@ -96,7 +96,7 @@ _ol_format_Feature_.prototype.getType = function() {}; * @param {olx.format.ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. */ -_ol_format_Feature_.prototype.readFeature = function(source, opt_options) {}; +FeatureFormat.prototype.readFeature = function(source, opt_options) {}; /** @@ -107,7 +107,7 @@ _ol_format_Feature_.prototype.readFeature = function(source, opt_options) {}; * @param {olx.format.ReadOptions=} opt_options Read options. * @return {Array.} Features. */ -_ol_format_Feature_.prototype.readFeatures = function(source, opt_options) {}; +FeatureFormat.prototype.readFeatures = function(source, opt_options) {}; /** @@ -118,7 +118,7 @@ _ol_format_Feature_.prototype.readFeatures = function(source, opt_options) {}; * @param {olx.format.ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. */ -_ol_format_Feature_.prototype.readGeometry = function(source, opt_options) {}; +FeatureFormat.prototype.readGeometry = function(source, opt_options) {}; /** @@ -128,7 +128,7 @@ _ol_format_Feature_.prototype.readGeometry = function(source, opt_options) {}; * @param {Document|Node|Object|string} source Source. * @return {ol.proj.Projection} Projection. */ -_ol_format_Feature_.prototype.readProjection = function(source) {}; +FeatureFormat.prototype.readProjection = function(source) {}; /** @@ -139,7 +139,7 @@ _ol_format_Feature_.prototype.readProjection = function(source) {}; * @param {olx.format.WriteOptions=} opt_options Write options. * @return {string} Result. */ -_ol_format_Feature_.prototype.writeFeature = function(feature, opt_options) {}; +FeatureFormat.prototype.writeFeature = function(feature, opt_options) {}; /** @@ -150,7 +150,7 @@ _ol_format_Feature_.prototype.writeFeature = function(feature, opt_options) {}; * @param {olx.format.WriteOptions=} opt_options Write options. * @return {string} Result. */ -_ol_format_Feature_.prototype.writeFeatures = function(features, opt_options) {}; +FeatureFormat.prototype.writeFeatures = function(features, opt_options) {}; /** @@ -161,7 +161,7 @@ _ol_format_Feature_.prototype.writeFeatures = function(features, opt_options) {} * @param {olx.format.WriteOptions=} opt_options Write options. * @return {string} Result. */ -_ol_format_Feature_.prototype.writeGeometry = function(geometry, opt_options) {}; +FeatureFormat.prototype.writeGeometry = function(geometry, opt_options) {}; /** @@ -172,7 +172,7 @@ _ol_format_Feature_.prototype.writeGeometry = function(geometry, opt_options) {} * @return {ol.geom.Geometry|ol.Extent} Transformed geometry. * @protected */ -_ol_format_Feature_.transformWithOptions = function( +FeatureFormat.transformWithOptions = function( geometry, write, opt_options) { var featureProjection = opt_options ? getProjection(opt_options.featureProjection) : null; @@ -219,4 +219,4 @@ _ol_format_Feature_.transformWithOptions = function( } return transformed; }; -export default _ol_format_Feature_; +export default FeatureFormat; diff --git a/src/ol/format/GML.js b/src/ol/format/GML.js index edcf6ce97b..740506185c 100644 --- a/src/ol/format/GML.js +++ b/src/ol/format/GML.js @@ -1,7 +1,7 @@ /** * @module ol/format/GML */ -import _ol_format_GML3_ from '../format/GML3.js'; +import GML3 from '../format/GML3.js'; /** * @classdesc @@ -15,7 +15,7 @@ import _ol_format_GML3_ from '../format/GML3.js'; * @extends {ol.format.GMLBase} * @api */ -var _ol_format_GML_ = _ol_format_GML3_; +var _ol_format_GML_ = GML3; /** diff --git a/src/ol/format/GML2.js b/src/ol/format/GML2.js index 4d1d7a9aaf..701b460c40 100644 --- a/src/ol/format/GML2.js +++ b/src/ol/format/GML2.js @@ -3,9 +3,9 @@ */ import {inherits} from '../index.js'; import {createOrUpdate} from '../extent.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_GMLBase_ from '../format/GMLBase.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import FeatureFormat from '../format/Feature.js'; +import GMLBase from '../format/GMLBase.js'; +import XSD from '../format/XSD.js'; import Geometry from '../geom/Geometry.js'; import _ol_obj_ from '../obj.js'; import {get as getProjection, transformExtent} from '../proj.js'; @@ -21,25 +21,25 @@ import _ol_xml_ from '../xml.js'; * @extends {ol.format.GMLBase} * @api */ -var _ol_format_GML2_ = function(opt_options) { +var GML2 = function(opt_options) { var options = /** @type {olx.format.GMLOptions} */ (opt_options ? opt_options : {}); - _ol_format_GMLBase_.call(this, options); + GMLBase.call(this, options); - this.FEATURE_COLLECTION_PARSERS[_ol_format_GMLBase_.GMLNS][ + this.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS][ 'featureMember'] = - _ol_xml_.makeArrayPusher(_ol_format_GMLBase_.prototype.readFeaturesInternal); + _ol_xml_.makeArrayPusher(GMLBase.prototype.readFeaturesInternal); /** * @inheritDoc */ this.schemaLocation = options.schemaLocation ? - options.schemaLocation : _ol_format_GML2_.schemaLocation_; + options.schemaLocation : GML2.schemaLocation_; }; -inherits(_ol_format_GML2_, _ol_format_GMLBase_); +inherits(GML2, GMLBase); /** @@ -47,7 +47,7 @@ inherits(_ol_format_GML2_, _ol_format_GMLBase_); * @type {string} * @private */ -_ol_format_GML2_.schemaLocation_ = _ol_format_GMLBase_.GMLNS + +GML2.schemaLocation_ = GMLBase.GMLNS + ' http://schemas.opengis.net/gml/2.1.2/feature.xsd'; @@ -57,7 +57,7 @@ _ol_format_GML2_.schemaLocation_ = _ol_format_GMLBase_.GMLNS + * @private * @return {Array.|undefined} Flat coordinates. */ -_ol_format_GML2_.prototype.readFlatCoordinates_ = function(node, objectStack) { +GML2.prototype.readFlatCoordinates_ = function(node, objectStack) { var s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]); var containerSrs = context['srsName']; @@ -92,7 +92,7 @@ _ol_format_GML2_.prototype.readFlatCoordinates_ = function(node, objectStack) { * @private * @return {ol.Extent|undefined} Envelope. */ -_ol_format_GML2_.prototype.readBox_ = function(node, objectStack) { +GML2.prototype.readBox_ = function(node, objectStack) { /** @type {Array.} */ var flatCoordinates = _ol_xml_.pushParseAndPop([null], this.BOX_PARSERS_, node, objectStack, this); @@ -107,7 +107,7 @@ _ol_format_GML2_.prototype.readBox_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GML2_.prototype.innerBoundaryIsParser_ = function(node, objectStack) { +GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) { /** @type {Array.|undefined} */ var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); @@ -124,7 +124,7 @@ _ol_format_GML2_.prototype.innerBoundaryIsParser_ = function(node, objectStack) * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GML2_.prototype.outerBoundaryIsParser_ = function(node, objectStack) { +GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) { /** @type {Array.|undefined} */ var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); @@ -141,10 +141,10 @@ _ol_format_GML2_.prototype.outerBoundaryIsParser_ = function(node, objectStack) * @type {Object.>} * @private */ -_ol_format_GML2_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { +GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { 'http://www.opengis.net/gml': { 'coordinates': _ol_xml_.makeReplacer( - _ol_format_GML2_.prototype.readFlatCoordinates_) + GML2.prototype.readFlatCoordinates_) } }; @@ -154,10 +154,10 @@ _ol_format_GML2_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML2_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { +GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { 'http://www.opengis.net/gml': { - 'innerBoundaryIs': _ol_format_GML2_.prototype.innerBoundaryIsParser_, - 'outerBoundaryIs': _ol_format_GML2_.prototype.outerBoundaryIsParser_ + 'innerBoundaryIs': GML2.prototype.innerBoundaryIsParser_, + 'outerBoundaryIs': GML2.prototype.outerBoundaryIsParser_ } }; @@ -167,10 +167,10 @@ _ol_format_GML2_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML2_.prototype.BOX_PARSERS_ = { +GML2.prototype.BOX_PARSERS_ = { 'http://www.opengis.net/gml': { 'coordinates': _ol_xml_.makeArrayPusher( - _ol_format_GML2_.prototype.readFlatCoordinates_) + GML2.prototype.readFlatCoordinates_) } }; @@ -180,21 +180,21 @@ _ol_format_GML2_.prototype.BOX_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML2_.prototype.GEOMETRY_PARSERS_ = { +GML2.prototype.GEOMETRY_PARSERS_ = { 'http://www.opengis.net/gml': { - 'Point': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPoint), + 'Point': _ol_xml_.makeReplacer(GMLBase.prototype.readPoint), 'MultiPoint': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readMultiPoint), + GMLBase.prototype.readMultiPoint), 'LineString': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readLineString), + GMLBase.prototype.readLineString), 'MultiLineString': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readMultiLineString), + GMLBase.prototype.readMultiLineString), 'LinearRing': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readLinearRing), - 'Polygon': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPolygon), + GMLBase.prototype.readLinearRing), + 'Polygon': _ol_xml_.makeReplacer(GMLBase.prototype.readPolygon), 'MultiPolygon': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readMultiPolygon), - 'Box': _ol_xml_.makeReplacer(_ol_format_GML2_.prototype.readBox_) + GMLBase.prototype.readMultiPolygon), + 'Box': _ol_xml_.makeReplacer(GML2.prototype.readBox_) } }; @@ -207,7 +207,7 @@ _ol_format_GML2_.prototype.GEOMETRY_PARSERS_ = { * @return {Node|undefined} Node. * @private */ -_ol_format_GML2_.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { +GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var context = objectStack[objectStack.length - 1]; var multiSurface = context['multiSurface']; var surface = context['surface']; @@ -235,7 +235,7 @@ _ol_format_GML2_.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, * @param {ol.Feature} feature Feature. * @param {Array.<*>} objectStack Node stack. */ -_ol_format_GML2_.prototype.writeFeatureElement = function(node, feature, objectStack) { +GML2.prototype.writeFeatureElement = function(node, feature, objectStack) { var fid = feature.getId(); if (fid) { node.setAttribute('fid', fid); @@ -262,7 +262,7 @@ _ol_format_GML2_.prototype.writeFeatureElement = function(node, feature, objectS } else { if (!(key in context.serializers[featureNS])) { context.serializers[featureNS][key] = _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeStringTextNode); + XSD.writeStringTextNode); } } } @@ -282,7 +282,7 @@ _ol_format_GML2_.prototype.writeFeatureElement = function(node, feature, objectS * @param {ol.geom.Geometry|ol.Extent} geometry Geometry. * @param {Array.<*>} objectStack Node stack. */ -_ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objectStack) { +GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) { var context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]); var item = _ol_obj_.assign({}, context); item.node = node; @@ -296,10 +296,10 @@ _ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objec } } else { value = - _ol_format_Feature_.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context); + FeatureFormat.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context); } _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ - (item), _ol_format_GML2_.GEOMETRY_SERIALIZERS_, + (item), GML2.GEOMETRY_SERIALIZERS_, this.GEOMETRY_NODE_FACTORY_, [value], objectStack, undefined, this); }; @@ -311,7 +311,7 @@ _ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objec * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) { +GML2.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var srsName = context['srsName']; if (node.nodeName !== 'LineStringSegment' && srsName) { @@ -336,7 +336,7 @@ _ol_format_GML2_.prototype.writeCurveOrLineString_ = function(node, geometry, ob * @returns {Node} coordinates node. * @private */ -_ol_format_GML2_.prototype.createCoordinatesNode_ = function(namespaceURI) { +GML2.prototype.createCoordinatesNode_ = function(namespaceURI) { var coordinates = _ol_xml_.createElementNS(namespaceURI, 'coordinates'); coordinates.setAttribute('decimal', '.'); coordinates.setAttribute('cs', ','); @@ -352,7 +352,7 @@ _ol_format_GML2_.prototype.createCoordinatesNode_ = function(namespaceURI) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeCoordinates_ = function(node, value, objectStack) { +GML2.prototype.writeCoordinates_ = function(node, value, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; var srsName = context['srsName']; @@ -365,7 +365,7 @@ _ol_format_GML2_.prototype.writeCoordinates_ = function(node, value, objectStack point = points[i]; parts[i] = this.getCoords_(point, srsName, hasZ); } - _ol_format_XSD_.writeStringTextNode(node, parts.join(' ')); + XSD.writeStringTextNode(node, parts.join(' ')); }; @@ -375,7 +375,7 @@ _ol_format_GML2_.prototype.writeCoordinates_ = function(node, value, objectStack * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeCurveSegments_ = function(node, line, objectStack) { +GML2.prototype.writeCurveSegments_ = function(node, line, objectStack) { var child = _ol_xml_.createElementNS(node.namespaceURI, 'LineStringSegment'); node.appendChild(child); @@ -389,7 +389,7 @@ _ol_format_GML2_.prototype.writeCurveSegments_ = function(node, line, objectStac * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) { +GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; var srsName = context['srsName']; @@ -400,7 +400,7 @@ _ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, obj var rings = geometry.getLinearRings(); _ol_xml_.pushSerializeAndPop( {node: node, hasZ: hasZ, srsName: srsName}, - _ol_format_GML2_.RING_SERIALIZERS_, + GML2.RING_SERIALIZERS_, this.RING_NODE_FACTORY_, rings, objectStack, undefined, this); } else if (node.nodeName === 'Surface') { @@ -419,7 +419,7 @@ _ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, obj * @return {Node} Node. * @private */ -_ol_format_GML2_.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { +GML2.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var context = objectStack[objectStack.length - 1]; var parentNode = context.node; var exteriorWritten = context['exteriorWritten']; @@ -437,7 +437,7 @@ _ol_format_GML2_.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) { +GML2.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) { var child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch'); node.appendChild(child); this.writeSurfaceOrPolygon_(child, polygon, objectStack); @@ -450,7 +450,7 @@ _ol_format_GML2_.prototype.writeSurfacePatches_ = function(node, polygon, object * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeRing_ = function(node, ring, objectStack) { +GML2.prototype.writeRing_ = function(node, ring, objectStack) { var linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing'); node.appendChild(linearRing); this.writeLinearRing_(linearRing, ring, objectStack); @@ -464,7 +464,7 @@ _ol_format_GML2_.prototype.writeRing_ = function(node, ring, objectStack) { * @return {string} The coords string. * @private */ -_ol_format_GML2_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) { +GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) { var axisOrientation = 'enu'; if (opt_srsName) { axisOrientation = getProjection(opt_srsName).getAxisOrientation(); @@ -488,7 +488,7 @@ _ol_format_GML2_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) { +GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; var srsName = context['srsName']; @@ -498,7 +498,7 @@ _ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometr } var lines = geometry.getLineStrings(); _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve}, - _ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_, + GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines, objectStack, undefined, this); }; @@ -510,7 +510,7 @@ _ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometr * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writePoint_ = function(node, geometry, objectStack) { +GML2.prototype.writePoint_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; var srsName = context['srsName']; @@ -521,7 +521,7 @@ _ol_format_GML2_.prototype.writePoint_ = function(node, geometry, objectStack) { node.appendChild(coordinates); var point = geometry.getCoordinates(); var coord = this.getCoords_(point, srsName, hasZ); - _ol_format_XSD_.writeStringTextNode(coordinates, coord); + XSD.writeStringTextNode(coordinates, coord); }; @@ -531,7 +531,7 @@ _ol_format_GML2_.prototype.writePoint_ = function(node, geometry, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry, +GML2.prototype.writeMultiPoint_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; @@ -541,7 +541,7 @@ _ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry, } var points = geometry.getPoints(); _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName}, - _ol_format_GML2_.POINTMEMBER_SERIALIZERS_, + GML2.POINTMEMBER_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('pointMember'), points, objectStack, undefined, this); }; @@ -553,7 +553,7 @@ _ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry, * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writePointMember_ = function(node, point, objectStack) { +GML2.prototype.writePointMember_ = function(node, point, objectStack) { var child = _ol_xml_.createElementNS(node.namespaceURI, 'Point'); node.appendChild(child); this.writePoint_(child, point, objectStack); @@ -566,7 +566,7 @@ _ol_format_GML2_.prototype.writePointMember_ = function(node, point, objectStack * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) { +GML2.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) { var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack); if (child) { node.appendChild(child); @@ -581,7 +581,7 @@ _ol_format_GML2_.prototype.writeLineStringOrCurveMember_ = function(node, line, * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeLinearRing_ = function(node, geometry, objectStack) { +GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var srsName = context['srsName']; if (srsName) { @@ -599,7 +599,7 @@ _ol_format_GML2_.prototype.writeLinearRing_ = function(node, geometry, objectSta * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) { +GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; var srsName = context['srsName']; @@ -609,7 +609,7 @@ _ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry } var polygons = geometry.getPolygons(); _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface}, - _ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_, + GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons, objectStack, undefined, this); }; @@ -621,7 +621,7 @@ _ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) { +GML2.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) { var child = this.GEOMETRY_NODE_FACTORY_( polygon, objectStack); if (child) { @@ -637,7 +637,7 @@ _ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) { +GML2.prototype.writeEnvelope = function(node, extent, objectStack) { var context = objectStack[objectStack.length - 1]; var srsName = context['srsName']; if (srsName) { @@ -646,7 +646,7 @@ _ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) { var keys = ['lowerCorner', 'upperCorner']; var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]]; _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ - ({node: node}), _ol_format_GML2_.ENVELOPE_SERIALIZERS_, + ({node: node}), GML2.ENVELOPE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, keys, this); @@ -658,31 +658,31 @@ _ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) { * @type {Object.>} * @private */ -_ol_format_GML2_.GEOMETRY_SERIALIZERS_ = { +GML2.GEOMETRY_SERIALIZERS_ = { 'http://www.opengis.net/gml': { 'Curve': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeCurveOrLineString_), + GML2.prototype.writeCurveOrLineString_), 'MultiCurve': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeMultiCurveOrLineString_), - 'Point': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writePoint_), + GML2.prototype.writeMultiCurveOrLineString_), + 'Point': _ol_xml_.makeChildAppender(GML2.prototype.writePoint_), 'MultiPoint': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeMultiPoint_), + GML2.prototype.writeMultiPoint_), 'LineString': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeCurveOrLineString_), + GML2.prototype.writeCurveOrLineString_), 'MultiLineString': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeMultiCurveOrLineString_), + GML2.prototype.writeMultiCurveOrLineString_), 'LinearRing': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeLinearRing_), + GML2.prototype.writeLinearRing_), 'Polygon': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeSurfaceOrPolygon_), + GML2.prototype.writeSurfaceOrPolygon_), 'MultiPolygon': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_), + GML2.prototype.writeMultiSurfaceOrPolygon_), 'Surface': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeSurfaceOrPolygon_), + GML2.prototype.writeSurfaceOrPolygon_), 'MultiSurface': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_), + GML2.prototype.writeMultiSurfaceOrPolygon_), 'Envelope': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeEnvelope) + GML2.prototype.writeEnvelope) } }; @@ -691,10 +691,10 @@ _ol_format_GML2_.GEOMETRY_SERIALIZERS_ = { * @type {Object.>} * @private */ -_ol_format_GML2_.RING_SERIALIZERS_ = { +GML2.RING_SERIALIZERS_ = { 'http://www.opengis.net/gml': { - 'outerBoundaryIs': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writeRing_), - 'innerBoundaryIs': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writeRing_) + 'outerBoundaryIs': _ol_xml_.makeChildAppender(GML2.prototype.writeRing_), + 'innerBoundaryIs': _ol_xml_.makeChildAppender(GML2.prototype.writeRing_) } }; @@ -703,10 +703,10 @@ _ol_format_GML2_.RING_SERIALIZERS_ = { * @type {Object.>} * @private */ -_ol_format_GML2_.POINTMEMBER_SERIALIZERS_ = { +GML2.POINTMEMBER_SERIALIZERS_ = { 'http://www.opengis.net/gml': { 'pointMember': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writePointMember_) + GML2.prototype.writePointMember_) } }; @@ -715,12 +715,12 @@ _ol_format_GML2_.POINTMEMBER_SERIALIZERS_ = { * @type {Object.>} * @private */ -_ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { +GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { 'http://www.opengis.net/gml': { 'lineStringMember': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeLineStringOrCurveMember_), + GML2.prototype.writeLineStringOrCurveMember_), 'curveMember': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeLineStringOrCurveMember_) + GML2.prototype.writeLineStringOrCurveMember_) } }; @@ -733,10 +733,10 @@ _ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { * @return {Node|undefined} Node. * @private */ -_ol_format_GML2_.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { +GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var parentNode = objectStack[objectStack.length - 1].node; return _ol_xml_.createElementNS('http://www.opengis.net/gml', - _ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]); + GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]); }; /** @@ -744,7 +744,7 @@ _ol_format_GML2_.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, * @type {Object.} * @private */ -_ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { +GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { 'MultiLineString': 'lineStringMember', 'MultiCurve': 'curveMember', 'MultiPolygon': 'polygonMember', @@ -757,12 +757,12 @@ _ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { * @type {Object.>} * @private */ -_ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { +GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { 'http://www.opengis.net/gml': { 'surfaceMember': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_), + GML2.prototype.writeSurfaceOrPolygonMember_), 'polygonMember': _ol_xml_.makeChildAppender( - _ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_) + GML2.prototype.writeSurfaceOrPolygonMember_) } }; @@ -771,10 +771,10 @@ _ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { * @type {Object.>} * @private */ -_ol_format_GML2_.ENVELOPE_SERIALIZERS_ = { +GML2.ENVELOPE_SERIALIZERS_ = { 'http://www.opengis.net/gml': { - 'lowerCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'upperCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) + 'lowerCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'upperCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode) } }; -export default _ol_format_GML2_; +export default GML2; diff --git a/src/ol/format/GML3.js b/src/ol/format/GML3.js index d5329f9ad1..2d56b1c552 100644 --- a/src/ol/format/GML3.js +++ b/src/ol/format/GML3.js @@ -4,9 +4,9 @@ import {inherits} from '../index.js'; import _ol_array_ from '../array.js'; import {createOrUpdate} from '../extent.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_GMLBase_ from '../format/GMLBase.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import FeatureFormat from '../format/Feature.js'; +import GMLBase from '../format/GMLBase.js'; +import XSD from '../format/XSD.js'; import Geometry from '../geom/Geometry.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import LineString from '../geom/LineString.js'; @@ -29,11 +29,11 @@ import _ol_xml_ from '../xml.js'; * @extends {ol.format.GMLBase} * @api */ -var _ol_format_GML3_ = function(opt_options) { +var GML3 = function(opt_options) { var options = /** @type {olx.format.GMLOptions} */ (opt_options ? opt_options : {}); - _ol_format_GMLBase_.call(this, options); + GMLBase.call(this, options); /** * @private @@ -65,7 +65,7 @@ var _ol_format_GML3_ = function(opt_options) { * @inheritDoc */ this.schemaLocation = options.schemaLocation ? - options.schemaLocation : _ol_format_GML3_.schemaLocation_; + options.schemaLocation : GML3.schemaLocation_; /** * @private @@ -76,7 +76,7 @@ var _ol_format_GML3_ = function(opt_options) { }; -inherits(_ol_format_GML3_, _ol_format_GMLBase_); +inherits(GML3, GMLBase); /** @@ -84,7 +84,7 @@ inherits(_ol_format_GML3_, _ol_format_GMLBase_); * @type {string} * @private */ -_ol_format_GML3_.schemaLocation_ = _ol_format_GMLBase_.GMLNS + +GML3.schemaLocation_ = GMLBase.GMLNS + ' http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/' + '1.0.0/gmlsf.xsd'; @@ -95,7 +95,7 @@ _ol_format_GML3_.schemaLocation_ = _ol_format_GMLBase_.GMLNS + * @private * @return {ol.geom.MultiLineString|undefined} MultiLineString. */ -_ol_format_GML3_.prototype.readMultiCurve_ = function(node, objectStack) { +GML3.prototype.readMultiCurve_ = function(node, objectStack) { /** @type {Array.} */ var lineStrings = _ol_xml_.pushParseAndPop([], this.MULTICURVE_PARSERS_, node, objectStack, this); @@ -115,7 +115,7 @@ _ol_format_GML3_.prototype.readMultiCurve_ = function(node, objectStack) { * @private * @return {ol.geom.MultiPolygon|undefined} MultiPolygon. */ -_ol_format_GML3_.prototype.readMultiSurface_ = function(node, objectStack) { +GML3.prototype.readMultiSurface_ = function(node, objectStack) { /** @type {Array.} */ var polygons = _ol_xml_.pushParseAndPop([], this.MULTISURFACE_PARSERS_, node, objectStack, this); @@ -134,7 +134,7 @@ _ol_format_GML3_.prototype.readMultiSurface_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GML3_.prototype.curveMemberParser_ = function(node, objectStack) { +GML3.prototype.curveMemberParser_ = function(node, objectStack) { _ol_xml_.parseNode(this.CURVEMEMBER_PARSERS_, node, objectStack, this); }; @@ -144,7 +144,7 @@ _ol_format_GML3_.prototype.curveMemberParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GML3_.prototype.surfaceMemberParser_ = function(node, objectStack) { +GML3.prototype.surfaceMemberParser_ = function(node, objectStack) { _ol_xml_.parseNode(this.SURFACEMEMBER_PARSERS_, node, objectStack, this); }; @@ -156,7 +156,7 @@ _ol_format_GML3_.prototype.surfaceMemberParser_ = function(node, objectStack) { * @private * @return {Array.<(Array.)>|undefined} flat coordinates. */ -_ol_format_GML3_.prototype.readPatch_ = function(node, objectStack) { +GML3.prototype.readPatch_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop([null], this.PATCHES_PARSERS_, node, objectStack, this); }; @@ -168,7 +168,7 @@ _ol_format_GML3_.prototype.readPatch_ = function(node, objectStack) { * @private * @return {Array.|undefined} flat coordinates. */ -_ol_format_GML3_.prototype.readSegment_ = function(node, objectStack) { +GML3.prototype.readSegment_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop([null], this.SEGMENTS_PARSERS_, node, objectStack, this); }; @@ -180,7 +180,7 @@ _ol_format_GML3_.prototype.readSegment_ = function(node, objectStack) { * @private * @return {Array.<(Array.)>|undefined} flat coordinates. */ -_ol_format_GML3_.prototype.readPolygonPatch_ = function(node, objectStack) { +GML3.prototype.readPolygonPatch_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop([null], this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); }; @@ -192,7 +192,7 @@ _ol_format_GML3_.prototype.readPolygonPatch_ = function(node, objectStack) { * @private * @return {Array.|undefined} flat coordinates. */ -_ol_format_GML3_.prototype.readLineStringSegment_ = function(node, objectStack) { +GML3.prototype.readLineStringSegment_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop([null], this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack, this); @@ -204,7 +204,7 @@ _ol_format_GML3_.prototype.readLineStringSegment_ = function(node, objectStack) * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GML3_.prototype.interiorParser_ = function(node, objectStack) { +GML3.prototype.interiorParser_ = function(node, objectStack) { /** @type {Array.|undefined} */ var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); @@ -221,7 +221,7 @@ _ol_format_GML3_.prototype.interiorParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GML3_.prototype.exteriorParser_ = function(node, objectStack) { +GML3.prototype.exteriorParser_ = function(node, objectStack) { /** @type {Array.|undefined} */ var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); @@ -239,7 +239,7 @@ _ol_format_GML3_.prototype.exteriorParser_ = function(node, objectStack) { * @private * @return {ol.geom.Polygon|undefined} Polygon. */ -_ol_format_GML3_.prototype.readSurface_ = function(node, objectStack) { +GML3.prototype.readSurface_ = function(node, objectStack) { /** @type {Array.>} */ var flatLinearRings = _ol_xml_.pushParseAndPop([null], this.SURFACE_PARSERS_, node, objectStack, this); @@ -267,7 +267,7 @@ _ol_format_GML3_.prototype.readSurface_ = function(node, objectStack) { * @private * @return {ol.geom.LineString|undefined} LineString. */ -_ol_format_GML3_.prototype.readCurve_ = function(node, objectStack) { +GML3.prototype.readCurve_ = function(node, objectStack) { /** @type {Array.} */ var flatCoordinates = _ol_xml_.pushParseAndPop([null], this.CURVE_PARSERS_, node, objectStack, this); @@ -287,7 +287,7 @@ _ol_format_GML3_.prototype.readCurve_ = function(node, objectStack) { * @private * @return {ol.Extent|undefined} Envelope. */ -_ol_format_GML3_.prototype.readEnvelope_ = function(node, objectStack) { +GML3.prototype.readEnvelope_ = function(node, objectStack) { /** @type {Array.} */ var flatCoordinates = _ol_xml_.pushParseAndPop([null], this.ENVELOPE_PARSERS_, node, objectStack, this); @@ -303,7 +303,7 @@ _ol_format_GML3_.prototype.readEnvelope_ = function(node, objectStack) { * @private * @return {Array.|undefined} Flat coordinates. */ -_ol_format_GML3_.prototype.readFlatPos_ = function(node, objectStack) { +GML3.prototype.readFlatPos_ = function(node, objectStack) { var s = _ol_xml_.getAllTextContent(node, false); var re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/; /** @type {Array.} */ @@ -349,7 +349,7 @@ _ol_format_GML3_.prototype.readFlatPos_ = function(node, objectStack) { * @private * @return {Array.|undefined} Flat coordinates. */ -_ol_format_GML3_.prototype.readFlatPosList_ = function(node, objectStack) { +GML3.prototype.readFlatPosList_ = function(node, objectStack) { var s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); var context = objectStack[0]; var containerSrs = context['srsName']; @@ -363,16 +363,16 @@ _ol_format_GML3_.prototype.readFlatPosList_ = function(node, objectStack) { // The "dimension" attribute is from the GML 3.0.1 spec. var dim = 2; if (node.getAttribute('srsDimension')) { - dim = _ol_format_XSD_.readNonNegativeIntegerString( + dim = XSD.readNonNegativeIntegerString( node.getAttribute('srsDimension')); } else if (node.getAttribute('dimension')) { - dim = _ol_format_XSD_.readNonNegativeIntegerString( + dim = XSD.readNonNegativeIntegerString( node.getAttribute('dimension')); } else if (node.parentNode.getAttribute('srsDimension')) { - dim = _ol_format_XSD_.readNonNegativeIntegerString( + dim = XSD.readNonNegativeIntegerString( node.parentNode.getAttribute('srsDimension')); } else if (contextDimension) { - dim = _ol_format_XSD_.readNonNegativeIntegerString(contextDimension); + dim = XSD.readNonNegativeIntegerString(contextDimension); } var x, y, z; var flatCoordinates = []; @@ -395,10 +395,10 @@ _ol_format_GML3_.prototype.readFlatPosList_ = function(node, objectStack) { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { +GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { 'http://www.opengis.net/gml': { - 'pos': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readFlatPos_), - 'posList': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readFlatPosList_) + 'pos': _ol_xml_.makeReplacer(GML3.prototype.readFlatPos_), + 'posList': _ol_xml_.makeReplacer(GML3.prototype.readFlatPosList_) } }; @@ -408,10 +408,10 @@ _ol_format_GML3_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { +GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { 'http://www.opengis.net/gml': { - 'interior': _ol_format_GML3_.prototype.interiorParser_, - 'exterior': _ol_format_GML3_.prototype.exteriorParser_ + 'interior': GML3.prototype.interiorParser_, + 'exterior': GML3.prototype.exteriorParser_ } }; @@ -421,27 +421,27 @@ _ol_format_GML3_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.GEOMETRY_PARSERS_ = { +GML3.prototype.GEOMETRY_PARSERS_ = { 'http://www.opengis.net/gml': { - 'Point': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPoint), + 'Point': _ol_xml_.makeReplacer(GMLBase.prototype.readPoint), 'MultiPoint': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readMultiPoint), + GMLBase.prototype.readMultiPoint), 'LineString': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readLineString), + GMLBase.prototype.readLineString), 'MultiLineString': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readMultiLineString), + GMLBase.prototype.readMultiLineString), 'LinearRing': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readLinearRing), - 'Polygon': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPolygon), + GMLBase.prototype.readLinearRing), + 'Polygon': _ol_xml_.makeReplacer(GMLBase.prototype.readPolygon), 'MultiPolygon': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readMultiPolygon), - 'Surface': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readSurface_), + GMLBase.prototype.readMultiPolygon), + 'Surface': _ol_xml_.makeReplacer(GML3.prototype.readSurface_), 'MultiSurface': _ol_xml_.makeReplacer( - _ol_format_GML3_.prototype.readMultiSurface_), - 'Curve': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readCurve_), + GML3.prototype.readMultiSurface_), + 'Curve': _ol_xml_.makeReplacer(GML3.prototype.readCurve_), 'MultiCurve': _ol_xml_.makeReplacer( - _ol_format_GML3_.prototype.readMultiCurve_), - 'Envelope': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readEnvelope_) + GML3.prototype.readMultiCurve_), + 'Envelope': _ol_xml_.makeReplacer(GML3.prototype.readEnvelope_) } }; @@ -451,12 +451,12 @@ _ol_format_GML3_.prototype.GEOMETRY_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.MULTICURVE_PARSERS_ = { +GML3.prototype.MULTICURVE_PARSERS_ = { 'http://www.opengis.net/gml': { 'curveMember': _ol_xml_.makeArrayPusher( - _ol_format_GML3_.prototype.curveMemberParser_), + GML3.prototype.curveMemberParser_), 'curveMembers': _ol_xml_.makeArrayPusher( - _ol_format_GML3_.prototype.curveMemberParser_) + GML3.prototype.curveMemberParser_) } }; @@ -466,12 +466,12 @@ _ol_format_GML3_.prototype.MULTICURVE_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.MULTISURFACE_PARSERS_ = { +GML3.prototype.MULTISURFACE_PARSERS_ = { 'http://www.opengis.net/gml': { 'surfaceMember': _ol_xml_.makeArrayPusher( - _ol_format_GML3_.prototype.surfaceMemberParser_), + GML3.prototype.surfaceMemberParser_), 'surfaceMembers': _ol_xml_.makeArrayPusher( - _ol_format_GML3_.prototype.surfaceMemberParser_) + GML3.prototype.surfaceMemberParser_) } }; @@ -481,11 +481,11 @@ _ol_format_GML3_.prototype.MULTISURFACE_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.CURVEMEMBER_PARSERS_ = { +GML3.prototype.CURVEMEMBER_PARSERS_ = { 'http://www.opengis.net/gml': { 'LineString': _ol_xml_.makeArrayPusher( - _ol_format_GMLBase_.prototype.readLineString), - 'Curve': _ol_xml_.makeArrayPusher(_ol_format_GML3_.prototype.readCurve_) + GMLBase.prototype.readLineString), + 'Curve': _ol_xml_.makeArrayPusher(GML3.prototype.readCurve_) } }; @@ -495,10 +495,10 @@ _ol_format_GML3_.prototype.CURVEMEMBER_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.SURFACEMEMBER_PARSERS_ = { +GML3.prototype.SURFACEMEMBER_PARSERS_ = { 'http://www.opengis.net/gml': { - 'Polygon': _ol_xml_.makeArrayPusher(_ol_format_GMLBase_.prototype.readPolygon), - 'Surface': _ol_xml_.makeArrayPusher(_ol_format_GML3_.prototype.readSurface_) + 'Polygon': _ol_xml_.makeArrayPusher(GMLBase.prototype.readPolygon), + 'Surface': _ol_xml_.makeArrayPusher(GML3.prototype.readSurface_) } }; @@ -508,9 +508,9 @@ _ol_format_GML3_.prototype.SURFACEMEMBER_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.SURFACE_PARSERS_ = { +GML3.prototype.SURFACE_PARSERS_ = { 'http://www.opengis.net/gml': { - 'patches': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readPatch_) + 'patches': _ol_xml_.makeReplacer(GML3.prototype.readPatch_) } }; @@ -520,9 +520,9 @@ _ol_format_GML3_.prototype.SURFACE_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.CURVE_PARSERS_ = { +GML3.prototype.CURVE_PARSERS_ = { 'http://www.opengis.net/gml': { - 'segments': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readSegment_) + 'segments': _ol_xml_.makeReplacer(GML3.prototype.readSegment_) } }; @@ -532,12 +532,12 @@ _ol_format_GML3_.prototype.CURVE_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.ENVELOPE_PARSERS_ = { +GML3.prototype.ENVELOPE_PARSERS_ = { 'http://www.opengis.net/gml': { 'lowerCorner': _ol_xml_.makeArrayPusher( - _ol_format_GML3_.prototype.readFlatPosList_), + GML3.prototype.readFlatPosList_), 'upperCorner': _ol_xml_.makeArrayPusher( - _ol_format_GML3_.prototype.readFlatPosList_) + GML3.prototype.readFlatPosList_) } }; @@ -547,10 +547,10 @@ _ol_format_GML3_.prototype.ENVELOPE_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.PATCHES_PARSERS_ = { +GML3.prototype.PATCHES_PARSERS_ = { 'http://www.opengis.net/gml': { 'PolygonPatch': _ol_xml_.makeReplacer( - _ol_format_GML3_.prototype.readPolygonPatch_) + GML3.prototype.readPolygonPatch_) } }; @@ -560,10 +560,10 @@ _ol_format_GML3_.prototype.PATCHES_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.prototype.SEGMENTS_PARSERS_ = { +GML3.prototype.SEGMENTS_PARSERS_ = { 'http://www.opengis.net/gml': { 'LineStringSegment': _ol_xml_.makeReplacer( - _ol_format_GML3_.prototype.readLineStringSegment_) + GML3.prototype.readLineStringSegment_) } }; @@ -574,7 +574,7 @@ _ol_format_GML3_.prototype.SEGMENTS_PARSERS_ = { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writePos_ = function(node, value, objectStack) { +GML3.prototype.writePos_ = function(node, value, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; var srsDimension = hasZ ? 3 : 2; @@ -597,7 +597,7 @@ _ol_format_GML3_.prototype.writePos_ = function(node, value, objectStack) { var z = point[2] || 0; coords += ' ' + z; } - _ol_format_XSD_.writeStringTextNode(node, coords); + XSD.writeStringTextNode(node, coords); }; @@ -608,7 +608,7 @@ _ol_format_GML3_.prototype.writePos_ = function(node, value, objectStack) { * @return {string} The coords string. * @private */ -_ol_format_GML3_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) { +GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) { var axisOrientation = 'enu'; if (opt_srsName) { axisOrientation = getProjection(opt_srsName).getAxisOrientation(); @@ -632,7 +632,7 @@ _ol_format_GML3_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writePosList_ = function(node, value, objectStack) { +GML3.prototype.writePosList_ = function(node, value, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; var srsDimension = hasZ ? 3 : 2; @@ -647,7 +647,7 @@ _ol_format_GML3_.prototype.writePosList_ = function(node, value, objectStack) { point = points[i]; parts[i] = this.getCoords_(point, srsName, hasZ); } - _ol_format_XSD_.writeStringTextNode(node, parts.join(' ')); + XSD.writeStringTextNode(node, parts.join(' ')); }; @@ -657,7 +657,7 @@ _ol_format_GML3_.prototype.writePosList_ = function(node, value, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writePoint_ = function(node, geometry, objectStack) { +GML3.prototype.writePoint_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var srsName = context['srsName']; if (srsName) { @@ -673,10 +673,10 @@ _ol_format_GML3_.prototype.writePoint_ = function(node, geometry, objectStack) { * @type {Object.>} * @private */ -_ol_format_GML3_.ENVELOPE_SERIALIZERS_ = { +GML3.ENVELOPE_SERIALIZERS_ = { 'http://www.opengis.net/gml': { - 'lowerCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'upperCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) + 'lowerCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'upperCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode) } }; @@ -686,7 +686,7 @@ _ol_format_GML3_.ENVELOPE_SERIALIZERS_ = { * @param {ol.Extent} extent Extent. * @param {Array.<*>} objectStack Node stack. */ -_ol_format_GML3_.prototype.writeEnvelope = function(node, extent, objectStack) { +GML3.prototype.writeEnvelope = function(node, extent, objectStack) { var context = objectStack[objectStack.length - 1]; var srsName = context['srsName']; if (srsName) { @@ -695,7 +695,7 @@ _ol_format_GML3_.prototype.writeEnvelope = function(node, extent, objectStack) { var keys = ['lowerCorner', 'upperCorner']; var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]]; _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ - ({node: node}), _ol_format_GML3_.ENVELOPE_SERIALIZERS_, + ({node: node}), GML3.ENVELOPE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, keys, this); @@ -708,7 +708,7 @@ _ol_format_GML3_.prototype.writeEnvelope = function(node, extent, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeLinearRing_ = function(node, geometry, objectStack) { +GML3.prototype.writeLinearRing_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var srsName = context['srsName']; if (srsName) { @@ -727,7 +727,7 @@ _ol_format_GML3_.prototype.writeLinearRing_ = function(node, geometry, objectSta * @return {Node} Node. * @private */ -_ol_format_GML3_.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { +GML3.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var context = objectStack[objectStack.length - 1]; var parentNode = context.node; var exteriorWritten = context['exteriorWritten']; @@ -745,7 +745,7 @@ _ol_format_GML3_.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) { +GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; var srsName = context['srsName']; @@ -756,7 +756,7 @@ _ol_format_GML3_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, obj var rings = geometry.getLinearRings(); _ol_xml_.pushSerializeAndPop( {node: node, hasZ: hasZ, srsName: srsName}, - _ol_format_GML3_.RING_SERIALIZERS_, + GML3.RING_SERIALIZERS_, this.RING_NODE_FACTORY_, rings, objectStack, undefined, this); } else if (node.nodeName === 'Surface') { @@ -774,7 +774,7 @@ _ol_format_GML3_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, obj * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) { +GML3.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var srsName = context['srsName']; if (node.nodeName !== 'LineStringSegment' && srsName) { @@ -800,7 +800,7 @@ _ol_format_GML3_.prototype.writeCurveOrLineString_ = function(node, geometry, ob * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) { +GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; var srsName = context['srsName']; @@ -810,7 +810,7 @@ _ol_format_GML3_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry } var polygons = geometry.getPolygons(); _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface}, - _ol_format_GML3_.SURFACEORPOLYGONMEMBER_SERIALIZERS_, + GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons, objectStack, undefined, this); }; @@ -822,7 +822,7 @@ _ol_format_GML3_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeMultiPoint_ = function(node, geometry, +GML3.prototype.writeMultiPoint_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var srsName = context['srsName']; @@ -832,7 +832,7 @@ _ol_format_GML3_.prototype.writeMultiPoint_ = function(node, geometry, } var points = geometry.getPoints(); _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName}, - _ol_format_GML3_.POINTMEMBER_SERIALIZERS_, + GML3.POINTMEMBER_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('pointMember'), points, objectStack, undefined, this); }; @@ -844,7 +844,7 @@ _ol_format_GML3_.prototype.writeMultiPoint_ = function(node, geometry, * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) { +GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) { var context = objectStack[objectStack.length - 1]; var hasZ = context['hasZ']; var srsName = context['srsName']; @@ -854,7 +854,7 @@ _ol_format_GML3_.prototype.writeMultiCurveOrLineString_ = function(node, geometr } var lines = geometry.getLineStrings(); _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve}, - _ol_format_GML3_.LINESTRINGORCURVEMEMBER_SERIALIZERS_, + GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines, objectStack, undefined, this); }; @@ -866,7 +866,7 @@ _ol_format_GML3_.prototype.writeMultiCurveOrLineString_ = function(node, geometr * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeRing_ = function(node, ring, objectStack) { +GML3.prototype.writeRing_ = function(node, ring, objectStack) { var linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing'); node.appendChild(linearRing); this.writeLinearRing_(linearRing, ring, objectStack); @@ -879,7 +879,7 @@ _ol_format_GML3_.prototype.writeRing_ = function(node, ring, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) { +GML3.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) { var child = this.GEOMETRY_NODE_FACTORY_( polygon, objectStack); if (child) { @@ -895,7 +895,7 @@ _ol_format_GML3_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writePointMember_ = function(node, point, objectStack) { +GML3.prototype.writePointMember_ = function(node, point, objectStack) { var child = _ol_xml_.createElementNS(node.namespaceURI, 'Point'); node.appendChild(child); this.writePoint_(child, point, objectStack); @@ -908,7 +908,7 @@ _ol_format_GML3_.prototype.writePointMember_ = function(node, point, objectStack * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) { +GML3.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) { var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack); if (child) { node.appendChild(child); @@ -923,7 +923,7 @@ _ol_format_GML3_.prototype.writeLineStringOrCurveMember_ = function(node, line, * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) { +GML3.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) { var child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch'); node.appendChild(child); this.writeSurfaceOrPolygon_(child, polygon, objectStack); @@ -936,7 +936,7 @@ _ol_format_GML3_.prototype.writeSurfacePatches_ = function(node, polygon, object * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeCurveSegments_ = function(node, line, objectStack) { +GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) { var child = _ol_xml_.createElementNS(node.namespaceURI, 'LineStringSegment'); node.appendChild(child); @@ -949,7 +949,7 @@ _ol_format_GML3_.prototype.writeCurveSegments_ = function(node, line, objectStac * @param {ol.geom.Geometry|ol.Extent} geometry Geometry. * @param {Array.<*>} objectStack Node stack. */ -_ol_format_GML3_.prototype.writeGeometryElement = function(node, geometry, objectStack) { +GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) { var context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]); var item = _ol_obj_.assign({}, context); item.node = node; @@ -963,10 +963,10 @@ _ol_format_GML3_.prototype.writeGeometryElement = function(node, geometry, objec } } else { value = - _ol_format_Feature_.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context); + FeatureFormat.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context); } _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ - (item), _ol_format_GML3_.GEOMETRY_SERIALIZERS_, + (item), GML3.GEOMETRY_SERIALIZERS_, this.GEOMETRY_NODE_FACTORY_, [value], objectStack, undefined, this); }; @@ -977,7 +977,7 @@ _ol_format_GML3_.prototype.writeGeometryElement = function(node, geometry, objec * @param {ol.Feature} feature Feature. * @param {Array.<*>} objectStack Node stack. */ -_ol_format_GML3_.prototype.writeFeatureElement = function(node, feature, objectStack) { +GML3.prototype.writeFeatureElement = function(node, feature, objectStack) { var fid = feature.getId(); if (fid) { node.setAttribute('fid', fid); @@ -1004,7 +1004,7 @@ _ol_format_GML3_.prototype.writeFeatureElement = function(node, feature, objectS } else { if (!(key in context.serializers[featureNS])) { context.serializers[featureNS][key] = _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeStringTextNode); + XSD.writeStringTextNode); } } } @@ -1025,7 +1025,7 @@ _ol_format_GML3_.prototype.writeFeatureElement = function(node, feature, objectS * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GML3_.prototype.writeFeatureMembers_ = function(node, features, objectStack) { +GML3.prototype.writeFeatureMembers_ = function(node, features, objectStack) { var context = /** @type {Object} */ (objectStack[objectStack.length - 1]); var featureType = context['featureType']; var featureNS = context['featureNS']; @@ -1047,12 +1047,12 @@ _ol_format_GML3_.prototype.writeFeatureMembers_ = function(node, features, objec * @type {Object.>} * @private */ -_ol_format_GML3_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { +GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { 'http://www.opengis.net/gml': { 'surfaceMember': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeSurfaceOrPolygonMember_), + GML3.prototype.writeSurfaceOrPolygonMember_), 'polygonMember': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeSurfaceOrPolygonMember_) + GML3.prototype.writeSurfaceOrPolygonMember_) } }; @@ -1061,10 +1061,10 @@ _ol_format_GML3_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.POINTMEMBER_SERIALIZERS_ = { +GML3.POINTMEMBER_SERIALIZERS_ = { 'http://www.opengis.net/gml': { 'pointMember': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writePointMember_) + GML3.prototype.writePointMember_) } }; @@ -1073,12 +1073,12 @@ _ol_format_GML3_.POINTMEMBER_SERIALIZERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { +GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { 'http://www.opengis.net/gml': { 'lineStringMember': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeLineStringOrCurveMember_), + GML3.prototype.writeLineStringOrCurveMember_), 'curveMember': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeLineStringOrCurveMember_) + GML3.prototype.writeLineStringOrCurveMember_) } }; @@ -1087,10 +1087,10 @@ _ol_format_GML3_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.RING_SERIALIZERS_ = { +GML3.RING_SERIALIZERS_ = { 'http://www.opengis.net/gml': { - 'exterior': _ol_xml_.makeChildAppender(_ol_format_GML3_.prototype.writeRing_), - 'interior': _ol_xml_.makeChildAppender(_ol_format_GML3_.prototype.writeRing_) + 'exterior': _ol_xml_.makeChildAppender(GML3.prototype.writeRing_), + 'interior': _ol_xml_.makeChildAppender(GML3.prototype.writeRing_) } }; @@ -1099,31 +1099,31 @@ _ol_format_GML3_.RING_SERIALIZERS_ = { * @type {Object.>} * @private */ -_ol_format_GML3_.GEOMETRY_SERIALIZERS_ = { +GML3.GEOMETRY_SERIALIZERS_ = { 'http://www.opengis.net/gml': { 'Curve': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeCurveOrLineString_), + GML3.prototype.writeCurveOrLineString_), 'MultiCurve': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeMultiCurveOrLineString_), - 'Point': _ol_xml_.makeChildAppender(_ol_format_GML3_.prototype.writePoint_), + GML3.prototype.writeMultiCurveOrLineString_), + 'Point': _ol_xml_.makeChildAppender(GML3.prototype.writePoint_), 'MultiPoint': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeMultiPoint_), + GML3.prototype.writeMultiPoint_), 'LineString': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeCurveOrLineString_), + GML3.prototype.writeCurveOrLineString_), 'MultiLineString': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeMultiCurveOrLineString_), + GML3.prototype.writeMultiCurveOrLineString_), 'LinearRing': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeLinearRing_), + GML3.prototype.writeLinearRing_), 'Polygon': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeSurfaceOrPolygon_), + GML3.prototype.writeSurfaceOrPolygon_), 'MultiPolygon': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeMultiSurfaceOrPolygon_), + GML3.prototype.writeMultiSurfaceOrPolygon_), 'Surface': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeSurfaceOrPolygon_), + GML3.prototype.writeSurfaceOrPolygon_), 'MultiSurface': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeMultiSurfaceOrPolygon_), + GML3.prototype.writeMultiSurfaceOrPolygon_), 'Envelope': _ol_xml_.makeChildAppender( - _ol_format_GML3_.prototype.writeEnvelope) + GML3.prototype.writeEnvelope) } }; @@ -1133,7 +1133,7 @@ _ol_format_GML3_.GEOMETRY_SERIALIZERS_ = { * @type {Object.} * @private */ -_ol_format_GML3_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { +GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { 'MultiLineString': 'lineStringMember', 'MultiCurve': 'curveMember', 'MultiPolygon': 'polygonMember', @@ -1149,10 +1149,10 @@ _ol_format_GML3_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { * @return {Node|undefined} Node. * @private */ -_ol_format_GML3_.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { +GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var parentNode = objectStack[objectStack.length - 1].node; return _ol_xml_.createElementNS('http://www.opengis.net/gml', - _ol_format_GML3_.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]); + GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]); }; @@ -1164,7 +1164,7 @@ _ol_format_GML3_.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, * @return {Node|undefined} Node. * @private */ -_ol_format_GML3_.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { +GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var context = objectStack[objectStack.length - 1]; var multiSurface = context['multiSurface']; var surface = context['surface']; @@ -1199,7 +1199,7 @@ _ol_format_GML3_.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, * @override * @api */ -_ol_format_GML3_.prototype.writeGeometryNode = function(geometry, opt_options) { +GML3.prototype.writeGeometryNode = function(geometry, opt_options) { opt_options = this.adaptOptions(opt_options); var geom = _ol_xml_.createElementNS('http://www.opengis.net/gml', 'geom'); var context = {node: geom, hasZ: this.hasZ, srsName: this.srsName, @@ -1222,7 +1222,7 @@ _ol_format_GML3_.prototype.writeGeometryNode = function(geometry, opt_options) { * @return {string} Result. * @api */ -_ol_format_GML3_.prototype.writeFeatures; +GML3.prototype.writeFeatures; /** @@ -1234,7 +1234,7 @@ _ol_format_GML3_.prototype.writeFeatures; * @override * @api */ -_ol_format_GML3_.prototype.writeFeaturesNode = function(features, opt_options) { +GML3.prototype.writeFeaturesNode = function(features, opt_options) { opt_options = this.adaptOptions(opt_options); var node = _ol_xml_.createElementNS('http://www.opengis.net/gml', 'featureMembers'); @@ -1256,4 +1256,4 @@ _ol_format_GML3_.prototype.writeFeaturesNode = function(features, opt_options) { this.writeFeatureMembers_(node, features, [context]); return node; }; -export default _ol_format_GML3_; +export default GML3; diff --git a/src/ol/format/GMLBase.js b/src/ol/format/GMLBase.js index e54cb88a86..8afecd8f19 100644 --- a/src/ol/format/GMLBase.js +++ b/src/ol/format/GMLBase.js @@ -7,8 +7,8 @@ import {inherits} from '../index.js'; import _ol_array_ from '../array.js'; import _ol_Feature_ from '../Feature.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; +import FeatureFormat from '../format/Feature.js'; +import XMLFeature from '../format/XMLFeature.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import LineString from '../geom/LineString.js'; import LinearRing from '../geom/LinearRing.js'; @@ -36,7 +36,7 @@ import _ol_xml_ from '../xml.js'; * Optional configuration object. * @extends {ol.format.XMLFeature} */ -var _ol_format_GMLBase_ = function(opt_options) { +var GMLBase = function(opt_options) { var options = /** @type {olx.format.GMLOptions} */ (opt_options ? opt_options : {}); @@ -68,24 +68,24 @@ var _ol_format_GMLBase_ = function(opt_options) { * @type {Object.>} */ this.FEATURE_COLLECTION_PARSERS = {}; - this.FEATURE_COLLECTION_PARSERS[_ol_format_GMLBase_.GMLNS] = { + this.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS] = { 'featureMember': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readFeaturesInternal), + GMLBase.prototype.readFeaturesInternal), 'featureMembers': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readFeaturesInternal) + GMLBase.prototype.readFeaturesInternal) }; - _ol_format_XMLFeature_.call(this); + XMLFeature.call(this); }; -inherits(_ol_format_GMLBase_, _ol_format_XMLFeature_); +inherits(GMLBase, XMLFeature); /** * @const * @type {string} */ -_ol_format_GMLBase_.GMLNS = 'http://www.opengis.net/gml'; +GMLBase.GMLNS = 'http://www.opengis.net/gml'; /** @@ -100,7 +100,7 @@ _ol_format_GMLBase_.GMLNS = 'http://www.opengis.net/gml'; * @type {RegExp} * @private */ -_ol_format_GMLBase_.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/; +GMLBase.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/; /** @@ -108,7 +108,7 @@ _ol_format_GMLBase_.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/; * @param {Array.<*>} objectStack Object stack. * @return {Array. | undefined} Features. */ -_ol_format_GMLBase_.prototype.readFeaturesInternal = function(node, objectStack) { +GMLBase.prototype.readFeaturesInternal = function(node, objectStack) { var localName = node.localName; var features = null; if (localName == 'FeatureCollection') { @@ -196,7 +196,7 @@ _ol_format_GMLBase_.prototype.readFeaturesInternal = function(node, objectStack) * @param {Array.<*>} objectStack Object stack. * @return {ol.geom.Geometry|undefined} Geometry. */ -_ol_format_GMLBase_.prototype.readGeometryElement = function(node, objectStack) { +GMLBase.prototype.readGeometryElement = function(node, objectStack) { var context = /** @type {Object} */ (objectStack[0]); context['srsName'] = node.firstElementChild.getAttribute('srsName'); context['srsDimension'] = node.firstElementChild.getAttribute('srsDimension'); @@ -205,7 +205,7 @@ _ol_format_GMLBase_.prototype.readGeometryElement = function(node, objectStack) this.GEOMETRY_PARSERS_, node, objectStack, this); if (geometry) { return ( - /** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(geometry, false, context) + /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions(geometry, false, context) ); } else { return undefined; @@ -218,10 +218,10 @@ _ol_format_GMLBase_.prototype.readGeometryElement = function(node, objectStack) * @param {Array.<*>} objectStack Object stack. * @return {ol.Feature} Feature. */ -_ol_format_GMLBase_.prototype.readFeatureElement = function(node, objectStack) { +GMLBase.prototype.readFeatureElement = function(node, objectStack) { var n; var fid = node.getAttribute('fid') || - _ol_xml_.getAttributeNS(node, _ol_format_GMLBase_.GMLNS, 'id'); + _ol_xml_.getAttributeNS(node, GMLBase.GMLNS, 'id'); var values = {}, geometryName; for (n = node.firstElementChild; n; n = n.nextElementSibling) { var localName = n.localName; @@ -232,7 +232,7 @@ _ol_format_GMLBase_.prototype.readFeatureElement = function(node, objectStack) { (n.childNodes.length === 1 && (n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))) { var value = _ol_xml_.getAllTextContent(n, false); - if (_ol_format_GMLBase_.ONLY_WHITESPACE_RE_.test(value)) { + if (GMLBase.ONLY_WHITESPACE_RE_.test(value)) { value = undefined; } values[localName] = value; @@ -260,7 +260,7 @@ _ol_format_GMLBase_.prototype.readFeatureElement = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {ol.geom.Point|undefined} Point. */ -_ol_format_GMLBase_.prototype.readPoint = function(node, objectStack) { +GMLBase.prototype.readPoint = function(node, objectStack) { var flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack); if (flatCoordinates) { @@ -276,7 +276,7 @@ _ol_format_GMLBase_.prototype.readPoint = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {ol.geom.MultiPoint|undefined} MultiPoint. */ -_ol_format_GMLBase_.prototype.readMultiPoint = function(node, objectStack) { +GMLBase.prototype.readMultiPoint = function(node, objectStack) { /** @type {Array.>} */ var coordinates = _ol_xml_.pushParseAndPop([], this.MULTIPOINT_PARSERS_, node, objectStack, this); @@ -293,7 +293,7 @@ _ol_format_GMLBase_.prototype.readMultiPoint = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {ol.geom.MultiLineString|undefined} MultiLineString. */ -_ol_format_GMLBase_.prototype.readMultiLineString = function(node, objectStack) { +GMLBase.prototype.readMultiLineString = function(node, objectStack) { /** @type {Array.} */ var lineStrings = _ol_xml_.pushParseAndPop([], this.MULTILINESTRING_PARSERS_, node, objectStack, this); @@ -312,7 +312,7 @@ _ol_format_GMLBase_.prototype.readMultiLineString = function(node, objectStack) * @param {Array.<*>} objectStack Object stack. * @return {ol.geom.MultiPolygon|undefined} MultiPolygon. */ -_ol_format_GMLBase_.prototype.readMultiPolygon = function(node, objectStack) { +GMLBase.prototype.readMultiPolygon = function(node, objectStack) { /** @type {Array.} */ var polygons = _ol_xml_.pushParseAndPop([], this.MULTIPOLYGON_PARSERS_, node, objectStack, this); @@ -331,7 +331,7 @@ _ol_format_GMLBase_.prototype.readMultiPolygon = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GMLBase_.prototype.pointMemberParser_ = function(node, objectStack) { +GMLBase.prototype.pointMemberParser_ = function(node, objectStack) { _ol_xml_.parseNode(this.POINTMEMBER_PARSERS_, node, objectStack, this); }; @@ -342,7 +342,7 @@ _ol_format_GMLBase_.prototype.pointMemberParser_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GMLBase_.prototype.lineStringMemberParser_ = function(node, objectStack) { +GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack) { _ol_xml_.parseNode(this.LINESTRINGMEMBER_PARSERS_, node, objectStack, this); }; @@ -353,7 +353,7 @@ _ol_format_GMLBase_.prototype.lineStringMemberParser_ = function(node, objectSta * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GMLBase_.prototype.polygonMemberParser_ = function(node, objectStack) { +GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) { _ol_xml_.parseNode(this.POLYGONMEMBER_PARSERS_, node, objectStack, this); }; @@ -364,7 +364,7 @@ _ol_format_GMLBase_.prototype.polygonMemberParser_ = function(node, objectStack) * @param {Array.<*>} objectStack Object stack. * @return {ol.geom.LineString|undefined} LineString. */ -_ol_format_GMLBase_.prototype.readLineString = function(node, objectStack) { +GMLBase.prototype.readLineString = function(node, objectStack) { var flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack); if (flatCoordinates) { @@ -383,7 +383,7 @@ _ol_format_GMLBase_.prototype.readLineString = function(node, objectStack) { * @private * @return {Array.|undefined} LinearRing flat coordinates. */ -_ol_format_GMLBase_.prototype.readFlatLinearRing_ = function(node, objectStack) { +GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) { var ring = _ol_xml_.pushParseAndPop(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack, this); @@ -400,7 +400,7 @@ _ol_format_GMLBase_.prototype.readFlatLinearRing_ = function(node, objectStack) * @param {Array.<*>} objectStack Object stack. * @return {ol.geom.LinearRing|undefined} LinearRing. */ -_ol_format_GMLBase_.prototype.readLinearRing = function(node, objectStack) { +GMLBase.prototype.readLinearRing = function(node, objectStack) { var flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack); if (flatCoordinates) { @@ -418,7 +418,7 @@ _ol_format_GMLBase_.prototype.readLinearRing = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {ol.geom.Polygon|undefined} Polygon. */ -_ol_format_GMLBase_.prototype.readPolygon = function(node, objectStack) { +GMLBase.prototype.readPolygon = function(node, objectStack) { /** @type {Array.>} */ var flatLinearRings = _ol_xml_.pushParseAndPop([null], this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); @@ -446,7 +446,7 @@ _ol_format_GMLBase_.prototype.readPolygon = function(node, objectStack) { * @private * @return {Array.} Flat coordinates. */ -_ol_format_GMLBase_.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) { +GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack, this); @@ -458,12 +458,12 @@ _ol_format_GMLBase_.prototype.readFlatCoordinatesFromNode_ = function(node, obje * @type {Object.>} * @private */ -_ol_format_GMLBase_.prototype.MULTIPOINT_PARSERS_ = { +GMLBase.prototype.MULTIPOINT_PARSERS_ = { 'http://www.opengis.net/gml': { 'pointMember': _ol_xml_.makeArrayPusher( - _ol_format_GMLBase_.prototype.pointMemberParser_), + GMLBase.prototype.pointMemberParser_), 'pointMembers': _ol_xml_.makeArrayPusher( - _ol_format_GMLBase_.prototype.pointMemberParser_) + GMLBase.prototype.pointMemberParser_) } }; @@ -473,12 +473,12 @@ _ol_format_GMLBase_.prototype.MULTIPOINT_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GMLBase_.prototype.MULTILINESTRING_PARSERS_ = { +GMLBase.prototype.MULTILINESTRING_PARSERS_ = { 'http://www.opengis.net/gml': { 'lineStringMember': _ol_xml_.makeArrayPusher( - _ol_format_GMLBase_.prototype.lineStringMemberParser_), + GMLBase.prototype.lineStringMemberParser_), 'lineStringMembers': _ol_xml_.makeArrayPusher( - _ol_format_GMLBase_.prototype.lineStringMemberParser_) + GMLBase.prototype.lineStringMemberParser_) } }; @@ -488,12 +488,12 @@ _ol_format_GMLBase_.prototype.MULTILINESTRING_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GMLBase_.prototype.MULTIPOLYGON_PARSERS_ = { +GMLBase.prototype.MULTIPOLYGON_PARSERS_ = { 'http://www.opengis.net/gml': { 'polygonMember': _ol_xml_.makeArrayPusher( - _ol_format_GMLBase_.prototype.polygonMemberParser_), + GMLBase.prototype.polygonMemberParser_), 'polygonMembers': _ol_xml_.makeArrayPusher( - _ol_format_GMLBase_.prototype.polygonMemberParser_) + GMLBase.prototype.polygonMemberParser_) } }; @@ -503,10 +503,10 @@ _ol_format_GMLBase_.prototype.MULTIPOLYGON_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GMLBase_.prototype.POINTMEMBER_PARSERS_ = { +GMLBase.prototype.POINTMEMBER_PARSERS_ = { 'http://www.opengis.net/gml': { 'Point': _ol_xml_.makeArrayPusher( - _ol_format_GMLBase_.prototype.readFlatCoordinatesFromNode_) + GMLBase.prototype.readFlatCoordinatesFromNode_) } }; @@ -516,10 +516,10 @@ _ol_format_GMLBase_.prototype.POINTMEMBER_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GMLBase_.prototype.LINESTRINGMEMBER_PARSERS_ = { +GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = { 'http://www.opengis.net/gml': { 'LineString': _ol_xml_.makeArrayPusher( - _ol_format_GMLBase_.prototype.readLineString) + GMLBase.prototype.readLineString) } }; @@ -529,10 +529,10 @@ _ol_format_GMLBase_.prototype.LINESTRINGMEMBER_PARSERS_ = { * @type {Object.>} * @private */ -_ol_format_GMLBase_.prototype.POLYGONMEMBER_PARSERS_ = { +GMLBase.prototype.POLYGONMEMBER_PARSERS_ = { 'http://www.opengis.net/gml': { 'Polygon': _ol_xml_.makeArrayPusher( - _ol_format_GMLBase_.prototype.readPolygon) + GMLBase.prototype.readPolygon) } }; @@ -542,10 +542,10 @@ _ol_format_GMLBase_.prototype.POLYGONMEMBER_PARSERS_ = { * @type {Object.>} * @protected */ -_ol_format_GMLBase_.prototype.RING_PARSERS = { +GMLBase.prototype.RING_PARSERS = { 'http://www.opengis.net/gml': { 'LinearRing': _ol_xml_.makeReplacer( - _ol_format_GMLBase_.prototype.readFlatLinearRing_) + GMLBase.prototype.readFlatLinearRing_) } }; @@ -553,7 +553,7 @@ _ol_format_GMLBase_.prototype.RING_PARSERS = { /** * @inheritDoc */ -_ol_format_GMLBase_.prototype.readGeometryFromNode = function(node, opt_options) { +GMLBase.prototype.readGeometryFromNode = function(node, opt_options) { var geometry = this.readGeometryElement(node, [this.getReadOptions(node, opt_options ? opt_options : {})]); return geometry ? geometry : null; @@ -569,13 +569,13 @@ _ol_format_GMLBase_.prototype.readGeometryFromNode = function(node, opt_options) * @return {Array.} Features. * @api */ -_ol_format_GMLBase_.prototype.readFeatures; +GMLBase.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_GMLBase_.prototype.readFeaturesFromNode = function(node, opt_options) { +GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) { var options = { featureType: this.featureType, featureNS: this.featureNS @@ -591,8 +591,8 @@ _ol_format_GMLBase_.prototype.readFeaturesFromNode = function(node, opt_options) /** * @inheritDoc */ -_ol_format_GMLBase_.prototype.readProjectionFromNode = function(node) { +GMLBase.prototype.readProjectionFromNode = function(node) { return getProjection(this.srsName ? this.srsName : node.firstElementChild.getAttribute('srsName')); }; -export default _ol_format_GMLBase_; +export default GMLBase; diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index 0f97695965..6fccfe8460 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -4,9 +4,9 @@ import {inherits} from '../index.js'; import _ol_Feature_ from '../Feature.js'; import _ol_array_ from '../array.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import FeatureFormat from '../format/Feature.js'; +import XMLFeature from '../format/XMLFeature.js'; +import XSD from '../format/XSD.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import LineString from '../geom/LineString.js'; import MultiLineString from '../geom/MultiLineString.js'; @@ -23,11 +23,11 @@ import _ol_xml_ from '../xml.js'; * @param {olx.format.GPXOptions=} opt_options Options. * @api */ -var _ol_format_GPX_ = function(opt_options) { +var GPX = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_format_XMLFeature_.call(this); + XMLFeature.call(this); /** * @inheritDoc @@ -41,7 +41,7 @@ var _ol_format_GPX_ = function(opt_options) { this.readExtensions_ = options.readExtensions; }; -inherits(_ol_format_GPX_, _ol_format_XMLFeature_); +inherits(GPX, XMLFeature); /** @@ -49,7 +49,7 @@ inherits(_ol_format_GPX_, _ol_format_XMLFeature_); * @private * @type {Array.} */ -_ol_format_GPX_.NAMESPACE_URIS_ = [ +GPX.NAMESPACE_URIS_ = [ null, 'http://www.topografix.com/GPX/1/0', 'http://www.topografix.com/GPX/1/1' @@ -61,7 +61,7 @@ _ol_format_GPX_.NAMESPACE_URIS_ = [ * @type {string} * @private */ -_ol_format_GPX_.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' + +GPX.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' + 'http://www.topografix.com/GPX/1/1/gpx.xsd'; @@ -73,7 +73,7 @@ _ol_format_GPX_.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' + * @private * @return {Array.} Flat coordinates. */ -_ol_format_GPX_.appendCoordinate_ = function(flatCoordinates, layoutOptions, node, values) { +GPX.appendCoordinate_ = function(flatCoordinates, layoutOptions, node, values) { flatCoordinates.push( parseFloat(node.getAttribute('lon')), parseFloat(node.getAttribute('lat'))); @@ -104,7 +104,7 @@ _ol_format_GPX_.appendCoordinate_ = function(flatCoordinates, layoutOptions, nod * @param {Array.=} ends Ends. * @return {ol.geom.GeometryLayout} Layout. */ -_ol_format_GPX_.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, ends) { +GPX.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, ends) { var layout = GeometryLayout.XY; var stride = 2; if (layoutOptions.hasZ && layoutOptions.hasM) { @@ -145,13 +145,13 @@ _ol_format_GPX_.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, e * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GPX_.parseLink_ = function(node, objectStack) { +GPX.parseLink_ = function(node, objectStack) { var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); var href = node.getAttribute('href'); if (href !== null) { values['link'] = href; } - _ol_xml_.parseNode(_ol_format_GPX_.LINK_PARSERS_, node, objectStack); + _ol_xml_.parseNode(GPX.LINK_PARSERS_, node, objectStack); }; @@ -160,7 +160,7 @@ _ol_format_GPX_.parseLink_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GPX_.parseExtensions_ = function(node, objectStack) { +GPX.parseExtensions_ = function(node, objectStack) { var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); values['extensionsNode_'] = node; }; @@ -171,16 +171,16 @@ _ol_format_GPX_.parseExtensions_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GPX_.parseRtePt_ = function(node, objectStack) { +GPX.parseRtePt_ = function(node, objectStack) { var values = _ol_xml_.pushParseAndPop( - {}, _ol_format_GPX_.RTEPT_PARSERS_, node, objectStack); + {}, GPX.RTEPT_PARSERS_, node, objectStack); if (values) { var rteValues = /** @type {Object} */ (objectStack[objectStack.length - 1]); var flatCoordinates = /** @type {Array.} */ (rteValues['flatCoordinates']); var layoutOptions = /** @type {ol.LayoutOptions} */ (rteValues['layoutOptions']); - _ol_format_GPX_.appendCoordinate_(flatCoordinates, layoutOptions, node, values); + GPX.appendCoordinate_(flatCoordinates, layoutOptions, node, values); } }; @@ -190,16 +190,16 @@ _ol_format_GPX_.parseRtePt_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GPX_.parseTrkPt_ = function(node, objectStack) { +GPX.parseTrkPt_ = function(node, objectStack) { var values = _ol_xml_.pushParseAndPop( - {}, _ol_format_GPX_.TRKPT_PARSERS_, node, objectStack); + {}, GPX.TRKPT_PARSERS_, node, objectStack); if (values) { var trkValues = /** @type {Object} */ (objectStack[objectStack.length - 1]); var flatCoordinates = /** @type {Array.} */ (trkValues['flatCoordinates']); var layoutOptions = /** @type {ol.LayoutOptions} */ (trkValues['layoutOptions']); - _ol_format_GPX_.appendCoordinate_(flatCoordinates, layoutOptions, node, values); + GPX.appendCoordinate_(flatCoordinates, layoutOptions, node, values); } }; @@ -209,9 +209,9 @@ _ol_format_GPX_.parseTrkPt_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GPX_.parseTrkSeg_ = function(node, objectStack) { +GPX.parseTrkSeg_ = function(node, objectStack) { var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); - _ol_xml_.parseNode(_ol_format_GPX_.TRKSEG_PARSERS_, node, objectStack); + _ol_xml_.parseNode(GPX.TRKSEG_PARSERS_, node, objectStack); var flatCoordinates = /** @type {Array.} */ (values['flatCoordinates']); var ends = /** @type {Array.} */ (values['ends']); @@ -225,12 +225,12 @@ _ol_format_GPX_.parseTrkSeg_ = function(node, objectStack) { * @private * @return {ol.Feature|undefined} Track. */ -_ol_format_GPX_.readRte_ = function(node, objectStack) { +GPX.readRte_ = function(node, objectStack) { var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var values = _ol_xml_.pushParseAndPop({ 'flatCoordinates': [], 'layoutOptions': {} - }, _ol_format_GPX_.RTE_PARSERS_, node, objectStack); + }, GPX.RTE_PARSERS_, node, objectStack); if (!values) { return undefined; } @@ -239,10 +239,10 @@ _ol_format_GPX_.readRte_ = function(node, objectStack) { delete values['flatCoordinates']; var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']); delete values['layoutOptions']; - var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, flatCoordinates); + var layout = GPX.applyLayoutOptions_(layoutOptions, flatCoordinates); var geometry = new LineString(null); geometry.setFlatCoordinates(layout, flatCoordinates); - _ol_format_Feature_.transformWithOptions(geometry, false, options); + FeatureFormat.transformWithOptions(geometry, false, options); var feature = new _ol_Feature_(geometry); feature.setProperties(values); return feature; @@ -255,13 +255,13 @@ _ol_format_GPX_.readRte_ = function(node, objectStack) { * @private * @return {ol.Feature|undefined} Track. */ -_ol_format_GPX_.readTrk_ = function(node, objectStack) { +GPX.readTrk_ = function(node, objectStack) { var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var values = _ol_xml_.pushParseAndPop({ 'flatCoordinates': [], 'ends': [], 'layoutOptions': {} - }, _ol_format_GPX_.TRK_PARSERS_, node, objectStack); + }, GPX.TRK_PARSERS_, node, objectStack); if (!values) { return undefined; } @@ -272,10 +272,10 @@ _ol_format_GPX_.readTrk_ = function(node, objectStack) { delete values['ends']; var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']); delete values['layoutOptions']; - var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, flatCoordinates, ends); + var layout = GPX.applyLayoutOptions_(layoutOptions, flatCoordinates, ends); var geometry = new MultiLineString(null); geometry.setFlatCoordinates(layout, flatCoordinates, ends); - _ol_format_Feature_.transformWithOptions(geometry, false, options); + FeatureFormat.transformWithOptions(geometry, false, options); var feature = new _ol_Feature_(geometry); feature.setProperties(values); return feature; @@ -288,18 +288,18 @@ _ol_format_GPX_.readTrk_ = function(node, objectStack) { * @private * @return {ol.Feature|undefined} Waypoint. */ -_ol_format_GPX_.readWpt_ = function(node, objectStack) { +GPX.readWpt_ = function(node, objectStack) { var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var values = _ol_xml_.pushParseAndPop( - {}, _ol_format_GPX_.WPT_PARSERS_, node, objectStack); + {}, GPX.WPT_PARSERS_, node, objectStack); if (!values) { return undefined; } var layoutOptions = /** @type {ol.LayoutOptions} */ ({}); - var coordinates = _ol_format_GPX_.appendCoordinate_([], layoutOptions, node, values); - var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, coordinates); + var coordinates = GPX.appendCoordinate_([], layoutOptions, node, values); + var layout = GPX.applyLayoutOptions_(layoutOptions, coordinates); var geometry = new Point(coordinates, layout); - _ol_format_Feature_.transformWithOptions(geometry, false, options); + FeatureFormat.transformWithOptions(geometry, false, options); var feature = new _ol_Feature_(geometry); feature.setProperties(values); return feature; @@ -311,10 +311,10 @@ _ol_format_GPX_.readWpt_ = function(node, objectStack) { * @type {Object.): (ol.Feature|undefined)>} * @private */ -_ol_format_GPX_.FEATURE_READER_ = { - 'rte': _ol_format_GPX_.readRte_, - 'trk': _ol_format_GPX_.readTrk_, - 'wpt': _ol_format_GPX_.readWpt_ +GPX.FEATURE_READER_ = { + 'rte': GPX.readRte_, + 'trk': GPX.readTrk_, + 'wpt': GPX.readWpt_ }; @@ -323,11 +323,11 @@ _ol_format_GPX_.FEATURE_READER_ = { * @type {Object.>} * @private */ -_ol_format_GPX_.GPX_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'rte': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readRte_), - 'trk': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readTrk_), - 'wpt': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readWpt_) +GPX.GPX_PARSERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'rte': _ol_xml_.makeArrayPusher(GPX.readRte_), + 'trk': _ol_xml_.makeArrayPusher(GPX.readTrk_), + 'wpt': _ol_xml_.makeArrayPusher(GPX.readWpt_) }); @@ -336,12 +336,12 @@ _ol_format_GPX_.GPX_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.LINK_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { +GPX.LINK_PARSERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { 'text': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString, 'linkText'), + _ol_xml_.makeObjectPropertySetter(XSD.readString, 'linkText'), 'type': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString, 'linkType') + _ol_xml_.makeObjectPropertySetter(XSD.readString, 'linkType') }); @@ -350,18 +350,18 @@ _ol_format_GPX_.LINK_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.RTE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'link': _ol_format_GPX_.parseLink_, +GPX.RTE_PARSERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'src': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'link': GPX.parseLink_, 'number': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger), - 'extensions': _ol_format_GPX_.parseExtensions_, - 'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'rtept': _ol_format_GPX_.parseRtePt_ + _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger), + 'extensions': GPX.parseExtensions_, + 'type': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'rtept': GPX.parseRtePt_ }); @@ -370,10 +370,10 @@ _ol_format_GPX_.RTE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.RTEPT_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime) +GPX.RTEPT_PARSERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime) }); @@ -382,18 +382,18 @@ _ol_format_GPX_.RTEPT_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.TRK_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'link': _ol_format_GPX_.parseLink_, +GPX.TRK_PARSERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'src': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'link': GPX.parseLink_, 'number': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger), - 'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'extensions': _ol_format_GPX_.parseExtensions_, - 'trkseg': _ol_format_GPX_.parseTrkSeg_ + _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger), + 'type': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'extensions': GPX.parseExtensions_, + 'trkseg': GPX.parseTrkSeg_ }); @@ -402,9 +402,9 @@ _ol_format_GPX_.TRK_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.TRKSEG_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'trkpt': _ol_format_GPX_.parseTrkPt_ +GPX.TRKSEG_PARSERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'trkpt': GPX.parseTrkPt_ }); @@ -413,10 +413,10 @@ _ol_format_GPX_.TRKSEG_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.TRKPT_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime) +GPX.TRKPT_PARSERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime) }); @@ -425,30 +425,30 @@ _ol_format_GPX_.TRKPT_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.WPT_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime), - 'magvar': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'geoidheight': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'link': _ol_format_GPX_.parseLink_, - 'sym': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'fix': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), +GPX.WPT_PARSERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime), + 'magvar': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'geoidheight': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'src': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'link': GPX.parseLink_, + 'sym': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'type': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'fix': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'sat': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), - 'hdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'vdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'pdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), + XSD.readNonNegativeInteger), + 'hdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'vdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'pdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), 'ageofdgpsdata': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), + _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), 'dgpsid': - _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger), - 'extensions': _ol_format_GPX_.parseExtensions_ + _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger), + 'extensions': GPX.parseExtensions_ }); @@ -456,7 +456,7 @@ _ol_format_GPX_.WPT_PARSERS_ = _ol_xml_.makeStructureNS( * @param {Array.} features List of features. * @private */ -_ol_format_GPX_.prototype.handleReadExtensions_ = function(features) { +GPX.prototype.handleReadExtensions_ = function(features) { if (!features) { features = []; } @@ -482,17 +482,17 @@ _ol_format_GPX_.prototype.handleReadExtensions_ = function(features) { * @return {ol.Feature} Feature. * @api */ -_ol_format_GPX_.prototype.readFeature; +GPX.prototype.readFeature; /** * @inheritDoc */ -_ol_format_GPX_.prototype.readFeatureFromNode = function(node, opt_options) { - if (!_ol_array_.includes(_ol_format_GPX_.NAMESPACE_URIS_, node.namespaceURI)) { +GPX.prototype.readFeatureFromNode = function(node, opt_options) { + if (!_ol_array_.includes(GPX.NAMESPACE_URIS_, node.namespaceURI)) { return null; } - var featureReader = _ol_format_GPX_.FEATURE_READER_[node.localName]; + var featureReader = GPX.FEATURE_READER_[node.localName]; if (!featureReader) { return null; } @@ -516,19 +516,19 @@ _ol_format_GPX_.prototype.readFeatureFromNode = function(node, opt_options) { * @return {Array.} Features. * @api */ -_ol_format_GPX_.prototype.readFeatures; +GPX.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_GPX_.prototype.readFeaturesFromNode = function(node, opt_options) { - if (!_ol_array_.includes(_ol_format_GPX_.NAMESPACE_URIS_, node.namespaceURI)) { +GPX.prototype.readFeaturesFromNode = function(node, opt_options) { + if (!_ol_array_.includes(GPX.NAMESPACE_URIS_, node.namespaceURI)) { return []; } if (node.localName == 'gpx') { /** @type {Array.} */ - var features = _ol_xml_.pushParseAndPop([], _ol_format_GPX_.GPX_PARSERS_, + var features = _ol_xml_.pushParseAndPop([], GPX.GPX_PARSERS_, node, [this.getReadOptions(node, opt_options)]); if (features) { this.handleReadExtensions_(features); @@ -549,7 +549,7 @@ _ol_format_GPX_.prototype.readFeaturesFromNode = function(node, opt_options) { * @return {ol.proj.Projection} Projection. * @api */ -_ol_format_GPX_.prototype.readProjection; +GPX.prototype.readProjection; /** @@ -558,7 +558,7 @@ _ol_format_GPX_.prototype.readProjection; * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_GPX_.writeLink_ = function(node, value, objectStack) { +GPX.writeLink_ = function(node, value, objectStack) { node.setAttribute('href', value); var context = objectStack[objectStack.length - 1]; var properties = context['properties']; @@ -567,8 +567,8 @@ _ol_format_GPX_.writeLink_ = function(node, value, objectStack) { properties['linkType'] ]; _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node}), - _ol_format_GPX_.LINK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, - link, objectStack, _ol_format_GPX_.LINK_SEQUENCE_); + GPX.LINK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, + link, objectStack, GPX.LINK_SEQUENCE_); }; @@ -578,7 +578,7 @@ _ol_format_GPX_.writeLink_ = function(node, value, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GPX_.writeWptType_ = function(node, coordinate, objectStack) { +GPX.writeWptType_ = function(node, coordinate, objectStack) { var context = objectStack[objectStack.length - 1]; var parentNode = context.node; var namespaceURI = parentNode.namespaceURI; @@ -607,12 +607,12 @@ _ol_format_GPX_.writeWptType_ = function(node, coordinate, objectStack) { // pass } var orderedKeys = (node.nodeName == 'rtept') ? - _ol_format_GPX_.RTEPT_TYPE_SEQUENCE_[namespaceURI] : - _ol_format_GPX_.WPT_TYPE_SEQUENCE_[namespaceURI]; + GPX.RTEPT_TYPE_SEQUENCE_[namespaceURI] : + GPX.WPT_TYPE_SEQUENCE_[namespaceURI]; var values = _ol_xml_.makeSequence(properties, orderedKeys); _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node, 'properties': properties}), - _ol_format_GPX_.WPT_TYPE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, + GPX.WPT_TYPE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); }; @@ -623,22 +623,22 @@ _ol_format_GPX_.writeWptType_ = function(node, coordinate, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GPX_.writeRte_ = function(node, feature, objectStack) { +GPX.writeRte_ = function(node, feature, objectStack) { var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); var properties = feature.getProperties(); var context = {node: node, 'properties': properties}; var geometry = feature.getGeometry(); if (geometry) { geometry = /** @type {ol.geom.LineString} */ - (_ol_format_Feature_.transformWithOptions(geometry, true, options)); + (FeatureFormat.transformWithOptions(geometry, true, options)); context['geometryLayout'] = geometry.getLayout(); properties['rtept'] = geometry.getCoordinates(); } var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = _ol_format_GPX_.RTE_SEQUENCE_[parentNode.namespaceURI]; + var orderedKeys = GPX.RTE_SEQUENCE_[parentNode.namespaceURI]; var values = _ol_xml_.makeSequence(properties, orderedKeys); _ol_xml_.pushSerializeAndPop(context, - _ol_format_GPX_.RTE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, + GPX.RTE_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); }; @@ -649,7 +649,7 @@ _ol_format_GPX_.writeRte_ = function(node, feature, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GPX_.writeTrk_ = function(node, feature, objectStack) { +GPX.writeTrk_ = function(node, feature, objectStack) { var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); var properties = feature.getProperties(); /** @type {ol.XmlNodeStackItem} */ @@ -657,14 +657,14 @@ _ol_format_GPX_.writeTrk_ = function(node, feature, objectStack) { var geometry = feature.getGeometry(); if (geometry) { geometry = /** @type {ol.geom.MultiLineString} */ - (_ol_format_Feature_.transformWithOptions(geometry, true, options)); + (FeatureFormat.transformWithOptions(geometry, true, options)); properties['trkseg'] = geometry.getLineStrings(); } var parentNode = objectStack[objectStack.length - 1].node; - var orderedKeys = _ol_format_GPX_.TRK_SEQUENCE_[parentNode.namespaceURI]; + var orderedKeys = GPX.TRK_SEQUENCE_[parentNode.namespaceURI]; var values = _ol_xml_.makeSequence(properties, orderedKeys); _ol_xml_.pushSerializeAndPop(context, - _ol_format_GPX_.TRK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, + GPX.TRK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); }; @@ -675,12 +675,12 @@ _ol_format_GPX_.writeTrk_ = function(node, feature, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GPX_.writeTrkSeg_ = function(node, lineString, objectStack) { +GPX.writeTrkSeg_ = function(node, lineString, objectStack) { /** @type {ol.XmlNodeStackItem} */ var context = {node: node, 'geometryLayout': lineString.getLayout(), 'properties': {}}; _ol_xml_.pushSerializeAndPop(context, - _ol_format_GPX_.TRKSEG_SERIALIZERS_, _ol_format_GPX_.TRKSEG_NODE_FACTORY_, + GPX.TRKSEG_SERIALIZERS_, GPX.TRKSEG_NODE_FACTORY_, lineString.getCoordinates(), objectStack); }; @@ -691,16 +691,16 @@ _ol_format_GPX_.writeTrkSeg_ = function(node, lineString, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_GPX_.writeWpt_ = function(node, feature, objectStack) { +GPX.writeWpt_ = function(node, feature, objectStack) { var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); var context = objectStack[objectStack.length - 1]; context['properties'] = feature.getProperties(); var geometry = feature.getGeometry(); if (geometry) { geometry = /** @type {ol.geom.Point} */ - (_ol_format_Feature_.transformWithOptions(geometry, true, options)); + (FeatureFormat.transformWithOptions(geometry, true, options)); context['geometryLayout'] = geometry.getLayout(); - _ol_format_GPX_.writeWptType_(node, geometry.getCoordinates(), objectStack); + GPX.writeWptType_(node, geometry.getCoordinates(), objectStack); } }; @@ -710,17 +710,17 @@ _ol_format_GPX_.writeWpt_ = function(node, feature, objectStack) { * @type {Array.} * @private */ -_ol_format_GPX_.LINK_SEQUENCE_ = ['text', 'type']; +GPX.LINK_SEQUENCE_ = ['text', 'type']; /** * @type {Object.>} * @private */ -_ol_format_GPX_.LINK_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'text': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) +GPX.LINK_SERIALIZERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'text': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode) }); @@ -729,8 +729,8 @@ _ol_format_GPX_.LINK_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.RTE_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, [ +GPX.RTE_SEQUENCE_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, [ 'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'rtept' ]); @@ -740,18 +740,18 @@ _ol_format_GPX_.RTE_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.RTE_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_), +GPX.RTE_SERIALIZERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'link': _ol_xml_.makeChildAppender(GPX.writeLink_), 'number': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeNonNegativeIntegerTextNode), - 'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + XSD.writeNonNegativeIntegerTextNode), + 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'rtept': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender( - _ol_format_GPX_.writeWptType_)) + GPX.writeWptType_)) }); @@ -760,8 +760,8 @@ _ol_format_GPX_.RTE_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.RTEPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, [ +GPX.RTEPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, [ 'ele', 'time' ]); @@ -771,8 +771,8 @@ _ol_format_GPX_.RTEPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.TRK_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, [ +GPX.TRK_SEQUENCE_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, [ 'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'trkseg' ]); @@ -782,18 +782,18 @@ _ol_format_GPX_.TRK_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.TRK_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_), +GPX.TRK_SERIALIZERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'link': _ol_xml_.makeChildAppender(GPX.writeLink_), 'number': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeNonNegativeIntegerTextNode), - 'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + XSD.writeNonNegativeIntegerTextNode), + 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'trkseg': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender( - _ol_format_GPX_.writeTrkSeg_)) + GPX.writeTrkSeg_)) }); @@ -802,7 +802,7 @@ _ol_format_GPX_.TRK_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {function(*, Array.<*>, string=): (Node|undefined)} * @private */ -_ol_format_GPX_.TRKSEG_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('trkpt'); +GPX.TRKSEG_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('trkpt'); /** @@ -810,9 +810,9 @@ _ol_format_GPX_.TRKSEG_NODE_FACTORY_ = _ol_xml_.makeSimpleNodeFactory('trkpt'); * @type {Object.>} * @private */ -_ol_format_GPX_.TRKSEG_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'trkpt': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeWptType_) +GPX.TRKSEG_SERIALIZERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'trkpt': _ol_xml_.makeChildAppender(GPX.writeWptType_) }); @@ -821,8 +821,8 @@ _ol_format_GPX_.TRKSEG_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.WPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, [ +GPX.WPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, [ 'ele', 'time', 'magvar', 'geoidheight', 'name', 'cmt', 'desc', 'src', 'link', 'sym', 'type', 'fix', 'sat', 'hdop', 'vdop', 'pdop', 'ageofdgpsdata', 'dgpsid' @@ -833,30 +833,30 @@ _ol_format_GPX_.WPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_GPX_.WPT_TYPE_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'ele': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'time': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDateTimeTextNode), - 'magvar': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), +GPX.WPT_TYPE_SERIALIZERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'ele': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'time': _ol_xml_.makeChildAppender(XSD.writeDateTimeTextNode), + 'magvar': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), 'geoidheight': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeDecimalTextNode), - 'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_), - 'sym': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'fix': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + XSD.writeDecimalTextNode), + 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'link': _ol_xml_.makeChildAppender(GPX.writeLink_), + 'sym': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'fix': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'sat': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeNonNegativeIntegerTextNode), - 'hdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'vdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'pdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), + XSD.writeNonNegativeIntegerTextNode), + 'hdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'vdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'pdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), 'ageofdgpsdata': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeDecimalTextNode), + XSD.writeDecimalTextNode), 'dgpsid': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeNonNegativeIntegerTextNode) + XSD.writeNonNegativeIntegerTextNode) }); @@ -865,7 +865,7 @@ _ol_format_GPX_.WPT_TYPE_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @type {Object.} * @private */ -_ol_format_GPX_.GEOMETRY_TYPE_TO_NODENAME_ = { +GPX.GEOMETRY_TYPE_TO_NODENAME_ = { 'Point': 'wpt', 'LineString': 'rte', 'MultiLineString': 'trk' @@ -880,10 +880,10 @@ _ol_format_GPX_.GEOMETRY_TYPE_TO_NODENAME_ = { * @return {Node|undefined} Node. * @private */ -_ol_format_GPX_.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { +GPX.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { var geometry = /** @type {ol.Feature} */ (value).getGeometry(); if (geometry) { - var nodeName = _ol_format_GPX_.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()]; + var nodeName = GPX.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()]; if (nodeName) { var parentNode = objectStack[objectStack.length - 1].node; return _ol_xml_.createElementNS(parentNode.namespaceURI, nodeName); @@ -897,11 +897,11 @@ _ol_format_GPX_.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { * @type {Object.>} * @private */ -_ol_format_GPX_.GPX_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_GPX_.NAMESPACE_URIS_, { - 'rte': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeRte_), - 'trk': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeTrk_), - 'wpt': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeWpt_) +GPX.GPX_SERIALIZERS_ = _ol_xml_.makeStructureNS( + GPX.NAMESPACE_URIS_, { + 'rte': _ol_xml_.makeChildAppender(GPX.writeRte_), + 'trk': _ol_xml_.makeChildAppender(GPX.writeTrk_), + 'wpt': _ol_xml_.makeChildAppender(GPX.writeWpt_) }); @@ -916,7 +916,7 @@ _ol_format_GPX_.GPX_SERIALIZERS_ = _ol_xml_.makeStructureNS( * @return {string} Result. * @api */ -_ol_format_GPX_.prototype.writeFeatures; +GPX.prototype.writeFeatures; /** @@ -930,7 +930,7 @@ _ol_format_GPX_.prototype.writeFeatures; * @override * @api */ -_ol_format_GPX_.prototype.writeFeaturesNode = function(features, opt_options) { +GPX.prototype.writeFeaturesNode = function(features, opt_options) { opt_options = this.adaptOptions(opt_options); //FIXME Serialize metadata var gpx = _ol_xml_.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx'); @@ -938,13 +938,13 @@ _ol_format_GPX_.prototype.writeFeaturesNode = function(features, opt_options) { var xmlSchemaInstanceUri = 'http://www.w3.org/2001/XMLSchema-instance'; _ol_xml_.setAttributeNS(gpx, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri); _ol_xml_.setAttributeNS(gpx, xmlSchemaInstanceUri, 'xsi:schemaLocation', - _ol_format_GPX_.SCHEMA_LOCATION_); + GPX.SCHEMA_LOCATION_); gpx.setAttribute('version', '1.1'); gpx.setAttribute('creator', 'OpenLayers'); _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ - ({node: gpx}), _ol_format_GPX_.GPX_SERIALIZERS_, - _ol_format_GPX_.GPX_NODE_FACTORY_, features, [opt_options]); + ({node: gpx}), GPX.GPX_SERIALIZERS_, + GPX.GPX_NODE_FACTORY_, features, [opt_options]); return gpx; }; -export default _ol_format_GPX_; +export default GPX; diff --git a/src/ol/format/GeoJSON.js b/src/ol/format/GeoJSON.js index 0c4e0ede91..bd9c4eeb79 100644 --- a/src/ol/format/GeoJSON.js +++ b/src/ol/format/GeoJSON.js @@ -7,8 +7,8 @@ import {inherits} from '../index.js'; import _ol_asserts_ from '../asserts.js'; import _ol_Feature_ from '../Feature.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_JSONFeature_ from '../format/JSONFeature.js'; +import FeatureFormat from '../format/Feature.js'; +import JSONFeature from '../format/JSONFeature.js'; import GeometryCollection from '../geom/GeometryCollection.js'; import LineString from '../geom/LineString.js'; import MultiLineString from '../geom/MultiLineString.js'; @@ -28,11 +28,11 @@ import {get as getProjection} from '../proj.js'; * @param {olx.format.GeoJSONOptions=} opt_options Options. * @api */ -var _ol_format_GeoJSON_ = function(opt_options) { +var GeoJSON = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_format_JSONFeature_.call(this); + JSONFeature.call(this); /** * @inheritDoc @@ -62,7 +62,7 @@ var _ol_format_GeoJSON_ = function(opt_options) { }; -inherits(_ol_format_GeoJSON_, _ol_format_JSONFeature_); +inherits(GeoJSON, JSONFeature); /** @@ -71,13 +71,13 @@ inherits(_ol_format_GeoJSON_, _ol_format_JSONFeature_); * @private * @return {ol.geom.Geometry} Geometry. */ -_ol_format_GeoJSON_.readGeometry_ = function(object, opt_options) { +GeoJSON.readGeometry_ = function(object, opt_options) { if (!object) { return null; } - var geometryReader = _ol_format_GeoJSON_.GEOMETRY_READERS_[object.type]; + var geometryReader = GeoJSON.GEOMETRY_READERS_[object.type]; return ( - /** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions( + /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions( geometryReader(object), false, opt_options) ); }; @@ -89,7 +89,7 @@ _ol_format_GeoJSON_.readGeometry_ = function(object, opt_options) { * @private * @return {ol.geom.GeometryCollection} Geometry collection. */ -_ol_format_GeoJSON_.readGeometryCollectionGeometry_ = function( +GeoJSON.readGeometryCollectionGeometry_ = function( object, opt_options) { var geometries = object.geometries.map( /** @@ -97,7 +97,7 @@ _ol_format_GeoJSON_.readGeometryCollectionGeometry_ = function( * @return {ol.geom.Geometry} geometry Geometry. */ function(geometry) { - return _ol_format_GeoJSON_.readGeometry_(geometry, opt_options); + return GeoJSON.readGeometry_(geometry, opt_options); }); return new GeometryCollection(geometries); }; @@ -108,7 +108,7 @@ _ol_format_GeoJSON_.readGeometryCollectionGeometry_ = function( * @private * @return {ol.geom.Point} Point. */ -_ol_format_GeoJSON_.readPointGeometry_ = function(object) { +GeoJSON.readPointGeometry_ = function(object) { return new Point(object.coordinates); }; @@ -118,7 +118,7 @@ _ol_format_GeoJSON_.readPointGeometry_ = function(object) { * @private * @return {ol.geom.LineString} LineString. */ -_ol_format_GeoJSON_.readLineStringGeometry_ = function(object) { +GeoJSON.readLineStringGeometry_ = function(object) { return new LineString(object.coordinates); }; @@ -128,7 +128,7 @@ _ol_format_GeoJSON_.readLineStringGeometry_ = function(object) { * @private * @return {ol.geom.MultiLineString} MultiLineString. */ -_ol_format_GeoJSON_.readMultiLineStringGeometry_ = function(object) { +GeoJSON.readMultiLineStringGeometry_ = function(object) { return new MultiLineString(object.coordinates); }; @@ -138,7 +138,7 @@ _ol_format_GeoJSON_.readMultiLineStringGeometry_ = function(object) { * @private * @return {ol.geom.MultiPoint} MultiPoint. */ -_ol_format_GeoJSON_.readMultiPointGeometry_ = function(object) { +GeoJSON.readMultiPointGeometry_ = function(object) { return new MultiPoint(object.coordinates); }; @@ -148,7 +148,7 @@ _ol_format_GeoJSON_.readMultiPointGeometry_ = function(object) { * @private * @return {ol.geom.MultiPolygon} MultiPolygon. */ -_ol_format_GeoJSON_.readMultiPolygonGeometry_ = function(object) { +GeoJSON.readMultiPolygonGeometry_ = function(object) { return new MultiPolygon(object.coordinates); }; @@ -158,7 +158,7 @@ _ol_format_GeoJSON_.readMultiPolygonGeometry_ = function(object) { * @private * @return {ol.geom.Polygon} Polygon. */ -_ol_format_GeoJSON_.readPolygonGeometry_ = function(object) { +GeoJSON.readPolygonGeometry_ = function(object) { return new Polygon(object.coordinates); }; @@ -169,10 +169,10 @@ _ol_format_GeoJSON_.readPolygonGeometry_ = function(object) { * @private * @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry. */ -_ol_format_GeoJSON_.writeGeometry_ = function(geometry, opt_options) { - var geometryWriter = _ol_format_GeoJSON_.GEOMETRY_WRITERS_[geometry.getType()]; +GeoJSON.writeGeometry_ = function(geometry, opt_options) { + var geometryWriter = GeoJSON.GEOMETRY_WRITERS_[geometry.getType()]; return geometryWriter(/** @type {ol.geom.Geometry} */ ( - _ol_format_Feature_.transformWithOptions(geometry, true, opt_options)), + FeatureFormat.transformWithOptions(geometry, true, opt_options)), opt_options); }; @@ -182,7 +182,7 @@ _ol_format_GeoJSON_.writeGeometry_ = function(geometry, opt_options) { * @private * @return {GeoJSONGeometryCollection} Empty GeoJSON geometry collection. */ -_ol_format_GeoJSON_.writeEmptyGeometryCollectionGeometry_ = function(geometry) { +GeoJSON.writeEmptyGeometryCollectionGeometry_ = function(geometry) { return /** @type {GeoJSONGeometryCollection} */ ({ type: 'GeometryCollection', geometries: [] @@ -196,12 +196,12 @@ _ol_format_GeoJSON_.writeEmptyGeometryCollectionGeometry_ = function(geometry) { * @private * @return {GeoJSONGeometryCollection} GeoJSON geometry collection. */ -_ol_format_GeoJSON_.writeGeometryCollectionGeometry_ = function( +GeoJSON.writeGeometryCollectionGeometry_ = function( geometry, opt_options) { var geometries = geometry.getGeometriesArray().map(function(geometry) { var options = _ol_obj_.assign({}, opt_options); delete options.featureProjection; - return _ol_format_GeoJSON_.writeGeometry_(geometry, options); + return GeoJSON.writeGeometry_(geometry, options); }); return /** @type {GeoJSONGeometryCollection} */ ({ type: 'GeometryCollection', @@ -216,7 +216,7 @@ _ol_format_GeoJSON_.writeGeometryCollectionGeometry_ = function( * @private * @return {GeoJSONGeometry} GeoJSON geometry. */ -_ol_format_GeoJSON_.writeLineStringGeometry_ = function(geometry, opt_options) { +GeoJSON.writeLineStringGeometry_ = function(geometry, opt_options) { return /** @type {GeoJSONGeometry} */ ({ type: 'LineString', coordinates: geometry.getCoordinates() @@ -230,7 +230,7 @@ _ol_format_GeoJSON_.writeLineStringGeometry_ = function(geometry, opt_options) { * @private * @return {GeoJSONGeometry} GeoJSON geometry. */ -_ol_format_GeoJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_options) { +GeoJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options) { return /** @type {GeoJSONGeometry} */ ({ type: 'MultiLineString', coordinates: geometry.getCoordinates() @@ -244,7 +244,7 @@ _ol_format_GeoJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_optio * @private * @return {GeoJSONGeometry} GeoJSON geometry. */ -_ol_format_GeoJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) { +GeoJSON.writeMultiPointGeometry_ = function(geometry, opt_options) { return /** @type {GeoJSONGeometry} */ ({ type: 'MultiPoint', coordinates: geometry.getCoordinates() @@ -258,7 +258,7 @@ _ol_format_GeoJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) { * @private * @return {GeoJSONGeometry} GeoJSON geometry. */ -_ol_format_GeoJSON_.writeMultiPolygonGeometry_ = function(geometry, opt_options) { +GeoJSON.writeMultiPolygonGeometry_ = function(geometry, opt_options) { var right; if (opt_options) { right = opt_options.rightHanded; @@ -276,7 +276,7 @@ _ol_format_GeoJSON_.writeMultiPolygonGeometry_ = function(geometry, opt_options) * @private * @return {GeoJSONGeometry} GeoJSON geometry. */ -_ol_format_GeoJSON_.writePointGeometry_ = function(geometry, opt_options) { +GeoJSON.writePointGeometry_ = function(geometry, opt_options) { return /** @type {GeoJSONGeometry} */ ({ type: 'Point', coordinates: geometry.getCoordinates() @@ -290,7 +290,7 @@ _ol_format_GeoJSON_.writePointGeometry_ = function(geometry, opt_options) { * @private * @return {GeoJSONGeometry} GeoJSON geometry. */ -_ol_format_GeoJSON_.writePolygonGeometry_ = function(geometry, opt_options) { +GeoJSON.writePolygonGeometry_ = function(geometry, opt_options) { var right; if (opt_options) { right = opt_options.rightHanded; @@ -307,14 +307,14 @@ _ol_format_GeoJSON_.writePolygonGeometry_ = function(geometry, opt_options) { * @private * @type {Object.} */ -_ol_format_GeoJSON_.GEOMETRY_READERS_ = { - 'Point': _ol_format_GeoJSON_.readPointGeometry_, - 'LineString': _ol_format_GeoJSON_.readLineStringGeometry_, - 'Polygon': _ol_format_GeoJSON_.readPolygonGeometry_, - 'MultiPoint': _ol_format_GeoJSON_.readMultiPointGeometry_, - 'MultiLineString': _ol_format_GeoJSON_.readMultiLineStringGeometry_, - 'MultiPolygon': _ol_format_GeoJSON_.readMultiPolygonGeometry_, - 'GeometryCollection': _ol_format_GeoJSON_.readGeometryCollectionGeometry_ +GeoJSON.GEOMETRY_READERS_ = { + 'Point': GeoJSON.readPointGeometry_, + 'LineString': GeoJSON.readLineStringGeometry_, + 'Polygon': GeoJSON.readPolygonGeometry_, + 'MultiPoint': GeoJSON.readMultiPointGeometry_, + 'MultiLineString': GeoJSON.readMultiLineStringGeometry_, + 'MultiPolygon': GeoJSON.readMultiPolygonGeometry_, + 'GeometryCollection': GeoJSON.readGeometryCollectionGeometry_ }; @@ -323,15 +323,15 @@ _ol_format_GeoJSON_.GEOMETRY_READERS_ = { * @private * @type {Object.} */ -_ol_format_GeoJSON_.GEOMETRY_WRITERS_ = { - 'Point': _ol_format_GeoJSON_.writePointGeometry_, - 'LineString': _ol_format_GeoJSON_.writeLineStringGeometry_, - 'Polygon': _ol_format_GeoJSON_.writePolygonGeometry_, - 'MultiPoint': _ol_format_GeoJSON_.writeMultiPointGeometry_, - 'MultiLineString': _ol_format_GeoJSON_.writeMultiLineStringGeometry_, - 'MultiPolygon': _ol_format_GeoJSON_.writeMultiPolygonGeometry_, - 'GeometryCollection': _ol_format_GeoJSON_.writeGeometryCollectionGeometry_, - 'Circle': _ol_format_GeoJSON_.writeEmptyGeometryCollectionGeometry_ +GeoJSON.GEOMETRY_WRITERS_ = { + 'Point': GeoJSON.writePointGeometry_, + 'LineString': GeoJSON.writeLineStringGeometry_, + 'Polygon': GeoJSON.writePolygonGeometry_, + 'MultiPoint': GeoJSON.writeMultiPointGeometry_, + 'MultiLineString': GeoJSON.writeMultiLineStringGeometry_, + 'MultiPolygon': GeoJSON.writeMultiPolygonGeometry_, + 'GeometryCollection': GeoJSON.writeGeometryCollectionGeometry_, + 'Circle': GeoJSON.writeEmptyGeometryCollectionGeometry_ }; @@ -347,7 +347,7 @@ _ol_format_GeoJSON_.GEOMETRY_WRITERS_ = { * @return {ol.Feature} Feature. * @api */ -_ol_format_GeoJSON_.prototype.readFeature; +GeoJSON.prototype.readFeature; /** @@ -361,13 +361,13 @@ _ol_format_GeoJSON_.prototype.readFeature; * @return {Array.} Features. * @api */ -_ol_format_GeoJSON_.prototype.readFeatures; +GeoJSON.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_GeoJSON_.prototype.readFeatureFromObject = function( +GeoJSON.prototype.readFeatureFromObject = function( object, opt_options) { /** * @type {GeoJSONFeature} @@ -382,7 +382,7 @@ _ol_format_GeoJSON_.prototype.readFeatureFromObject = function( }); } - var geometry = _ol_format_GeoJSON_.readGeometry_(geoJSONFeature.geometry, opt_options); + var geometry = GeoJSON.readGeometry_(geoJSONFeature.geometry, opt_options); var feature = new _ol_Feature_(); if (this.geometryName_) { feature.setGeometryName(this.geometryName_); @@ -403,7 +403,7 @@ _ol_format_GeoJSON_.prototype.readFeatureFromObject = function( /** * @inheritDoc */ -_ol_format_GeoJSON_.prototype.readFeaturesFromObject = function( +GeoJSON.prototype.readFeaturesFromObject = function( object, opt_options) { var geoJSONObject = /** @type {GeoJSONObject} */ (object); /** @type {Array.} */ @@ -434,15 +434,15 @@ _ol_format_GeoJSON_.prototype.readFeaturesFromObject = function( * @return {ol.geom.Geometry} Geometry. * @api */ -_ol_format_GeoJSON_.prototype.readGeometry; +GeoJSON.prototype.readGeometry; /** * @inheritDoc */ -_ol_format_GeoJSON_.prototype.readGeometryFromObject = function( +GeoJSON.prototype.readGeometryFromObject = function( object, opt_options) { - return _ol_format_GeoJSON_.readGeometry_( + return GeoJSON.readGeometry_( /** @type {GeoJSONGeometry} */ (object), opt_options); }; @@ -455,13 +455,13 @@ _ol_format_GeoJSON_.prototype.readGeometryFromObject = function( * @return {ol.proj.Projection} Projection. * @api */ -_ol_format_GeoJSON_.prototype.readProjection; +GeoJSON.prototype.readProjection; /** * @inheritDoc */ -_ol_format_GeoJSON_.prototype.readProjectionFromObject = function(object) { +GeoJSON.prototype.readProjectionFromObject = function(object) { var geoJSONObject = /** @type {GeoJSONObject} */ (object); var crs = geoJSONObject.crs; var projection; @@ -488,7 +488,7 @@ _ol_format_GeoJSON_.prototype.readProjectionFromObject = function(object) { * @override * @api */ -_ol_format_GeoJSON_.prototype.writeFeature; +GeoJSON.prototype.writeFeature; /** @@ -500,7 +500,7 @@ _ol_format_GeoJSON_.prototype.writeFeature; * @override * @api */ -_ol_format_GeoJSON_.prototype.writeFeatureObject = function(feature, opt_options) { +GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) { opt_options = this.adaptOptions(opt_options); var object = /** @type {GeoJSONFeature} */ ({ @@ -513,7 +513,7 @@ _ol_format_GeoJSON_.prototype.writeFeatureObject = function(feature, opt_options var geometry = feature.getGeometry(); if (geometry) { object.geometry = - _ol_format_GeoJSON_.writeGeometry_(geometry, opt_options); + GeoJSON.writeGeometry_(geometry, opt_options); } else { object.geometry = null; } @@ -537,7 +537,7 @@ _ol_format_GeoJSON_.prototype.writeFeatureObject = function(feature, opt_options * @return {string} GeoJSON. * @api */ -_ol_format_GeoJSON_.prototype.writeFeatures; +GeoJSON.prototype.writeFeatures; /** @@ -549,7 +549,7 @@ _ol_format_GeoJSON_.prototype.writeFeatures; * @override * @api */ -_ol_format_GeoJSON_.prototype.writeFeaturesObject = function(features, opt_options) { +GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) { opt_options = this.adaptOptions(opt_options); var objects = []; var i, ii; @@ -572,7 +572,7 @@ _ol_format_GeoJSON_.prototype.writeFeaturesObject = function(features, opt_optio * @return {string} GeoJSON. * @api */ -_ol_format_GeoJSON_.prototype.writeGeometry; +GeoJSON.prototype.writeGeometry; /** @@ -584,9 +584,9 @@ _ol_format_GeoJSON_.prototype.writeGeometry; * @override * @api */ -_ol_format_GeoJSON_.prototype.writeGeometryObject = function(geometry, +GeoJSON.prototype.writeGeometryObject = function(geometry, opt_options) { - return _ol_format_GeoJSON_.writeGeometry_(geometry, + return GeoJSON.writeGeometry_(geometry, this.adaptOptions(opt_options)); }; -export default _ol_format_GeoJSON_; +export default GeoJSON; diff --git a/src/ol/format/IGC.js b/src/ol/format/IGC.js index dc238e7445..5bc8e137ff 100644 --- a/src/ol/format/IGC.js +++ b/src/ol/format/IGC.js @@ -3,9 +3,9 @@ */ import {inherits} from '../index.js'; import _ol_Feature_ from '../Feature.js'; -import _ol_format_Feature_ from '../format/Feature.js'; +import FeatureFormat from '../format/Feature.js'; import _ol_format_IGCZ_ from '../format/IGCZ.js'; -import _ol_format_TextFeature_ from '../format/TextFeature.js'; +import TextFeature from '../format/TextFeature.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import LineString from '../geom/LineString.js'; import {get as getProjection} from '../proj.js'; @@ -19,11 +19,11 @@ import {get as getProjection} from '../proj.js'; * @param {olx.format.IGCOptions=} opt_options Options. * @api */ -var _ol_format_IGC_ = function(opt_options) { +var IGC = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_format_TextFeature_.call(this); + TextFeature.call(this); /** * @inheritDoc @@ -39,7 +39,7 @@ var _ol_format_IGC_ = function(opt_options) { }; -inherits(_ol_format_IGC_, _ol_format_TextFeature_); +inherits(IGC, TextFeature); /** @@ -47,7 +47,7 @@ inherits(_ol_format_IGC_, _ol_format_TextFeature_); * @type {RegExp} * @private */ -_ol_format_IGC_.B_RECORD_RE_ = +IGC.B_RECORD_RE_ = /^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/; @@ -56,7 +56,7 @@ _ol_format_IGC_.B_RECORD_RE_ = * @type {RegExp} * @private */ -_ol_format_IGC_.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/; +IGC.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/; /** @@ -64,7 +64,7 @@ _ol_format_IGC_.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/; * @type {RegExp} * @private */ -_ol_format_IGC_.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/; +IGC.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/; /** @@ -74,7 +74,7 @@ _ol_format_IGC_.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/; * @type {RegExp} * @private */ -_ol_format_IGC_.NEWLINE_RE_ = /\r\n|\r|\n/; +IGC.NEWLINE_RE_ = /\r\n|\r|\n/; /** @@ -86,15 +86,15 @@ _ol_format_IGC_.NEWLINE_RE_ = /\r\n|\r|\n/; * @return {ol.Feature} Feature. * @api */ -_ol_format_IGC_.prototype.readFeature; +IGC.prototype.readFeature; /** * @inheritDoc */ -_ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) { +IGC.prototype.readFeatureFromText = function(text, opt_options) { var altitudeMode = this.altitudeMode_; - var lines = text.split(_ol_format_IGC_.NEWLINE_RE_); + var lines = text.split(IGC.NEWLINE_RE_); /** @type {Object.} */ var properties = {}; var flatCoordinates = []; @@ -107,7 +107,7 @@ _ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) { var line = lines[i]; var m; if (line.charAt(0) == 'B') { - m = _ol_format_IGC_.B_RECORD_RE_.exec(line); + m = IGC.B_RECORD_RE_.exec(line); if (m) { var hour = parseInt(m[1], 10); var minute = parseInt(m[2], 10); @@ -141,13 +141,13 @@ _ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) { lastDateTime = dateTime; } } else if (line.charAt(0) == 'H') { - m = _ol_format_IGC_.HFDTE_RECORD_RE_.exec(line); + m = IGC.HFDTE_RECORD_RE_.exec(line); if (m) { day = parseInt(m[1], 10); month = parseInt(m[2], 10) - 1; year = 2000 + parseInt(m[3], 10); } else { - m = _ol_format_IGC_.H_RECORD_RE_.exec(line); + m = IGC.H_RECORD_RE_.exec(line); if (m) { properties[m[1]] = m[2].trim(); } @@ -161,7 +161,7 @@ _ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) { var layout = altitudeMode == _ol_format_IGCZ_.NONE ? GeometryLayout.XYM : GeometryLayout.XYZM; lineString.setFlatCoordinates(layout, flatCoordinates); - var feature = new _ol_Feature_(_ol_format_Feature_.transformWithOptions( + var feature = new _ol_Feature_(FeatureFormat.transformWithOptions( lineString, false, opt_options)); feature.setProperties(properties); return feature; @@ -178,13 +178,13 @@ _ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) { * @return {Array.} Features. * @api */ -_ol_format_IGC_.prototype.readFeatures; +IGC.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_IGC_.prototype.readFeaturesFromText = function(text, opt_options) { +IGC.prototype.readFeaturesFromText = function(text, opt_options) { var feature = this.readFeatureFromText(text, opt_options); if (feature) { return [feature]; @@ -202,33 +202,33 @@ _ol_format_IGC_.prototype.readFeaturesFromText = function(text, opt_options) { * @return {ol.proj.Projection} Projection. * @api */ -_ol_format_IGC_.prototype.readProjection; +IGC.prototype.readProjection; /** * Not implemented. * @inheritDoc */ -_ol_format_IGC_.prototype.writeFeatureText = function(feature, opt_options) {}; +IGC.prototype.writeFeatureText = function(feature, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_IGC_.prototype.writeFeaturesText = function(features, opt_options) {}; +IGC.prototype.writeFeaturesText = function(features, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_IGC_.prototype.writeGeometryText = function(geometry, opt_options) {}; +IGC.prototype.writeGeometryText = function(geometry, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_IGC_.prototype.readGeometryFromText = function(text, opt_options) {}; -export default _ol_format_IGC_; +IGC.prototype.readGeometryFromText = function(text, opt_options) {}; +export default IGC; diff --git a/src/ol/format/JSONFeature.js b/src/ol/format/JSONFeature.js index 39facbebbe..802c59d83c 100644 --- a/src/ol/format/JSONFeature.js +++ b/src/ol/format/JSONFeature.js @@ -2,7 +2,7 @@ * @module ol/format/JSONFeature */ import {inherits} from '../index.js'; -import _ol_format_Feature_ from '../format/Feature.js'; +import FeatureFormat from '../format/Feature.js'; import _ol_format_FormatType_ from '../format/FormatType.js'; /** @@ -15,11 +15,11 @@ import _ol_format_FormatType_ from '../format/FormatType.js'; * @abstract * @extends {ol.format.Feature} */ -var _ol_format_JSONFeature_ = function() { - _ol_format_Feature_.call(this); +var JSONFeature = function() { + FeatureFormat.call(this); }; -inherits(_ol_format_JSONFeature_, _ol_format_Feature_); +inherits(JSONFeature, FeatureFormat); /** @@ -27,7 +27,7 @@ inherits(_ol_format_JSONFeature_, _ol_format_Feature_); * @private * @return {Object} Object. */ -_ol_format_JSONFeature_.prototype.getObject_ = function(source) { +JSONFeature.prototype.getObject_ = function(source) { if (typeof source === 'string') { var object = JSON.parse(source); return object ? /** @type {Object} */ (object) : null; @@ -42,7 +42,7 @@ _ol_format_JSONFeature_.prototype.getObject_ = function(source) { /** * @inheritDoc */ -_ol_format_JSONFeature_.prototype.getType = function() { +JSONFeature.prototype.getType = function() { return _ol_format_FormatType_.JSON; }; @@ -50,7 +50,7 @@ _ol_format_JSONFeature_.prototype.getType = function() { /** * @inheritDoc */ -_ol_format_JSONFeature_.prototype.readFeature = function(source, opt_options) { +JSONFeature.prototype.readFeature = function(source, opt_options) { return this.readFeatureFromObject( this.getObject_(source), this.getReadOptions(source, opt_options)); }; @@ -59,7 +59,7 @@ _ol_format_JSONFeature_.prototype.readFeature = function(source, opt_options) { /** * @inheritDoc */ -_ol_format_JSONFeature_.prototype.readFeatures = function(source, opt_options) { +JSONFeature.prototype.readFeatures = function(source, opt_options) { return this.readFeaturesFromObject( this.getObject_(source), this.getReadOptions(source, opt_options)); }; @@ -72,7 +72,7 @@ _ol_format_JSONFeature_.prototype.readFeatures = function(source, opt_options) { * @protected * @return {ol.Feature} Feature. */ -_ol_format_JSONFeature_.prototype.readFeatureFromObject = function(object, opt_options) {}; +JSONFeature.prototype.readFeatureFromObject = function(object, opt_options) {}; /** @@ -82,13 +82,13 @@ _ol_format_JSONFeature_.prototype.readFeatureFromObject = function(object, opt_o * @protected * @return {Array.} Features. */ -_ol_format_JSONFeature_.prototype.readFeaturesFromObject = function(object, opt_options) {}; +JSONFeature.prototype.readFeaturesFromObject = function(object, opt_options) {}; /** * @inheritDoc */ -_ol_format_JSONFeature_.prototype.readGeometry = function(source, opt_options) { +JSONFeature.prototype.readGeometry = function(source, opt_options) { return this.readGeometryFromObject( this.getObject_(source), this.getReadOptions(source, opt_options)); }; @@ -101,13 +101,13 @@ _ol_format_JSONFeature_.prototype.readGeometry = function(source, opt_options) { * @protected * @return {ol.geom.Geometry} Geometry. */ -_ol_format_JSONFeature_.prototype.readGeometryFromObject = function(object, opt_options) {}; +JSONFeature.prototype.readGeometryFromObject = function(object, opt_options) {}; /** * @inheritDoc */ -_ol_format_JSONFeature_.prototype.readProjection = function(source) { +JSONFeature.prototype.readProjection = function(source) { return this.readProjectionFromObject(this.getObject_(source)); }; @@ -118,13 +118,13 @@ _ol_format_JSONFeature_.prototype.readProjection = function(source) { * @protected * @return {ol.proj.Projection} Projection. */ -_ol_format_JSONFeature_.prototype.readProjectionFromObject = function(object) {}; +JSONFeature.prototype.readProjectionFromObject = function(object) {}; /** * @inheritDoc */ -_ol_format_JSONFeature_.prototype.writeFeature = function(feature, opt_options) { +JSONFeature.prototype.writeFeature = function(feature, opt_options) { return JSON.stringify(this.writeFeatureObject(feature, opt_options)); }; @@ -135,13 +135,13 @@ _ol_format_JSONFeature_.prototype.writeFeature = function(feature, opt_options) * @param {olx.format.WriteOptions=} opt_options Write options. * @return {Object} Object. */ -_ol_format_JSONFeature_.prototype.writeFeatureObject = function(feature, opt_options) {}; +JSONFeature.prototype.writeFeatureObject = function(feature, opt_options) {}; /** * @inheritDoc */ -_ol_format_JSONFeature_.prototype.writeFeatures = function(features, opt_options) { +JSONFeature.prototype.writeFeatures = function(features, opt_options) { return JSON.stringify(this.writeFeaturesObject(features, opt_options)); }; @@ -152,13 +152,13 @@ _ol_format_JSONFeature_.prototype.writeFeatures = function(features, opt_options * @param {olx.format.WriteOptions=} opt_options Write options. * @return {Object} Object. */ -_ol_format_JSONFeature_.prototype.writeFeaturesObject = function(features, opt_options) {}; +JSONFeature.prototype.writeFeaturesObject = function(features, opt_options) {}; /** * @inheritDoc */ -_ol_format_JSONFeature_.prototype.writeGeometry = function(geometry, opt_options) { +JSONFeature.prototype.writeGeometry = function(geometry, opt_options) { return JSON.stringify(this.writeGeometryObject(geometry, opt_options)); }; @@ -169,5 +169,5 @@ _ol_format_JSONFeature_.prototype.writeGeometry = function(geometry, opt_options * @param {olx.format.WriteOptions=} opt_options Write options. * @return {Object} Object. */ -_ol_format_JSONFeature_.prototype.writeGeometryObject = function(geometry, opt_options) {}; -export default _ol_format_JSONFeature_; +JSONFeature.prototype.writeGeometryObject = function(geometry, opt_options) {}; +export default JSONFeature; diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 6237861a47..c5087535e9 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -1,19 +1,14 @@ /** * @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'; import _ol_asserts_ from '../asserts.js'; import _ol_color_ from '../color.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import FeatureFormat from '../format/Feature.js'; +import XMLFeature from '../format/XMLFeature.js'; +import XSD from '../format/XSD.js'; import GeometryCollection from '../geom/GeometryCollection.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryType from '../geom/GeometryType.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); + 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, 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,8 +535,8 @@ _ol_format_KML_.readVec2_ = function(node) { * @private * @return {number|undefined} Scale. */ -_ol_format_KML_.readScale_ = function(node) { - return _ol_format_XSD_.readDecimal(node); +KML.readScale_ = function(node) { + return 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,10 +1191,10 @@ _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); + var data = XSD.readString(node); var featureObject = /** @type {Object} */ (objectStack[objectStack.length - 1]); featureObject[name] = data; @@ -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,10 +1308,10 @@ _ol_format_KML_.whenParser_ = function(node, objectStack) { * @type {Object.>} * @private */ -_ol_format_KML_.DATA_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'displayName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'value': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) +KML.DATA_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'displayName': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'value': _ol_xml_.makeObjectPropertySetter(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,15 +1344,15 @@ _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_, { - 'altitudeMode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'minAltitude': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'maxAltitude': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'north': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'south': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'east': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'west': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal) +KML.LAT_LON_ALT_BOX_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'altitudeMode': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'minAltitude': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'maxAltitude': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'north': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'south': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'east': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'west': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal) }); @@ -1366,12 +1361,12 @@ _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_, { - 'minLodPixels': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'maxLodPixels': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'minFadeExtent': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'maxFadeExtent': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal) +KML.LOD_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'minLodPixels': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'maxLodPixels': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'minFadeExtent': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'maxFadeExtent': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal) }); @@ -1380,11 +1375,11 @@ _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_, { - 'extrude': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), - 'tessellate': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), - 'altitudeMode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) +KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'extrude': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean), + 'tessellate': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean), + 'altitudeMode': _ol_xml_.makeObjectPropertySetter(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,15 +1436,15 @@ _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_, { - 'x': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'y': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'w': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'h': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal) + KML.GX_NAMESPACE_URIS_, { + 'x': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'y': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'w': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + 'h': _ol_xml_.makeObjectPropertySetter(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_), - 'heading': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), - 'hotSpot': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readVec2_), - 'scale': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readScale_) +KML.ICON_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Icon': _ol_xml_.makeObjectPropertySetter(KML.readIcon_), + 'heading': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal), + '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,10 +1490,10 @@ _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_), - 'width': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal) +KML.LINE_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'color': _ol_xml_.makeObjectPropertySetter(KML.readColor_), + 'width': _ol_xml_.makeObjectPropertySetter(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,17 +1528,17 @@ _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_, - '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), - 'visibility': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean) +KML.NETWORK_LINK_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'ExtendedData': KML.ExtendedDataParser_, + 'Region': KML.RegionParser_, + 'Link': KML.LinkParser_, + 'address': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'description': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'open': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean), + 'phoneNumber': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'visibility': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean) }); @@ -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_), - 'key': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'styleUrl': _ol_xml_.makeObjectPropertySetter(_ol_format_KML_.readURI_) +KML.PAIR_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Style': _ol_xml_.makeObjectPropertySetter(KML.readStyle_), + 'key': _ol_xml_.makeObjectPropertySetter(XSD.readString), + '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_, - '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_), - 'visibility': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean) + KML.readPolygon_, 'geometry'), + 'Style': _ol_xml_.makeObjectPropertySetter(KML.readStyle_), + 'StyleMap': KML.PlacemarkStyleMapParser_, + 'address': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'description': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'open': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean), + 'phoneNumber': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'styleUrl': _ol_xml_.makeObjectPropertySetter(KML.readURI_), + 'visibility': _ol_xml_.makeObjectPropertySetter(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,11 +1620,11 @@ _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_), - 'fill': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean), - 'outline': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readBoolean) +KML.POLY_STYLE_PARSERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'color': _ol_xml_.makeObjectPropertySetter(KML.readColor_), + 'fill': _ol_xml_.makeObjectPropertySetter(XSD.readBoolean), + 'outline': _ol_xml_.makeObjectPropertySetter(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; } @@ -1716,7 +1711,7 @@ _ol_format_KML_.prototype.readPlacemark_ = function(node, objectStack) { var geometry = object['geometry']; if (geometry) { - _ol_format_Feature_.transformWithOptions(geometry, false, options); + FeatureFormat.transformWithOptions(geometry, false, options); } feature.setGeometry(geometry); delete object['geometry']; @@ -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); + return 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]]; @@ -2105,7 +2100,7 @@ _ol_format_KML_.writeColorTextNode_ = function(node, color) { var hex = parseInt(abgr[i], 10).toString(16); abgr[i] = (hex.length == 1) ? '0' + hex : hex; } - _ol_format_XSD_.writeStringTextNode(node, abgr.join('')); + XSD.writeStringTextNode(node, abgr.join('')); }; @@ -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']; @@ -2147,7 +2142,7 @@ _ol_format_KML_.writeCoordinatesTextNode_ = function(node, coordinates, objectSt } } } - _ol_format_XSD_.writeStringTextNode(node, text); + XSD.writeStringTextNode(node, text); }; @@ -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,8 +2179,8 @@ _ol_format_KML_.writeDataNode_ = function(node, pair, objectStack) { * @param {string} name DisplayName. * @private */ -_ol_format_KML_.writeDataNodeName_ = function(node, name) { - _ol_format_XSD_.writeCDATASection(node, name); +KML.writeDataNodeName_ = function(node, name) { + XSD.writeCDATASection(node, name); }; @@ -2194,8 +2189,8 @@ _ol_format_KML_.writeDataNodeName_ = function(node, name) { * @param {string} value Value. * @private */ -_ol_format_KML_.writeDataNodeValue_ = function(node, value) { - _ol_format_XSD_.writeStringTextNode(node, value); +KML.writeDataNodeValue_ = function(node, value) { + 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 @@ -2471,10 +2466,10 @@ _ol_format_KML_.writePlacemark_ = function(node, feature, objectStack) { var geometry = feature.getGeometry(); if (geometry) { geometry = - _ol_format_Feature_.transformWithOptions(geometry, true, options); + 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,9 +2538,9 @@ _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, + 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,15 +2673,15 @@ _ol_format_KML_.ICON_SEQUENCE_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_KML_.ICON_SERIALIZERS_ = _ol_xml_.makeStructureNS( - _ol_format_KML_.NAMESPACE_URIS_, { - 'href': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) +KML.ICON_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'href': _ol_xml_.makeChildAppender(XSD.writeStringTextNode) }, _ol_xml_.makeStructureNS( - _ol_format_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), - 'h': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode) + KML.GX_NAMESPACE_URIS_, { + 'x': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'y': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'w': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + 'h': _ol_xml_.makeChildAppender(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_), - 'heading': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), - 'hotSpot': _ol_xml_.makeChildAppender(_ol_format_KML_.writeVec2_), - 'scale': _ol_xml_.makeChildAppender(_ol_format_KML_.writeScaleTextNode_) +KML.ICON_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'Icon': _ol_xml_.makeChildAppender(KML.writeIcon_), + 'heading': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode), + '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,10 +2749,10 @@ _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_), - 'width': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode) +KML.LINE_STYLE_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'color': _ol_xml_.makeChildAppender(KML.writeColorTextNode_), + 'width': _ol_xml_.makeChildAppender(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,30 +2802,30 @@ _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_), - 'address': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + KML.writePrimitiveGeometry_), + 'Polygon': _ol_xml_.makeChildAppender(KML.writePolygon_), + 'Style': _ol_xml_.makeChildAppender(KML.writeStyle_), + 'address': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'description': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeStringTextNode), - 'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), - 'open': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeBooleanTextNode), + XSD.writeStringTextNode), + 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), + 'open': _ol_xml_.makeChildAppender(XSD.writeBooleanTextNode), 'phoneNumber': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeStringTextNode), - 'styleUrl': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), + XSD.writeStringTextNode), + 'styleUrl': _ol_xml_.makeChildAppender(XSD.writeStringTextNode), 'visibility': _ol_xml_.makeChildAppender( - _ol_format_XSD_.writeBooleanTextNode) + XSD.writeBooleanTextNode) }); @@ -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_, { - 'extrude': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeBooleanTextNode), - 'tessellate': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeBooleanTextNode), - 'altitudeMode': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), +KML.PRIMITIVE_GEOMETRY_SERIALIZERS_ = _ol_xml_.makeStructureNS( + KML.NAMESPACE_URIS_, { + 'extrude': _ol_xml_.makeChildAppender(XSD.writeBooleanTextNode), + 'tessellate': _ol_xml_.makeChildAppender(XSD.writeBooleanTextNode), + 'altitudeMode': _ol_xml_.makeChildAppender(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/src/ol/format/MVT.js b/src/ol/format/MVT.js index 954fb6d1ef..08ff917c84 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -6,7 +6,7 @@ import {inherits} from '../index.js'; import _ol_asserts_ from '../asserts.js'; import PBF from 'pbf'; -import _ol_format_Feature_ from '../format/Feature.js'; +import FeatureFormat from '../format/Feature.js'; import _ol_format_FormatType_ from '../format/FormatType.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryType from '../geom/GeometryType.js'; @@ -30,9 +30,9 @@ import _ol_render_Feature_ from '../render/Feature.js'; * @param {olx.format.MVTOptions=} opt_options Options. * @api */ -var _ol_format_MVT_ = function(opt_options) { +var MVT = function(opt_options) { - _ol_format_Feature_.call(this); + FeatureFormat.call(this); var options = opt_options ? opt_options : {}; @@ -79,14 +79,14 @@ var _ol_format_MVT_ = function(opt_options) { }; -inherits(_ol_format_MVT_, _ol_format_Feature_); +inherits(MVT, FeatureFormat); /** * Reader callbacks for parsing the PBF. * @type {Object.} */ -_ol_format_MVT_.pbfReaders_ = { +MVT.pbfReaders_ = { layers: function(tag, layers, pbf) { if (tag === 3) { var layer = { @@ -95,7 +95,7 @@ _ol_format_MVT_.pbfReaders_ = { features: [] }; var end = pbf.readVarint() + pbf.pos; - pbf.readFields(_ol_format_MVT_.pbfReaders_.layer, layer, end); + pbf.readFields(MVT.pbfReaders_.layer, layer, end); layer.length = layer.features.length; if (layer.length) { layers[layer.name] = layer; @@ -157,7 +157,7 @@ _ol_format_MVT_.pbfReaders_ = { * @param {number} i Index of the feature in the raw layer's `features` array. * @return {Object} Raw feature. */ -_ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) { +MVT.readRawFeature_ = function(pbf, layer, i) { pbf.pos = layer.features[i]; var end = pbf.readVarint() + pbf.pos; @@ -166,7 +166,7 @@ _ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) { type: 0, properties: {} }; - pbf.readFields(_ol_format_MVT_.pbfReaders_.feature, feature, end); + pbf.readFields(MVT.pbfReaders_.feature, feature, end); return feature; }; @@ -181,7 +181,7 @@ _ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) { * @param {Array.} flatCoordinates Array to store flat coordinates in. * @param {Array.} ends Array to store ends in. */ -_ol_format_MVT_.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) { +MVT.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) { pbf.pos = feature.geometry; var end = pbf.readVarint() + pbf.pos; @@ -245,7 +245,7 @@ _ol_format_MVT_.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) * geometry. * @return {ol.geom.GeometryType} The geometry type. */ -_ol_format_MVT_.getGeometryType_ = function(type, numEnds) { +MVT.getGeometryType_ = function(type, numEnds) { /** @type {ol.geom.GeometryType} */ var geometryType; if (type === 1) { @@ -270,7 +270,7 @@ _ol_format_MVT_.getGeometryType_ = function(type, numEnds) { * @param {olx.format.ReadOptions=} opt_options Read options. * @return {ol.Feature|ol.render.Feature} Feature. */ -_ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options) { +MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) { var type = rawFeature.type; if (type === 0) { return null; @@ -283,9 +283,9 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options var flatCoordinates = []; var ends = []; - _ol_format_MVT_.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends); + MVT.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends); - var geometryType = _ol_format_MVT_.getGeometryType_(type, ends.length); + var geometryType = MVT.getGeometryType_(type, ends.length); if (this.featureClass_ === _ol_render_Feature_) { feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id); @@ -322,7 +322,7 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options if (this.geometryName_) { feature.setGeometryName(this.geometryName_); } - var geometry = _ol_format_Feature_.transformWithOptions(geom, false, this.adaptOptions(opt_options)); + var geometry = FeatureFormat.transformWithOptions(geom, false, this.adaptOptions(opt_options)); feature.setGeometry(geometry); feature.setId(id); feature.setProperties(values); @@ -336,7 +336,7 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options * @inheritDoc * @api */ -_ol_format_MVT_.prototype.getLastExtent = function() { +MVT.prototype.getLastExtent = function() { return this.extent_; }; @@ -344,7 +344,7 @@ _ol_format_MVT_.prototype.getLastExtent = function() { /** * @inheritDoc */ -_ol_format_MVT_.prototype.getType = function() { +MVT.prototype.getType = function() { return _ol_format_FormatType_.ARRAY_BUFFER; }; @@ -353,11 +353,11 @@ _ol_format_MVT_.prototype.getType = function() { * @inheritDoc * @api */ -_ol_format_MVT_.prototype.readFeatures = function(source, opt_options) { +MVT.prototype.readFeatures = function(source, opt_options) { var layers = this.layers_; var pbf = new PBF(/** @type {ArrayBuffer} */ (source)); - var pbfLayers = pbf.readFields(_ol_format_MVT_.pbfReaders_.layers, {}); + var pbfLayers = pbf.readFields(MVT.pbfReaders_.layers, {}); /** @type {Array.} */ var features = []; var pbfLayer; @@ -369,7 +369,7 @@ _ol_format_MVT_.prototype.readFeatures = function(source, opt_options) { var rawFeature; for (var i = 0, ii = pbfLayer.length; i < ii; ++i) { - rawFeature = _ol_format_MVT_.readRawFeature_(pbf, pbfLayer, i); + rawFeature = MVT.readRawFeature_(pbf, pbfLayer, i); features.push(this.createFeature_(pbf, rawFeature)); } this.extent_ = pbfLayer ? [0, 0, pbfLayer.extent, pbfLayer.extent] : null; @@ -383,7 +383,7 @@ _ol_format_MVT_.prototype.readFeatures = function(source, opt_options) { * @inheritDoc * @api */ -_ol_format_MVT_.prototype.readProjection = function(source) { +MVT.prototype.readProjection = function(source) { return this.defaultDataProjection; }; @@ -393,7 +393,7 @@ _ol_format_MVT_.prototype.readProjection = function(source) { * @param {Array.} layers Layers. * @api */ -_ol_format_MVT_.prototype.setLayers = function(layers) { +MVT.prototype.setLayers = function(layers) { this.layers_ = layers; }; @@ -402,33 +402,33 @@ _ol_format_MVT_.prototype.setLayers = function(layers) { * Not implemented. * @override */ -_ol_format_MVT_.prototype.readFeature = function() {}; +MVT.prototype.readFeature = function() {}; /** * Not implemented. * @override */ -_ol_format_MVT_.prototype.readGeometry = function() {}; +MVT.prototype.readGeometry = function() {}; /** * Not implemented. * @override */ -_ol_format_MVT_.prototype.writeFeature = function() {}; +MVT.prototype.writeFeature = function() {}; /** * Not implemented. * @override */ -_ol_format_MVT_.prototype.writeGeometry = function() {}; +MVT.prototype.writeGeometry = function() {}; /** * Not implemented. * @override */ -_ol_format_MVT_.prototype.writeFeatures = function() {}; -export default _ol_format_MVT_; +MVT.prototype.writeFeatures = function() {}; +export default MVT; diff --git a/src/ol/format/OSMXML.js b/src/ol/format/OSMXML.js index c53ef23980..9df3b0afd1 100644 --- a/src/ol/format/OSMXML.js +++ b/src/ol/format/OSMXML.js @@ -5,8 +5,8 @@ import {inherits} from '../index.js'; import _ol_array_ from '../array.js'; import _ol_Feature_ from '../Feature.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; +import FeatureFormat from '../format/Feature.js'; +import XMLFeature from '../format/XMLFeature.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import LineString from '../geom/LineString.js'; import Point from '../geom/Point.js'; @@ -24,8 +24,8 @@ import _ol_xml_ from '../xml.js'; * @extends {ol.format.XMLFeature} * @api */ -var _ol_format_OSMXML_ = function() { - _ol_format_XMLFeature_.call(this); +var OSMXML = function() { + XMLFeature.call(this); /** * @inheritDoc @@ -33,7 +33,7 @@ var _ol_format_OSMXML_ = function() { this.defaultDataProjection = getProjection('EPSG:4326'); }; -inherits(_ol_format_OSMXML_, _ol_format_XMLFeature_); +inherits(OSMXML, XMLFeature); /** @@ -41,7 +41,7 @@ inherits(_ol_format_OSMXML_, _ol_format_XMLFeature_); * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_OSMXML_.readNode_ = function(node, objectStack) { +OSMXML.readNode_ = function(node, objectStack) { var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var state = /** @type {Object} */ (objectStack[objectStack.length - 1]); var id = node.getAttribute('id'); @@ -54,10 +54,10 @@ _ol_format_OSMXML_.readNode_ = function(node, objectStack) { var values = _ol_xml_.pushParseAndPop({ tags: {} - }, _ol_format_OSMXML_.NODE_PARSERS_, node, objectStack); + }, OSMXML.NODE_PARSERS_, node, objectStack); if (!_ol_obj_.isEmpty(values.tags)) { var geometry = new Point(coordinates); - _ol_format_Feature_.transformWithOptions(geometry, false, options); + FeatureFormat.transformWithOptions(geometry, false, options); var feature = new _ol_Feature_(geometry); feature.setId(id); feature.setProperties(values.tags); @@ -71,13 +71,13 @@ _ol_format_OSMXML_.readNode_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_OSMXML_.readWay_ = function(node, objectStack) { +OSMXML.readWay_ = function(node, objectStack) { var id = node.getAttribute('id'); var values = _ol_xml_.pushParseAndPop({ id: id, ndrefs: [], tags: {} - }, _ol_format_OSMXML_.WAY_PARSERS_, node, objectStack); + }, OSMXML.WAY_PARSERS_, node, objectStack); var state = /** @type {Object} */ (objectStack[objectStack.length - 1]); state.ways.push(values); }; @@ -88,7 +88,7 @@ _ol_format_OSMXML_.readWay_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_OSMXML_.readNd_ = function(node, objectStack) { +OSMXML.readNd_ = function(node, objectStack) { var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); values.ndrefs.push(node.getAttribute('ref')); }; @@ -99,7 +99,7 @@ _ol_format_OSMXML_.readNd_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_OSMXML_.readTag_ = function(node, objectStack) { +OSMXML.readTag_ = function(node, objectStack) { var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); values.tags[node.getAttribute('k')] = node.getAttribute('v'); }; @@ -110,7 +110,7 @@ _ol_format_OSMXML_.readTag_ = function(node, objectStack) { * @private * @type {Array.} */ -_ol_format_OSMXML_.NAMESPACE_URIS_ = [ +OSMXML.NAMESPACE_URIS_ = [ null ]; @@ -120,10 +120,10 @@ _ol_format_OSMXML_.NAMESPACE_URIS_ = [ * @type {Object.>} * @private */ -_ol_format_OSMXML_.WAY_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OSMXML_.NAMESPACE_URIS_, { - 'nd': _ol_format_OSMXML_.readNd_, - 'tag': _ol_format_OSMXML_.readTag_ +OSMXML.WAY_PARSERS_ = _ol_xml_.makeStructureNS( + OSMXML.NAMESPACE_URIS_, { + 'nd': OSMXML.readNd_, + 'tag': OSMXML.readTag_ }); @@ -132,10 +132,10 @@ _ol_format_OSMXML_.WAY_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OSMXML_.PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OSMXML_.NAMESPACE_URIS_, { - 'node': _ol_format_OSMXML_.readNode_, - 'way': _ol_format_OSMXML_.readWay_ +OSMXML.PARSERS_ = _ol_xml_.makeStructureNS( + OSMXML.NAMESPACE_URIS_, { + 'node': OSMXML.readNode_, + 'way': OSMXML.readWay_ }); @@ -144,9 +144,9 @@ _ol_format_OSMXML_.PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OSMXML_.NODE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OSMXML_.NAMESPACE_URIS_, { - 'tag': _ol_format_OSMXML_.readTag_ +OSMXML.NODE_PARSERS_ = _ol_xml_.makeStructureNS( + OSMXML.NAMESPACE_URIS_, { + 'tag': OSMXML.readTag_ }); @@ -159,20 +159,20 @@ _ol_format_OSMXML_.NODE_PARSERS_ = _ol_xml_.makeStructureNS( * @return {Array.} Features. * @api */ -_ol_format_OSMXML_.prototype.readFeatures; +OSMXML.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_OSMXML_.prototype.readFeaturesFromNode = function(node, opt_options) { +OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) { var options = this.getReadOptions(node, opt_options); if (node.localName == 'osm') { var state = _ol_xml_.pushParseAndPop({ nodes: {}, ways: [], features: [] - }, _ol_format_OSMXML_.PARSERS_, node, [options]); + }, OSMXML.PARSERS_, node, [options]); // parse nodes in ways for (var j = 0; j < state.ways.length; j++) { var values = /** @type {Object} */ (state.ways[j]); @@ -192,7 +192,7 @@ _ol_format_OSMXML_.prototype.readFeaturesFromNode = function(node, opt_options) geometry = new LineString(null); geometry.setFlatCoordinates(GeometryLayout.XY, flatCoordinates); } - _ol_format_Feature_.transformWithOptions(geometry, false, options); + FeatureFormat.transformWithOptions(geometry, false, options); var feature = new _ol_Feature_(geometry); feature.setId(values.id); feature.setProperties(values.tags); @@ -214,26 +214,26 @@ _ol_format_OSMXML_.prototype.readFeaturesFromNode = function(node, opt_options) * @return {ol.proj.Projection} Projection. * @api */ -_ol_format_OSMXML_.prototype.readProjection; +OSMXML.prototype.readProjection; /** * Not implemented. * @inheritDoc */ -_ol_format_OSMXML_.prototype.writeFeatureNode = function(feature, opt_options) {}; +OSMXML.prototype.writeFeatureNode = function(feature, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_OSMXML_.prototype.writeFeaturesNode = function(features, opt_options) {}; +OSMXML.prototype.writeFeaturesNode = function(features, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_OSMXML_.prototype.writeGeometryNode = function(geometry, opt_options) {}; -export default _ol_format_OSMXML_; +OSMXML.prototype.writeGeometryNode = function(geometry, opt_options) {}; +export default OSMXML; diff --git a/src/ol/format/OWS.js b/src/ol/format/OWS.js index a210d4d6dc..ae46fd59d4 100644 --- a/src/ol/format/OWS.js +++ b/src/ol/format/OWS.js @@ -2,26 +2,26 @@ * @module ol/format/OWS */ import {inherits} from '../index.js'; -import _ol_format_XLink_ from '../format/XLink.js'; -import _ol_format_XML_ from '../format/XML.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XLink from '../format/XLink.js'; +import XML from '../format/XML.js'; +import XSD from '../format/XSD.js'; import _ol_xml_ from '../xml.js'; /** * @constructor * @extends {ol.format.XML} */ -var _ol_format_OWS_ = function() { - _ol_format_XML_.call(this); +var OWS = function() { + XML.call(this); }; -inherits(_ol_format_OWS_, _ol_format_XML_); +inherits(OWS, XML); /** * @inheritDoc */ -_ol_format_OWS_.prototype.readFromDocument = function(doc) { +OWS.prototype.readFromDocument = function(doc) { for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { return this.readFromNode(n); @@ -34,9 +34,9 @@ _ol_format_OWS_.prototype.readFromDocument = function(doc) { /** * @inheritDoc */ -_ol_format_OWS_.prototype.readFromNode = function(node) { +OWS.prototype.readFromNode = function(node) { var owsObject = _ol_xml_.pushParseAndPop({}, - _ol_format_OWS_.PARSERS_, node, []); + OWS.PARSERS_, node, []); return owsObject ? owsObject : null; }; @@ -47,9 +47,9 @@ _ol_format_OWS_.prototype.readFromNode = function(node) { * @private * @return {Object|undefined} The address. */ -_ol_format_OWS_.readAddress_ = function(node, objectStack) { +OWS.readAddress_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop({}, - _ol_format_OWS_.ADDRESS_PARSERS_, node, objectStack); + OWS.ADDRESS_PARSERS_, node, objectStack); }; @@ -59,9 +59,9 @@ _ol_format_OWS_.readAddress_ = function(node, objectStack) { * @private * @return {Object|undefined} The values. */ -_ol_format_OWS_.readAllowedValues_ = function(node, objectStack) { +OWS.readAllowedValues_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop({}, - _ol_format_OWS_.ALLOWED_VALUES_PARSERS_, node, objectStack); + OWS.ALLOWED_VALUES_PARSERS_, node, objectStack); }; @@ -71,13 +71,13 @@ _ol_format_OWS_.readAllowedValues_ = function(node, objectStack) { * @private * @return {Object|undefined} The constraint. */ -_ol_format_OWS_.readConstraint_ = function(node, objectStack) { +OWS.readConstraint_ = function(node, objectStack) { var name = node.getAttribute('name'); if (!name) { return undefined; } return _ol_xml_.pushParseAndPop({'name': name}, - _ol_format_OWS_.CONSTRAINT_PARSERS_, node, + OWS.CONSTRAINT_PARSERS_, node, objectStack); }; @@ -88,9 +88,9 @@ _ol_format_OWS_.readConstraint_ = function(node, objectStack) { * @private * @return {Object|undefined} The contact info. */ -_ol_format_OWS_.readContactInfo_ = function(node, objectStack) { +OWS.readContactInfo_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop({}, - _ol_format_OWS_.CONTACT_INFO_PARSERS_, node, objectStack); + OWS.CONTACT_INFO_PARSERS_, node, objectStack); }; @@ -100,9 +100,9 @@ _ol_format_OWS_.readContactInfo_ = function(node, objectStack) { * @private * @return {Object|undefined} The DCP. */ -_ol_format_OWS_.readDcp_ = function(node, objectStack) { +OWS.readDcp_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop({}, - _ol_format_OWS_.DCP_PARSERS_, node, objectStack); + OWS.DCP_PARSERS_, node, objectStack); }; @@ -112,13 +112,13 @@ _ol_format_OWS_.readDcp_ = function(node, objectStack) { * @private * @return {Object|undefined} The GET object. */ -_ol_format_OWS_.readGet_ = function(node, objectStack) { - var href = _ol_format_XLink_.readHref(node); +OWS.readGet_ = function(node, objectStack) { + var href = XLink.readHref(node); if (!href) { return undefined; } return _ol_xml_.pushParseAndPop({'href': href}, - _ol_format_OWS_.REQUEST_METHOD_PARSERS_, node, objectStack); + OWS.REQUEST_METHOD_PARSERS_, node, objectStack); }; @@ -128,8 +128,8 @@ _ol_format_OWS_.readGet_ = function(node, objectStack) { * @private * @return {Object|undefined} The HTTP object. */ -_ol_format_OWS_.readHttp_ = function(node, objectStack) { - return _ol_xml_.pushParseAndPop({}, _ol_format_OWS_.HTTP_PARSERS_, +OWS.readHttp_ = function(node, objectStack) { + return _ol_xml_.pushParseAndPop({}, OWS.HTTP_PARSERS_, node, objectStack); }; @@ -140,10 +140,10 @@ _ol_format_OWS_.readHttp_ = function(node, objectStack) { * @private * @return {Object|undefined} The operation. */ -_ol_format_OWS_.readOperation_ = function(node, objectStack) { +OWS.readOperation_ = function(node, objectStack) { var name = node.getAttribute('name'); var value = _ol_xml_.pushParseAndPop({}, - _ol_format_OWS_.OPERATION_PARSERS_, node, objectStack); + OWS.OPERATION_PARSERS_, node, objectStack); if (!value) { return undefined; } @@ -159,10 +159,10 @@ _ol_format_OWS_.readOperation_ = function(node, objectStack) { * @private * @return {Object|undefined} The operations metadata. */ -_ol_format_OWS_.readOperationsMetadata_ = function(node, +OWS.readOperationsMetadata_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop({}, - _ol_format_OWS_.OPERATIONS_METADATA_PARSERS_, node, + OWS.OPERATIONS_METADATA_PARSERS_, node, objectStack); }; @@ -173,9 +173,9 @@ _ol_format_OWS_.readOperationsMetadata_ = function(node, * @private * @return {Object|undefined} The phone. */ -_ol_format_OWS_.readPhone_ = function(node, objectStack) { +OWS.readPhone_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop({}, - _ol_format_OWS_.PHONE_PARSERS_, node, objectStack); + OWS.PHONE_PARSERS_, node, objectStack); }; @@ -185,10 +185,10 @@ _ol_format_OWS_.readPhone_ = function(node, objectStack) { * @private * @return {Object|undefined} The service identification. */ -_ol_format_OWS_.readServiceIdentification_ = function(node, +OWS.readServiceIdentification_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_OWS_.SERVICE_IDENTIFICATION_PARSERS_, node, + {}, OWS.SERVICE_IDENTIFICATION_PARSERS_, node, objectStack); }; @@ -199,9 +199,9 @@ _ol_format_OWS_.readServiceIdentification_ = function(node, * @private * @return {Object|undefined} The service contact. */ -_ol_format_OWS_.readServiceContact_ = function(node, objectStack) { +OWS.readServiceContact_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_OWS_.SERVICE_CONTACT_PARSERS_, node, + {}, OWS.SERVICE_CONTACT_PARSERS_, node, objectStack); }; @@ -212,9 +212,9 @@ _ol_format_OWS_.readServiceContact_ = function(node, objectStack) { * @private * @return {Object|undefined} The service provider. */ -_ol_format_OWS_.readServiceProvider_ = function(node, objectStack) { +OWS.readServiceProvider_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_OWS_.SERVICE_PROVIDER_PARSERS_, node, + {}, OWS.SERVICE_PROVIDER_PARSERS_, node, objectStack); }; @@ -225,8 +225,8 @@ _ol_format_OWS_.readServiceProvider_ = function(node, objectStack) { * @private * @return {string|undefined} The value. */ -_ol_format_OWS_.readValue_ = function(node, objectStack) { - return _ol_format_XSD_.readString(node); +OWS.readValue_ = function(node, objectStack) { + return XSD.readString(node); }; @@ -235,7 +235,7 @@ _ol_format_OWS_.readValue_ = function(node, objectStack) { * @type {Array.} * @private */ -_ol_format_OWS_.NAMESPACE_URIS_ = [ +OWS.NAMESPACE_URIS_ = [ null, 'http://www.opengis.net/ows/1.1' ]; @@ -246,14 +246,14 @@ _ol_format_OWS_.NAMESPACE_URIS_ = [ * @type {Object.>} * @private */ -_ol_format_OWS_.PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { +OWS.PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { 'ServiceIdentification': _ol_xml_.makeObjectPropertySetter( - _ol_format_OWS_.readServiceIdentification_), + OWS.readServiceIdentification_), 'ServiceProvider': _ol_xml_.makeObjectPropertySetter( - _ol_format_OWS_.readServiceProvider_), + OWS.readServiceProvider_), 'OperationsMetadata': _ol_xml_.makeObjectPropertySetter( - _ol_format_OWS_.readOperationsMetadata_) + OWS.readOperationsMetadata_) }); @@ -262,17 +262,17 @@ _ol_format_OWS_.PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { +OWS.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { 'DeliveryPoint': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), - 'City': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + XSD.readString), + 'City': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'AdministrativeArea': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), - 'PostalCode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Country': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + XSD.readString), + 'PostalCode': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Country': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'ElectronicMailAddress': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) }); @@ -281,9 +281,9 @@ _ol_format_OWS_.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.ALLOWED_VALUES_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { - 'Value': _ol_xml_.makeObjectPropertyPusher(_ol_format_OWS_.readValue_) +OWS.ALLOWED_VALUES_PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { + 'Value': _ol_xml_.makeObjectPropertyPusher(OWS.readValue_) }); @@ -292,10 +292,10 @@ _ol_format_OWS_.ALLOWED_VALUES_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.CONSTRAINT_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { +OWS.CONSTRAINT_PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { 'AllowedValues': _ol_xml_.makeObjectPropertySetter( - _ol_format_OWS_.readAllowedValues_) + OWS.readAllowedValues_) }); @@ -304,10 +304,10 @@ _ol_format_OWS_.CONSTRAINT_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.CONTACT_INFO_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { - 'Phone': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readPhone_), - 'Address': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readAddress_) +OWS.CONTACT_INFO_PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { + 'Phone': _ol_xml_.makeObjectPropertySetter(OWS.readPhone_), + 'Address': _ol_xml_.makeObjectPropertySetter(OWS.readAddress_) }); @@ -316,9 +316,9 @@ _ol_format_OWS_.CONTACT_INFO_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.DCP_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { - 'HTTP': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readHttp_) +OWS.DCP_PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { + 'HTTP': _ol_xml_.makeObjectPropertySetter(OWS.readHttp_) }); @@ -327,9 +327,9 @@ _ol_format_OWS_.DCP_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { - 'Get': _ol_xml_.makeObjectPropertyPusher(_ol_format_OWS_.readGet_), +OWS.HTTP_PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { + 'Get': _ol_xml_.makeObjectPropertyPusher(OWS.readGet_), 'Post': undefined // TODO }); @@ -339,9 +339,9 @@ _ol_format_OWS_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.OPERATION_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { - 'DCP': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readDcp_) +OWS.OPERATION_PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { + 'DCP': _ol_xml_.makeObjectPropertySetter(OWS.readDcp_) }); @@ -350,9 +350,9 @@ _ol_format_OWS_.OPERATION_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { - 'Operation': _ol_format_OWS_.readOperation_ +OWS.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { + 'Operation': OWS.readOperation_ }); @@ -361,10 +361,10 @@ _ol_format_OWS_.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.PHONE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { - 'Voice': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Facsimile': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) +OWS.PHONE_PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { + 'Voice': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Facsimile': _ol_xml_.makeObjectPropertySetter(XSD.readString) }); @@ -373,10 +373,10 @@ _ol_format_OWS_.PHONE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.REQUEST_METHOD_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { +OWS.REQUEST_METHOD_PARSERS_ = _ol_xml_.makeStructureNS( + OWS.NAMESPACE_URIS_, { 'Constraint': _ol_xml_.makeObjectPropertyPusher( - _ol_format_OWS_.readConstraint_) + OWS.readConstraint_) }); @@ -385,14 +385,14 @@ _ol_format_OWS_.REQUEST_METHOD_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_OWS_.SERVICE_CONTACT_PARSERS_ = +OWS.SERVICE_CONTACT_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { + OWS.NAMESPACE_URIS_, { 'IndividualName': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), - 'PositionName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + XSD.readString), + 'PositionName': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'ContactInfo': _ol_xml_.makeObjectPropertySetter( - _ol_format_OWS_.readContactInfo_) + OWS.readContactInfo_) }); @@ -401,16 +401,16 @@ _ol_format_OWS_.SERVICE_CONTACT_PARSERS_ = * @type {Object.>} * @private */ -_ol_format_OWS_.SERVICE_IDENTIFICATION_PARSERS_ = +OWS.SERVICE_IDENTIFICATION_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { - 'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'AccessConstraints': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Fees': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + OWS.NAMESPACE_URIS_, { + 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'AccessConstraints': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Fees': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'ServiceTypeVersion': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), - 'ServiceType': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) + XSD.readString), + 'ServiceType': _ol_xml_.makeObjectPropertySetter(XSD.readString) }); @@ -419,12 +419,12 @@ _ol_format_OWS_.SERVICE_IDENTIFICATION_PARSERS_ = * @type {Object.>} * @private */ -_ol_format_OWS_.SERVICE_PROVIDER_PARSERS_ = +OWS.SERVICE_PROVIDER_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_OWS_.NAMESPACE_URIS_, { - 'ProviderName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'ProviderSite': _ol_xml_.makeObjectPropertySetter(_ol_format_XLink_.readHref), + OWS.NAMESPACE_URIS_, { + 'ProviderName': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'ProviderSite': _ol_xml_.makeObjectPropertySetter(XLink.readHref), 'ServiceContact': _ol_xml_.makeObjectPropertySetter( - _ol_format_OWS_.readServiceContact_) + OWS.readServiceContact_) }); -export default _ol_format_OWS_; +export default OWS; diff --git a/src/ol/format/Polyline.js b/src/ol/format/Polyline.js index 952b12c7f5..282be5f3b5 100644 --- a/src/ol/format/Polyline.js +++ b/src/ol/format/Polyline.js @@ -4,8 +4,8 @@ import {inherits} from '../index.js'; import _ol_asserts_ from '../asserts.js'; import _ol_Feature_ from '../Feature.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_TextFeature_ from '../format/TextFeature.js'; +import FeatureFormat from '../format/Feature.js'; +import TextFeature from '../format/TextFeature.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import LineString from '../geom/LineString.js'; import SimpleGeometry from '../geom/SimpleGeometry.js'; @@ -24,11 +24,11 @@ import {get as getProjection} from '../proj.js'; * Optional configuration object. * @api */ -var _ol_format_Polyline_ = function(opt_options) { +var Polyline = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_format_TextFeature_.call(this); + TextFeature.call(this); /** * @inheritDoc @@ -49,7 +49,7 @@ var _ol_format_Polyline_ = function(opt_options) { options.geometryLayout : GeometryLayout.XY; }; -inherits(_ol_format_Polyline_, _ol_format_TextFeature_); +inherits(Polyline, TextFeature); /** @@ -65,7 +65,7 @@ inherits(_ol_format_Polyline_, _ol_format_TextFeature_); * @return {string} The encoded string. * @api */ -_ol_format_Polyline_.encodeDeltas = function(numbers, stride, opt_factor) { +Polyline.encodeDeltas = function(numbers, stride, opt_factor) { var factor = opt_factor ? opt_factor : 1e5; var d; @@ -85,7 +85,7 @@ _ol_format_Polyline_.encodeDeltas = function(numbers, stride, opt_factor) { } } - return _ol_format_Polyline_.encodeFloats(numbers, factor); + return Polyline.encodeFloats(numbers, factor); }; @@ -100,7 +100,7 @@ _ol_format_Polyline_.encodeDeltas = function(numbers, stride, opt_factor) { * @return {Array.} A list of n-dimensional points. * @api */ -_ol_format_Polyline_.decodeDeltas = function(encoded, stride, opt_factor) { +Polyline.decodeDeltas = function(encoded, stride, opt_factor) { var factor = opt_factor ? opt_factor : 1e5; var d; @@ -110,7 +110,7 @@ _ol_format_Polyline_.decodeDeltas = function(encoded, stride, opt_factor) { lastNumbers[d] = 0; } - var numbers = _ol_format_Polyline_.decodeFloats(encoded, factor); + var numbers = Polyline.decodeFloats(encoded, factor); var i, ii; for (i = 0, ii = numbers.length; i < ii;) { @@ -137,14 +137,14 @@ _ol_format_Polyline_.decodeDeltas = function(encoded, stride, opt_factor) { * @return {string} The encoded string. * @api */ -_ol_format_Polyline_.encodeFloats = function(numbers, opt_factor) { +Polyline.encodeFloats = function(numbers, opt_factor) { var factor = opt_factor ? opt_factor : 1e5; var i, ii; for (i = 0, ii = numbers.length; i < ii; ++i) { numbers[i] = Math.round(numbers[i] * factor); } - return _ol_format_Polyline_.encodeSignedIntegers(numbers); + return Polyline.encodeSignedIntegers(numbers); }; @@ -157,9 +157,9 @@ _ol_format_Polyline_.encodeFloats = function(numbers, opt_factor) { * @return {Array.} A list of floating point numbers. * @api */ -_ol_format_Polyline_.decodeFloats = function(encoded, opt_factor) { +Polyline.decodeFloats = function(encoded, opt_factor) { var factor = opt_factor ? opt_factor : 1e5; - var numbers = _ol_format_Polyline_.decodeSignedIntegers(encoded); + var numbers = Polyline.decodeSignedIntegers(encoded); var i, ii; for (i = 0, ii = numbers.length; i < ii; ++i) { numbers[i] /= factor; @@ -176,13 +176,13 @@ _ol_format_Polyline_.decodeFloats = function(encoded, opt_factor) { * @param {Array.} numbers A list of signed integers. * @return {string} The encoded string. */ -_ol_format_Polyline_.encodeSignedIntegers = function(numbers) { +Polyline.encodeSignedIntegers = function(numbers) { var i, ii; for (i = 0, ii = numbers.length; i < ii; ++i) { var num = numbers[i]; numbers[i] = (num < 0) ? ~(num << 1) : (num << 1); } - return _ol_format_Polyline_.encodeUnsignedIntegers(numbers); + return Polyline.encodeUnsignedIntegers(numbers); }; @@ -192,8 +192,8 @@ _ol_format_Polyline_.encodeSignedIntegers = function(numbers) { * @param {string} encoded An encoded string. * @return {Array.} A list of signed integers. */ -_ol_format_Polyline_.decodeSignedIntegers = function(encoded) { - var numbers = _ol_format_Polyline_.decodeUnsignedIntegers(encoded); +Polyline.decodeSignedIntegers = function(encoded) { + var numbers = Polyline.decodeUnsignedIntegers(encoded); var i, ii; for (i = 0, ii = numbers.length; i < ii; ++i) { var num = numbers[i]; @@ -209,11 +209,11 @@ _ol_format_Polyline_.decodeSignedIntegers = function(encoded) { * @param {Array.} numbers A list of unsigned integers. * @return {string} The encoded string. */ -_ol_format_Polyline_.encodeUnsignedIntegers = function(numbers) { +Polyline.encodeUnsignedIntegers = function(numbers) { var encoded = ''; var i, ii; for (i = 0, ii = numbers.length; i < ii; ++i) { - encoded += _ol_format_Polyline_.encodeUnsignedInteger(numbers[i]); + encoded += Polyline.encodeUnsignedInteger(numbers[i]); } return encoded; }; @@ -225,7 +225,7 @@ _ol_format_Polyline_.encodeUnsignedIntegers = function(numbers) { * @param {string} encoded An encoded string. * @return {Array.} A list of unsigned integers. */ -_ol_format_Polyline_.decodeUnsignedIntegers = function(encoded) { +Polyline.decodeUnsignedIntegers = function(encoded) { var numbers = []; var current = 0; var shift = 0; @@ -251,7 +251,7 @@ _ol_format_Polyline_.decodeUnsignedIntegers = function(encoded) { * @param {number} num Unsigned integer that should be encoded. * @return {string} The encoded string. */ -_ol_format_Polyline_.encodeUnsignedInteger = function(num) { +Polyline.encodeUnsignedInteger = function(num) { var value, encoded = ''; while (num >= 0x20) { value = (0x20 | (num & 0x1f)) + 63; @@ -274,13 +274,13 @@ _ol_format_Polyline_.encodeUnsignedInteger = function(num) { * @return {ol.Feature} Feature. * @api */ -_ol_format_Polyline_.prototype.readFeature; +Polyline.prototype.readFeature; /** * @inheritDoc */ -_ol_format_Polyline_.prototype.readFeatureFromText = function(text, opt_options) { +Polyline.prototype.readFeatureFromText = function(text, opt_options) { var geometry = this.readGeometryFromText(text, opt_options); return new _ol_Feature_(geometry); }; @@ -296,13 +296,13 @@ _ol_format_Polyline_.prototype.readFeatureFromText = function(text, opt_options) * @return {Array.} Features. * @api */ -_ol_format_Polyline_.prototype.readFeatures; +Polyline.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_Polyline_.prototype.readFeaturesFromText = function(text, opt_options) { +Polyline.prototype.readFeaturesFromText = function(text, opt_options) { var feature = this.readFeatureFromText(text, opt_options); return [feature]; }; @@ -317,15 +317,15 @@ _ol_format_Polyline_.prototype.readFeaturesFromText = function(text, opt_options * @return {ol.geom.Geometry} Geometry. * @api */ -_ol_format_Polyline_.prototype.readGeometry; +Polyline.prototype.readGeometry; /** * @inheritDoc */ -_ol_format_Polyline_.prototype.readGeometryFromText = function(text, opt_options) { +Polyline.prototype.readGeometryFromText = function(text, opt_options) { var stride = SimpleGeometry.getStrideForLayout(this.geometryLayout_); - var flatCoordinates = _ol_format_Polyline_.decodeDeltas( + var flatCoordinates = Polyline.decodeDeltas( text, stride, this.factor_); _ol_geom_flat_flip_.flipXY( flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates); @@ -333,7 +333,7 @@ _ol_format_Polyline_.prototype.readGeometryFromText = function(text, opt_options flatCoordinates, 0, flatCoordinates.length, stride); return ( - /** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions( + /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions( new LineString(coordinates, this.geometryLayout_), false, this.adaptOptions(opt_options)) ); @@ -348,13 +348,13 @@ _ol_format_Polyline_.prototype.readGeometryFromText = function(text, opt_options * @return {ol.proj.Projection} Projection. * @api */ -_ol_format_Polyline_.prototype.readProjection; +Polyline.prototype.readProjection; /** * @inheritDoc */ -_ol_format_Polyline_.prototype.writeFeatureText = function(feature, opt_options) { +Polyline.prototype.writeFeatureText = function(feature, opt_options) { var geometry = feature.getGeometry(); if (geometry) { return this.writeGeometryText(geometry, opt_options); @@ -368,7 +368,7 @@ _ol_format_Polyline_.prototype.writeFeatureText = function(feature, opt_options) /** * @inheritDoc */ -_ol_format_Polyline_.prototype.writeFeaturesText = function(features, opt_options) { +Polyline.prototype.writeFeaturesText = function(features, opt_options) { return this.writeFeatureText(features[0], opt_options); }; @@ -382,20 +382,20 @@ _ol_format_Polyline_.prototype.writeFeaturesText = function(features, opt_option * @return {string} Geometry. * @api */ -_ol_format_Polyline_.prototype.writeGeometry; +Polyline.prototype.writeGeometry; /** * @inheritDoc */ -_ol_format_Polyline_.prototype.writeGeometryText = function(geometry, opt_options) { +Polyline.prototype.writeGeometryText = function(geometry, opt_options) { geometry = /** @type {ol.geom.LineString} */ - (_ol_format_Feature_.transformWithOptions( + (FeatureFormat.transformWithOptions( geometry, true, this.adaptOptions(opt_options))); var flatCoordinates = geometry.getFlatCoordinates(); var stride = geometry.getStride(); _ol_geom_flat_flip_.flipXY( flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates); - return _ol_format_Polyline_.encodeDeltas(flatCoordinates, stride, this.factor_); + return Polyline.encodeDeltas(flatCoordinates, stride, this.factor_); }; -export default _ol_format_Polyline_; +export default Polyline; diff --git a/src/ol/format/TextFeature.js b/src/ol/format/TextFeature.js index d39087ca3f..31543cfa02 100644 --- a/src/ol/format/TextFeature.js +++ b/src/ol/format/TextFeature.js @@ -2,7 +2,7 @@ * @module ol/format/TextFeature */ import {inherits} from '../index.js'; -import _ol_format_Feature_ from '../format/Feature.js'; +import FeatureFormat from '../format/Feature.js'; import _ol_format_FormatType_ from '../format/FormatType.js'; /** @@ -15,11 +15,11 @@ import _ol_format_FormatType_ from '../format/FormatType.js'; * @abstract * @extends {ol.format.Feature} */ -var _ol_format_TextFeature_ = function() { - _ol_format_Feature_.call(this); +var TextFeature = function() { + FeatureFormat.call(this); }; -inherits(_ol_format_TextFeature_, _ol_format_Feature_); +inherits(TextFeature, FeatureFormat); /** @@ -27,7 +27,7 @@ inherits(_ol_format_TextFeature_, _ol_format_Feature_); * @private * @return {string} Text. */ -_ol_format_TextFeature_.prototype.getText_ = function(source) { +TextFeature.prototype.getText_ = function(source) { if (typeof source === 'string') { return source; } else { @@ -39,7 +39,7 @@ _ol_format_TextFeature_.prototype.getText_ = function(source) { /** * @inheritDoc */ -_ol_format_TextFeature_.prototype.getType = function() { +TextFeature.prototype.getType = function() { return _ol_format_FormatType_.TEXT; }; @@ -47,7 +47,7 @@ _ol_format_TextFeature_.prototype.getType = function() { /** * @inheritDoc */ -_ol_format_TextFeature_.prototype.readFeature = function(source, opt_options) { +TextFeature.prototype.readFeature = function(source, opt_options) { return this.readFeatureFromText( this.getText_(source), this.adaptOptions(opt_options)); }; @@ -60,13 +60,13 @@ _ol_format_TextFeature_.prototype.readFeature = function(source, opt_options) { * @protected * @return {ol.Feature} Feature. */ -_ol_format_TextFeature_.prototype.readFeatureFromText = function(text, opt_options) {}; +TextFeature.prototype.readFeatureFromText = function(text, opt_options) {}; /** * @inheritDoc */ -_ol_format_TextFeature_.prototype.readFeatures = function(source, opt_options) { +TextFeature.prototype.readFeatures = function(source, opt_options) { return this.readFeaturesFromText( this.getText_(source), this.adaptOptions(opt_options)); }; @@ -79,13 +79,13 @@ _ol_format_TextFeature_.prototype.readFeatures = function(source, opt_options) { * @protected * @return {Array.} Features. */ -_ol_format_TextFeature_.prototype.readFeaturesFromText = function(text, opt_options) {}; +TextFeature.prototype.readFeaturesFromText = function(text, opt_options) {}; /** * @inheritDoc */ -_ol_format_TextFeature_.prototype.readGeometry = function(source, opt_options) { +TextFeature.prototype.readGeometry = function(source, opt_options) { return this.readGeometryFromText( this.getText_(source), this.adaptOptions(opt_options)); }; @@ -98,13 +98,13 @@ _ol_format_TextFeature_.prototype.readGeometry = function(source, opt_options) { * @protected * @return {ol.geom.Geometry} Geometry. */ -_ol_format_TextFeature_.prototype.readGeometryFromText = function(text, opt_options) {}; +TextFeature.prototype.readGeometryFromText = function(text, opt_options) {}; /** * @inheritDoc */ -_ol_format_TextFeature_.prototype.readProjection = function(source) { +TextFeature.prototype.readProjection = function(source) { return this.readProjectionFromText(this.getText_(source)); }; @@ -114,7 +114,7 @@ _ol_format_TextFeature_.prototype.readProjection = function(source) { * @protected * @return {ol.proj.Projection} Projection. */ -_ol_format_TextFeature_.prototype.readProjectionFromText = function(text) { +TextFeature.prototype.readProjectionFromText = function(text) { return this.defaultDataProjection; }; @@ -122,7 +122,7 @@ _ol_format_TextFeature_.prototype.readProjectionFromText = function(text) { /** * @inheritDoc */ -_ol_format_TextFeature_.prototype.writeFeature = function(feature, opt_options) { +TextFeature.prototype.writeFeature = function(feature, opt_options) { return this.writeFeatureText(feature, this.adaptOptions(opt_options)); }; @@ -134,13 +134,13 @@ _ol_format_TextFeature_.prototype.writeFeature = function(feature, opt_options) * @protected * @return {string} Text. */ -_ol_format_TextFeature_.prototype.writeFeatureText = function(feature, opt_options) {}; +TextFeature.prototype.writeFeatureText = function(feature, opt_options) {}; /** * @inheritDoc */ -_ol_format_TextFeature_.prototype.writeFeatures = function( +TextFeature.prototype.writeFeatures = function( features, opt_options) { return this.writeFeaturesText(features, this.adaptOptions(opt_options)); }; @@ -153,13 +153,13 @@ _ol_format_TextFeature_.prototype.writeFeatures = function( * @protected * @return {string} Text. */ -_ol_format_TextFeature_.prototype.writeFeaturesText = function(features, opt_options) {}; +TextFeature.prototype.writeFeaturesText = function(features, opt_options) {}; /** * @inheritDoc */ -_ol_format_TextFeature_.prototype.writeGeometry = function( +TextFeature.prototype.writeGeometry = function( geometry, opt_options) { return this.writeGeometryText(geometry, this.adaptOptions(opt_options)); }; @@ -172,5 +172,5 @@ _ol_format_TextFeature_.prototype.writeGeometry = function( * @protected * @return {string} Text. */ -_ol_format_TextFeature_.prototype.writeGeometryText = function(geometry, opt_options) {}; -export default _ol_format_TextFeature_; +TextFeature.prototype.writeGeometryText = function(geometry, opt_options) {}; +export default TextFeature; diff --git a/src/ol/format/TopoJSON.js b/src/ol/format/TopoJSON.js index 212079a062..6a19c80ed7 100644 --- a/src/ol/format/TopoJSON.js +++ b/src/ol/format/TopoJSON.js @@ -3,8 +3,8 @@ */ import {inherits} from '../index.js'; import _ol_Feature_ from '../Feature.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_JSONFeature_ from '../format/JSONFeature.js'; +import FeatureFormat from '../format/Feature.js'; +import JSONFeature from '../format/JSONFeature.js'; import LineString from '../geom/LineString.js'; import MultiLineString from '../geom/MultiLineString.js'; import MultiPoint from '../geom/MultiPoint.js'; @@ -22,11 +22,11 @@ import {get as getProjection} from '../proj.js'; * @param {olx.format.TopoJSONOptions=} opt_options Options. * @api */ -var _ol_format_TopoJSON_ = function(opt_options) { +var TopoJSON = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_format_JSONFeature_.call(this); + JSONFeature.call(this); /** * @private @@ -49,7 +49,7 @@ var _ol_format_TopoJSON_ = function(opt_options) { }; -inherits(_ol_format_TopoJSON_, _ol_format_JSONFeature_); +inherits(TopoJSON, JSONFeature); /** @@ -61,7 +61,7 @@ inherits(_ol_format_TopoJSON_, _ol_format_JSONFeature_); * @return {Array.} Coordinates array. * @private */ -_ol_format_TopoJSON_.concatenateArcs_ = function(indices, arcs) { +TopoJSON.concatenateArcs_ = function(indices, arcs) { /** @type {Array.} */ var coordinates = []; var index, arc; @@ -99,10 +99,10 @@ _ol_format_TopoJSON_.concatenateArcs_ = function(indices, arcs) { * @return {ol.geom.Point} Geometry. * @private */ -_ol_format_TopoJSON_.readPointGeometry_ = function(object, scale, translate) { +TopoJSON.readPointGeometry_ = function(object, scale, translate) { var coordinates = object.coordinates; if (scale && translate) { - _ol_format_TopoJSON_.transformVertex_(coordinates, scale, translate); + TopoJSON.transformVertex_(coordinates, scale, translate); } return new Point(coordinates); }; @@ -117,13 +117,13 @@ _ol_format_TopoJSON_.readPointGeometry_ = function(object, scale, translate) { * @return {ol.geom.MultiPoint} Geometry. * @private */ -_ol_format_TopoJSON_.readMultiPointGeometry_ = function(object, scale, +TopoJSON.readMultiPointGeometry_ = function(object, scale, translate) { var coordinates = object.coordinates; var i, ii; if (scale && translate) { for (i = 0, ii = coordinates.length; i < ii; ++i) { - _ol_format_TopoJSON_.transformVertex_(coordinates[i], scale, translate); + TopoJSON.transformVertex_(coordinates[i], scale, translate); } } return new MultiPoint(coordinates); @@ -138,8 +138,8 @@ _ol_format_TopoJSON_.readMultiPointGeometry_ = function(object, scale, * @return {ol.geom.LineString} Geometry. * @private */ -_ol_format_TopoJSON_.readLineStringGeometry_ = function(object, arcs) { - var coordinates = _ol_format_TopoJSON_.concatenateArcs_(object.arcs, arcs); +TopoJSON.readLineStringGeometry_ = function(object, arcs) { + var coordinates = TopoJSON.concatenateArcs_(object.arcs, arcs); return new LineString(coordinates); }; @@ -152,11 +152,11 @@ _ol_format_TopoJSON_.readLineStringGeometry_ = function(object, arcs) { * @return {ol.geom.MultiLineString} Geometry. * @private */ -_ol_format_TopoJSON_.readMultiLineStringGeometry_ = function(object, arcs) { +TopoJSON.readMultiLineStringGeometry_ = function(object, arcs) { var coordinates = []; var i, ii; for (i = 0, ii = object.arcs.length; i < ii; ++i) { - coordinates[i] = _ol_format_TopoJSON_.concatenateArcs_(object.arcs[i], arcs); + coordinates[i] = TopoJSON.concatenateArcs_(object.arcs[i], arcs); } return new MultiLineString(coordinates); }; @@ -170,11 +170,11 @@ _ol_format_TopoJSON_.readMultiLineStringGeometry_ = function(object, arcs) { * @return {ol.geom.Polygon} Geometry. * @private */ -_ol_format_TopoJSON_.readPolygonGeometry_ = function(object, arcs) { +TopoJSON.readPolygonGeometry_ = function(object, arcs) { var coordinates = []; var i, ii; for (i = 0, ii = object.arcs.length; i < ii; ++i) { - coordinates[i] = _ol_format_TopoJSON_.concatenateArcs_(object.arcs[i], arcs); + coordinates[i] = TopoJSON.concatenateArcs_(object.arcs[i], arcs); } return new Polygon(coordinates); }; @@ -188,7 +188,7 @@ _ol_format_TopoJSON_.readPolygonGeometry_ = function(object, arcs) { * @return {ol.geom.MultiPolygon} Geometry. * @private */ -_ol_format_TopoJSON_.readMultiPolygonGeometry_ = function(object, arcs) { +TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) { var coordinates = []; var polyArray, ringCoords, j, jj; var i, ii; @@ -198,7 +198,7 @@ _ol_format_TopoJSON_.readMultiPolygonGeometry_ = function(object, arcs) { ringCoords = []; for (j = 0, jj = polyArray.length; j < jj; ++j) { // for each ring - ringCoords[j] = _ol_format_TopoJSON_.concatenateArcs_(polyArray[j], arcs); + ringCoords[j] = TopoJSON.concatenateArcs_(polyArray[j], arcs); } coordinates[i] = ringCoords; } @@ -221,13 +221,13 @@ _ol_format_TopoJSON_.readMultiPolygonGeometry_ = function(object, arcs) { * @return {Array.} Array of features. * @private */ -_ol_format_TopoJSON_.readFeaturesFromGeometryCollection_ = function( +TopoJSON.readFeaturesFromGeometryCollection_ = function( collection, arcs, scale, translate, property, name, opt_options) { var geometries = collection.geometries; var features = []; var i, ii; for (i = 0, ii = geometries.length; i < ii; ++i) { - features[i] = _ol_format_TopoJSON_.readFeatureFromGeometry_( + features[i] = TopoJSON.readFeatureFromGeometry_( geometries[i], arcs, scale, translate, property, name, opt_options); } return features; @@ -248,11 +248,11 @@ _ol_format_TopoJSON_.readFeaturesFromGeometryCollection_ = function( * @return {ol.Feature} Feature. * @private */ -_ol_format_TopoJSON_.readFeatureFromGeometry_ = function(object, arcs, +TopoJSON.readFeatureFromGeometry_ = function(object, arcs, scale, translate, property, name, opt_options) { var geometry; var type = object.type; - var geometryReader = _ol_format_TopoJSON_.GEOMETRY_READERS_[type]; + var geometryReader = TopoJSON.GEOMETRY_READERS_[type]; if ((type === 'Point') || (type === 'MultiPoint')) { geometry = geometryReader(object, scale, translate); } else { @@ -260,7 +260,7 @@ _ol_format_TopoJSON_.readFeatureFromGeometry_ = function(object, arcs, } var feature = new _ol_Feature_(); feature.setGeometry(/** @type {ol.geom.Geometry} */ ( - _ol_format_Feature_.transformWithOptions(geometry, false, opt_options))); + FeatureFormat.transformWithOptions(geometry, false, opt_options))); if (object.id !== undefined) { feature.setId(object.id); } @@ -286,13 +286,13 @@ _ol_format_TopoJSON_.readFeatureFromGeometry_ = function(object, arcs, * @return {Array.} Features. * @api */ -_ol_format_TopoJSON_.prototype.readFeatures; +TopoJSON.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_TopoJSON_.prototype.readFeaturesFromObject = function( +TopoJSON.prototype.readFeaturesFromObject = function( object, opt_options) { if (object.type == 'Topology') { var topoJSONTopology = /** @type {TopoJSONTopology} */ (object); @@ -304,7 +304,7 @@ _ol_format_TopoJSON_.prototype.readFeaturesFromObject = function( } var arcs = topoJSONTopology.arcs; if (transform) { - _ol_format_TopoJSON_.transformArcs_(arcs, scale, translate); + TopoJSON.transformArcs_(arcs, scale, translate); } /** @type {Array.} */ var features = []; @@ -319,12 +319,12 @@ _ol_format_TopoJSON_.prototype.readFeaturesFromObject = function( feature = /** @type {TopoJSONGeometryCollection} */ (topoJSONFeatures[objectName]); features.push.apply(features, - _ol_format_TopoJSON_.readFeaturesFromGeometryCollection_( + TopoJSON.readFeaturesFromGeometryCollection_( feature, arcs, scale, translate, property, objectName, opt_options)); } else { feature = /** @type {TopoJSONGeometry} */ (topoJSONFeatures[objectName]); - features.push(_ol_format_TopoJSON_.readFeatureFromGeometry_( + features.push(TopoJSON.readFeatureFromGeometry_( feature, arcs, scale, translate, property, objectName, opt_options)); } } @@ -344,10 +344,10 @@ _ol_format_TopoJSON_.prototype.readFeaturesFromObject = function( * @param {Array.} translate Translation for each dimension. * @private */ -_ol_format_TopoJSON_.transformArcs_ = function(arcs, scale, translate) { +TopoJSON.transformArcs_ = function(arcs, scale, translate) { var i, ii; for (i = 0, ii = arcs.length; i < ii; ++i) { - _ol_format_TopoJSON_.transformArc_(arcs[i], scale, translate); + TopoJSON.transformArc_(arcs[i], scale, translate); } }; @@ -360,7 +360,7 @@ _ol_format_TopoJSON_.transformArcs_ = function(arcs, scale, translate) { * @param {Array.} translate Translation for each dimension. * @private */ -_ol_format_TopoJSON_.transformArc_ = function(arc, scale, translate) { +TopoJSON.transformArc_ = function(arc, scale, translate) { var x = 0; var y = 0; var vertex; @@ -371,7 +371,7 @@ _ol_format_TopoJSON_.transformArc_ = function(arc, scale, translate) { y += vertex[1]; vertex[0] = x; vertex[1] = y; - _ol_format_TopoJSON_.transformVertex_(vertex, scale, translate); + TopoJSON.transformVertex_(vertex, scale, translate); } }; @@ -385,7 +385,7 @@ _ol_format_TopoJSON_.transformArc_ = function(arc, scale, translate) { * @param {Array.} translate Translation for each dimension. * @private */ -_ol_format_TopoJSON_.transformVertex_ = function(vertex, scale, translate) { +TopoJSON.transformVertex_ = function(vertex, scale, translate) { vertex[0] = vertex[0] * scale[0] + translate[0]; vertex[1] = vertex[1] * scale[1] + translate[1]; }; @@ -399,13 +399,13 @@ _ol_format_TopoJSON_.transformVertex_ = function(vertex, scale, translate) { * @override * @api */ -_ol_format_TopoJSON_.prototype.readProjection; +TopoJSON.prototype.readProjection; /** * @inheritDoc */ -_ol_format_TopoJSON_.prototype.readProjectionFromObject = function(object) { +TopoJSON.prototype.readProjectionFromObject = function(object) { return this.defaultDataProjection; }; @@ -415,13 +415,13 @@ _ol_format_TopoJSON_.prototype.readProjectionFromObject = function(object) { * @private * @type {Object.} */ -_ol_format_TopoJSON_.GEOMETRY_READERS_ = { - 'Point': _ol_format_TopoJSON_.readPointGeometry_, - 'LineString': _ol_format_TopoJSON_.readLineStringGeometry_, - 'Polygon': _ol_format_TopoJSON_.readPolygonGeometry_, - 'MultiPoint': _ol_format_TopoJSON_.readMultiPointGeometry_, - 'MultiLineString': _ol_format_TopoJSON_.readMultiLineStringGeometry_, - 'MultiPolygon': _ol_format_TopoJSON_.readMultiPolygonGeometry_ +TopoJSON.GEOMETRY_READERS_ = { + 'Point': TopoJSON.readPointGeometry_, + 'LineString': TopoJSON.readLineStringGeometry_, + 'Polygon': TopoJSON.readPolygonGeometry_, + 'MultiPoint': TopoJSON.readMultiPointGeometry_, + 'MultiLineString': TopoJSON.readMultiLineStringGeometry_, + 'MultiPolygon': TopoJSON.readMultiPolygonGeometry_ }; @@ -429,33 +429,33 @@ _ol_format_TopoJSON_.GEOMETRY_READERS_ = { * Not implemented. * @inheritDoc */ -_ol_format_TopoJSON_.prototype.writeFeatureObject = function(feature, opt_options) {}; +TopoJSON.prototype.writeFeatureObject = function(feature, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_TopoJSON_.prototype.writeFeaturesObject = function(features, opt_options) {}; +TopoJSON.prototype.writeFeaturesObject = function(features, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_TopoJSON_.prototype.writeGeometryObject = function(geometry, opt_options) {}; +TopoJSON.prototype.writeGeometryObject = function(geometry, opt_options) {}; /** * Not implemented. * @override */ -_ol_format_TopoJSON_.prototype.readGeometryFromObject = function() {}; +TopoJSON.prototype.readGeometryFromObject = function() {}; /** * Not implemented. * @override */ -_ol_format_TopoJSON_.prototype.readFeatureFromObject = function() {}; -export default _ol_format_TopoJSON_; +TopoJSON.prototype.readFeatureFromObject = function() {}; +export default TopoJSON; diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index be1720a9c3..ebdad61b0e 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -3,12 +3,12 @@ */ import {inherits} from '../index.js'; import _ol_asserts_ from '../asserts.js'; -import _ol_format_GML2_ from '../format/GML2.js'; -import _ol_format_GML3_ from '../format/GML3.js'; -import _ol_format_GMLBase_ from '../format/GMLBase.js'; +import GML2 from '../format/GML2.js'; +import GML3 from '../format/GML3.js'; +import GMLBase from '../format/GMLBase.js'; import _ol_format_filter_ from '../format/filter.js'; -import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XMLFeature from '../format/XMLFeature.js'; +import XSD from '../format/XSD.js'; import Geometry from '../geom/Geometry.js'; import _ol_obj_ from '../obj.js'; import {get as getProjection} from '../proj.js'; @@ -27,7 +27,7 @@ import _ol_xml_ from '../xml.js'; * @extends {ol.format.XMLFeature} * @api */ -var _ol_format_WFS_ = function(opt_options) { +var WFS = function(opt_options) { var options = opt_options ? opt_options : {}; /** @@ -47,7 +47,7 @@ var _ol_format_WFS_ = function(opt_options) { * @type {ol.format.GMLBase} */ this.gmlFormat_ = options.gmlFormat ? - options.gmlFormat : new _ol_format_GML3_(); + options.gmlFormat : new GML3(); /** * @private @@ -55,54 +55,54 @@ var _ol_format_WFS_ = function(opt_options) { */ this.schemaLocation_ = options.schemaLocation ? options.schemaLocation : - _ol_format_WFS_.SCHEMA_LOCATIONS[_ol_format_WFS_.DEFAULT_VERSION]; + WFS.SCHEMA_LOCATIONS[WFS.DEFAULT_VERSION]; - _ol_format_XMLFeature_.call(this); + XMLFeature.call(this); }; -inherits(_ol_format_WFS_, _ol_format_XMLFeature_); +inherits(WFS, XMLFeature); /** * @const * @type {string} */ -_ol_format_WFS_.FEATURE_PREFIX = 'feature'; +WFS.FEATURE_PREFIX = 'feature'; /** * @const * @type {string} */ -_ol_format_WFS_.XMLNS = 'http://www.w3.org/2000/xmlns/'; +WFS.XMLNS = 'http://www.w3.org/2000/xmlns/'; /** * @const * @type {string} */ -_ol_format_WFS_.OGCNS = 'http://www.opengis.net/ogc'; +WFS.OGCNS = 'http://www.opengis.net/ogc'; /** * @const * @type {string} */ -_ol_format_WFS_.WFSNS = 'http://www.opengis.net/wfs'; +WFS.WFSNS = 'http://www.opengis.net/wfs'; /** * @const * @type {string} */ -_ol_format_WFS_.FESNS = 'http://www.opengis.net/fes'; +WFS.FESNS = 'http://www.opengis.net/fes'; /** * @const * @type {Object.} */ -_ol_format_WFS_.SCHEMA_LOCATIONS = { +WFS.SCHEMA_LOCATIONS = { '1.1.0': 'http://www.opengis.net/wfs ' + 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd', '1.0.0': 'http://www.opengis.net/wfs ' + @@ -114,13 +114,13 @@ _ol_format_WFS_.SCHEMA_LOCATIONS = { * @const * @type {string} */ -_ol_format_WFS_.DEFAULT_VERSION = '1.1.0'; +WFS.DEFAULT_VERSION = '1.1.0'; /** * @return {Array.|string|undefined} featureType */ -_ol_format_WFS_.prototype.getFeatureType = function() { +WFS.prototype.getFeatureType = function() { return this.featureType_; }; @@ -128,7 +128,7 @@ _ol_format_WFS_.prototype.getFeatureType = function() { /** * @param {Array.|string|undefined} featureType Feature type(s) to parse. */ -_ol_format_WFS_.prototype.setFeatureType = function(featureType) { +WFS.prototype.setFeatureType = function(featureType) { this.featureType_ = featureType; }; @@ -142,13 +142,13 @@ _ol_format_WFS_.prototype.setFeatureType = function(featureType) { * @return {Array.} Features. * @api */ -_ol_format_WFS_.prototype.readFeatures; +WFS.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_WFS_.prototype.readFeaturesFromNode = function(node, opt_options) { +WFS.prototype.readFeaturesFromNode = function(node, opt_options) { var context = /** @type {ol.XmlNodeStackItem} */ ({ 'featureType': this.featureType_, 'featureNS': this.featureNS_ @@ -156,9 +156,9 @@ _ol_format_WFS_.prototype.readFeaturesFromNode = function(node, opt_options) { _ol_obj_.assign(context, this.getReadOptions(node, opt_options ? opt_options : {})); var objectStack = [context]; - this.gmlFormat_.FEATURE_COLLECTION_PARSERS[_ol_format_GMLBase_.GMLNS][ + this.gmlFormat_.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS][ 'featureMember'] = - _ol_xml_.makeArrayPusher(_ol_format_GMLBase_.prototype.readFeaturesInternal); + _ol_xml_.makeArrayPusher(GMLBase.prototype.readFeaturesInternal); var features = _ol_xml_.pushParseAndPop([], this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node, objectStack, this.gmlFormat_); @@ -176,7 +176,7 @@ _ol_format_WFS_.prototype.readFeaturesFromNode = function(node, opt_options) { * @return {ol.WFSTransactionResponse|undefined} Transaction response. * @api */ -_ol_format_WFS_.prototype.readTransactionResponse = function(source) { +WFS.prototype.readTransactionResponse = function(source) { if (_ol_xml_.isDocument(source)) { return this.readTransactionResponseFromDocument( /** @type {Document} */ (source)); @@ -199,7 +199,7 @@ _ol_format_WFS_.prototype.readTransactionResponse = function(source) { * FeatureCollection metadata. * @api */ -_ol_format_WFS_.prototype.readFeatureCollectionMetadata = function(source) { +WFS.prototype.readFeatureCollectionMetadata = function(source) { if (_ol_xml_.isDocument(source)) { return this.readFeatureCollectionMetadataFromDocument( /** @type {Document} */ (source)); @@ -220,7 +220,7 @@ _ol_format_WFS_.prototype.readFeatureCollectionMetadata = function(source) { * @return {ol.WFSFeatureCollectionMetadata|undefined} * FeatureCollection metadata. */ -_ol_format_WFS_.prototype.readFeatureCollectionMetadataFromDocument = function(doc) { +WFS.prototype.readFeatureCollectionMetadataFromDocument = function(doc) { for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { return this.readFeatureCollectionMetadataFromNode(n); @@ -235,10 +235,10 @@ _ol_format_WFS_.prototype.readFeatureCollectionMetadataFromDocument = function(d * @type {Object.>} * @private */ -_ol_format_WFS_.FEATURE_COLLECTION_PARSERS_ = { +WFS.FEATURE_COLLECTION_PARSERS_ = { 'http://www.opengis.net/gml': { 'boundedBy': _ol_xml_.makeObjectPropertySetter( - _ol_format_GMLBase_.prototype.readGeometryElement, 'bounds') + GMLBase.prototype.readGeometryElement, 'bounds') } }; @@ -248,14 +248,14 @@ _ol_format_WFS_.FEATURE_COLLECTION_PARSERS_ = { * @return {ol.WFSFeatureCollectionMetadata|undefined} * FeatureCollection metadata. */ -_ol_format_WFS_.prototype.readFeatureCollectionMetadataFromNode = function(node) { +WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) { var result = {}; - var value = _ol_format_XSD_.readNonNegativeIntegerString( + var value = XSD.readNonNegativeIntegerString( node.getAttribute('numberOfFeatures')); result['numberOfFeatures'] = value; return _ol_xml_.pushParseAndPop( /** @type {ol.WFSFeatureCollectionMetadata} */ (result), - _ol_format_WFS_.FEATURE_COLLECTION_PARSERS_, node, [], this.gmlFormat_); + WFS.FEATURE_COLLECTION_PARSERS_, node, [], this.gmlFormat_); }; @@ -264,14 +264,14 @@ _ol_format_WFS_.prototype.readFeatureCollectionMetadataFromNode = function(node) * @type {Object.>} * @private */ -_ol_format_WFS_.TRANSACTION_SUMMARY_PARSERS_ = { +WFS.TRANSACTION_SUMMARY_PARSERS_ = { 'http://www.opengis.net/wfs': { 'totalInserted': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'totalUpdated': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'totalDeleted': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger) + XSD.readNonNegativeInteger) } }; @@ -282,9 +282,9 @@ _ol_format_WFS_.TRANSACTION_SUMMARY_PARSERS_ = { * @return {Object|undefined} Transaction Summary. * @private */ -_ol_format_WFS_.readTransactionSummary_ = function(node, objectStack) { +WFS.readTransactionSummary_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WFS_.TRANSACTION_SUMMARY_PARSERS_, node, objectStack); + {}, WFS.TRANSACTION_SUMMARY_PARSERS_, node, objectStack); }; @@ -293,7 +293,7 @@ _ol_format_WFS_.readTransactionSummary_ = function(node, objectStack) { * @type {Object.>} * @private */ -_ol_format_WFS_.OGC_FID_PARSERS_ = { +WFS.OGC_FID_PARSERS_ = { 'http://www.opengis.net/ogc': { 'FeatureId': _ol_xml_.makeArrayPusher(function(node, objectStack) { return node.getAttribute('fid'); @@ -307,8 +307,8 @@ _ol_format_WFS_.OGC_FID_PARSERS_ = { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_WFS_.fidParser_ = function(node, objectStack) { - _ol_xml_.parseNode(_ol_format_WFS_.OGC_FID_PARSERS_, node, objectStack); +WFS.fidParser_ = function(node, objectStack) { + _ol_xml_.parseNode(WFS.OGC_FID_PARSERS_, node, objectStack); }; @@ -317,9 +317,9 @@ _ol_format_WFS_.fidParser_ = function(node, objectStack) { * @type {Object.>} * @private */ -_ol_format_WFS_.INSERT_RESULTS_PARSERS_ = { +WFS.INSERT_RESULTS_PARSERS_ = { 'http://www.opengis.net/wfs': { - 'Feature': _ol_format_WFS_.fidParser_ + 'Feature': WFS.fidParser_ } }; @@ -330,9 +330,9 @@ _ol_format_WFS_.INSERT_RESULTS_PARSERS_ = { * @return {Array.|undefined} Insert results. * @private */ -_ol_format_WFS_.readInsertResults_ = function(node, objectStack) { +WFS.readInsertResults_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - [], _ol_format_WFS_.INSERT_RESULTS_PARSERS_, node, objectStack); + [], WFS.INSERT_RESULTS_PARSERS_, node, objectStack); }; @@ -341,12 +341,12 @@ _ol_format_WFS_.readInsertResults_ = function(node, objectStack) { * @type {Object.>} * @private */ -_ol_format_WFS_.TRANSACTION_RESPONSE_PARSERS_ = { +WFS.TRANSACTION_RESPONSE_PARSERS_ = { 'http://www.opengis.net/wfs': { 'TransactionSummary': _ol_xml_.makeObjectPropertySetter( - _ol_format_WFS_.readTransactionSummary_, 'transactionSummary'), + WFS.readTransactionSummary_, 'transactionSummary'), 'InsertResults': _ol_xml_.makeObjectPropertySetter( - _ol_format_WFS_.readInsertResults_, 'insertIds') + WFS.readInsertResults_, 'insertIds') } }; @@ -355,7 +355,7 @@ _ol_format_WFS_.TRANSACTION_RESPONSE_PARSERS_ = { * @param {Document} doc Document. * @return {ol.WFSTransactionResponse|undefined} Transaction response. */ -_ol_format_WFS_.prototype.readTransactionResponseFromDocument = function(doc) { +WFS.prototype.readTransactionResponseFromDocument = function(doc) { for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { return this.readTransactionResponseFromNode(n); @@ -369,10 +369,10 @@ _ol_format_WFS_.prototype.readTransactionResponseFromDocument = function(doc) { * @param {Node} node Node. * @return {ol.WFSTransactionResponse|undefined} Transaction response. */ -_ol_format_WFS_.prototype.readTransactionResponseFromNode = function(node) { +WFS.prototype.readTransactionResponseFromNode = function(node) { return _ol_xml_.pushParseAndPop( /** @type {ol.WFSTransactionResponse} */({}), - _ol_format_WFS_.TRANSACTION_RESPONSE_PARSERS_, node, []); + WFS.TRANSACTION_RESPONSE_PARSERS_, node, []); }; @@ -380,9 +380,9 @@ _ol_format_WFS_.prototype.readTransactionResponseFromNode = function(node) { * @type {Object.>} * @private */ -_ol_format_WFS_.QUERY_SERIALIZERS_ = { +WFS.QUERY_SERIALIZERS_ = { 'http://www.opengis.net/wfs': { - 'PropertyName': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) + 'PropertyName': _ol_xml_.makeChildAppender(XSD.writeStringTextNode) } }; @@ -393,7 +393,7 @@ _ol_format_WFS_.QUERY_SERIALIZERS_ = { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeFeature_ = function(node, feature, objectStack) { +WFS.writeFeature_ = function(node, feature, objectStack) { var context = objectStack[objectStack.length - 1]; var featureType = context['featureType']; var featureNS = context['featureNS']; @@ -401,9 +401,9 @@ _ol_format_WFS_.writeFeature_ = function(node, feature, objectStack) { var child = _ol_xml_.createElementNS(featureNS, featureType); node.appendChild(child); if (gmlVersion === 2) { - _ol_format_GML2_.prototype.writeFeatureElement(child, feature, objectStack); + GML2.prototype.writeFeatureElement(child, feature, objectStack); } else { - _ol_format_GML3_.prototype.writeFeatureElement(child, feature, objectStack); + GML3.prototype.writeFeatureElement(child, feature, objectStack); } }; @@ -414,9 +414,9 @@ _ol_format_WFS_.writeFeature_ = function(node, feature, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeOgcFidFilter_ = function(node, fid, objectStack) { - var filter = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'Filter'); - var child = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'FeatureId'); +WFS.writeOgcFidFilter_ = function(node, fid, objectStack) { + var filter = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter'); + var child = _ol_xml_.createElementNS(WFS.OGCNS, 'FeatureId'); filter.appendChild(child); child.setAttribute('fid', fid); node.appendChild(filter); @@ -429,9 +429,9 @@ _ol_format_WFS_.writeOgcFidFilter_ = function(node, fid, objectStack) { * @returns {string} The value of the typeName property. * @private */ -_ol_format_WFS_.getTypeName_ = function(featurePrefix, featureType) { +WFS.getTypeName_ = function(featurePrefix, featureType) { featurePrefix = featurePrefix ? featurePrefix : - _ol_format_WFS_.FEATURE_PREFIX; + WFS.FEATURE_PREFIX; var prefix = featurePrefix + ':'; // The featureType already contains the prefix. if (featureType.indexOf(prefix) === 0) { @@ -448,19 +448,19 @@ _ol_format_WFS_.getTypeName_ = function(featurePrefix, featureType) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeDelete_ = function(node, feature, objectStack) { +WFS.writeDelete_ = function(node, feature, objectStack) { var context = objectStack[objectStack.length - 1]; _ol_asserts_.assert(feature.getId() !== undefined, 26); // Features must have an id set var featureType = context['featureType']; var featurePrefix = context['featurePrefix']; var featureNS = context['featureNS']; - var typeName = _ol_format_WFS_.getTypeName_(featurePrefix, featureType); + var typeName = WFS.getTypeName_(featurePrefix, featureType); node.setAttribute('typeName', typeName); - _ol_xml_.setAttributeNS(node, _ol_format_WFS_.XMLNS, 'xmlns:' + featurePrefix, + _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix, featureNS); var fid = feature.getId(); if (fid !== undefined) { - _ol_format_WFS_.writeOgcFidFilter_(node, fid, objectStack); + WFS.writeOgcFidFilter_(node, fid, objectStack); } }; @@ -471,16 +471,16 @@ _ol_format_WFS_.writeDelete_ = function(node, feature, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeUpdate_ = function(node, feature, objectStack) { +WFS.writeUpdate_ = function(node, feature, objectStack) { var context = objectStack[objectStack.length - 1]; _ol_asserts_.assert(feature.getId() !== undefined, 27); // Features must have an id set var featureType = context['featureType']; var featurePrefix = context['featurePrefix']; var featureNS = context['featureNS']; - var typeName = _ol_format_WFS_.getTypeName_(featurePrefix, featureType); + var typeName = WFS.getTypeName_(featurePrefix, featureType); var geometryName = feature.getGeometryName(); node.setAttribute('typeName', typeName); - _ol_xml_.setAttributeNS(node, _ol_format_WFS_.XMLNS, 'xmlns:' + featurePrefix, + _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix, featureNS); var fid = feature.getId(); if (fid !== undefined) { @@ -499,10 +499,10 @@ _ol_format_WFS_.writeUpdate_ = function(node, feature, objectStack) { _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ( {'gmlVersion': context['gmlVersion'], node: node, 'hasZ': context['hasZ'], 'srsName': context['srsName']}), - _ol_format_WFS_.TRANSACTION_SERIALIZERS_, + WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Property'), values, objectStack); - _ol_format_WFS_.writeOgcFidFilter_(node, fid, objectStack); + WFS.writeOgcFidFilter_(node, fid, objectStack); } }; @@ -513,25 +513,25 @@ _ol_format_WFS_.writeUpdate_ = function(node, feature, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeProperty_ = function(node, pair, objectStack) { - var name = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'Name'); +WFS.writeProperty_ = function(node, pair, objectStack) { + var name = _ol_xml_.createElementNS(WFS.WFSNS, 'Name'); var context = objectStack[objectStack.length - 1]; var gmlVersion = context['gmlVersion']; node.appendChild(name); - _ol_format_XSD_.writeStringTextNode(name, pair.name); + XSD.writeStringTextNode(name, pair.name); if (pair.value !== undefined && pair.value !== null) { - var value = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'Value'); + var value = _ol_xml_.createElementNS(WFS.WFSNS, 'Value'); node.appendChild(value); if (pair.value instanceof Geometry) { if (gmlVersion === 2) { - _ol_format_GML2_.prototype.writeGeometryElement(value, + GML2.prototype.writeGeometryElement(value, pair.value, objectStack); } else { - _ol_format_GML3_.prototype.writeGeometryElement(value, + GML3.prototype.writeGeometryElement(value, pair.value, objectStack); } } else { - _ol_format_XSD_.writeStringTextNode(value, pair.value); + XSD.writeStringTextNode(value, pair.value); } } }; @@ -544,7 +544,7 @@ _ol_format_WFS_.writeProperty_ = function(node, pair, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeNative_ = function(node, nativeElement, objectStack) { +WFS.writeNative_ = function(node, nativeElement, objectStack) { if (nativeElement.vendorId) { node.setAttribute('vendorId', nativeElement.vendorId); } @@ -552,7 +552,7 @@ _ol_format_WFS_.writeNative_ = function(node, nativeElement, objectStack) { node.setAttribute('safeToIgnore', nativeElement.safeToIgnore); } if (nativeElement.value !== undefined) { - _ol_format_XSD_.writeStringTextNode(node, nativeElement.value); + XSD.writeStringTextNode(node, nativeElement.value); } }; @@ -561,13 +561,13 @@ _ol_format_WFS_.writeNative_ = function(node, nativeElement, objectStack) { * @type {Object.>} * @private */ -_ol_format_WFS_.TRANSACTION_SERIALIZERS_ = { +WFS.TRANSACTION_SERIALIZERS_ = { 'http://www.opengis.net/wfs': { - 'Insert': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeFeature_), - 'Update': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeUpdate_), - 'Delete': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeDelete_), - 'Property': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeProperty_), - 'Native': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeNative_) + 'Insert': _ol_xml_.makeChildAppender(WFS.writeFeature_), + 'Update': _ol_xml_.makeChildAppender(WFS.writeUpdate_), + 'Delete': _ol_xml_.makeChildAppender(WFS.writeDelete_), + 'Property': _ol_xml_.makeChildAppender(WFS.writeProperty_), + 'Native': _ol_xml_.makeChildAppender(WFS.writeNative_) } }; @@ -578,7 +578,7 @@ _ol_format_WFS_.TRANSACTION_SERIALIZERS_ = { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) { +WFS.writeQuery_ = function(node, featureType, objectStack) { var context = /** @type {Object} */ (objectStack[objectStack.length - 1]); var featurePrefix = context['featurePrefix']; var featureNS = context['featureNS']; @@ -587,7 +587,7 @@ _ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) { var typeName; // If feature prefix is not defined, we must not use the default prefix. if (featurePrefix) { - typeName = _ol_format_WFS_.getTypeName_(featurePrefix, featureType); + typeName = WFS.getTypeName_(featurePrefix, featureType); } else { typeName = featureType; } @@ -596,20 +596,20 @@ _ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) { node.setAttribute('srsName', srsName); } if (featureNS) { - _ol_xml_.setAttributeNS(node, _ol_format_WFS_.XMLNS, 'xmlns:' + featurePrefix, + _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix, featureNS); } var item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context)); item.node = node; _ol_xml_.pushSerializeAndPop(item, - _ol_format_WFS_.QUERY_SERIALIZERS_, + WFS.QUERY_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('PropertyName'), propertyNames, objectStack); var filter = context['filter']; if (filter) { - var child = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'Filter'); + var child = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter'); node.appendChild(child); - _ol_format_WFS_.writeFilterCondition_(child, filter, objectStack); + WFS.writeFilterCondition_(child, filter, objectStack); } }; @@ -620,11 +620,11 @@ _ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeFilterCondition_ = function(node, filter, objectStack) { +WFS.writeFilterCondition_ = function(node, filter, objectStack) { /** @type {ol.XmlNodeStackItem} */ var item = {node: node}; _ol_xml_.pushSerializeAndPop(item, - _ol_format_WFS_.GETFEATURE_SERIALIZERS_, + WFS.GETFEATURE_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory(filter.getTagName()), [filter], objectStack); }; @@ -636,12 +636,12 @@ _ol_format_WFS_.writeFilterCondition_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeBboxFilter_ = function(node, filter, objectStack) { +WFS.writeBboxFilter_ = function(node, filter, objectStack) { var context = objectStack[objectStack.length - 1]; context['srsName'] = filter.srsName; - _ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); - _ol_format_GML3_.prototype.writeGeometryElement(node, filter.extent, objectStack); + WFS.writeOgcPropertyName_(node, filter.geometryName); + GML3.prototype.writeGeometryElement(node, filter.extent, objectStack); }; @@ -651,12 +651,12 @@ _ol_format_WFS_.writeBboxFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeContainsFilter_ = function(node, filter, objectStack) { +WFS.writeContainsFilter_ = function(node, filter, objectStack) { var context = objectStack[objectStack.length - 1]; context['srsName'] = filter.srsName; - _ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); - _ol_format_GML3_.prototype.writeGeometryElement(node, filter.geometry, objectStack); + WFS.writeOgcPropertyName_(node, filter.geometryName); + GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack); }; @@ -666,12 +666,12 @@ _ol_format_WFS_.writeContainsFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeIntersectsFilter_ = function(node, filter, objectStack) { +WFS.writeIntersectsFilter_ = function(node, filter, objectStack) { var context = objectStack[objectStack.length - 1]; context['srsName'] = filter.srsName; - _ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); - _ol_format_GML3_.prototype.writeGeometryElement(node, filter.geometry, objectStack); + WFS.writeOgcPropertyName_(node, filter.geometryName); + GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack); }; @@ -681,12 +681,12 @@ _ol_format_WFS_.writeIntersectsFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeWithinFilter_ = function(node, filter, objectStack) { +WFS.writeWithinFilter_ = function(node, filter, objectStack) { var context = objectStack[objectStack.length - 1]; context['srsName'] = filter.srsName; - _ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); - _ol_format_GML3_.prototype.writeGeometryElement(node, filter.geometry, objectStack); + WFS.writeOgcPropertyName_(node, filter.geometryName); + GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack); }; @@ -696,23 +696,23 @@ _ol_format_WFS_.writeWithinFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeDuringFilter_ = function(node, filter, objectStack) { +WFS.writeDuringFilter_ = function(node, filter, objectStack) { - var valueReference = _ol_xml_.createElementNS(_ol_format_WFS_.FESNS, 'ValueReference'); - _ol_format_XSD_.writeStringTextNode(valueReference, filter.propertyName); + var valueReference = _ol_xml_.createElementNS(WFS.FESNS, 'ValueReference'); + XSD.writeStringTextNode(valueReference, filter.propertyName); node.appendChild(valueReference); - var timePeriod = _ol_xml_.createElementNS(_ol_format_GMLBase_.GMLNS, 'TimePeriod'); + var timePeriod = _ol_xml_.createElementNS(GMLBase.GMLNS, 'TimePeriod'); node.appendChild(timePeriod); - var begin = _ol_xml_.createElementNS(_ol_format_GMLBase_.GMLNS, 'begin'); + var begin = _ol_xml_.createElementNS(GMLBase.GMLNS, 'begin'); timePeriod.appendChild(begin); - _ol_format_WFS_.writeTimeInstant_(begin, filter.begin); + WFS.writeTimeInstant_(begin, filter.begin); - var end = _ol_xml_.createElementNS(_ol_format_GMLBase_.GMLNS, 'end'); + var end = _ol_xml_.createElementNS(GMLBase.GMLNS, 'end'); timePeriod.appendChild(end); - _ol_format_WFS_.writeTimeInstant_(end, filter.end); + WFS.writeTimeInstant_(end, filter.end); }; @@ -722,14 +722,14 @@ _ol_format_WFS_.writeDuringFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeLogicalFilter_ = function(node, filter, objectStack) { +WFS.writeLogicalFilter_ = function(node, filter, objectStack) { /** @type {ol.XmlNodeStackItem} */ var item = {node: node}; var conditions = filter.conditions; for (var i = 0, ii = conditions.length; i < ii; ++i) { var condition = conditions[i]; _ol_xml_.pushSerializeAndPop(item, - _ol_format_WFS_.GETFEATURE_SERIALIZERS_, + WFS.GETFEATURE_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory(condition.getTagName()), [condition], objectStack); } @@ -742,12 +742,12 @@ _ol_format_WFS_.writeLogicalFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeNotFilter_ = function(node, filter, objectStack) { +WFS.writeNotFilter_ = function(node, filter, objectStack) { /** @type {ol.XmlNodeStackItem} */ var item = {node: node}; var condition = filter.condition; _ol_xml_.pushSerializeAndPop(item, - _ol_format_WFS_.GETFEATURE_SERIALIZERS_, + WFS.GETFEATURE_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory(condition.getTagName()), [condition], objectStack); }; @@ -759,12 +759,12 @@ _ol_format_WFS_.writeNotFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeComparisonFilter_ = function(node, filter, objectStack) { +WFS.writeComparisonFilter_ = function(node, filter, objectStack) { if (filter.matchCase !== undefined) { node.setAttribute('matchCase', filter.matchCase.toString()); } - _ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); - _ol_format_WFS_.writeOgcLiteral_(node, '' + filter.expression); + WFS.writeOgcPropertyName_(node, filter.propertyName); + WFS.writeOgcLiteral_(node, '' + filter.expression); }; @@ -774,8 +774,8 @@ _ol_format_WFS_.writeComparisonFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeIsNullFilter_ = function(node, filter, objectStack) { - _ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); +WFS.writeIsNullFilter_ = function(node, filter, objectStack) { + WFS.writeOgcPropertyName_(node, filter.propertyName); }; @@ -785,16 +785,16 @@ _ol_format_WFS_.writeIsNullFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeIsBetweenFilter_ = function(node, filter, objectStack) { - _ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); +WFS.writeIsBetweenFilter_ = function(node, filter, objectStack) { + WFS.writeOgcPropertyName_(node, filter.propertyName); - var lowerBoundary = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'LowerBoundary'); + var lowerBoundary = _ol_xml_.createElementNS(WFS.OGCNS, 'LowerBoundary'); node.appendChild(lowerBoundary); - _ol_format_WFS_.writeOgcLiteral_(lowerBoundary, '' + filter.lowerBoundary); + WFS.writeOgcLiteral_(lowerBoundary, '' + filter.lowerBoundary); - var upperBoundary = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'UpperBoundary'); + var upperBoundary = _ol_xml_.createElementNS(WFS.OGCNS, 'UpperBoundary'); node.appendChild(upperBoundary); - _ol_format_WFS_.writeOgcLiteral_(upperBoundary, '' + filter.upperBoundary); + WFS.writeOgcLiteral_(upperBoundary, '' + filter.upperBoundary); }; @@ -804,15 +804,15 @@ _ol_format_WFS_.writeIsBetweenFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeIsLikeFilter_ = function(node, filter, objectStack) { +WFS.writeIsLikeFilter_ = function(node, filter, objectStack) { node.setAttribute('wildCard', filter.wildCard); node.setAttribute('singleChar', filter.singleChar); node.setAttribute('escapeChar', filter.escapeChar); if (filter.matchCase !== undefined) { node.setAttribute('matchCase', filter.matchCase.toString()); } - _ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); - _ol_format_WFS_.writeOgcLiteral_(node, '' + filter.pattern); + WFS.writeOgcPropertyName_(node, filter.propertyName); + WFS.writeOgcLiteral_(node, '' + filter.pattern); }; @@ -822,9 +822,9 @@ _ol_format_WFS_.writeIsLikeFilter_ = function(node, filter, objectStack) { * @param {string} value Value. * @private */ -_ol_format_WFS_.writeOgcExpression_ = function(tagName, node, value) { - var property = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, tagName); - _ol_format_XSD_.writeStringTextNode(property, value); +WFS.writeOgcExpression_ = function(tagName, node, value) { + var property = _ol_xml_.createElementNS(WFS.OGCNS, tagName); + XSD.writeStringTextNode(property, value); node.appendChild(property); }; @@ -834,8 +834,8 @@ _ol_format_WFS_.writeOgcExpression_ = function(tagName, node, value) { * @param {string} value PropertyName value. * @private */ -_ol_format_WFS_.writeOgcPropertyName_ = function(node, value) { - _ol_format_WFS_.writeOgcExpression_('PropertyName', node, value); +WFS.writeOgcPropertyName_ = function(node, value) { + WFS.writeOgcExpression_('PropertyName', node, value); }; @@ -844,8 +844,8 @@ _ol_format_WFS_.writeOgcPropertyName_ = function(node, value) { * @param {string} value PropertyName value. * @private */ -_ol_format_WFS_.writeOgcLiteral_ = function(node, value) { - _ol_format_WFS_.writeOgcExpression_('Literal', node, value); +WFS.writeOgcLiteral_ = function(node, value) { + WFS.writeOgcExpression_('Literal', node, value); }; @@ -854,13 +854,13 @@ _ol_format_WFS_.writeOgcLiteral_ = function(node, value) { * @param {string} time PropertyName value. * @private */ -_ol_format_WFS_.writeTimeInstant_ = function(node, time) { - var timeInstant = _ol_xml_.createElementNS(_ol_format_GMLBase_.GMLNS, 'TimeInstant'); +WFS.writeTimeInstant_ = function(node, time) { + var timeInstant = _ol_xml_.createElementNS(GMLBase.GMLNS, 'TimeInstant'); node.appendChild(timeInstant); - var timePosition = _ol_xml_.createElementNS(_ol_format_GMLBase_.GMLNS, 'timePosition'); + var timePosition = _ol_xml_.createElementNS(GMLBase.GMLNS, 'timePosition'); timeInstant.appendChild(timePosition); - _ol_format_XSD_.writeStringTextNode(timePosition, time); + XSD.writeStringTextNode(timePosition, time); }; @@ -868,28 +868,28 @@ _ol_format_WFS_.writeTimeInstant_ = function(node, time) { * @type {Object.>} * @private */ -_ol_format_WFS_.GETFEATURE_SERIALIZERS_ = { +WFS.GETFEATURE_SERIALIZERS_ = { 'http://www.opengis.net/wfs': { - 'Query': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeQuery_) + 'Query': _ol_xml_.makeChildAppender(WFS.writeQuery_) }, 'http://www.opengis.net/ogc': { - 'During': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeDuringFilter_), - 'And': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeLogicalFilter_), - 'Or': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeLogicalFilter_), - 'Not': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeNotFilter_), - 'BBOX': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeBboxFilter_), - 'Contains': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeContainsFilter_), - 'Intersects': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIntersectsFilter_), - 'Within': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeWithinFilter_), - 'PropertyIsEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsNotEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsLessThan': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsLessThanOrEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsGreaterThan': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsGreaterThanOrEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsNull': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIsNullFilter_), - 'PropertyIsBetween': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIsBetweenFilter_), - 'PropertyIsLike': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIsLikeFilter_) + 'During': _ol_xml_.makeChildAppender(WFS.writeDuringFilter_), + 'And': _ol_xml_.makeChildAppender(WFS.writeLogicalFilter_), + 'Or': _ol_xml_.makeChildAppender(WFS.writeLogicalFilter_), + 'Not': _ol_xml_.makeChildAppender(WFS.writeNotFilter_), + 'BBOX': _ol_xml_.makeChildAppender(WFS.writeBboxFilter_), + 'Contains': _ol_xml_.makeChildAppender(WFS.writeContainsFilter_), + 'Intersects': _ol_xml_.makeChildAppender(WFS.writeIntersectsFilter_), + 'Within': _ol_xml_.makeChildAppender(WFS.writeWithinFilter_), + 'PropertyIsEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsNotEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsLessThan': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsLessThanOrEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsGreaterThan': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsGreaterThanOrEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsNull': _ol_xml_.makeChildAppender(WFS.writeIsNullFilter_), + 'PropertyIsBetween': _ol_xml_.makeChildAppender(WFS.writeIsBetweenFilter_), + 'PropertyIsLike': _ol_xml_.makeChildAppender(WFS.writeIsLikeFilter_) } }; @@ -901,9 +901,9 @@ _ol_format_WFS_.GETFEATURE_SERIALIZERS_ = { * @return {Node} Result. * @api */ -_ol_format_WFS_.writeFilter = function(filter) { - var child = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'Filter'); - _ol_format_WFS_.writeFilterCondition_(child, filter, []); +WFS.writeFilter = function(filter) { + var child = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter'); + WFS.writeFilterCondition_(child, filter, []); return child; }; @@ -914,12 +914,12 @@ _ol_format_WFS_.writeFilter = function(filter) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeGetFeature_ = function(node, featureTypes, objectStack) { +WFS.writeGetFeature_ = function(node, featureTypes, objectStack) { var context = /** @type {Object} */ (objectStack[objectStack.length - 1]); var item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context)); item.node = node; _ol_xml_.pushSerializeAndPop(item, - _ol_format_WFS_.GETFEATURE_SERIALIZERS_, + WFS.GETFEATURE_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Query'), featureTypes, objectStack); }; @@ -932,8 +932,8 @@ _ol_format_WFS_.writeGetFeature_ = function(node, featureTypes, objectStack) { * @return {Node} Result. * @api */ -_ol_format_WFS_.prototype.writeGetFeature = function(options) { - var node = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'GetFeature'); +WFS.prototype.writeGetFeature = function(options) { + var node = _ol_xml_.createElementNS(WFS.WFSNS, 'GetFeature'); node.setAttribute('service', 'WFS'); node.setAttribute('version', '1.1.0'); var filter; @@ -984,7 +984,7 @@ _ol_format_WFS_.prototype.writeGetFeature = function(options) { }; _ol_asserts_.assert(Array.isArray(options.featureTypes), 11); // `options.featureTypes` should be an Array - _ol_format_WFS_.writeGetFeature_(node, /** @type {!Array.} */ (options.featureTypes), [context]); + WFS.writeGetFeature_(node, /** @type {!Array.} */ (options.featureTypes), [context]); return node; }; @@ -999,12 +999,12 @@ _ol_format_WFS_.prototype.writeGetFeature = function(options) { * @return {Node} Result. * @api */ -_ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, +WFS.prototype.writeTransaction = function(inserts, updates, deletes, options) { var objectStack = []; - var node = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'Transaction'); + var node = _ol_xml_.createElementNS(WFS.WFSNS, 'Transaction'); var version = options.version ? - options.version : _ol_format_WFS_.DEFAULT_VERSION; + options.version : WFS.DEFAULT_VERSION; var gmlVersion = version === '1.0.0' ? 2 : 3; node.setAttribute('service', 'WFS'); node.setAttribute('version', version); @@ -1017,17 +1017,17 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, node.setAttribute('handle', options.handle); } } - var schemaLocation = _ol_format_WFS_.SCHEMA_LOCATIONS[version]; + var schemaLocation = WFS.SCHEMA_LOCATIONS[version]; _ol_xml_.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', schemaLocation); - var featurePrefix = options.featurePrefix ? options.featurePrefix : _ol_format_WFS_.FEATURE_PREFIX; + var featurePrefix = options.featurePrefix ? options.featurePrefix : WFS.FEATURE_PREFIX; if (inserts) { obj = {node: node, 'featureNS': options.featureNS, 'featureType': options.featureType, 'featurePrefix': featurePrefix, 'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; _ol_obj_.assign(obj, baseObj); _ol_xml_.pushSerializeAndPop(obj, - _ol_format_WFS_.TRANSACTION_SERIALIZERS_, + WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Insert'), inserts, objectStack); } @@ -1037,7 +1037,7 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, 'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; _ol_obj_.assign(obj, baseObj); _ol_xml_.pushSerializeAndPop(obj, - _ol_format_WFS_.TRANSACTION_SERIALIZERS_, + WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Update'), updates, objectStack); } @@ -1045,7 +1045,7 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, _ol_xml_.pushSerializeAndPop({node: node, 'featureNS': options.featureNS, 'featureType': options.featureType, 'featurePrefix': featurePrefix, 'gmlVersion': gmlVersion, 'srsName': options.srsName}, - _ol_format_WFS_.TRANSACTION_SERIALIZERS_, + WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Delete'), deletes, objectStack); } @@ -1053,7 +1053,7 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, _ol_xml_.pushSerializeAndPop({node: node, 'featureNS': options.featureNS, 'featureType': options.featureType, 'featurePrefix': featurePrefix, 'gmlVersion': gmlVersion, 'srsName': options.srsName}, - _ol_format_WFS_.TRANSACTION_SERIALIZERS_, + WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Native'), options.nativeElements, objectStack); } @@ -1069,13 +1069,13 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, * @return {?ol.proj.Projection} Projection. * @api */ -_ol_format_WFS_.prototype.readProjection; +WFS.prototype.readProjection; /** * @inheritDoc */ -_ol_format_WFS_.prototype.readProjectionFromDocument = function(doc) { +WFS.prototype.readProjectionFromDocument = function(doc) { for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { return this.readProjectionFromNode(n); @@ -1088,7 +1088,7 @@ _ol_format_WFS_.prototype.readProjectionFromDocument = function(doc) { /** * @inheritDoc */ -_ol_format_WFS_.prototype.readProjectionFromNode = function(node) { +WFS.prototype.readProjectionFromNode = function(node) { if (node.firstElementChild && node.firstElementChild.firstElementChild) { node = node.firstElementChild.firstElementChild; @@ -1105,4 +1105,4 @@ _ol_format_WFS_.prototype.readProjectionFromNode = function(node) { return null; }; -export default _ol_format_WFS_; +export default WFS; diff --git a/src/ol/format/WKT.js b/src/ol/format/WKT.js index b26469909c..7b49365ac6 100644 --- a/src/ol/format/WKT.js +++ b/src/ol/format/WKT.js @@ -3,8 +3,8 @@ */ import {inherits} from '../index.js'; import _ol_Feature_ from '../Feature.js'; -import _ol_format_Feature_ from '../format/Feature.js'; -import _ol_format_TextFeature_ from '../format/TextFeature.js'; +import FeatureFormat from '../format/Feature.js'; +import TextFeature from '../format/TextFeature.js'; import GeometryCollection from '../geom/GeometryCollection.js'; import GeometryType from '../geom/GeometryType.js'; import GeometryLayout from '../geom/GeometryLayout.js'; @@ -26,11 +26,11 @@ import SimpleGeometry from '../geom/SimpleGeometry.js'; * @param {olx.format.WKTOptions=} opt_options Options. * @api */ -var _ol_format_WKT_ = function(opt_options) { +var WKT = function(opt_options) { var options = opt_options ? opt_options : {}; - _ol_format_TextFeature_.call(this); + TextFeature.call(this); /** * Split GeometryCollection into multiple features. @@ -42,35 +42,35 @@ var _ol_format_WKT_ = function(opt_options) { }; -inherits(_ol_format_WKT_, _ol_format_TextFeature_); +inherits(WKT, TextFeature); /** * @const * @type {string} */ -_ol_format_WKT_.EMPTY = 'EMPTY'; +WKT.EMPTY = 'EMPTY'; /** * @const * @type {string} */ -_ol_format_WKT_.Z = 'Z'; +WKT.Z = 'Z'; /** * @const * @type {string} */ -_ol_format_WKT_.M = 'M'; +WKT.M = 'M'; /** * @const * @type {string} */ -_ol_format_WKT_.ZM = 'ZM'; +WKT.ZM = 'ZM'; /** @@ -78,7 +78,7 @@ _ol_format_WKT_.ZM = 'ZM'; * @return {string} Coordinates part of Point as WKT. * @private */ -_ol_format_WKT_.encodePointGeometry_ = function(geom) { +WKT.encodePointGeometry_ = function(geom) { var coordinates = geom.getCoordinates(); if (coordinates.length === 0) { return ''; @@ -92,11 +92,11 @@ _ol_format_WKT_.encodePointGeometry_ = function(geom) { * @return {string} Coordinates part of MultiPoint as WKT. * @private */ -_ol_format_WKT_.encodeMultiPointGeometry_ = function(geom) { +WKT.encodeMultiPointGeometry_ = function(geom) { var array = []; var components = geom.getPoints(); for (var i = 0, ii = components.length; i < ii; ++i) { - array.push('(' + _ol_format_WKT_.encodePointGeometry_(components[i]) + ')'); + array.push('(' + WKT.encodePointGeometry_(components[i]) + ')'); } return array.join(','); }; @@ -107,11 +107,11 @@ _ol_format_WKT_.encodeMultiPointGeometry_ = function(geom) { * @return {string} Coordinates part of GeometryCollection as WKT. * @private */ -_ol_format_WKT_.encodeGeometryCollectionGeometry_ = function(geom) { +WKT.encodeGeometryCollectionGeometry_ = function(geom) { var array = []; var geoms = geom.getGeometries(); for (var i = 0, ii = geoms.length; i < ii; ++i) { - array.push(_ol_format_WKT_.encode_(geoms[i])); + array.push(WKT.encode_(geoms[i])); } return array.join(','); }; @@ -122,7 +122,7 @@ _ol_format_WKT_.encodeGeometryCollectionGeometry_ = function(geom) { * @return {string} Coordinates part of LineString as WKT. * @private */ -_ol_format_WKT_.encodeLineStringGeometry_ = function(geom) { +WKT.encodeLineStringGeometry_ = function(geom) { var coordinates = geom.getCoordinates(); var array = []; for (var i = 0, ii = coordinates.length; i < ii; ++i) { @@ -137,11 +137,11 @@ _ol_format_WKT_.encodeLineStringGeometry_ = function(geom) { * @return {string} Coordinates part of MultiLineString as WKT. * @private */ -_ol_format_WKT_.encodeMultiLineStringGeometry_ = function(geom) { +WKT.encodeMultiLineStringGeometry_ = function(geom) { var array = []; var components = geom.getLineStrings(); for (var i = 0, ii = components.length; i < ii; ++i) { - array.push('(' + _ol_format_WKT_.encodeLineStringGeometry_( + array.push('(' + WKT.encodeLineStringGeometry_( components[i]) + ')'); } return array.join(','); @@ -153,11 +153,11 @@ _ol_format_WKT_.encodeMultiLineStringGeometry_ = function(geom) { * @return {string} Coordinates part of Polygon as WKT. * @private */ -_ol_format_WKT_.encodePolygonGeometry_ = function(geom) { +WKT.encodePolygonGeometry_ = function(geom) { var array = []; var rings = geom.getLinearRings(); for (var i = 0, ii = rings.length; i < ii; ++i) { - array.push('(' + _ol_format_WKT_.encodeLineStringGeometry_( + array.push('(' + WKT.encodeLineStringGeometry_( rings[i]) + ')'); } return array.join(','); @@ -169,11 +169,11 @@ _ol_format_WKT_.encodePolygonGeometry_ = function(geom) { * @return {string} Coordinates part of MultiPolygon as WKT. * @private */ -_ol_format_WKT_.encodeMultiPolygonGeometry_ = function(geom) { +WKT.encodeMultiPolygonGeometry_ = function(geom) { var array = []; var components = geom.getPolygons(); for (var i = 0, ii = components.length; i < ii; ++i) { - array.push('(' + _ol_format_WKT_.encodePolygonGeometry_( + array.push('(' + WKT.encodePolygonGeometry_( components[i]) + ')'); } return array.join(','); @@ -184,14 +184,14 @@ _ol_format_WKT_.encodeMultiPolygonGeometry_ = function(geom) { * @return {string} Potential dimensional information for WKT type. * @private */ -_ol_format_WKT_.encodeGeometryLayout_ = function(geom) { +WKT.encodeGeometryLayout_ = function(geom) { var layout = geom.getLayout(); var dimInfo = ''; if (layout === GeometryLayout.XYZ || layout === GeometryLayout.XYZM) { - dimInfo += _ol_format_WKT_.Z; + dimInfo += WKT.Z; } if (layout === GeometryLayout.XYM || layout === GeometryLayout.XYZM) { - dimInfo += _ol_format_WKT_.M; + dimInfo += WKT.M; } return dimInfo; }; @@ -203,19 +203,19 @@ _ol_format_WKT_.encodeGeometryLayout_ = function(geom) { * @return {string} WKT string for the geometry. * @private */ -_ol_format_WKT_.encode_ = function(geom) { +WKT.encode_ = function(geom) { var type = geom.getType(); - var geometryEncoder = _ol_format_WKT_.GeometryEncoder_[type]; + var geometryEncoder = WKT.GeometryEncoder_[type]; var enc = geometryEncoder(geom); type = type.toUpperCase(); if (geom instanceof SimpleGeometry) { - var dimInfo = _ol_format_WKT_.encodeGeometryLayout_(geom); + var dimInfo = WKT.encodeGeometryLayout_(geom); if (dimInfo.length > 0) { type += ' ' + dimInfo; } } if (enc.length === 0) { - return type + ' ' + _ol_format_WKT_.EMPTY; + return type + ' ' + WKT.EMPTY; } return type + '(' + enc + ')'; }; @@ -226,14 +226,14 @@ _ol_format_WKT_.encode_ = function(geom) { * @type {Object.} * @private */ -_ol_format_WKT_.GeometryEncoder_ = { - 'Point': _ol_format_WKT_.encodePointGeometry_, - 'LineString': _ol_format_WKT_.encodeLineStringGeometry_, - 'Polygon': _ol_format_WKT_.encodePolygonGeometry_, - 'MultiPoint': _ol_format_WKT_.encodeMultiPointGeometry_, - 'MultiLineString': _ol_format_WKT_.encodeMultiLineStringGeometry_, - 'MultiPolygon': _ol_format_WKT_.encodeMultiPolygonGeometry_, - 'GeometryCollection': _ol_format_WKT_.encodeGeometryCollectionGeometry_ +WKT.GeometryEncoder_ = { + 'Point': WKT.encodePointGeometry_, + 'LineString': WKT.encodeLineStringGeometry_, + 'Polygon': WKT.encodePolygonGeometry_, + 'MultiPoint': WKT.encodeMultiPointGeometry_, + 'MultiLineString': WKT.encodeMultiLineStringGeometry_, + 'MultiPolygon': WKT.encodeMultiPolygonGeometry_, + 'GeometryCollection': WKT.encodeGeometryCollectionGeometry_ }; @@ -244,9 +244,9 @@ _ol_format_WKT_.GeometryEncoder_ = { * The geometry created. * @private */ -_ol_format_WKT_.prototype.parse_ = function(wkt) { - var lexer = new _ol_format_WKT_.Lexer(wkt); - var parser = new _ol_format_WKT_.Parser(lexer); +WKT.prototype.parse_ = function(wkt) { + var lexer = new WKT.Lexer(wkt); + var parser = new WKT.Parser(lexer); return parser.parse(); }; @@ -260,13 +260,13 @@ _ol_format_WKT_.prototype.parse_ = function(wkt) { * @return {ol.Feature} Feature. * @api */ -_ol_format_WKT_.prototype.readFeature; +WKT.prototype.readFeature; /** * @inheritDoc */ -_ol_format_WKT_.prototype.readFeatureFromText = function(text, opt_options) { +WKT.prototype.readFeatureFromText = function(text, opt_options) { var geom = this.readGeometryFromText(text, opt_options); if (geom) { var feature = new _ol_Feature_(); @@ -286,13 +286,13 @@ _ol_format_WKT_.prototype.readFeatureFromText = function(text, opt_options) { * @return {Array.} Features. * @api */ -_ol_format_WKT_.prototype.readFeatures; +WKT.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_WKT_.prototype.readFeaturesFromText = function(text, opt_options) { +WKT.prototype.readFeaturesFromText = function(text, opt_options) { var geometries = []; var geometry = this.readGeometryFromText(text, opt_options); if (this.splitCollection_ && @@ -321,17 +321,17 @@ _ol_format_WKT_.prototype.readFeaturesFromText = function(text, opt_options) { * @return {ol.geom.Geometry} Geometry. * @api */ -_ol_format_WKT_.prototype.readGeometry; +WKT.prototype.readGeometry; /** * @inheritDoc */ -_ol_format_WKT_.prototype.readGeometryFromText = function(text, opt_options) { +WKT.prototype.readGeometryFromText = function(text, opt_options) { var geometry = this.parse_(text); if (geometry) { return ( - /** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(geometry, false, opt_options) + /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions(geometry, false, opt_options) ); } else { return null; @@ -348,13 +348,13 @@ _ol_format_WKT_.prototype.readGeometryFromText = function(text, opt_options) { * @return {string} WKT string. * @api */ -_ol_format_WKT_.prototype.writeFeature; +WKT.prototype.writeFeature; /** * @inheritDoc */ -_ol_format_WKT_.prototype.writeFeatureText = function(feature, opt_options) { +WKT.prototype.writeFeatureText = function(feature, opt_options) { var geometry = feature.getGeometry(); if (geometry) { return this.writeGeometryText(geometry, opt_options); @@ -372,13 +372,13 @@ _ol_format_WKT_.prototype.writeFeatureText = function(feature, opt_options) { * @return {string} WKT string. * @api */ -_ol_format_WKT_.prototype.writeFeatures; +WKT.prototype.writeFeatures; /** * @inheritDoc */ -_ol_format_WKT_.prototype.writeFeaturesText = function(features, opt_options) { +WKT.prototype.writeFeaturesText = function(features, opt_options) { if (features.length == 1) { return this.writeFeatureText(features[0], opt_options); } @@ -400,15 +400,15 @@ _ol_format_WKT_.prototype.writeFeaturesText = function(features, opt_options) { * @return {string} WKT string. * @api */ -_ol_format_WKT_.prototype.writeGeometry; +WKT.prototype.writeGeometry; /** * @inheritDoc */ -_ol_format_WKT_.prototype.writeGeometryText = function(geometry, opt_options) { - return _ol_format_WKT_.encode_(/** @type {ol.geom.Geometry} */ ( - _ol_format_Feature_.transformWithOptions(geometry, true, opt_options))); +WKT.prototype.writeGeometryText = function(geometry, opt_options) { + return WKT.encode_(/** @type {ol.geom.Geometry} */ ( + FeatureFormat.transformWithOptions(geometry, true, opt_options))); }; @@ -417,7 +417,7 @@ _ol_format_WKT_.prototype.writeGeometryText = function(geometry, opt_options) { * @enum {number} * @private */ -_ol_format_WKT_.TokenType_ = { +WKT.TokenType_ = { TEXT: 1, LEFT_PAREN: 2, RIGHT_PAREN: 3, @@ -433,7 +433,7 @@ _ol_format_WKT_.TokenType_ = { * @constructor * @protected */ -_ol_format_WKT_.Lexer = function(wkt) { +WKT.Lexer = function(wkt) { /** * @type {string} @@ -453,7 +453,7 @@ _ol_format_WKT_.Lexer = function(wkt) { * @return {boolean} Whether the character is alphabetic. * @private */ -_ol_format_WKT_.Lexer.prototype.isAlpha_ = function(c) { +WKT.Lexer.prototype.isAlpha_ = function(c) { return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z'; }; @@ -465,7 +465,7 @@ _ol_format_WKT_.Lexer.prototype.isAlpha_ = function(c) { * @return {boolean} Whether the character is numeric. * @private */ -_ol_format_WKT_.Lexer.prototype.isNumeric_ = function(c, opt_decimal) { +WKT.Lexer.prototype.isNumeric_ = function(c, opt_decimal) { var decimal = opt_decimal !== undefined ? opt_decimal : false; return c >= '0' && c <= '9' || c == '.' && !decimal; }; @@ -476,7 +476,7 @@ _ol_format_WKT_.Lexer.prototype.isNumeric_ = function(c, opt_decimal) { * @return {boolean} Whether the character is whitespace. * @private */ -_ol_format_WKT_.Lexer.prototype.isWhiteSpace_ = function(c) { +WKT.Lexer.prototype.isWhiteSpace_ = function(c) { return c == ' ' || c == '\t' || c == '\r' || c == '\n'; }; @@ -485,7 +485,7 @@ _ol_format_WKT_.Lexer.prototype.isWhiteSpace_ = function(c) { * @return {string} Next string character. * @private */ -_ol_format_WKT_.Lexer.prototype.nextChar_ = function() { +WKT.Lexer.prototype.nextChar_ = function() { return this.wkt.charAt(++this.index_); }; @@ -494,26 +494,26 @@ _ol_format_WKT_.Lexer.prototype.nextChar_ = function() { * Fetch and return the next token. * @return {!ol.WKTToken} Next string token. */ -_ol_format_WKT_.Lexer.prototype.nextToken = function() { +WKT.Lexer.prototype.nextToken = function() { var c = this.nextChar_(); var token = {position: this.index_, value: c}; if (c == '(') { - token.type = _ol_format_WKT_.TokenType_.LEFT_PAREN; + token.type = WKT.TokenType_.LEFT_PAREN; } else if (c == ',') { - token.type = _ol_format_WKT_.TokenType_.COMMA; + token.type = WKT.TokenType_.COMMA; } else if (c == ')') { - token.type = _ol_format_WKT_.TokenType_.RIGHT_PAREN; + token.type = WKT.TokenType_.RIGHT_PAREN; } else if (this.isNumeric_(c) || c == '-') { - token.type = _ol_format_WKT_.TokenType_.NUMBER; + token.type = WKT.TokenType_.NUMBER; token.value = this.readNumber_(); } else if (this.isAlpha_(c)) { - token.type = _ol_format_WKT_.TokenType_.TEXT; + token.type = WKT.TokenType_.TEXT; token.value = this.readText_(); } else if (this.isWhiteSpace_(c)) { return this.nextToken(); } else if (c === '') { - token.type = _ol_format_WKT_.TokenType_.EOF; + token.type = WKT.TokenType_.EOF; } else { throw new Error('Unexpected character: ' + c); } @@ -526,7 +526,7 @@ _ol_format_WKT_.Lexer.prototype.nextToken = function() { * @return {number} Numeric token value. * @private */ -_ol_format_WKT_.Lexer.prototype.readNumber_ = function() { +WKT.Lexer.prototype.readNumber_ = function() { var c, index = this.index_; var decimal = false; var scientificNotation = false; @@ -554,7 +554,7 @@ _ol_format_WKT_.Lexer.prototype.readNumber_ = function() { * @return {string} String token value. * @private */ -_ol_format_WKT_.Lexer.prototype.readText_ = function() { +WKT.Lexer.prototype.readText_ = function() { var c, index = this.index_; do { c = this.nextChar_(); @@ -569,7 +569,7 @@ _ol_format_WKT_.Lexer.prototype.readText_ = function() { * @constructor * @protected */ -_ol_format_WKT_.Parser = function(lexer) { +WKT.Parser = function(lexer) { /** * @type {ol.format.WKT.Lexer} @@ -595,7 +595,7 @@ _ol_format_WKT_.Parser = function(lexer) { * Fetch the next token form the lexer and replace the active token. * @private */ -_ol_format_WKT_.Parser.prototype.consume_ = function() { +WKT.Parser.prototype.consume_ = function() { this.token_ = this.lexer_.nextToken(); }; @@ -604,7 +604,7 @@ _ol_format_WKT_.Parser.prototype.consume_ = function() { * @param {ol.format.WKT.TokenType_} type Token type. * @return {boolean} Whether the token matches the given type. */ -_ol_format_WKT_.Parser.prototype.isTokenType = function(type) { +WKT.Parser.prototype.isTokenType = function(type) { var isMatch = this.token_.type == type; return isMatch; }; @@ -615,7 +615,7 @@ _ol_format_WKT_.Parser.prototype.isTokenType = function(type) { * @param {ol.format.WKT.TokenType_} type Token type. * @return {boolean} Whether the token matches the given type. */ -_ol_format_WKT_.Parser.prototype.match = function(type) { +WKT.Parser.prototype.match = function(type) { var isMatch = this.isTokenType(type); if (isMatch) { this.consume_(); @@ -628,7 +628,7 @@ _ol_format_WKT_.Parser.prototype.match = function(type) { * Try to parse the tokens provided by the lexer. * @return {ol.geom.Geometry} The geometry. */ -_ol_format_WKT_.Parser.prototype.parse = function() { +WKT.Parser.prototype.parse = function() { this.consume_(); var geometry = this.parseGeometry_(); return geometry; @@ -640,16 +640,16 @@ _ol_format_WKT_.Parser.prototype.parse = function() { * @return {ol.geom.GeometryLayout} The layout. * @private */ -_ol_format_WKT_.Parser.prototype.parseGeometryLayout_ = function() { +WKT.Parser.prototype.parseGeometryLayout_ = function() { var layout = GeometryLayout.XY; var dimToken = this.token_; - if (this.isTokenType(_ol_format_WKT_.TokenType_.TEXT)) { + if (this.isTokenType(WKT.TokenType_.TEXT)) { var dimInfo = dimToken.value; - if (dimInfo === _ol_format_WKT_.Z) { + if (dimInfo === WKT.Z) { layout = GeometryLayout.XYZ; - } else if (dimInfo === _ol_format_WKT_.M) { + } else if (dimInfo === WKT.M) { layout = GeometryLayout.XYM; - } else if (dimInfo === _ol_format_WKT_.ZM) { + } else if (dimInfo === WKT.ZM) { layout = GeometryLayout.XYZM; } if (layout !== GeometryLayout.XY) { @@ -664,17 +664,17 @@ _ol_format_WKT_.Parser.prototype.parseGeometryLayout_ = function() { * @return {!ol.geom.Geometry} The geometry. * @private */ -_ol_format_WKT_.Parser.prototype.parseGeometry_ = function() { +WKT.Parser.prototype.parseGeometry_ = function() { var token = this.token_; - if (this.match(_ol_format_WKT_.TokenType_.TEXT)) { + if (this.match(WKT.TokenType_.TEXT)) { var geomType = token.value; this.layout_ = this.parseGeometryLayout_(); if (geomType == GeometryType.GEOMETRY_COLLECTION.toUpperCase()) { var geometries = this.parseGeometryCollectionText_(); return new GeometryCollection(geometries); } else { - var parser = _ol_format_WKT_.Parser.GeometryParser_[geomType]; - var ctor = _ol_format_WKT_.Parser.GeometryConstructor_[geomType]; + var parser = WKT.Parser.GeometryParser_[geomType]; + var ctor = WKT.Parser.GeometryConstructor_[geomType]; if (!parser || !ctor) { throw new Error('Invalid geometry type: ' + geomType); } @@ -690,13 +690,13 @@ _ol_format_WKT_.Parser.prototype.parseGeometry_ = function() { * @return {!Array.} A collection of geometries. * @private */ -_ol_format_WKT_.Parser.prototype.parseGeometryCollectionText_ = function() { - if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { +WKT.Parser.prototype.parseGeometryCollectionText_ = function() { + if (this.match(WKT.TokenType_.LEFT_PAREN)) { var geometries = []; do { geometries.push(this.parseGeometry_()); - } while (this.match(_ol_format_WKT_.TokenType_.COMMA)); - if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { + } while (this.match(WKT.TokenType_.COMMA)); + if (this.match(WKT.TokenType_.RIGHT_PAREN)) { return geometries; } } else if (this.isEmptyGeometry_()) { @@ -710,10 +710,10 @@ _ol_format_WKT_.Parser.prototype.parseGeometryCollectionText_ = function() { * @return {Array.} All values in a point. * @private */ -_ol_format_WKT_.Parser.prototype.parsePointText_ = function() { - if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { +WKT.Parser.prototype.parsePointText_ = function() { + if (this.match(WKT.TokenType_.LEFT_PAREN)) { var coordinates = this.parsePoint_(); - if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { + if (this.match(WKT.TokenType_.RIGHT_PAREN)) { return coordinates; } } else if (this.isEmptyGeometry_()) { @@ -727,10 +727,10 @@ _ol_format_WKT_.Parser.prototype.parsePointText_ = function() { * @return {!Array.>} All points in a linestring. * @private */ -_ol_format_WKT_.Parser.prototype.parseLineStringText_ = function() { - if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { +WKT.Parser.prototype.parseLineStringText_ = function() { + if (this.match(WKT.TokenType_.LEFT_PAREN)) { var coordinates = this.parsePointList_(); - if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { + if (this.match(WKT.TokenType_.RIGHT_PAREN)) { return coordinates; } } else if (this.isEmptyGeometry_()) { @@ -744,10 +744,10 @@ _ol_format_WKT_.Parser.prototype.parseLineStringText_ = function() { * @return {!Array.>} All points in a polygon. * @private */ -_ol_format_WKT_.Parser.prototype.parsePolygonText_ = function() { - if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { +WKT.Parser.prototype.parsePolygonText_ = function() { + if (this.match(WKT.TokenType_.LEFT_PAREN)) { var coordinates = this.parseLineStringTextList_(); - if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { + if (this.match(WKT.TokenType_.RIGHT_PAREN)) { return coordinates; } } else if (this.isEmptyGeometry_()) { @@ -761,15 +761,15 @@ _ol_format_WKT_.Parser.prototype.parsePolygonText_ = function() { * @return {!Array.>} All points in a multipoint. * @private */ -_ol_format_WKT_.Parser.prototype.parseMultiPointText_ = function() { - if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { +WKT.Parser.prototype.parseMultiPointText_ = function() { + if (this.match(WKT.TokenType_.LEFT_PAREN)) { var coordinates; - if (this.token_.type == _ol_format_WKT_.TokenType_.LEFT_PAREN) { + if (this.token_.type == WKT.TokenType_.LEFT_PAREN) { coordinates = this.parsePointTextList_(); } else { coordinates = this.parsePointList_(); } - if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { + if (this.match(WKT.TokenType_.RIGHT_PAREN)) { return coordinates; } } else if (this.isEmptyGeometry_()) { @@ -784,10 +784,10 @@ _ol_format_WKT_.Parser.prototype.parseMultiPointText_ = function() { * in a multilinestring. * @private */ -_ol_format_WKT_.Parser.prototype.parseMultiLineStringText_ = function() { - if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { +WKT.Parser.prototype.parseMultiLineStringText_ = function() { + if (this.match(WKT.TokenType_.LEFT_PAREN)) { var coordinates = this.parseLineStringTextList_(); - if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { + if (this.match(WKT.TokenType_.RIGHT_PAREN)) { return coordinates; } } else if (this.isEmptyGeometry_()) { @@ -801,10 +801,10 @@ _ol_format_WKT_.Parser.prototype.parseMultiLineStringText_ = function() { * @return {!Array.>} All polygon points in a multipolygon. * @private */ -_ol_format_WKT_.Parser.prototype.parseMultiPolygonText_ = function() { - if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { +WKT.Parser.prototype.parseMultiPolygonText_ = function() { + if (this.match(WKT.TokenType_.LEFT_PAREN)) { var coordinates = this.parsePolygonTextList_(); - if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { + if (this.match(WKT.TokenType_.RIGHT_PAREN)) { return coordinates; } } else if (this.isEmptyGeometry_()) { @@ -818,12 +818,12 @@ _ol_format_WKT_.Parser.prototype.parseMultiPolygonText_ = function() { * @return {!Array.} A point. * @private */ -_ol_format_WKT_.Parser.prototype.parsePoint_ = function() { +WKT.Parser.prototype.parsePoint_ = function() { var coordinates = []; var dimensions = this.layout_.length; for (var i = 0; i < dimensions; ++i) { var token = this.token_; - if (this.match(_ol_format_WKT_.TokenType_.NUMBER)) { + if (this.match(WKT.TokenType_.NUMBER)) { coordinates.push(token.value); } else { break; @@ -840,9 +840,9 @@ _ol_format_WKT_.Parser.prototype.parsePoint_ = function() { * @return {!Array.>} An array of points. * @private */ -_ol_format_WKT_.Parser.prototype.parsePointList_ = function() { +WKT.Parser.prototype.parsePointList_ = function() { var coordinates = [this.parsePoint_()]; - while (this.match(_ol_format_WKT_.TokenType_.COMMA)) { + while (this.match(WKT.TokenType_.COMMA)) { coordinates.push(this.parsePoint_()); } return coordinates; @@ -853,9 +853,9 @@ _ol_format_WKT_.Parser.prototype.parsePointList_ = function() { * @return {!Array.>} An array of points. * @private */ -_ol_format_WKT_.Parser.prototype.parsePointTextList_ = function() { +WKT.Parser.prototype.parsePointTextList_ = function() { var coordinates = [this.parsePointText_()]; - while (this.match(_ol_format_WKT_.TokenType_.COMMA)) { + while (this.match(WKT.TokenType_.COMMA)) { coordinates.push(this.parsePointText_()); } return coordinates; @@ -866,9 +866,9 @@ _ol_format_WKT_.Parser.prototype.parsePointTextList_ = function() { * @return {!Array.>} An array of points. * @private */ -_ol_format_WKT_.Parser.prototype.parseLineStringTextList_ = function() { +WKT.Parser.prototype.parseLineStringTextList_ = function() { var coordinates = [this.parseLineStringText_()]; - while (this.match(_ol_format_WKT_.TokenType_.COMMA)) { + while (this.match(WKT.TokenType_.COMMA)) { coordinates.push(this.parseLineStringText_()); } return coordinates; @@ -879,9 +879,9 @@ _ol_format_WKT_.Parser.prototype.parseLineStringTextList_ = function() { * @return {!Array.>} An array of points. * @private */ -_ol_format_WKT_.Parser.prototype.parsePolygonTextList_ = function() { +WKT.Parser.prototype.parsePolygonTextList_ = function() { var coordinates = [this.parsePolygonText_()]; - while (this.match(_ol_format_WKT_.TokenType_.COMMA)) { + while (this.match(WKT.TokenType_.COMMA)) { coordinates.push(this.parsePolygonText_()); } return coordinates; @@ -892,9 +892,9 @@ _ol_format_WKT_.Parser.prototype.parsePolygonTextList_ = function() { * @return {boolean} Whether the token implies an empty geometry. * @private */ -_ol_format_WKT_.Parser.prototype.isEmptyGeometry_ = function() { - var isEmpty = this.isTokenType(_ol_format_WKT_.TokenType_.TEXT) && - this.token_.value == _ol_format_WKT_.EMPTY; +WKT.Parser.prototype.isEmptyGeometry_ = function() { + var isEmpty = this.isTokenType(WKT.TokenType_.TEXT) && + this.token_.value == WKT.EMPTY; if (isEmpty) { this.consume_(); } @@ -907,7 +907,7 @@ _ol_format_WKT_.Parser.prototype.isEmptyGeometry_ = function() { * @return {string} Error message. * @private */ -_ol_format_WKT_.Parser.prototype.formatErrorMessage_ = function() { +WKT.Parser.prototype.formatErrorMessage_ = function() { return 'Unexpected `' + this.token_.value + '` at position ' + this.token_.position + ' in `' + this.lexer_.wkt + '`'; }; @@ -917,7 +917,7 @@ _ol_format_WKT_.Parser.prototype.formatErrorMessage_ = function() { * @enum {function (new:ol.geom.Geometry, Array, ol.geom.GeometryLayout)} * @private */ -_ol_format_WKT_.Parser.GeometryConstructor_ = { +WKT.Parser.GeometryConstructor_ = { 'POINT': Point, 'LINESTRING': LineString, 'POLYGON': Polygon, @@ -931,12 +931,12 @@ _ol_format_WKT_.Parser.GeometryConstructor_ = { * @enum {(function(): Array)} * @private */ -_ol_format_WKT_.Parser.GeometryParser_ = { - 'POINT': _ol_format_WKT_.Parser.prototype.parsePointText_, - 'LINESTRING': _ol_format_WKT_.Parser.prototype.parseLineStringText_, - 'POLYGON': _ol_format_WKT_.Parser.prototype.parsePolygonText_, - 'MULTIPOINT': _ol_format_WKT_.Parser.prototype.parseMultiPointText_, - 'MULTILINESTRING': _ol_format_WKT_.Parser.prototype.parseMultiLineStringText_, - 'MULTIPOLYGON': _ol_format_WKT_.Parser.prototype.parseMultiPolygonText_ +WKT.Parser.GeometryParser_ = { + 'POINT': WKT.Parser.prototype.parsePointText_, + 'LINESTRING': WKT.Parser.prototype.parseLineStringText_, + 'POLYGON': WKT.Parser.prototype.parsePolygonText_, + 'MULTIPOINT': WKT.Parser.prototype.parseMultiPointText_, + 'MULTILINESTRING': WKT.Parser.prototype.parseMultiLineStringText_, + 'MULTIPOLYGON': WKT.Parser.prototype.parseMultiPolygonText_ }; -export default _ol_format_WKT_; +export default WKT; diff --git a/src/ol/format/WMSCapabilities.js b/src/ol/format/WMSCapabilities.js index 91d850abca..62eb05ce68 100644 --- a/src/ol/format/WMSCapabilities.js +++ b/src/ol/format/WMSCapabilities.js @@ -2,9 +2,9 @@ * @module ol/format/WMSCapabilities */ import {inherits} from '../index.js'; -import _ol_format_XLink_ from '../format/XLink.js'; -import _ol_format_XML_ from '../format/XML.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import XLink from '../format/XLink.js'; +import XML from '../format/XML.js'; +import XSD from '../format/XSD.js'; import _ol_xml_ from '../xml.js'; /** @@ -15,9 +15,9 @@ import _ol_xml_ from '../xml.js'; * @extends {ol.format.XML} * @api */ -var _ol_format_WMSCapabilities_ = function() { +var WMSCapabilities = function() { - _ol_format_XML_.call(this); + XML.call(this); /** * @type {string|undefined} @@ -25,7 +25,7 @@ var _ol_format_WMSCapabilities_ = function() { this.version = undefined; }; -inherits(_ol_format_WMSCapabilities_, _ol_format_XML_); +inherits(WMSCapabilities, XML); /** @@ -36,13 +36,13 @@ inherits(_ol_format_WMSCapabilities_, _ol_format_XML_); * @return {Object} An object representing the WMS capabilities. * @api */ -_ol_format_WMSCapabilities_.prototype.read; +WMSCapabilities.prototype.read; /** * @inheritDoc */ -_ol_format_WMSCapabilities_.prototype.readFromDocument = function(doc) { +WMSCapabilities.prototype.readFromDocument = function(doc) { for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { return this.readFromNode(n); @@ -55,11 +55,11 @@ _ol_format_WMSCapabilities_.prototype.readFromDocument = function(doc) { /** * @inheritDoc */ -_ol_format_WMSCapabilities_.prototype.readFromNode = function(node) { +WMSCapabilities.prototype.readFromNode = function(node) { this.version = node.getAttribute('version').trim(); var wmsCapabilityObject = _ol_xml_.pushParseAndPop({ 'version': this.version - }, _ol_format_WMSCapabilities_.PARSERS_, node, []); + }, WMSCapabilities.PARSERS_, node, []); return wmsCapabilityObject ? wmsCapabilityObject : null; }; @@ -70,9 +70,9 @@ _ol_format_WMSCapabilities_.prototype.readFromNode = function(node) { * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} Attribution object. */ -_ol_format_WMSCapabilities_.readAttribution_ = function(node, objectStack) { +WMSCapabilities.readAttribution_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.ATTRIBUTION_PARSERS_, node, objectStack); + {}, WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack); }; @@ -82,17 +82,17 @@ _ol_format_WMSCapabilities_.readAttribution_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Object} Bounding box object. */ -_ol_format_WMSCapabilities_.readBoundingBox_ = function(node, objectStack) { +WMSCapabilities.readBoundingBox_ = function(node, objectStack) { var extent = [ - _ol_format_XSD_.readDecimalString(node.getAttribute('minx')), - _ol_format_XSD_.readDecimalString(node.getAttribute('miny')), - _ol_format_XSD_.readDecimalString(node.getAttribute('maxx')), - _ol_format_XSD_.readDecimalString(node.getAttribute('maxy')) + XSD.readDecimalString(node.getAttribute('minx')), + XSD.readDecimalString(node.getAttribute('miny')), + XSD.readDecimalString(node.getAttribute('maxx')), + XSD.readDecimalString(node.getAttribute('maxy')) ]; var resolutions = [ - _ol_format_XSD_.readDecimalString(node.getAttribute('resx')), - _ol_format_XSD_.readDecimalString(node.getAttribute('resy')) + XSD.readDecimalString(node.getAttribute('resx')), + XSD.readDecimalString(node.getAttribute('resy')) ]; return { @@ -109,10 +109,10 @@ _ol_format_WMSCapabilities_.readBoundingBox_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {ol.Extent|undefined} Bounding box object. */ -_ol_format_WMSCapabilities_.readEXGeographicBoundingBox_ = function(node, objectStack) { +WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) { var geographicBoundingBox = _ol_xml_.pushParseAndPop( {}, - _ol_format_WMSCapabilities_.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_, + WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_, node, objectStack); if (!geographicBoundingBox) { return undefined; @@ -142,9 +142,9 @@ _ol_format_WMSCapabilities_.readEXGeographicBoundingBox_ = function(node, object * @private * @return {Object|undefined} Capability object. */ -_ol_format_WMSCapabilities_.readCapability_ = function(node, objectStack) { +WMSCapabilities.readCapability_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.CAPABILITY_PARSERS_, node, objectStack); + {}, WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack); }; @@ -154,9 +154,9 @@ _ol_format_WMSCapabilities_.readCapability_ = function(node, objectStack) { * @private * @return {Object|undefined} Service object. */ -_ol_format_WMSCapabilities_.readService_ = function(node, objectStack) { +WMSCapabilities.readService_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.SERVICE_PARSERS_, node, objectStack); + {}, WMSCapabilities.SERVICE_PARSERS_, node, objectStack); }; @@ -166,9 +166,9 @@ _ol_format_WMSCapabilities_.readService_ = function(node, objectStack) { * @private * @return {Object|undefined} Contact information object. */ -_ol_format_WMSCapabilities_.readContactInformation_ = function(node, objectStack) { +WMSCapabilities.readContactInformation_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.CONTACT_INFORMATION_PARSERS_, + {}, WMSCapabilities.CONTACT_INFORMATION_PARSERS_, node, objectStack); }; @@ -179,9 +179,9 @@ _ol_format_WMSCapabilities_.readContactInformation_ = function(node, objectStack * @private * @return {Object|undefined} Contact person object. */ -_ol_format_WMSCapabilities_.readContactPersonPrimary_ = function(node, objectStack) { +WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.CONTACT_PERSON_PARSERS_, + {}, WMSCapabilities.CONTACT_PERSON_PARSERS_, node, objectStack); }; @@ -192,9 +192,9 @@ _ol_format_WMSCapabilities_.readContactPersonPrimary_ = function(node, objectSta * @private * @return {Object|undefined} Contact address object. */ -_ol_format_WMSCapabilities_.readContactAddress_ = function(node, objectStack) { +WMSCapabilities.readContactAddress_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.CONTACT_ADDRESS_PARSERS_, + {}, WMSCapabilities.CONTACT_ADDRESS_PARSERS_, node, objectStack); }; @@ -205,9 +205,9 @@ _ol_format_WMSCapabilities_.readContactAddress_ = function(node, objectStack) { * @private * @return {Array.|undefined} Format array. */ -_ol_format_WMSCapabilities_.readException_ = function(node, objectStack) { +WMSCapabilities.readException_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - [], _ol_format_WMSCapabilities_.EXCEPTION_PARSERS_, node, objectStack); + [], WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack); }; @@ -217,9 +217,9 @@ _ol_format_WMSCapabilities_.readException_ = function(node, objectStack) { * @private * @return {Object|undefined} Layer object. */ -_ol_format_WMSCapabilities_.readCapabilityLayer_ = function(node, objectStack) { +WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.LAYER_PARSERS_, node, objectStack); + {}, WMSCapabilities.LAYER_PARSERS_, node, objectStack); }; @@ -229,52 +229,52 @@ _ol_format_WMSCapabilities_.readCapabilityLayer_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} Layer object. */ -_ol_format_WMSCapabilities_.readLayer_ = function(node, objectStack) { +WMSCapabilities.readLayer_ = function(node, objectStack) { var parentLayerObject = /** @type {Object.} */ (objectStack[objectStack.length - 1]); var layerObject = _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.LAYER_PARSERS_, node, objectStack); + {}, WMSCapabilities.LAYER_PARSERS_, node, objectStack); if (!layerObject) { return undefined; } var queryable = - _ol_format_XSD_.readBooleanString(node.getAttribute('queryable')); + XSD.readBooleanString(node.getAttribute('queryable')); if (queryable === undefined) { queryable = parentLayerObject['queryable']; } layerObject['queryable'] = queryable !== undefined ? queryable : false; - var cascaded = _ol_format_XSD_.readNonNegativeIntegerString( + var cascaded = XSD.readNonNegativeIntegerString( node.getAttribute('cascaded')); if (cascaded === undefined) { cascaded = parentLayerObject['cascaded']; } layerObject['cascaded'] = cascaded; - var opaque = _ol_format_XSD_.readBooleanString(node.getAttribute('opaque')); + var opaque = XSD.readBooleanString(node.getAttribute('opaque')); if (opaque === undefined) { opaque = parentLayerObject['opaque']; } layerObject['opaque'] = opaque !== undefined ? opaque : false; var noSubsets = - _ol_format_XSD_.readBooleanString(node.getAttribute('noSubsets')); + XSD.readBooleanString(node.getAttribute('noSubsets')); if (noSubsets === undefined) { noSubsets = parentLayerObject['noSubsets']; } layerObject['noSubsets'] = noSubsets !== undefined ? noSubsets : false; var fixedWidth = - _ol_format_XSD_.readDecimalString(node.getAttribute('fixedWidth')); + XSD.readDecimalString(node.getAttribute('fixedWidth')); if (!fixedWidth) { fixedWidth = parentLayerObject['fixedWidth']; } layerObject['fixedWidth'] = fixedWidth; var fixedHeight = - _ol_format_XSD_.readDecimalString(node.getAttribute('fixedHeight')); + XSD.readDecimalString(node.getAttribute('fixedHeight')); if (!fixedHeight) { fixedHeight = parentLayerObject['fixedHeight']; } @@ -308,18 +308,18 @@ _ol_format_WMSCapabilities_.readLayer_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Object} Dimension object. */ -_ol_format_WMSCapabilities_.readDimension_ = function(node, objectStack) { +WMSCapabilities.readDimension_ = function(node, objectStack) { var dimensionObject = { 'name': node.getAttribute('name'), 'units': node.getAttribute('units'), 'unitSymbol': node.getAttribute('unitSymbol'), 'default': node.getAttribute('default'), - 'multipleValues': _ol_format_XSD_.readBooleanString( + 'multipleValues': XSD.readBooleanString( node.getAttribute('multipleValues')), - 'nearestValue': _ol_format_XSD_.readBooleanString( + 'nearestValue': XSD.readBooleanString( node.getAttribute('nearestValue')), - 'current': _ol_format_XSD_.readBooleanString(node.getAttribute('current')), - 'values': _ol_format_XSD_.readString(node) + 'current': XSD.readBooleanString(node.getAttribute('current')), + 'values': XSD.readString(node) }; return dimensionObject; }; @@ -331,9 +331,9 @@ _ol_format_WMSCapabilities_.readDimension_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} Online resource object. */ -_ol_format_WMSCapabilities_.readFormatOnlineresource_ = function(node, objectStack) { +WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.FORMAT_ONLINERESOURCE_PARSERS_, + {}, WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_, node, objectStack); }; @@ -344,9 +344,9 @@ _ol_format_WMSCapabilities_.readFormatOnlineresource_ = function(node, objectSta * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} Request object. */ -_ol_format_WMSCapabilities_.readRequest_ = function(node, objectStack) { +WMSCapabilities.readRequest_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.REQUEST_PARSERS_, node, objectStack); + {}, WMSCapabilities.REQUEST_PARSERS_, node, objectStack); }; @@ -356,9 +356,9 @@ _ol_format_WMSCapabilities_.readRequest_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} DCP type object. */ -_ol_format_WMSCapabilities_.readDCPType_ = function(node, objectStack) { +WMSCapabilities.readDCPType_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.DCPTYPE_PARSERS_, node, objectStack); + {}, WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack); }; @@ -368,9 +368,9 @@ _ol_format_WMSCapabilities_.readDCPType_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} HTTP object. */ -_ol_format_WMSCapabilities_.readHTTP_ = function(node, objectStack) { +WMSCapabilities.readHTTP_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.HTTP_PARSERS_, node, objectStack); + {}, WMSCapabilities.HTTP_PARSERS_, node, objectStack); }; @@ -380,9 +380,9 @@ _ol_format_WMSCapabilities_.readHTTP_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} Operation type object. */ -_ol_format_WMSCapabilities_.readOperationType_ = function(node, objectStack) { +WMSCapabilities.readOperationType_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.OPERATIONTYPE_PARSERS_, node, objectStack); + {}, WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack); }; @@ -392,13 +392,13 @@ _ol_format_WMSCapabilities_.readOperationType_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} Online resource object. */ -_ol_format_WMSCapabilities_.readSizedFormatOnlineresource_ = function(node, objectStack) { +WMSCapabilities.readSizedFormatOnlineresource_ = function(node, objectStack) { var formatOnlineresource = - _ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack); + WMSCapabilities.readFormatOnlineresource_(node, objectStack); if (formatOnlineresource) { var size = [ - _ol_format_XSD_.readNonNegativeIntegerString(node.getAttribute('width')), - _ol_format_XSD_.readNonNegativeIntegerString(node.getAttribute('height')) + XSD.readNonNegativeIntegerString(node.getAttribute('width')), + XSD.readNonNegativeIntegerString(node.getAttribute('height')) ]; formatOnlineresource['size'] = size; return formatOnlineresource; @@ -413,9 +413,9 @@ _ol_format_WMSCapabilities_.readSizedFormatOnlineresource_ = function(node, obje * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} Authority URL object. */ -_ol_format_WMSCapabilities_.readAuthorityURL_ = function(node, objectStack) { +WMSCapabilities.readAuthorityURL_ = function(node, objectStack) { var authorityObject = - _ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack); + WMSCapabilities.readFormatOnlineresource_(node, objectStack); if (authorityObject) { authorityObject['name'] = node.getAttribute('name'); return authorityObject; @@ -430,9 +430,9 @@ _ol_format_WMSCapabilities_.readAuthorityURL_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} Metadata URL object. */ -_ol_format_WMSCapabilities_.readMetadataURL_ = function(node, objectStack) { +WMSCapabilities.readMetadataURL_ = function(node, objectStack) { var metadataObject = - _ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack); + WMSCapabilities.readFormatOnlineresource_(node, objectStack); if (metadataObject) { metadataObject['type'] = node.getAttribute('type'); return metadataObject; @@ -447,9 +447,9 @@ _ol_format_WMSCapabilities_.readMetadataURL_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Object|undefined} Style object. */ -_ol_format_WMSCapabilities_.readStyle_ = function(node, objectStack) { +WMSCapabilities.readStyle_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WMSCapabilities_.STYLE_PARSERS_, node, objectStack); + {}, WMSCapabilities.STYLE_PARSERS_, node, objectStack); }; @@ -459,9 +459,9 @@ _ol_format_WMSCapabilities_.readStyle_ = function(node, objectStack) { * @param {Array.<*>} objectStack Object stack. * @return {Array.|undefined} Keyword list. */ -_ol_format_WMSCapabilities_.readKeywordList_ = function(node, objectStack) { +WMSCapabilities.readKeywordList_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - [], _ol_format_WMSCapabilities_.KEYWORDLIST_PARSERS_, node, objectStack); + [], WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack); }; @@ -470,7 +470,7 @@ _ol_format_WMSCapabilities_.readKeywordList_ = function(node, objectStack) { * @private * @type {Array.} */ -_ol_format_WMSCapabilities_.NAMESPACE_URIS_ = [ +WMSCapabilities.NAMESPACE_URIS_ = [ null, 'http://www.opengis.net/wms' ]; @@ -481,12 +481,12 @@ _ol_format_WMSCapabilities_.NAMESPACE_URIS_ = [ * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { +WMSCapabilities.PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { 'Service': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readService_), + WMSCapabilities.readService_), 'Capability': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readCapability_) + WMSCapabilities.readCapability_) }); @@ -495,14 +495,14 @@ _ol_format_WMSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { +WMSCapabilities.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { 'Request': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readRequest_), + WMSCapabilities.readRequest_), 'Exception': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readException_), + WMSCapabilities.readException_), 'Layer': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readCapabilityLayer_) + WMSCapabilities.readCapabilityLayer_) }); @@ -511,26 +511,26 @@ _ol_format_WMSCapabilities_.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { - 'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), +WMSCapabilities.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { + 'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'KeywordList': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readKeywordList_), + WMSCapabilities.readKeywordList_), 'OnlineResource': _ol_xml_.makeObjectPropertySetter( - _ol_format_XLink_.readHref), + XLink.readHref), 'ContactInformation': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readContactInformation_), - 'Fees': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), + WMSCapabilities.readContactInformation_), + 'Fees': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'AccessConstraints': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'LayerLimit': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MaxWidth': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MaxHeight': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger) + XSD.readNonNegativeInteger) }); @@ -539,20 +539,20 @@ _ol_format_WMSCapabilities_.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { +WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { 'ContactPersonPrimary': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readContactPersonPrimary_), + WMSCapabilities.readContactPersonPrimary_), 'ContactPosition': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'ContactAddress': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readContactAddress_), + WMSCapabilities.readContactAddress_), 'ContactVoiceTelephone': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'ContactFacsimileTelephone': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'ContactElectronicMailAddress': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) }); @@ -561,12 +561,12 @@ _ol_format_WMSCapabilities_.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructur * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { +WMSCapabilities.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { 'ContactPerson': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'ContactOrganization': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) }); @@ -575,15 +575,15 @@ _ol_format_WMSCapabilities_.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { - 'AddressType': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Address': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'City': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), +WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { + 'AddressType': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Address': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'City': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'StateOrProvince': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), - 'PostCode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Country': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) + XSD.readString), + 'PostCode': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Country': _ol_xml_.makeObjectPropertySetter(XSD.readString) }); @@ -592,9 +592,9 @@ _ol_format_WMSCapabilities_.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { - 'Format': _ol_xml_.makeArrayPusher(_ol_format_XSD_.readString) +WMSCapabilities.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { + 'Format': _ol_xml_.makeArrayPusher(XSD.readString) }); @@ -603,39 +603,39 @@ _ol_format_WMSCapabilities_.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { - 'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), +WMSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { + 'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'KeywordList': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readKeywordList_), - 'CRS': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString), + WMSCapabilities.readKeywordList_), + 'CRS': _ol_xml_.makeObjectPropertyPusher(XSD.readString), 'EX_GeographicBoundingBox': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readEXGeographicBoundingBox_), + WMSCapabilities.readEXGeographicBoundingBox_), 'BoundingBox': _ol_xml_.makeObjectPropertyPusher( - _ol_format_WMSCapabilities_.readBoundingBox_), + WMSCapabilities.readBoundingBox_), 'Dimension': _ol_xml_.makeObjectPropertyPusher( - _ol_format_WMSCapabilities_.readDimension_), + WMSCapabilities.readDimension_), 'Attribution': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readAttribution_), + WMSCapabilities.readAttribution_), 'AuthorityURL': _ol_xml_.makeObjectPropertyPusher( - _ol_format_WMSCapabilities_.readAuthorityURL_), - 'Identifier': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString), + WMSCapabilities.readAuthorityURL_), + 'Identifier': _ol_xml_.makeObjectPropertyPusher(XSD.readString), 'MetadataURL': _ol_xml_.makeObjectPropertyPusher( - _ol_format_WMSCapabilities_.readMetadataURL_), + WMSCapabilities.readMetadataURL_), 'DataURL': _ol_xml_.makeObjectPropertyPusher( - _ol_format_WMSCapabilities_.readFormatOnlineresource_), + WMSCapabilities.readFormatOnlineresource_), 'FeatureListURL': _ol_xml_.makeObjectPropertyPusher( - _ol_format_WMSCapabilities_.readFormatOnlineresource_), + WMSCapabilities.readFormatOnlineresource_), 'Style': _ol_xml_.makeObjectPropertyPusher( - _ol_format_WMSCapabilities_.readStyle_), + WMSCapabilities.readStyle_), 'MinScaleDenominator': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'MaxScaleDenominator': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'Layer': _ol_xml_.makeObjectPropertyPusher( - _ol_format_WMSCapabilities_.readLayer_) + WMSCapabilities.readLayer_) }); @@ -644,13 +644,13 @@ _ol_format_WMSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { - 'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), +WMSCapabilities.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { + 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'OnlineResource': _ol_xml_.makeObjectPropertySetter( - _ol_format_XLink_.readHref), + XLink.readHref), 'LogoURL': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readSizedFormatOnlineresource_) + WMSCapabilities.readSizedFormatOnlineresource_) }); @@ -659,16 +659,16 @@ _ol_format_WMSCapabilities_.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ = - _ol_xml_.makeStructureNS(_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { +WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ = + _ol_xml_.makeStructureNS(WMSCapabilities.NAMESPACE_URIS_, { 'westBoundLongitude': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'eastBoundLongitude': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'southBoundLatitude': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'northBoundLatitude': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal) + XSD.readDecimal) }); @@ -677,14 +677,14 @@ _ol_format_WMSCapabilities_.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ = * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { +WMSCapabilities.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { 'GetCapabilities': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readOperationType_), + WMSCapabilities.readOperationType_), 'GetMap': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readOperationType_), + WMSCapabilities.readOperationType_), 'GetFeatureInfo': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readOperationType_) + WMSCapabilities.readOperationType_) }); @@ -693,11 +693,11 @@ _ol_format_WMSCapabilities_.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { - 'Format': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString), +WMSCapabilities.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { + 'Format': _ol_xml_.makeObjectPropertyPusher(XSD.readString), 'DCPType': _ol_xml_.makeObjectPropertyPusher( - _ol_format_WMSCapabilities_.readDCPType_) + WMSCapabilities.readDCPType_) }); @@ -706,10 +706,10 @@ _ol_format_WMSCapabilities_.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.DCPTYPE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { +WMSCapabilities.DCPTYPE_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { 'HTTP': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readHTTP_) + WMSCapabilities.readHTTP_) }); @@ -718,12 +718,12 @@ _ol_format_WMSCapabilities_.DCPTYPE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { +WMSCapabilities.HTTP_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { 'Get': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readFormatOnlineresource_), + WMSCapabilities.readFormatOnlineresource_), 'Post': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readFormatOnlineresource_) + WMSCapabilities.readFormatOnlineresource_) }); @@ -732,17 +732,17 @@ _ol_format_WMSCapabilities_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { - 'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), - 'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), +WMSCapabilities.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { + 'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString), + 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'LegendURL': _ol_xml_.makeObjectPropertyPusher( - _ol_format_WMSCapabilities_.readSizedFormatOnlineresource_), + WMSCapabilities.readSizedFormatOnlineresource_), 'StyleSheetURL': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readFormatOnlineresource_), + WMSCapabilities.readFormatOnlineresource_), 'StyleURL': _ol_xml_.makeObjectPropertySetter( - _ol_format_WMSCapabilities_.readFormatOnlineresource_) + WMSCapabilities.readFormatOnlineresource_) }); @@ -751,11 +751,11 @@ _ol_format_WMSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.FORMAT_ONLINERESOURCE_PARSERS_ = - _ol_xml_.makeStructureNS(_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { - 'Format': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), +WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ = + _ol_xml_.makeStructureNS(WMSCapabilities.NAMESPACE_URIS_, { + 'Format': _ol_xml_.makeObjectPropertySetter(XSD.readString), 'OnlineResource': _ol_xml_.makeObjectPropertySetter( - _ol_format_XLink_.readHref) + XLink.readHref) }); @@ -764,8 +764,8 @@ _ol_format_WMSCapabilities_.FORMAT_ONLINERESOURCE_PARSERS_ = * @type {Object.>} * @private */ -_ol_format_WMSCapabilities_.KEYWORDLIST_PARSERS_ = _ol_xml_.makeStructureNS( - _ol_format_WMSCapabilities_.NAMESPACE_URIS_, { - 'Keyword': _ol_xml_.makeArrayPusher(_ol_format_XSD_.readString) +WMSCapabilities.KEYWORDLIST_PARSERS_ = _ol_xml_.makeStructureNS( + WMSCapabilities.NAMESPACE_URIS_, { + 'Keyword': _ol_xml_.makeArrayPusher(XSD.readString) }); -export default _ol_format_WMSCapabilities_; +export default WMSCapabilities; diff --git a/src/ol/format/WMSGetFeatureInfo.js b/src/ol/format/WMSGetFeatureInfo.js index 719f17bf56..b257b53763 100644 --- a/src/ol/format/WMSGetFeatureInfo.js +++ b/src/ol/format/WMSGetFeatureInfo.js @@ -3,8 +3,8 @@ */ import {inherits} from '../index.js'; import _ol_array_ from '../array.js'; -import _ol_format_GML2_ from '../format/GML2.js'; -import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; +import GML2 from '../format/GML2.js'; +import XMLFeature from '../format/XMLFeature.js'; import _ol_obj_ from '../obj.js'; import _ol_xml_ from '../xml.js'; @@ -18,7 +18,7 @@ import _ol_xml_ from '../xml.js'; * @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options. * @api */ -var _ol_format_WMSGetFeatureInfo_ = function(opt_options) { +var WMSGetFeatureInfo = function(opt_options) { var options = opt_options ? opt_options : {}; @@ -33,7 +33,7 @@ var _ol_format_WMSGetFeatureInfo_ = function(opt_options) { * @private * @type {ol.format.GML2} */ - this.gmlFormat_ = new _ol_format_GML2_(); + this.gmlFormat_ = new GML2(); /** @@ -42,10 +42,10 @@ var _ol_format_WMSGetFeatureInfo_ = function(opt_options) { */ this.layers_ = options.layers ? options.layers : null; - _ol_format_XMLFeature_.call(this); + XMLFeature.call(this); }; -inherits(_ol_format_WMSGetFeatureInfo_, _ol_format_XMLFeature_); +inherits(WMSGetFeatureInfo, XMLFeature); /** @@ -53,7 +53,7 @@ inherits(_ol_format_WMSGetFeatureInfo_, _ol_format_XMLFeature_); * @type {string} * @private */ -_ol_format_WMSGetFeatureInfo_.featureIdentifier_ = '_feature'; +WMSGetFeatureInfo.featureIdentifier_ = '_feature'; /** @@ -61,13 +61,13 @@ _ol_format_WMSGetFeatureInfo_.featureIdentifier_ = '_feature'; * @type {string} * @private */ -_ol_format_WMSGetFeatureInfo_.layerIdentifier_ = '_layer'; +WMSGetFeatureInfo.layerIdentifier_ = '_layer'; /** * @return {Array.} layers */ -_ol_format_WMSGetFeatureInfo_.prototype.getLayers = function() { +WMSGetFeatureInfo.prototype.getLayers = function() { return this.layers_; }; @@ -75,7 +75,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.getLayers = function() { /** * @param {Array.} layers Layers to parse. */ -_ol_format_WMSGetFeatureInfo_.prototype.setLayers = function(layers) { +WMSGetFeatureInfo.prototype.setLayers = function(layers) { this.layers_ = layers; }; @@ -86,7 +86,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.setLayers = function(layers) { * @return {Array.} Features. * @private */ -_ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectStack) { +WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) { node.setAttribute('namespaceURI', this.featureNS_); var localName = node.localName; /** @type {Array.} */ @@ -102,7 +102,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta } var context = objectStack[0]; - var toRemove = _ol_format_WMSGetFeatureInfo_.layerIdentifier_; + var toRemove = WMSGetFeatureInfo.layerIdentifier_; var layerName = layer.localName.replace(toRemove, ''); if (this.layers_ && !_ol_array_.includes(this.layers_, layerName)) { @@ -110,7 +110,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta } var featureType = layerName + - _ol_format_WMSGetFeatureInfo_.featureIdentifier_; + WMSGetFeatureInfo.featureIdentifier_; context['featureType'] = featureType; context['featureNS'] = this.featureNS_; @@ -149,13 +149,13 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta * @return {Array.} Features. * @api */ -_ol_format_WMSGetFeatureInfo_.prototype.readFeatures; +WMSGetFeatureInfo.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_WMSGetFeatureInfo_.prototype.readFeaturesFromNode = function(node, opt_options) { +WMSGetFeatureInfo.prototype.readFeaturesFromNode = function(node, opt_options) { var options = {}; if (opt_options) { _ol_obj_.assign(options, this.getReadOptions(node, opt_options)); @@ -168,19 +168,19 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeaturesFromNode = function(node, op * Not implemented. * @inheritDoc */ -_ol_format_WMSGetFeatureInfo_.prototype.writeFeatureNode = function(feature, opt_options) {}; +WMSGetFeatureInfo.prototype.writeFeatureNode = function(feature, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_WMSGetFeatureInfo_.prototype.writeFeaturesNode = function(features, opt_options) {}; +WMSGetFeatureInfo.prototype.writeFeaturesNode = function(features, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_WMSGetFeatureInfo_.prototype.writeGeometryNode = function(geometry, opt_options) {}; -export default _ol_format_WMSGetFeatureInfo_; +WMSGetFeatureInfo.prototype.writeGeometryNode = function(geometry, opt_options) {}; +export default WMSGetFeatureInfo; diff --git a/src/ol/format/WMTSCapabilities.js b/src/ol/format/WMTSCapabilities.js index 8e7e5d4143..2973a0105b 100644 --- a/src/ol/format/WMTSCapabilities.js +++ b/src/ol/format/WMTSCapabilities.js @@ -3,10 +3,10 @@ */ import {inherits} from '../index.js'; import {boundingExtent} from '../extent.js'; -import _ol_format_OWS_ from '../format/OWS.js'; -import _ol_format_XLink_ from '../format/XLink.js'; -import _ol_format_XML_ from '../format/XML.js'; -import _ol_format_XSD_ from '../format/XSD.js'; +import OWS from '../format/OWS.js'; +import XLink from '../format/XLink.js'; +import XML from '../format/XML.js'; +import XSD from '../format/XSD.js'; import _ol_xml_ from '../xml.js'; /** @@ -18,16 +18,16 @@ import _ol_xml_ from '../xml.js'; * @api */ var _ol_format_WMTSCapabilities_ = function() { - _ol_format_XML_.call(this); + XML.call(this); /** * @type {ol.format.OWS} * @private */ - this.owsParser_ = new _ol_format_OWS_(); + this.owsParser_ = new OWS(); }; -inherits(_ol_format_WMTSCapabilities_, _ol_format_XML_); +inherits(_ol_format_WMTSCapabilities_, XML); /** @@ -199,7 +199,7 @@ _ol_format_WMTSCapabilities_.readWgs84BoundingBox_ = function(node, objectStack) _ol_format_WMTSCapabilities_.readLegendUrl_ = function(node, objectStack) { var legend = {}; legend['format'] = node.getAttribute('format'); - legend['href'] = _ol_format_XLink_.readHref(node); + legend['href'] = XLink.readHref(node); return legend; }; @@ -211,7 +211,7 @@ _ol_format_WMTSCapabilities_.readLegendUrl_ = function(node, objectStack) { * @return {Object|undefined} Coordinates object. */ _ol_format_WMTSCapabilities_.readCoordinates_ = function(node, objectStack) { - var coordinates = _ol_format_XSD_.readString(node).split(' '); + var coordinates = XSD.readString(node).split(' '); if (!coordinates || coordinates.length != 2) { return undefined; } @@ -320,7 +320,7 @@ _ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( 'Style': _ol_xml_.makeObjectPropertyPusher( _ol_format_WMTSCapabilities_.readStyle_), 'Format': _ol_xml_.makeObjectPropertyPusher( - _ol_format_XSD_.readString), + XSD.readString), 'TileMatrixSetLink': _ol_xml_.makeObjectPropertyPusher( _ol_format_WMTSCapabilities_.readTileMatrixSetLink_), 'Dimension': _ol_xml_.makeObjectPropertyPusher( @@ -329,13 +329,13 @@ _ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.readResourceUrl_) }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { 'Title': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'Abstract': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'WGS84BoundingBox': _ol_xml_.makeObjectPropertySetter( _ol_format_WMTSCapabilities_.readWgs84BoundingBox_), 'Identifier': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) })); @@ -350,9 +350,9 @@ _ol_format_WMTSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.readLegendUrl_) }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { 'Title': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'Identifier': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) })); @@ -364,7 +364,7 @@ _ol_format_WMTSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { 'TileMatrixSet': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'TileMatrixSetLimits': _ol_xml_.makeObjectPropertySetter( _ol_format_WMTSCapabilities_.readTileMatrixLimitsList_) }); @@ -389,15 +389,15 @@ _ol_format_WMTSCapabilities_.TMS_LIMITS_LIST_PARSERS_ = _ol_xml_.makeStructureNS _ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { 'TileMatrix': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'MinTileRow': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MaxTileRow': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MinTileCol': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MaxTileCol': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger) + XSD.readNonNegativeInteger) }); @@ -409,12 +409,12 @@ _ol_format_WMTSCapabilities_.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { 'Default': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'Value': _ol_xml_.makeObjectPropertyPusher( - _ol_format_XSD_.readString) + XSD.readString) }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { 'Identifier': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) })); @@ -440,14 +440,14 @@ _ol_format_WMTSCapabilities_.WGS84_BBOX_READERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.TMS_PARSERS_ = _ol_xml_.makeStructureNS( _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { 'WellKnownScaleSet': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'TileMatrix': _ol_xml_.makeObjectPropertyPusher( _ol_format_WMTSCapabilities_.readTileMatrix_) }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { 'SupportedCRS': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString), + XSD.readString), 'Identifier': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) })); @@ -461,17 +461,17 @@ _ol_format_WMTSCapabilities_.TM_PARSERS_ = _ol_xml_.makeStructureNS( 'TopLeftCorner': _ol_xml_.makeObjectPropertySetter( _ol_format_WMTSCapabilities_.readCoordinates_), 'ScaleDenominator': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readDecimal), + XSD.readDecimal), 'TileWidth': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'TileHeight': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MatrixWidth': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger), + XSD.readNonNegativeInteger), 'MatrixHeight': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readNonNegativeInteger) + XSD.readNonNegativeInteger) }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { 'Identifier': _ol_xml_.makeObjectPropertySetter( - _ol_format_XSD_.readString) + XSD.readString) })); export default _ol_format_WMTSCapabilities_; diff --git a/src/ol/format/XLink.js b/src/ol/format/XLink.js index 4b60661f50..c61a00e15d 100644 --- a/src/ol/format/XLink.js +++ b/src/ol/format/XLink.js @@ -1,21 +1,21 @@ /** * @module ol/format/XLink */ -var _ol_format_XLink_ = {}; +var XLink = {}; /** * @const * @type {string} */ -_ol_format_XLink_.NAMESPACE_URI = 'http://www.w3.org/1999/xlink'; +XLink.NAMESPACE_URI = 'http://www.w3.org/1999/xlink'; /** * @param {Node} node Node. * @return {boolean|undefined} Boolean. */ -_ol_format_XLink_.readHref = function(node) { - return node.getAttributeNS(_ol_format_XLink_.NAMESPACE_URI, 'href'); +XLink.readHref = function(node) { + return node.getAttributeNS(XLink.NAMESPACE_URI, 'href'); }; -export default _ol_format_XLink_; +export default XLink; diff --git a/src/ol/format/XML.js b/src/ol/format/XML.js index 17ab8d234a..c5e6af0649 100644 --- a/src/ol/format/XML.js +++ b/src/ol/format/XML.js @@ -11,7 +11,7 @@ import _ol_xml_ from '../xml.js'; * @abstract * @struct */ -var _ol_format_XML_ = function() { +var XML = function() { }; @@ -19,7 +19,7 @@ var _ol_format_XML_ = function() { * @param {Document|Node|string} source Source. * @return {Object} The parsed result. */ -_ol_format_XML_.prototype.read = function(source) { +XML.prototype.read = function(source) { if (_ol_xml_.isDocument(source)) { return this.readFromDocument(/** @type {Document} */ (source)); } else if (_ol_xml_.isNode(source)) { @@ -38,7 +38,7 @@ _ol_format_XML_.prototype.read = function(source) { * @param {Document} doc Document. * @return {Object} Object */ -_ol_format_XML_.prototype.readFromDocument = function(doc) {}; +XML.prototype.readFromDocument = function(doc) {}; /** @@ -46,5 +46,5 @@ _ol_format_XML_.prototype.readFromDocument = function(doc) {}; * @param {Node} node Node. * @return {Object} Object */ -_ol_format_XML_.prototype.readFromNode = function(node) {}; -export default _ol_format_XML_; +XML.prototype.readFromNode = function(node) {}; +export default XML; diff --git a/src/ol/format/XMLFeature.js b/src/ol/format/XMLFeature.js index 0b27764aa1..c6faf92b21 100644 --- a/src/ol/format/XMLFeature.js +++ b/src/ol/format/XMLFeature.js @@ -3,7 +3,7 @@ */ import {inherits} from '../index.js'; import _ol_array_ from '../array.js'; -import _ol_format_Feature_ from '../format/Feature.js'; +import FeatureFormat from '../format/Feature.js'; import _ol_format_FormatType_ from '../format/FormatType.js'; import _ol_xml_ from '../xml.js'; @@ -17,7 +17,7 @@ import _ol_xml_ from '../xml.js'; * @abstract * @extends {ol.format.Feature} */ -var _ol_format_XMLFeature_ = function() { +var XMLFeature = function() { /** * @type {XMLSerializer} @@ -25,16 +25,16 @@ var _ol_format_XMLFeature_ = function() { */ this.xmlSerializer_ = new XMLSerializer(); - _ol_format_Feature_.call(this); + FeatureFormat.call(this); }; -inherits(_ol_format_XMLFeature_, _ol_format_Feature_); +inherits(XMLFeature, FeatureFormat); /** * @inheritDoc */ -_ol_format_XMLFeature_.prototype.getType = function() { +XMLFeature.prototype.getType = function() { return _ol_format_FormatType_.XML; }; @@ -42,7 +42,7 @@ _ol_format_XMLFeature_.prototype.getType = function() { /** * @inheritDoc */ -_ol_format_XMLFeature_.prototype.readFeature = function(source, opt_options) { +XMLFeature.prototype.readFeature = function(source, opt_options) { if (_ol_xml_.isDocument(source)) { return this.readFeatureFromDocument( /** @type {Document} */ (source), opt_options); @@ -62,7 +62,7 @@ _ol_format_XMLFeature_.prototype.readFeature = function(source, opt_options) { * @param {olx.format.ReadOptions=} opt_options Options. * @return {ol.Feature} Feature. */ -_ol_format_XMLFeature_.prototype.readFeatureFromDocument = function( +XMLFeature.prototype.readFeatureFromDocument = function( doc, opt_options) { var features = this.readFeaturesFromDocument(doc, opt_options); if (features.length > 0) { @@ -78,7 +78,7 @@ _ol_format_XMLFeature_.prototype.readFeatureFromDocument = function( * @param {olx.format.ReadOptions=} opt_options Options. * @return {ol.Feature} Feature. */ -_ol_format_XMLFeature_.prototype.readFeatureFromNode = function(node, opt_options) { +XMLFeature.prototype.readFeatureFromNode = function(node, opt_options) { return null; // not implemented }; @@ -86,7 +86,7 @@ _ol_format_XMLFeature_.prototype.readFeatureFromNode = function(node, opt_option /** * @inheritDoc */ -_ol_format_XMLFeature_.prototype.readFeatures = function(source, opt_options) { +XMLFeature.prototype.readFeatures = function(source, opt_options) { if (_ol_xml_.isDocument(source)) { return this.readFeaturesFromDocument( /** @type {Document} */ (source), opt_options); @@ -107,7 +107,7 @@ _ol_format_XMLFeature_.prototype.readFeatures = function(source, opt_options) { * @protected * @return {Array.} Features. */ -_ol_format_XMLFeature_.prototype.readFeaturesFromDocument = function( +XMLFeature.prototype.readFeaturesFromDocument = function( doc, opt_options) { /** @type {Array.} */ var features = []; @@ -128,13 +128,13 @@ _ol_format_XMLFeature_.prototype.readFeaturesFromDocument = function( * @protected * @return {Array.} Features. */ -_ol_format_XMLFeature_.prototype.readFeaturesFromNode = function(node, opt_options) {}; +XMLFeature.prototype.readFeaturesFromNode = function(node, opt_options) {}; /** * @inheritDoc */ -_ol_format_XMLFeature_.prototype.readGeometry = function(source, opt_options) { +XMLFeature.prototype.readGeometry = function(source, opt_options) { if (_ol_xml_.isDocument(source)) { return this.readGeometryFromDocument( /** @type {Document} */ (source), opt_options); @@ -155,7 +155,7 @@ _ol_format_XMLFeature_.prototype.readGeometry = function(source, opt_options) { * @protected * @return {ol.geom.Geometry} Geometry. */ -_ol_format_XMLFeature_.prototype.readGeometryFromDocument = function(doc, opt_options) { +XMLFeature.prototype.readGeometryFromDocument = function(doc, opt_options) { return null; // not implemented }; @@ -166,7 +166,7 @@ _ol_format_XMLFeature_.prototype.readGeometryFromDocument = function(doc, opt_op * @protected * @return {ol.geom.Geometry} Geometry. */ -_ol_format_XMLFeature_.prototype.readGeometryFromNode = function(node, opt_options) { +XMLFeature.prototype.readGeometryFromNode = function(node, opt_options) { return null; // not implemented }; @@ -174,7 +174,7 @@ _ol_format_XMLFeature_.prototype.readGeometryFromNode = function(node, opt_optio /** * @inheritDoc */ -_ol_format_XMLFeature_.prototype.readProjection = function(source) { +XMLFeature.prototype.readProjection = function(source) { if (_ol_xml_.isDocument(source)) { return this.readProjectionFromDocument(/** @type {Document} */ (source)); } else if (_ol_xml_.isNode(source)) { @@ -193,7 +193,7 @@ _ol_format_XMLFeature_.prototype.readProjection = function(source) { * @protected * @return {ol.proj.Projection} Projection. */ -_ol_format_XMLFeature_.prototype.readProjectionFromDocument = function(doc) { +XMLFeature.prototype.readProjectionFromDocument = function(doc) { return this.defaultDataProjection; }; @@ -203,7 +203,7 @@ _ol_format_XMLFeature_.prototype.readProjectionFromDocument = function(doc) { * @protected * @return {ol.proj.Projection} Projection. */ -_ol_format_XMLFeature_.prototype.readProjectionFromNode = function(node) { +XMLFeature.prototype.readProjectionFromNode = function(node) { return this.defaultDataProjection; }; @@ -211,7 +211,7 @@ _ol_format_XMLFeature_.prototype.readProjectionFromNode = function(node) { /** * @inheritDoc */ -_ol_format_XMLFeature_.prototype.writeFeature = function(feature, opt_options) { +XMLFeature.prototype.writeFeature = function(feature, opt_options) { var node = this.writeFeatureNode(feature, opt_options); return this.xmlSerializer_.serializeToString(node); }; @@ -223,7 +223,7 @@ _ol_format_XMLFeature_.prototype.writeFeature = function(feature, opt_options) { * @protected * @return {Node} Node. */ -_ol_format_XMLFeature_.prototype.writeFeatureNode = function(feature, opt_options) { +XMLFeature.prototype.writeFeatureNode = function(feature, opt_options) { return null; // not implemented }; @@ -231,7 +231,7 @@ _ol_format_XMLFeature_.prototype.writeFeatureNode = function(feature, opt_option /** * @inheritDoc */ -_ol_format_XMLFeature_.prototype.writeFeatures = function(features, opt_options) { +XMLFeature.prototype.writeFeatures = function(features, opt_options) { var node = this.writeFeaturesNode(features, opt_options); return this.xmlSerializer_.serializeToString(node); }; @@ -242,7 +242,7 @@ _ol_format_XMLFeature_.prototype.writeFeatures = function(features, opt_options) * @param {olx.format.WriteOptions=} opt_options Options. * @return {Node} Node. */ -_ol_format_XMLFeature_.prototype.writeFeaturesNode = function(features, opt_options) { +XMLFeature.prototype.writeFeaturesNode = function(features, opt_options) { return null; // not implemented }; @@ -250,7 +250,7 @@ _ol_format_XMLFeature_.prototype.writeFeaturesNode = function(features, opt_opti /** * @inheritDoc */ -_ol_format_XMLFeature_.prototype.writeGeometry = function(geometry, opt_options) { +XMLFeature.prototype.writeGeometry = function(geometry, opt_options) { var node = this.writeGeometryNode(geometry, opt_options); return this.xmlSerializer_.serializeToString(node); }; @@ -261,7 +261,7 @@ _ol_format_XMLFeature_.prototype.writeGeometry = function(geometry, opt_options) * @param {olx.format.WriteOptions=} opt_options Options. * @return {Node} Node. */ -_ol_format_XMLFeature_.prototype.writeGeometryNode = function(geometry, opt_options) { +XMLFeature.prototype.writeGeometryNode = function(geometry, opt_options) { return null; // not implemented }; -export default _ol_format_XMLFeature_; +export default XMLFeature; diff --git a/src/ol/format/XSD.js b/src/ol/format/XSD.js index e93c1ae933..94ed677f86 100644 --- a/src/ol/format/XSD.js +++ b/src/ol/format/XSD.js @@ -3,23 +3,23 @@ */ import _ol_xml_ from '../xml.js'; import _ol_string_ from '../string.js'; -var _ol_format_XSD_ = {}; +var XSD = {}; /** * @const * @type {string} */ -_ol_format_XSD_.NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema'; +XSD.NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema'; /** * @param {Node} node Node. * @return {boolean|undefined} Boolean. */ -_ol_format_XSD_.readBoolean = function(node) { +XSD.readBoolean = function(node) { var s = _ol_xml_.getAllTextContent(node, false); - return _ol_format_XSD_.readBooleanString(s); + return XSD.readBooleanString(s); }; @@ -27,7 +27,7 @@ _ol_format_XSD_.readBoolean = function(node) { * @param {string} string String. * @return {boolean|undefined} Boolean. */ -_ol_format_XSD_.readBooleanString = function(string) { +XSD.readBooleanString = function(string) { var m = /^\s*(true|1)|(false|0)\s*$/.exec(string); if (m) { return m[1] !== undefined || false; @@ -41,7 +41,7 @@ _ol_format_XSD_.readBooleanString = function(string) { * @param {Node} node Node. * @return {number|undefined} DateTime in seconds. */ -_ol_format_XSD_.readDateTime = function(node) { +XSD.readDateTime = function(node) { var s = _ol_xml_.getAllTextContent(node, false); var dateTime = Date.parse(s); return isNaN(dateTime) ? undefined : dateTime / 1000; @@ -52,9 +52,9 @@ _ol_format_XSD_.readDateTime = function(node) { * @param {Node} node Node. * @return {number|undefined} Decimal. */ -_ol_format_XSD_.readDecimal = function(node) { +XSD.readDecimal = function(node) { var s = _ol_xml_.getAllTextContent(node, false); - return _ol_format_XSD_.readDecimalString(s); + return XSD.readDecimalString(s); }; @@ -62,7 +62,7 @@ _ol_format_XSD_.readDecimal = function(node) { * @param {string} string String. * @return {number|undefined} Decimal. */ -_ol_format_XSD_.readDecimalString = function(string) { +XSD.readDecimalString = function(string) { // FIXME check spec var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(string); if (m) { @@ -77,9 +77,9 @@ _ol_format_XSD_.readDecimalString = function(string) { * @param {Node} node Node. * @return {number|undefined} Non negative integer. */ -_ol_format_XSD_.readNonNegativeInteger = function(node) { +XSD.readNonNegativeInteger = function(node) { var s = _ol_xml_.getAllTextContent(node, false); - return _ol_format_XSD_.readNonNegativeIntegerString(s); + return XSD.readNonNegativeIntegerString(s); }; @@ -87,7 +87,7 @@ _ol_format_XSD_.readNonNegativeInteger = function(node) { * @param {string} string String. * @return {number|undefined} Non negative integer. */ -_ol_format_XSD_.readNonNegativeIntegerString = function(string) { +XSD.readNonNegativeIntegerString = function(string) { var m = /^\s*(\d+)\s*$/.exec(string); if (m) { return parseInt(m[1], 10); @@ -101,7 +101,7 @@ _ol_format_XSD_.readNonNegativeIntegerString = function(string) { * @param {Node} node Node. * @return {string|undefined} String. */ -_ol_format_XSD_.readString = function(node) { +XSD.readString = function(node) { return _ol_xml_.getAllTextContent(node, false).trim(); }; @@ -110,8 +110,8 @@ _ol_format_XSD_.readString = function(node) { * @param {Node} node Node to append a TextNode with the boolean to. * @param {boolean} bool Boolean. */ -_ol_format_XSD_.writeBooleanTextNode = function(node, bool) { - _ol_format_XSD_.writeStringTextNode(node, (bool) ? '1' : '0'); +XSD.writeBooleanTextNode = function(node, bool) { + XSD.writeStringTextNode(node, (bool) ? '1' : '0'); }; @@ -119,7 +119,7 @@ _ol_format_XSD_.writeBooleanTextNode = function(node, bool) { * @param {Node} node Node to append a CDATA Section with the string to. * @param {string} string String. */ -_ol_format_XSD_.writeCDATASection = function(node, string) { +XSD.writeCDATASection = function(node, string) { node.appendChild(_ol_xml_.DOCUMENT.createCDATASection(string)); }; @@ -128,7 +128,7 @@ _ol_format_XSD_.writeCDATASection = function(node, string) { * @param {Node} node Node to append a TextNode with the dateTime to. * @param {number} dateTime DateTime in seconds. */ -_ol_format_XSD_.writeDateTimeTextNode = function(node, dateTime) { +XSD.writeDateTimeTextNode = function(node, dateTime) { var date = new Date(dateTime * 1000); var string = date.getUTCFullYear() + '-' + _ol_string_.padNumber(date.getUTCMonth() + 1, 2) + '-' + @@ -144,7 +144,7 @@ _ol_format_XSD_.writeDateTimeTextNode = function(node, dateTime) { * @param {Node} node Node to append a TextNode with the decimal to. * @param {number} decimal Decimal. */ -_ol_format_XSD_.writeDecimalTextNode = function(node, decimal) { +XSD.writeDecimalTextNode = function(node, decimal) { var string = decimal.toPrecision(); node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string)); }; @@ -154,7 +154,7 @@ _ol_format_XSD_.writeDecimalTextNode = function(node, decimal) { * @param {Node} node Node to append a TextNode with the decimal to. * @param {number} nonNegativeInteger Non negative integer. */ -_ol_format_XSD_.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) { +XSD.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) { var string = nonNegativeInteger.toString(); node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string)); }; @@ -164,7 +164,7 @@ _ol_format_XSD_.writeNonNegativeIntegerTextNode = function(node, nonNegativeInte * @param {Node} node Node to append a TextNode with the string to. * @param {string} string String. */ -_ol_format_XSD_.writeStringTextNode = function(node, string) { +XSD.writeStringTextNode = function(node, string) { node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string)); }; -export default _ol_format_XSD_; +export default XSD; diff --git a/test/rendering/ol/layer/vector.test.js b/test/rendering/ol/layer/vector.test.js index 6153fd4864..2d594d97b6 100644 --- a/test/rendering/ol/layer/vector.test.js +++ b/test/rendering/ol/layer/vector.test.js @@ -1,7 +1,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Map_ from '../../../../src/ol/Map.js'; import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js'; +import GeoJSON from '../../../../src/ol/format/GeoJSON.js'; import Circle from '../../../../src/ol/geom/Circle.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import Point from '../../../../src/ol/geom/Point.js'; @@ -463,7 +463,7 @@ describe('ol.rendering.layer.Vector', function() { properties: {} }; - var format = new _ol_format_GeoJSON_({featureProjection: 'EPSG:3857'}); + var format = new GeoJSON({featureProjection: 'EPSG:3857'}); var feature = format.readFeature(json); var layer = new _ol_layer_Vector_({ diff --git a/test/rendering/ol/layer/vectortile.test.js b/test/rendering/ol/layer/vectortile.test.js index 6f265d0415..6ea5607e09 100644 --- a/test/rendering/ol/layer/vectortile.test.js +++ b/test/rendering/ol/layer/vectortile.test.js @@ -1,7 +1,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Map_ from '../../../../src/ol/Map.js'; import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_format_MVT_ from '../../../../src/ol/format/MVT.js'; +import MVT from '../../../../src/ol/format/MVT.js'; import Point from '../../../../src/ol/geom/Point.js'; import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; @@ -70,7 +70,7 @@ describe('ol.rendering.layer.VectorTile', function() { beforeEach(function() { source = new _ol_source_VectorTile_({ - format: new _ol_format_MVT_(), + format: new MVT(), tileGrid: _ol_tilegrid_.createXYZ(), url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf', transition: 0 diff --git a/test/spec/ol/featureloader.test.js b/test/spec/ol/featureloader.test.js index 103e8ec0cd..6165a735d6 100644 --- a/test/spec/ol/featureloader.test.js +++ b/test/spec/ol/featureloader.test.js @@ -1,5 +1,5 @@ import _ol_featureloader_ from '../../../src/ol/featureloader.js'; -import _ol_format_GeoJSON_ from '../../../src/ol/format/GeoJSON.js'; +import GeoJSON from '../../../src/ol/format/GeoJSON.js'; import _ol_source_Vector_ from '../../../src/ol/source/Vector.js'; @@ -13,7 +13,7 @@ describe('ol.featureloader', function() { beforeEach(function() { url = 'spec/ol/data/point.json'; - format = new _ol_format_GeoJSON_(); + format = new GeoJSON(); source = new _ol_source_Vector_(); }); diff --git a/test/spec/ol/format/esrijson.test.js b/test/spec/ol/format/esrijson.test.js index f936d42ab0..03b39c1518 100644 --- a/test/spec/ol/format/esrijson.test.js +++ b/test/spec/ol/format/esrijson.test.js @@ -1,6 +1,6 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; -import _ol_format_EsriJSON_ from '../../../../src/ol/format/EsriJSON.js'; +import EsriJSON from '../../../../src/ol/format/EsriJSON.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; @@ -15,7 +15,7 @@ describe('ol.format.EsriJSON', function() { var format; beforeEach(function() { - format = new _ol_format_EsriJSON_(); + format = new EsriJSON(); }); var pointEsriJSON = { @@ -265,7 +265,7 @@ describe('ol.format.EsriJSON', function() { }); it('can create a feature with a specific geometryName', function() { - var feature = new _ol_format_EsriJSON_({geometryName: 'the_geom'}). + var feature = new EsriJSON({geometryName: 'the_geom'}). readFeature(pointEsriJSON); expect(feature.getGeometryName()).to.be('the_geom'); expect(feature.getGeometry()).to.be.an(Point); diff --git a/test/spec/ol/format/geojson.test.js b/test/spec/ol/format/geojson.test.js index cffafb4869..5c1d1b86d5 100644 --- a/test/spec/ol/format/geojson.test.js +++ b/test/spec/ol/format/geojson.test.js @@ -1,6 +1,6 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; -import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js'; +import GeoJSON from '../../../../src/ol/format/GeoJSON.js'; import Circle from '../../../../src/ol/geom/Circle.js'; import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js'; import LineString from '../../../../src/ol/geom/LineString.js'; @@ -15,7 +15,7 @@ describe('ol.format.GeoJSON', function() { var format; beforeEach(function() { - format = new _ol_format_GeoJSON_(); + format = new GeoJSON(); }); var pointGeoJSON = { @@ -215,7 +215,7 @@ describe('ol.format.GeoJSON', function() { }); it('uses featureProjection passed to the constructor', function() { - var format = new _ol_format_GeoJSON_({featureProjection: 'EPSG:3857'}); + var format = new GeoJSON({featureProjection: 'EPSG:3857'}); var feature = format.readFeatures(pointGeoJSON); expect(feature[0].getGeometry()).to.be.an(Point); expect(feature[0].getGeometry().getCoordinates()).to.eql( @@ -223,7 +223,7 @@ describe('ol.format.GeoJSON', function() { }); it('gives precedence to options passed to the read method', function() { - var format = new _ol_format_GeoJSON_({featureProjection: 'EPSG:1234'}); + var format = new GeoJSON({featureProjection: 'EPSG:1234'}); var feature = format.readFeatures(pointGeoJSON, { featureProjection: 'EPSG:3857' }); @@ -254,7 +254,7 @@ describe('ol.format.GeoJSON', function() { }); it('can create a feature with a specific geometryName', function() { - var feature = new _ol_format_GeoJSON_({geometryName: 'the_geom'}). + var feature = new GeoJSON({geometryName: 'the_geom'}). readFeature(pointGeoJSON); expect(feature.getGeometryName()).to.be('the_geom'); expect(feature.getGeometry()).to.be.an(Point); @@ -322,7 +322,7 @@ describe('ol.format.GeoJSON', function() { it('generates an array of features for Feature', function() { - var format = new _ol_format_GeoJSON_(); + var format = new GeoJSON(); var json = { type: 'Feature', properties: { @@ -604,7 +604,7 @@ describe('ol.format.GeoJSON', function() { }); it('respects featureProjection passed to constructor', function() { - var format = new _ol_format_GeoJSON_({featureProjection: 'EPSG:3857'}); + var format = new GeoJSON({featureProjection: 'EPSG:3857'}); var point = new Point(fromLonLat([10, 20])); var geojson = format.writeGeometry(point); var obj = JSON.parse(geojson); diff --git a/test/spec/ol/format/gml.test.js b/test/spec/ol/format/gml.test.js index fbfdf9ff34..607ae08b32 100644 --- a/test/spec/ol/format/gml.test.js +++ b/test/spec/ol/format/gml.test.js @@ -1,6 +1,6 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_format_GML_ from '../../../../src/ol/format/GML.js'; -import _ol_format_GML2_ from '../../../../src/ol/format/GML2.js'; +import GML2 from '../../../../src/ol/format/GML2.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; @@ -23,7 +23,7 @@ describe('ol.format.GML2', function() { var format; beforeEach(function() { - format = new _ol_format_GML2_({srsName: 'CRS:84'}); + format = new GML2({srsName: 'CRS:84'}); }); describe('#readFeatures', function() { @@ -32,7 +32,7 @@ describe('ol.format.GML2', function() { var url = 'spec/ol/format/gml/osm-wfs-10.xml'; afterLoadText(url, function(xml) { try { - features = new _ol_format_GML2_().readFeatures(xml); + features = new GML2().readFeatures(xml); } catch (e) { done(e); } diff --git a/test/spec/ol/format/gpx.test.js b/test/spec/ol/format/gpx.test.js index 1744914168..a575d6be2d 100644 --- a/test/spec/ol/format/gpx.test.js +++ b/test/spec/ol/format/gpx.test.js @@ -1,5 +1,5 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; -import _ol_format_GPX_ from '../../../../src/ol/format/GPX.js'; +import GPX from '../../../../src/ol/format/GPX.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import Point from '../../../../src/ol/geom/Point.js'; @@ -11,7 +11,7 @@ describe('ol.format.GPX', function() { var format; beforeEach(function() { - format = new _ol_format_GPX_(); + format = new GPX(); }); describe('#readProjection', function() { @@ -550,7 +550,7 @@ describe('ol.format.GPX', function() { describe('XML namespace support', function() { beforeEach(function() { - format = new _ol_format_GPX_(); + format = new GPX(); }); it('can read features with a version 1.0 namespace', function() { @@ -591,7 +591,7 @@ describe('ol.format.GPX', function() { describe('extensions support', function() { beforeEach(function() { - format = new _ol_format_GPX_({ + format = new GPX({ readExtensions: function(feature, extensionsNode) { var nodes = extensionsNode.getElementsByTagName('id'); var id = nodes.item(0).textContent; @@ -657,7 +657,7 @@ describe('ol.format.GPX', function() { describe('write unsupported geometries', function() { beforeEach(function() { - format = new _ol_format_GPX_(); + format = new GPX(); }); it('does not fail', function() { diff --git a/test/spec/ol/format/igc.test.js b/test/spec/ol/format/igc.test.js index 6fd3a0a821..e7b6714521 100644 --- a/test/spec/ol/format/igc.test.js +++ b/test/spec/ol/format/igc.test.js @@ -1,4 +1,4 @@ -import _ol_format_IGC_ from '../../../../src/ol/format/IGC.js'; +import IGC from '../../../../src/ol/format/IGC.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js'; import {get as getProjection, transform} from '../../../../src/ol/proj.js'; @@ -29,7 +29,7 @@ describe('ol.format.IGC', function() { 'G60189641B00B00800019000000000000'; beforeEach(function() { - format = new _ol_format_IGC_(); + format = new IGC(); }); describe('#readProjectionFromText', function() { diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 79c3c42504..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 _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js'; -import _ol_format_KML_ from '../../../../src/ol/format/KML.js'; +import GeoJSON from '../../../../src/ol/format/GeoJSON.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() { @@ -3230,7 +3230,7 @@ describe('ol.format.KML', function() { }); it('feature must not have a properties property', function() { - var geojsonFormat = new _ol_format_GeoJSON_(); + var geojsonFormat = new GeoJSON(); features.forEach(function(feature) { var geojsonFeature = geojsonFormat.writeFeatureObject(feature); expect(geojsonFeature.properties).to.be(null); diff --git a/test/spec/ol/format/mvt.test.js b/test/spec/ol/format/mvt.test.js index 0371232d68..7a28cb489c 100644 --- a/test/spec/ol/format/mvt.test.js +++ b/test/spec/ol/format/mvt.test.js @@ -1,6 +1,6 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; -import _ol_format_MVT_ from '../../../../src/ol/format/MVT.js'; +import MVT from '../../../../src/ol/format/MVT.js'; import Point from '../../../../src/ol/geom/Point.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; @@ -23,19 +23,19 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() { describe('#readFeatures', function() { it('uses ol.render.Feature as feature class by default', function() { - var format = new _ol_format_MVT_({layers: ['water']}); + var format = new MVT({layers: ['water']}); var features = format.readFeatures(data); expect(features[0]).to.be.a(_ol_render_Feature_); }); it('parses only specified layers', function() { - var format = new _ol_format_MVT_({layers: ['water']}); + var format = new MVT({layers: ['water']}); var features = format.readFeatures(data); expect(features.length).to.be(10); }); it('parses geometries correctly', function() { - var format = new _ol_format_MVT_({ + var format = new MVT({ featureClass: _ol_Feature_, layers: ['poi_label'] }); @@ -60,14 +60,14 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() { it('parses id property', function() { // ol.Feature - var format = new _ol_format_MVT_({ + var format = new MVT({ featureClass: _ol_Feature_, layers: ['building'] }); var features = format.readFeatures(data); expect(features[0].getId()).to.be(2); // ol.render.Feature - format = new _ol_format_MVT_({ + format = new MVT({ layers: ['building'] }); features = format.readFeatures(data); @@ -75,7 +75,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() { }); it('sets the extent of the last readFeatures call', function() { - var format = new _ol_format_MVT_(); + var format = new MVT(); format.readFeatures(data); var extent = format.getLastExtent(); expect(_ol_extent_.getWidth(extent)).to.be(4096); @@ -89,7 +89,7 @@ describe('ol.format.MVT', function() { describe('#createFeature_', function() { it('accepts a geometryName', function() { - var format = new _ol_format_MVT_({ + var format = new MVT({ featureClass: _ol_Feature_, geometryName: 'myGeom' }); @@ -103,13 +103,13 @@ describe('ol.format.MVT', function() { name: 'layer1' } }; - var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; - _ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { + var readRawGeometry_ = MVT.readRawGeometry_; + MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { flatCoordinates.push(0, 0); ends.push(2); }; var feature = format.createFeature_({}, rawFeature); - _ol_format_MVT_.readRawGeometry_ = readRawGeometry_; + MVT.readRawGeometry_ = readRawGeometry_; var geometry = feature.getGeometry(); expect(geometry).to.be.a(Point); expect(feature.get('myGeom')).to.equal(geometry); @@ -117,7 +117,7 @@ describe('ol.format.MVT', function() { }); it('detects a Polygon', function() { - var format = new _ol_format_MVT_({ + var format = new MVT({ featureClass: _ol_Feature_ }); var rawFeature = { @@ -127,20 +127,20 @@ describe('ol.format.MVT', function() { name: 'layer1' } }; - var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; - _ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { + var readRawGeometry_ = MVT.readRawGeometry_; + MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { flatCoordinates.push(0, 0, 3, 0, 3, 3, 3, 0, 0, 0); flatCoordinates.push(1, 1, 1, 2, 2, 2, 2, 1, 1, 1); ends.push(10, 20); }; var feature = format.createFeature_({}, rawFeature); - _ol_format_MVT_.readRawGeometry_ = readRawGeometry_; + MVT.readRawGeometry_ = readRawGeometry_; var geometry = feature.getGeometry(); expect(geometry).to.be.a(Polygon); }); it('detects a MultiPolygon', function() { - var format = new _ol_format_MVT_({ + var format = new MVT({ featureClass: _ol_Feature_ }); var rawFeature = { @@ -150,20 +150,20 @@ describe('ol.format.MVT', function() { name: 'layer1' } }; - var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; - _ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { + var readRawGeometry_ = MVT.readRawGeometry_; + MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { flatCoordinates.push(0, 0, 1, 0, 1, 1, 1, 0, 0, 0); flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1); ends.push(10, 20); }; var feature = format.createFeature_({}, rawFeature); - _ol_format_MVT_.readRawGeometry_ = readRawGeometry_; + MVT.readRawGeometry_ = readRawGeometry_; var geometry = feature.getGeometry(); expect(geometry).to.be.a(MultiPolygon); }); it('creates ol.render.Feature instances', function() { - var format = new _ol_format_MVT_(); + var format = new MVT(); var rawFeature = { type: 3, properties: { @@ -173,10 +173,10 @@ describe('ol.format.MVT', function() { name: 'layer1' } }; - var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; + var readRawGeometry_ = MVT.readRawGeometry_; var createdFlatCoordinates; var createdEnds; - _ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { + MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { flatCoordinates.push(0, 0, 1, 0, 1, 1, 1, 0, 0, 0); flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1); createdFlatCoordinates = flatCoordinates; @@ -184,7 +184,7 @@ describe('ol.format.MVT', function() { createdEnds = ends; }; var feature = format.createFeature_({}, rawFeature); - _ol_format_MVT_.readRawGeometry_ = readRawGeometry_; + MVT.readRawGeometry_ = readRawGeometry_; expect(feature).to.be.a(_ol_render_Feature_); expect(feature.getType()).to.be('Polygon'); expect(feature.getFlatCoordinates()).to.equal(createdFlatCoordinates); diff --git a/test/spec/ol/format/osmxml.test.js b/test/spec/ol/format/osmxml.test.js index bc55744786..a02309ac59 100644 --- a/test/spec/ol/format/osmxml.test.js +++ b/test/spec/ol/format/osmxml.test.js @@ -1,5 +1,5 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; -import _ol_format_OSMXML_ from '../../../../src/ol/format/OSMXML.js'; +import OSMXML from '../../../../src/ol/format/OSMXML.js'; import Point from '../../../../src/ol/geom/Point.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import {get as getProjection, transform} from '../../../../src/ol/proj.js'; @@ -9,7 +9,7 @@ describe('ol.format.OSMXML', function() { var format; beforeEach(function() { - format = new _ol_format_OSMXML_(); + format = new OSMXML(); }); describe('#readProjection', function() { diff --git a/test/spec/ol/format/ows.test.js b/test/spec/ol/format/ows.test.js index 5026fbf844..ea148cc648 100644 --- a/test/spec/ol/format/ows.test.js +++ b/test/spec/ol/format/ows.test.js @@ -1,10 +1,10 @@ -import _ol_format_OWS_ from '../../../../src/ol/format/OWS.js'; +import OWS from '../../../../src/ol/format/OWS.js'; import _ol_xml_ from '../../../../src/ol/xml.js'; describe('ol.format.OWS 1.1', function() { - var parser = new _ol_format_OWS_(); + var parser = new OWS(); it('should read ServiceProvider tag properly', function() { var doc = _ol_xml_.parse( diff --git a/test/spec/ol/format/polyline.test.js b/test/spec/ol/format/polyline.test.js index 70e5f9826f..205f7ee9ca 100644 --- a/test/spec/ol/format/polyline.test.js +++ b/test/spec/ol/format/polyline.test.js @@ -1,5 +1,5 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; -import _ol_format_Polyline_ from '../../../../src/ol/format/Polyline.js'; +import Polyline from '../../../../src/ol/format/Polyline.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import {get as getProjection, transform} from '../../../../src/ol/proj.js'; @@ -14,7 +14,7 @@ describe('ol.format.Polyline', function() { var points3857; function resetTestingData() { - format = new _ol_format_Polyline_(); + format = new Polyline(); points = [ [-120.20000, 38.50000], [-120.95000, 40.70000], @@ -60,7 +60,7 @@ describe('ol.format.Polyline', function() { describe('encodeDeltas', function() { it('returns expected value', function() { - var encodeDeltas = _ol_format_Polyline_.encodeDeltas; + var encodeDeltas = Polyline.encodeDeltas; expect(encodeDeltas(flippedFlatPoints, 2)).to.eql(encodedFlatPoints); }); @@ -68,7 +68,7 @@ describe('ol.format.Polyline', function() { describe('decodeDeltas', function() { it('returns expected value', function() { - var decodeDeltas = _ol_format_Polyline_.decodeDeltas; + var decodeDeltas = Polyline.decodeDeltas; expect(decodeDeltas(encodedFlatPoints, 2)).to.eql(flippedFlatPoints); }); @@ -77,7 +77,7 @@ describe('ol.format.Polyline', function() { describe('encodeFloats', function() { it('returns expected value', function() { - var encodeFloats = _ol_format_Polyline_.encodeFloats; + var encodeFloats = Polyline.encodeFloats; expect(encodeFloats(smallFloats)).to.eql(encodedFloats); @@ -90,7 +90,7 @@ describe('ol.format.Polyline', function() { describe('decodeFloats', function() { it('returns expected value', function() { - var decodeFloats = _ol_format_Polyline_.decodeFloats; + var decodeFloats = Polyline.decodeFloats; expect(decodeFloats(encodedFloats)).to.eql(smallFloats); expect(decodeFloats(encodedFloats, 1e5)).to.eql(smallFloats); @@ -101,7 +101,7 @@ describe('ol.format.Polyline', function() { describe('encodeSignedIntegers', function() { it('returns expected value', function() { - var encodeSignedIntegers = _ol_format_Polyline_.encodeSignedIntegers; + var encodeSignedIntegers = Polyline.encodeSignedIntegers; expect(encodeSignedIntegers( signedIntegers)).to.eql(encodedSignedIntegers); @@ -110,7 +110,7 @@ describe('ol.format.Polyline', function() { describe('decodeSignedIntegers', function() { it('returns expected value', function() { - var decodeSignedIntegers = _ol_format_Polyline_.decodeSignedIntegers; + var decodeSignedIntegers = Polyline.decodeSignedIntegers; expect(decodeSignedIntegers( encodedSignedIntegers)).to.eql(signedIntegers); @@ -120,7 +120,7 @@ describe('ol.format.Polyline', function() { describe('encodeUnsignedIntegers', function() { it('returns expected value', function() { - var encodeUnsignedIntegers = _ol_format_Polyline_.encodeUnsignedIntegers; + var encodeUnsignedIntegers = Polyline.encodeUnsignedIntegers; expect(encodeUnsignedIntegers( unsignedIntegers)).to.eql(encodedUnsignedIntegers); @@ -129,7 +129,7 @@ describe('ol.format.Polyline', function() { describe('decodeUnsignedIntegers', function() { it('returns expected value', function() { - var decodeUnsignedIntegers = _ol_format_Polyline_.decodeUnsignedIntegers; + var decodeUnsignedIntegers = Polyline.decodeUnsignedIntegers; expect(decodeUnsignedIntegers( encodedUnsignedIntegers)).to.eql(unsignedIntegers); @@ -139,7 +139,7 @@ describe('ol.format.Polyline', function() { describe('encodeFloat', function() { it('returns expected value', function() { - var encodeFloats = _ol_format_Polyline_.encodeFloats; + var encodeFloats = Polyline.encodeFloats; expect(encodeFloats([0.00000])).to.eql('?'); expect(encodeFloats([-0.00001])).to.eql('@'); @@ -162,7 +162,7 @@ describe('ol.format.Polyline', function() { describe('decodeFloat', function() { it('returns expected value', function() { - var decodeFloats = _ol_format_Polyline_.decodeFloats; + var decodeFloats = Polyline.decodeFloats; expect(decodeFloats('?')).to.eql([0.00000]); expect(decodeFloats('@')).to.eql([-0.00001]); @@ -186,7 +186,7 @@ describe('ol.format.Polyline', function() { describe('encodeSignedInteger', function() { it('returns expected value', function() { - var encodeSignedIntegers = _ol_format_Polyline_.encodeSignedIntegers; + var encodeSignedIntegers = Polyline.encodeSignedIntegers; expect(encodeSignedIntegers([0])).to.eql('?'); expect(encodeSignedIntegers([-1])).to.eql('@'); @@ -204,7 +204,7 @@ describe('ol.format.Polyline', function() { describe('decodeSignedInteger', function() { it('returns expected value', function() { - var decodeSignedIntegers = _ol_format_Polyline_.decodeSignedIntegers; + var decodeSignedIntegers = Polyline.decodeSignedIntegers; expect(decodeSignedIntegers('?')).to.eql([0]); expect(decodeSignedIntegers('@')).to.eql([-1]); @@ -223,7 +223,7 @@ describe('ol.format.Polyline', function() { describe('encodeUnsignedInteger', function() { it('returns expected value', function() { - var encodeUnsignedInteger = _ol_format_Polyline_.encodeUnsignedInteger; + var encodeUnsignedInteger = Polyline.encodeUnsignedInteger; expect(encodeUnsignedInteger(0)).to.eql('?'); expect(encodeUnsignedInteger(1)).to.eql('@'); @@ -243,7 +243,7 @@ describe('ol.format.Polyline', function() { describe('decodeUnsignedInteger', function() { it('returns expected value', function() { - var decodeUnsignedIntegers = _ol_format_Polyline_.decodeUnsignedIntegers; + var decodeUnsignedIntegers = Polyline.decodeUnsignedIntegers; expect(decodeUnsignedIntegers('?')).to.eql([0]); expect(decodeUnsignedIntegers('@')).to.eql([1]); @@ -320,12 +320,12 @@ describe('ol.format.Polyline', function() { }); it('parses XYZ linestring', function() { - var xyz = _ol_format_Polyline_.encodeDeltas([ + var xyz = Polyline.encodeDeltas([ 38.500, -120.200, 100, 40.700, -120.950, 200, 43.252, -126.453, 20 ], 3); - var format = new _ol_format_Polyline_({ + var format = new Polyline({ geometryLayout: 'XYZ' }); diff --git a/test/spec/ol/format/topojson.test.js b/test/spec/ol/format/topojson.test.js index d42aa14a99..69ff8fd9c0 100644 --- a/test/spec/ol/format/topojson.test.js +++ b/test/spec/ol/format/topojson.test.js @@ -1,9 +1,9 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import Polygon from '../../../../src/ol/geom/Polygon.js'; -import _ol_format_Feature_ from '../../../../src/ol/format/Feature.js'; +import FeatureFormat from '../../../../src/ol/format/Feature.js'; import {transform} from '../../../../src/ol/proj.js'; -import _ol_format_TopoJSON_ from '../../../../src/ol/format/TopoJSON.js'; +import TopoJSON from '../../../../src/ol/format/TopoJSON.js'; var aruba = { type: 'Topology', @@ -42,13 +42,13 @@ describe('ol.format.TopoJSON', function() { var format; before(function() { - format = new _ol_format_TopoJSON_(); + format = new TopoJSON(); }); describe('constructor', function() { it('creates a new format', function() { - expect(format).to.be.a(_ol_format_Feature_); - expect(format).to.be.a(_ol_format_TopoJSON_); + expect(format).to.be.a(FeatureFormat); + expect(format).to.be.a(TopoJSON); }); }); @@ -176,7 +176,7 @@ describe('ol.format.TopoJSON', function() { it('sets the topology\'s child names as feature property', function(done) { afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) { - var format = new _ol_format_TopoJSON_({ + var format = new TopoJSON({ layerName: 'layer' }); var features = format.readFeatures(text); @@ -188,7 +188,7 @@ describe('ol.format.TopoJSON', function() { it('only parses features from specified topology\'s children', function(done) { afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) { - var format = new _ol_format_TopoJSON_({ + var format = new TopoJSON({ layers: ['land'] }); var features = format.readFeatures(text); diff --git a/test/spec/ol/format/wfs.test.js b/test/spec/ol/format/wfs.test.js index f3f38faa6e..431c02ee08 100644 --- a/test/spec/ol/format/wfs.test.js +++ b/test/spec/ol/format/wfs.test.js @@ -1,6 +1,6 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; -import _ol_format_GML2_ from '../../../../src/ol/format/GML2.js'; -import _ol_format_WFS_ from '../../../../src/ol/format/WFS.js'; +import GML2 from '../../../../src/ol/format/GML2.js'; +import WFS from '../../../../src/ol/format/WFS.js'; import _ol_format_filter_ from '../../../../src/ol/format/filter.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; @@ -16,7 +16,7 @@ describe('ol.format.WFS', function() { describe('featureType', function() { it('#getFeatureType #setFeatureType', function() { - var format = new _ol_format_WFS_({ + var format = new WFS({ featureNS: 'http://www.openplans.org/topp', featureType: ['foo', 'bar'] }); @@ -41,7 +41,7 @@ describe('ol.format.WFS', function() { afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(data) { try { xml = data; - features = new _ol_format_WFS_(config).readFeatures(xml); + features = new WFS(config).readFeatures(xml); } catch (e) { done(e); } @@ -67,7 +67,7 @@ describe('ol.format.WFS', function() { }); it('transforms and creates a polygon for Illinois', function() { - features = new _ol_format_WFS_(config).readFeatures(xml, { + features = new WFS(config).readFeatures(xml, { featureProjection: 'EPSG:3857' }); feature = features[0]; @@ -88,7 +88,7 @@ describe('ol.format.WFS', function() { var config = { 'featureNS': 'http://mapserver.gis.umn.edu/mapserver', 'featureType': 'polygon', - 'gmlFormat': new _ol_format_GML2_() + 'gmlFormat': new GML2() }; before(function(done) { @@ -97,7 +97,7 @@ describe('ol.format.WFS', function() { afterLoadText('spec/ol/format/wfs/polygonv2.xml', function(data) { try { xml = data; - features = new _ol_format_WFS_(config).readFeatures(xml); + features = new WFS(config).readFeatures(xml); } catch (e) { done(e); } @@ -138,7 +138,7 @@ describe('ol.format.WFS', function() { }); }); it('returns an empty array of features when none exist', function() { - var result = new _ol_format_WFS_().readFeatures(xml); + var result = new WFS().readFeatures(xml); expect(result).to.have.length(0); }); }); @@ -149,7 +149,7 @@ describe('ol.format.WFS', function() { afterLoadText('spec/ol/format/wfs/NumberOfFeatures.xml', function(xml) { try { - response = new _ol_format_WFS_().readFeatureCollectionMetadata(xml); + response = new WFS().readFeatureCollectionMetadata(xml); } catch (e) { done(e); } @@ -172,7 +172,7 @@ describe('ol.format.WFS', function() { afterLoadText('spec/ol/format/wfs/boundedBy.xml', function(xml) { try { - response = new _ol_format_WFS_().readFeatureCollectionMetadata(xml); + response = new WFS().readFeatureCollectionMetadata(xml); } catch (e) { done(e); } @@ -191,7 +191,7 @@ describe('ol.format.WFS', function() { afterLoadText('spec/ol/format/wfs/TransactionResponse.xml', function(xml) { try { - response = new _ol_format_WFS_().readTransactionResponse(xml); + response = new WFS().readTransactionResponse(xml); } catch (e) { done(e); } @@ -226,7 +226,7 @@ describe('ol.format.WFS', function() { ' STATE_ABBR' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ resultType: 'hits', featureTypes: ['states'], featureNS: 'http://www.openplans.org/topp', @@ -251,7 +251,7 @@ describe('ol.format.WFS', function() { ' xmlns:topp="http://www.openplans.org/topp">' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ count: 10, startIndex: 20, srsName: 'urn:ogc:def:crs:EPSG::4326', @@ -278,7 +278,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -301,7 +301,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -329,7 +329,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -371,7 +371,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -403,7 +403,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -424,7 +424,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -446,7 +446,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -468,7 +468,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -492,7 +492,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -528,7 +528,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -562,7 +562,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'EPSG:4326', featureTypes: ['area'], filter: _ol_format_filter_.contains( @@ -599,7 +599,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'EPSG:4326', featureTypes: ['area'], filter: _ol_format_filter_.intersects( @@ -636,7 +636,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'EPSG:4326', featureTypes: ['area'], filter: _ol_format_filter_.within( @@ -676,7 +676,7 @@ describe('ol.format.WFS', function() { ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'EPSG:4326', featureTypes: ['states'], filter: _ol_format_filter_.during('date_prop', '2010-01-20T00:00:00Z', '2012-12-31T00:00:00Z') @@ -695,7 +695,7 @@ describe('ol.format.WFS', function() { 'service="WFS" version="1.1.0" handle="handle_t" ' + 'xsi:schemaLocation="http://www.opengis.net/wfs ' + 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>'; - var serialized = new _ol_format_WFS_().writeTransaction(null, null, null, + var serialized = new WFS().writeTransaction(null, null, null, {handle: 'handle_t'}); expect(serialized).to.xmleql(_ol_xml_.parse(text)); }); @@ -711,7 +711,7 @@ describe('ol.format.WFS', function() { }); }); it('creates the correct srsName', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new MultiLineString([[ [-5178372.1885436, 1992365.7775042], @@ -742,7 +742,7 @@ describe('ol.format.WFS', function() { }); it('creates the correct update', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var updateFeature = new _ol_Feature_(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ @@ -763,7 +763,7 @@ describe('ol.format.WFS', function() { }); it('creates the correct update if geometry name is alias', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var updateFeature = new _ol_Feature_(new MultiLineString([[ [-12279454, 6741885], [-12064207, 6732101], @@ -787,7 +787,7 @@ describe('ol.format.WFS', function() { describe('when writing out a Transaction request', function() { it('creates the correct update with default featurePrefix', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var updateFeature = new _ol_Feature_(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ @@ -810,7 +810,7 @@ describe('ol.format.WFS', function() { describe('when writing out a Transaction request', function() { it('does not create an update if no fid', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var updateFeature = new _ol_Feature_(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ @@ -843,7 +843,7 @@ describe('ol.format.WFS', function() { }); it('handles multiple geometries', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var updateFeature = new _ol_Feature_(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ @@ -878,7 +878,7 @@ describe('ol.format.WFS', function() { }); it('creates the correct transaction body', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new MultiPoint([[1, 2]]), foo: 'bar', @@ -921,7 +921,7 @@ describe('ol.format.WFS', function() { }); it('handles writing out Native', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var serialized = format.writeTransaction(null, null, null, { nativeElements: [{ vendorId: 'ORACLE', @@ -948,7 +948,7 @@ describe('ol.format.WFS', function() { }); it('handles the WFS version', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new LineString([[1.1, 2], [3, 4.2]]), foo: 'bar', @@ -992,7 +992,7 @@ describe('ol.format.WFS', function() { }); it('do not add feature prefix twice', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new MultiPoint([[1, 2]]), foo: 'bar', @@ -1035,7 +1035,7 @@ describe('ol.format.WFS', function() { }); it('handles 3D in WFS 1.0.0', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new LineString([[1.1, 2, 4], [3, 4.2, 5]]), foo: 'bar', @@ -1077,7 +1077,7 @@ describe('ol.format.WFS', function() { }); it('handles 3D in WFS 1.1.0', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new MultiPoint([[1, 2, 3]]), foo: 'bar', @@ -1117,7 +1117,7 @@ describe('ol.format.WFS', function() { }); it('handles writing multiple Query elements', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var serialized = format.writeGetFeature({ featureNS: 'http://www.openplans.org/topp', featureTypes: ['states', 'cities'], @@ -1137,7 +1137,7 @@ describe('ol.format.WFS', function() { 'featureNS': 'http://mapserver.gis.umn.edu/mapserver', 'featureType': 'Historische_Messtischblaetter_WFS' }; - features = new _ol_format_WFS_(config).readFeatures(xml); + features = new WFS(config).readFeatures(xml); } catch (e) { done(e); } @@ -1165,7 +1165,7 @@ describe('ol.format.WFS', function() { before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { try { - features = new _ol_format_WFS_({ + features = new WFS({ featureNS: 'http://localhost:8080/official', featureType: ['planet_osm_polygon', 'planet_osm_line'] }).readFeatures(xml); @@ -1188,11 +1188,11 @@ describe('ol.format.WFS', function() { before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { try { - lineFeatures = new _ol_format_WFS_({ + lineFeatures = new WFS({ featureNS: 'http://localhost:8080/official', featureType: ['planet_osm_line'] }).readFeatures(xml); - polygonFeatures = new _ol_format_WFS_({ + polygonFeatures = new WFS({ featureNS: 'http://localhost:8080/official', featureType: ['planet_osm_polygon'] }).readFeatures(xml); @@ -1216,7 +1216,7 @@ describe('ol.format.WFS', function() { before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { try { - features = new _ol_format_WFS_().readFeatures(xml); + features = new WFS().readFeatures(xml); } catch (e) { done(e); } @@ -1236,7 +1236,7 @@ describe('ol.format.WFS', function() { before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) { try { - features = new _ol_format_WFS_().readFeatures(xml); + features = new WFS().readFeatures(xml); } catch (e) { done(e); } @@ -1259,11 +1259,11 @@ describe('ol.format.WFS', function() { before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) { try { - busFeatures = new _ol_format_WFS_({ + busFeatures = new WFS({ featureNS: 'http://mapserver.gis.umn.edu/mapserver', featureType: ['bus_stop'] }).readFeatures(xml); - infoFeatures = new _ol_format_WFS_({ + infoFeatures = new WFS({ featureNS: 'http://mapserver.gis.umn.edu/mapserver', featureType: ['information'] }).readFeatures(xml); @@ -1296,7 +1296,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = _ol_format_WFS_.writeFilter( + var serialized = WFS.writeFilter( _ol_format_filter_.and( _ol_format_filter_.like('name', 'Mississippi*'), _ol_format_filter_.equalTo('waterway', 'riverbank') diff --git a/test/spec/ol/format/wkt.test.js b/test/spec/ol/format/wkt.test.js index 2204c3d628..6d36ac0a00 100644 --- a/test/spec/ol/format/wkt.test.js +++ b/test/spec/ol/format/wkt.test.js @@ -1,12 +1,12 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; import Point from '../../../../src/ol/geom/Point.js'; -import _ol_format_WKT_ from '../../../../src/ol/format/WKT.js'; +import WKT from '../../../../src/ol/format/WKT.js'; import {transform} from '../../../../src/ol/proj.js'; describe('ol.format.WKT', function() { - var format = new _ol_format_WKT_(); + var format = new WKT(); describe('#readProjectionFromText', function() { it('returns the default projection', function() { @@ -779,7 +779,7 @@ describe('ol.format.WKT', function() { }); it('GeometryCollection split / merged correctly', function() { - format = new _ol_format_WKT_({splitCollection: true}); + format = new WKT({splitCollection: true}); var wkt = 'GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))'; var features = format.readFeatures(wkt); expect(features.length).to.eql(2); diff --git a/test/spec/ol/format/wmscapabilities.test.js b/test/spec/ol/format/wmscapabilities.test.js index 2f9f01989d..5fdd0f054d 100644 --- a/test/spec/ol/format/wmscapabilities.test.js +++ b/test/spec/ol/format/wmscapabilities.test.js @@ -1,10 +1,10 @@ -import _ol_format_WMSCapabilities_ from '../../../../src/ol/format/WMSCapabilities.js'; +import WMSCapabilities from '../../../../src/ol/format/WMSCapabilities.js'; describe('ol.format.WMSCapabilities', function() { describe('when parsing ogcsample.xml', function() { - var parser = new _ol_format_WMSCapabilities_(); + var parser = new WMSCapabilities(); var capabilities; before(function(done) { afterLoadText('spec/ol/format/wms/ogcsample.xml', function(xml) { diff --git a/test/spec/ol/format/wmsgetfeatureinfo.test.js b/test/spec/ol/format/wmsgetfeatureinfo.test.js index 755f64ce72..168e092a53 100644 --- a/test/spec/ol/format/wmsgetfeatureinfo.test.js +++ b/test/spec/ol/format/wmsgetfeatureinfo.test.js @@ -1,4 +1,4 @@ -import _ol_format_WMSGetFeatureInfo_ from '../../../../src/ol/format/WMSGetFeatureInfo.js'; +import WMSGetFeatureInfo from '../../../../src/ol/format/WMSGetFeatureInfo.js'; import {addCommon, clearAllProjections} from '../../../../src/ol/proj.js'; import {register} from '../../../../src/ol/proj/proj4.js'; @@ -8,12 +8,12 @@ describe('ol.format.WMSGetFeatureInfo', function() { describe('#getLayers', function() { it('returns null if layers is undefined', function() { - var format = new _ol_format_WMSGetFeatureInfo_(); + var format = new WMSGetFeatureInfo(); expect(format.getLayers()).to.be(null); }); it('returns the value provided in the layers option', function() { - var format = new _ol_format_WMSGetFeatureInfo_({ + var format = new WMSGetFeatureInfo({ layers: ['a', 'z'] }); expect(format.getLayers()).to.eql(['a', 'z']); @@ -32,7 +32,7 @@ describe('ol.format.WMSGetFeatureInfo', function() { register(proj4); afterLoadText('spec/ol/format/wms/getfeatureinfo.xml', function(data) { try { - features = new _ol_format_WMSGetFeatureInfo_().readFeatures(data); + features = new WMSGetFeatureInfo().readFeatures(data); } catch (e) { done(e); } @@ -73,7 +73,7 @@ describe('ol.format.WMSGetFeatureInfo', function() { ' ' + ' ' + ''; - var features = new _ol_format_WMSGetFeatureInfo_().readFeatures(text); + var features = new WMSGetFeatureInfo().readFeatures(text); expect(features.length).to.be(0); }); @@ -98,7 +98,7 @@ describe('ol.format.WMSGetFeatureInfo', function() { ' ' + ' ' + ''; - var features = new _ol_format_WMSGetFeatureInfo_().readFeatures(text); + var features = new WMSGetFeatureInfo().readFeatures(text); expect(features.length).to.be(1); expect(features[0].get('FOO')).to.be('bar'); // FIXME is that really wanted ? @@ -158,7 +158,7 @@ describe('ol.format.WMSGetFeatureInfo', function() { ' ' + ' ' + ''; - var format = new _ol_format_WMSGetFeatureInfo_(); + var format = new WMSGetFeatureInfo(); var features = format.readFeatures(text); expect(features.length).to.be(2); expect(features[0].get('OBJECTID')).to.be('287'); @@ -224,7 +224,7 @@ describe('ol.format.WMSGetFeatureInfo', function() { ' ' + ' ' + ''; - var features = new _ol_format_WMSGetFeatureInfo_().readFeatures(text); + var features = new WMSGetFeatureInfo().readFeatures(text); expect(features.length).to.be(1); expect(features[0].get('cat')).to.be('3'); expect(features[0].getGeometry().getType()).to.be('MultiLineString'); diff --git a/test/spec/ol/format/xsd.test.js b/test/spec/ol/format/xsd.test.js index e4a6a0546a..614358632d 100644 --- a/test/spec/ol/format/xsd.test.js +++ b/test/spec/ol/format/xsd.test.js @@ -1,4 +1,4 @@ -import _ol_format_XSD_ from '../../../../src/ol/format/XSD.js'; +import XSD from '../../../../src/ol/format/XSD.js'; describe('ol.format.XSD', function() { @@ -7,7 +7,7 @@ describe('ol.format.XSD', function() { it('can handle non-Zulu time zones', function() { var node = document.createElement('time'); node.textContent = '2016-07-12T15:00:00+03:00'; - expect(new Date(_ol_format_XSD_.readDateTime(node) * 1000).toISOString()).to.eql('2016-07-12T12:00:00.000Z'); + expect(new Date(XSD.readDateTime(node) * 1000).toISOString()).to.eql('2016-07-12T12:00:00.000Z'); }); }); diff --git a/test/spec/ol/interaction/draganddrop.test.js b/test/spec/ol/interaction/draganddrop.test.js index 99a3665b44..ffd6d51be6 100644 --- a/test/spec/ol/interaction/draganddrop.test.js +++ b/test/spec/ol/interaction/draganddrop.test.js @@ -2,7 +2,7 @@ import {inherits} from '../../../../src/ol/index.js'; import _ol_View_ from '../../../../src/ol/View.js'; import Event from '../../../../src/ol/events/Event.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js'; -import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js'; +import GeoJSON from '../../../../src/ol/format/GeoJSON.js'; import DragAndDrop from '../../../../src/ol/interaction/DragAndDrop.js'; import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js'; @@ -20,7 +20,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() { } }; interaction = new DragAndDrop({ - formatConstructors: [_ol_format_GeoJSON_] + formatConstructors: [GeoJSON] }); }); @@ -38,7 +38,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() { it('accepts a source option', function() { var source = new _ol_source_Vector_(); var drop = new DragAndDrop({ - formatConstructors: [_ol_format_GeoJSON_], + formatConstructors: [GeoJSON], source: source }); expect(drop.source_).to.equal(source); @@ -74,7 +74,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() { it('registers and unregisters listeners on a custom target', function() { var customTarget = new EventTarget(); interaction = new DragAndDrop({ - formatConstructors: [_ol_format_GeoJSON_], + formatConstructors: [GeoJSON], target: customTarget }); interaction.setMap(map); @@ -138,7 +138,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() { it('adds dropped features to a source', function(done) { var source = new _ol_source_Vector_(); var drop = new DragAndDrop({ - formatConstructors: [_ol_format_GeoJSON_], + formatConstructors: [GeoJSON], source: source }); drop.setMap(map); diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js index 77c3f7889d..da6d0af867 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -7,7 +7,7 @@ import _ol_VectorImageTile_ from '../../../../../src/ol/VectorImageTile.js'; import _ol_VectorTile_ from '../../../../../src/ol/VectorTile.js'; import _ol_View_ from '../../../../../src/ol/View.js'; import * as _ol_extent_ from '../../../../../src/ol/extent.js'; -import _ol_format_MVT_ from '../../../../../src/ol/format/MVT.js'; +import MVT from '../../../../../src/ol/format/MVT.js'; import Point from '../../../../../src/ol/geom/Point.js'; import _ol_layer_VectorTile_ from '../../../../../src/ol/layer/VectorTile.js'; import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.js'; @@ -68,7 +68,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { }; inherits(TileClass, _ol_VectorTile_); source = new _ol_source_VectorTile_({ - format: new _ol_format_MVT_(), + format: new MVT(), tileClass: TileClass, tileGrid: _ol_tilegrid_.createXYZ() }); @@ -350,7 +350,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { document.body.appendChild(target); var extent = [1824704.739223726, 6141868.096770482, 1827150.7241288517, 6144314.081675608]; var source = new _ol_source_VectorTile_({ - format: new _ol_format_MVT_(), + format: new MVT(), url: 'spec/ol/data/14-8938-5680.vector.pbf', minZoom: 14, maxZoom: 14 diff --git a/test/spec/ol/source/vectortile.test.js b/test/spec/ol/source/vectortile.test.js index 11b4ad8c71..c9ee4f4743 100644 --- a/test/spec/ol/source/vectortile.test.js +++ b/test/spec/ol/source/vectortile.test.js @@ -2,7 +2,7 @@ import _ol_Map_ from '../../../../src/ol/Map.js'; import _ol_View_ from '../../../../src/ol/View.js'; import _ol_VectorImageTile_ from '../../../../src/ol/VectorImageTile.js'; import _ol_VectorTile_ from '../../../../src/ol/VectorTile.js'; -import _ol_format_MVT_ from '../../../../src/ol/format/MVT.js'; +import MVT from '../../../../src/ol/format/MVT.js'; import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import {get as getProjection} from '../../../../src/ol/proj.js'; import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js'; @@ -11,7 +11,7 @@ import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js'; describe('ol.source.VectorTile', function() { - var format = new _ol_format_MVT_(); + var format = new MVT(); var source = new _ol_source_VectorTile_({ format: format, tilePixelRatio: 8, diff --git a/test/spec/ol/sphere.test.js b/test/spec/ol/sphere.test.js index 3aa331c7e0..923832ada3 100644 --- a/test/spec/ol/sphere.test.js +++ b/test/spec/ol/sphere.test.js @@ -3,7 +3,7 @@ import _ol_Sphere_ from '../../../src/ol/Sphere.js'; -import _ol_format_WKT_ from '../../../src/ol/format/WKT.js'; +import WKT from '../../../src/ol/format/WKT.js'; import GeometryCollection from '../../../src/ol/geom/GeometryCollection.js'; import LineString from '../../../src/ol/geom/LineString.js'; import MultiLineString from '../../../src/ol/geom/MultiLineString.js'; @@ -95,7 +95,7 @@ describe('ol.Sphere', function() { before(function(done) { afterLoadText('spec/ol/format/wkt/illinois.wkt', function(wkt) { try { - var format = new _ol_format_WKT_(); + var format = new WKT(); geometry = format.readGeometry(wkt); } catch (e) { done(e); @@ -187,7 +187,7 @@ describe('ol.Sphere.getArea()', function() { before(function(done) { afterLoadText('spec/ol/format/wkt/illinois.wkt', function(wkt) { try { - var format = new _ol_format_WKT_(); + var format = new WKT(); geometry = format.readGeometry(wkt); } catch (e) { done(e); diff --git a/test/spec/ol/vectorimagetile.test.js b/test/spec/ol/vectorimagetile.test.js index 922ea6b1d9..4e88bb3e1e 100644 --- a/test/spec/ol/vectorimagetile.test.js +++ b/test/spec/ol/vectorimagetile.test.js @@ -2,7 +2,7 @@ import _ol_TileState_ from '../../../src/ol/TileState.js'; import _ol_VectorImageTile_ from '../../../src/ol/VectorImageTile.js'; import _ol_VectorTile_ from '../../../src/ol/VectorTile.js'; import _ol_events_ from '../../../src/ol/events.js'; -import _ol_format_GeoJSON_ from '../../../src/ol/format/GeoJSON.js'; +import GeoJSON from '../../../src/ol/format/GeoJSON.js'; import {get as getProjection} from '../../../src/ol/proj.js'; import _ol_tilegrid_ from '../../../src/ol/tilegrid.js'; import _ol_tilegrid_TileGrid_ from '../../../src/ol/tilegrid/TileGrid.js'; @@ -11,7 +11,7 @@ import _ol_tilegrid_TileGrid_ from '../../../src/ol/tilegrid/TileGrid.js'; describe('ol.VectorImageTile', function() { it('configures loader that sets features on the source tile', function(done) { - var format = new _ol_format_GeoJSON_(); + var format = new GeoJSON(); var url = 'spec/ol/data/point.json'; var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format, _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() { @@ -31,7 +31,7 @@ describe('ol.VectorImageTile', function() { }); it('sets LOADED state when previously failed source tiles are loaded', function(done) { - var format = new _ol_format_GeoJSON_(); + var format = new GeoJSON(); var url = 'spec/ol/data/unavailable.json'; var sourceTile; var tile = new _ol_VectorImageTile_([0, 0, 0] /* one world away */, 0, url, format, @@ -59,7 +59,7 @@ describe('ol.VectorImageTile', function() { }); it('sets ERROR state when source tiles fail to load', function(done) { - var format = new _ol_format_GeoJSON_(); + var format = new GeoJSON(); var url = 'spec/ol/data/unavailable.json'; var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format, _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() { @@ -76,7 +76,7 @@ describe('ol.VectorImageTile', function() { }); it('sets EMPTY state when tile has only empty source tiles', function(done) { - var format = new _ol_format_GeoJSON_(); + var format = new GeoJSON(); var url = ''; var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format, _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() {}, @@ -92,7 +92,7 @@ describe('ol.VectorImageTile', function() { }); it('only loads tiles within the source tileGrid\'s extent', function() { - var format = new _ol_format_GeoJSON_(); + var format = new GeoJSON(); var url = 'spec/ol/data/point.json'; var tileGrid = new _ol_tilegrid_TileGrid_({ resolutions: [0.02197265625, 0.010986328125, 0.0054931640625], @@ -112,7 +112,7 @@ describe('ol.VectorImageTile', function() { }); it('#dispose() while loading', function() { - var format = new _ol_format_GeoJSON_(); + var format = new GeoJSON(); var url = 'spec/ol/data/point.json'; var tile = new _ol_VectorImageTile_([0, 0, 0] /* one world away */, 0, url, format, _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() { @@ -132,7 +132,7 @@ describe('ol.VectorImageTile', function() { }); it('#dispose() when loaded', function(done) { - var format = new _ol_format_GeoJSON_(); + var format = new GeoJSON(); var url = 'spec/ol/data/point.json'; var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format, _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() { diff --git a/test/spec/ol/vectortile.test.js b/test/spec/ol/vectortile.test.js index 8bdda00f26..4cb6e2453e 100644 --- a/test/spec/ol/vectortile.test.js +++ b/test/spec/ol/vectortile.test.js @@ -2,7 +2,7 @@ import _ol_Feature_ from '../../../src/ol/Feature.js'; import _ol_VectorImageTile_ from '../../../src/ol/VectorImageTile.js'; import _ol_VectorTile_ from '../../../src/ol/VectorTile.js'; import _ol_events_ from '../../../src/ol/events.js'; -import _ol_format_TextFeature_ from '../../../src/ol/format/TextFeature.js'; +import TextFeature from '../../../src/ol/format/TextFeature.js'; import {get as getProjection} from '../../../src/ol/proj.js'; import _ol_proj_Projection_ from '../../../src/ol/proj/Projection.js'; @@ -11,7 +11,7 @@ describe('ol.VectorTile', function() { it('loader sets features on the tile and updates proj units', function(done) { // mock format that return a tile-pixels feature - var format = new _ol_format_TextFeature_(); + var format = new TextFeature(); format.readProjection = function(source) { return new _ol_proj_Projection_({ code: '',