Merge pull request #7620 from tschaub/rename

Rename variables in format modules
This commit is contained in:
Tim Schaub
2017-12-17 02:40:29 -07:00
committed by GitHub
96 changed files with 2379 additions and 2384 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_events_condition_ from '../src/ol/events/condition.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 DragBox from '../src/ol/interaction/DragBox.js';
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.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_({ var vectorSource = new _ol_source_Vector_({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}); });
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import * as _ol_extent_ from '../src/ol/extent.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_has_ from '../src/ol/has.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import {fromLonLat} from '../src/ol/proj.js'; import {fromLonLat} from '../src/ol/proj.js';
@@ -84,7 +84,7 @@ var getStackedStyle = function(feature, resolution) {
var vectorLayer = new _ol_layer_Vector_({ var vectorLayer = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}), }),
style: getStackedStyle style: getStackedStyle
}); });
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.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_({ var source = new _ol_source_Vector_({
url: 'data/geojson/switzerland.geojson', url: 'data/geojson/switzerland.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}); });
var style = new _ol_style_Style_({ var style = new _ol_style_Style_({
fill: new _ol_style_Fill_({ fill: new _ol_style_Fill_({
+10 -10
View File
@@ -1,10 +1,10 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; import GeoJSON from '../src/ol/format/GeoJSON.js';
import _ol_format_IGC_ from '../src/ol/format/IGC.js'; import IGC from '../src/ol/format/IGC.js';
import _ol_format_KML_ from '../src/ol/format/KML.js'; import KML from '../src/ol/format/KML.js';
import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js'; import TopoJSON from '../src/ol/format/TopoJSON.js';
import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_ from '../src/ol/interaction.js';
import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
@@ -85,11 +85,11 @@ var styleFunction = function(feature, resolution) {
var dragAndDropInteraction = new DragAndDrop({ var dragAndDropInteraction = new DragAndDrop({
formatConstructors: [ formatConstructors: [
_ol_format_GPX_, GPX,
_ol_format_GeoJSON_, GeoJSON,
_ol_format_IGC_, IGC,
_ol_format_KML_, KML,
_ol_format_TopoJSON_ TopoJSON
] ]
}); });
+10 -10
View File
@@ -1,10 +1,10 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_format_GeoJSON_ from '../src/ol/format/GeoJSON.js'; import GeoJSON from '../src/ol/format/GeoJSON.js';
import _ol_format_IGC_ from '../src/ol/format/IGC.js'; import IGC from '../src/ol/format/IGC.js';
import _ol_format_KML_ from '../src/ol/format/KML.js'; import KML from '../src/ol/format/KML.js';
import _ol_format_TopoJSON_ from '../src/ol/format/TopoJSON.js'; import TopoJSON from '../src/ol/format/TopoJSON.js';
import _ol_interaction_ from '../src/ol/interaction.js'; import _ol_interaction_ from '../src/ol/interaction.js';
import DragAndDrop from '../src/ol/interaction/DragAndDrop.js'; import DragAndDrop from '../src/ol/interaction/DragAndDrop.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
@@ -85,11 +85,11 @@ var styleFunction = function(feature, resolution) {
var dragAndDropInteraction = new DragAndDrop({ var dragAndDropInteraction = new DragAndDrop({
formatConstructors: [ formatConstructors: [
_ol_format_GPX_, GPX,
_ol_format_GeoJSON_, GeoJSON,
_ol_format_IGC_, IGC,
_ol_format_KML_, KML,
_ol_format_TopoJSON_ TopoJSON
] ]
}); });
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import * as _ol_extent_ from '../src/ol/extent.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_ from '../src/ol/interaction.js';
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
@@ -126,7 +126,7 @@ vector = new _ol_layer_Vector_({
distance: 40, distance: 40,
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/kml/2012_Earthquakes_Mag5.kml', url: 'data/kml/2012_Earthquakes_Mag5.kml',
format: new _ol_format_KML_({ format: new KML({
extractStyles: false extractStyles: false
}) })
}) })
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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 Polygon from '../src/ol/geom/Polygon.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.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_({ var vector = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/kml/2012_Earthquakes_Mag5.kml', url: 'data/kml/2012_Earthquakes_Mag5.kml',
format: new _ol_format_KML_({ format: new KML({
extractStyles: false extractStyles: false
}) })
}), }),
+2 -2
View File
@@ -3,7 +3,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js';
@@ -17,7 +17,7 @@ var map = new _ol_Map_({
new _ol_layer_Vector_({ new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}) })
}) })
], ],
+2 -2
View File
@@ -2,7 +2,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.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_() source: new _ol_source_OSM_()
}); });
var format = new _ol_format_WKT_(); var format = new WKT();
var feature = format.readFeature( var feature = format.readFeature(
'POLYGON((10.689697265625 -25.0927734375, 34.595947265625 ' + 'POLYGON((10.689697265625 -25.0927734375, 34.595947265625 ' +
'-20.1708984375, 38.814697265625 -35.6396484375, 13.502197265625 ' + '-20.1708984375, 38.814697265625 -35.6396484375, 13.502197265625 ' +
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_events_condition_ from '../src/ol/events/condition.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_interaction_Extent_ from '../src/ol/interaction/Extent.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.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_({ var vectorSource = new _ol_source_Vector_({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}); });
var map = new _ol_Map_({ var map = new _ol_Map_({
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Feature_ from '../src/ol/Feature.js'; import _ol_Feature_ from '../src/ol/Feature.js';
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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 Point from '../src/ol/geom/Point.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.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' '~@ym@yjA??a@cFd@kBrCgDbAUnAcBhAyAdk@et@??kF}D??OL'
].join(''); ].join('');
var route = /** @type {ol.geom.LineString} */ (new _ol_format_Polyline_({ var route = /** @type {ol.geom.LineString} */ (new Polyline({
factor: 1e6 factor: 1e6
}).readGeometry(polyline, { }).readGeometry(polyline, {
dataProjection: 'EPSG:4326', dataProjection: 'EPSG:4326',
+2 -2
View File
@@ -1,7 +1,7 @@
// NOCOMPILE // NOCOMPILE
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_OSM_ from '../src/ol/source/OSM.js';
import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
@@ -75,7 +75,7 @@ fetch(url).then(function(response) {
debug: 1 debug: 1
}); });
var vectorSource = new _ol_source_VectorTile_({ var vectorSource = new _ol_source_VectorTile_({
format: new _ol_format_GeoJSON_(), format: new GeoJSON(),
tileLoadFunction: function(tile) { tileLoadFunction: function(tile) {
var format = tile.getFormat(); var format = tile.getFormat();
var tileCoord = tile.getTileCoord(); var tileCoord = tile.getTileCoord();
+2 -2
View File
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../src/ol/Feature.js';
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.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 Circle from '../src/ol/geom/Circle.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
@@ -161,7 +161,7 @@ var geojsonObject = {
}; };
var vectorSource = new _ol_source_Vector_({ 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))); vectorSource.addFeature(new _ol_Feature_(new Circle([5e6, 7e6], 1e6)));
+4 -4
View File
@@ -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) { fetch('data/wmsgetfeatureinfo/osm-restaurant-hotel.xml').then(function(response) {
return response.text(); return response.text();
}).then(function(response) { }).then(function(response) {
// this is the standard way to read the features // 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(); document.getElementById('all').innerText = allFeatures.length.toString();
// when specifying the 'layers' options, only the features of those // when specifying the 'layers' options, only the features of those
// layers are returned by the format // layers are returned by the format
var hotelFeatures = new _ol_format_WMSGetFeatureInfo_({ var hotelFeatures = new WMSGetFeatureInfo({
layers: ['hotel'] layers: ['hotel']
}).readFeatures(response); }).readFeatures(response);
document.getElementById('hotel').innerText = hotelFeatures.length.toString(); document.getElementById('hotel').innerText = hotelFeatures.length.toString();
var restaurantFeatures = new _ol_format_WMSGetFeatureInfo_({ var restaurantFeatures = new WMSGetFeatureInfo({
layers: ['restaurant'] layers: ['restaurant']
}).readFeatures(response); }).readFeatures(response);
document.getElementById('restaurant').innerText = restaurantFeatures.length.toString(); document.getElementById('restaurant').innerText = restaurantFeatures.length.toString();
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
@@ -47,7 +47,7 @@ var style = {
var vector = new _ol_layer_Vector_({ var vector = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/gpx/fells_loop.gpx', url: 'data/gpx/fells_loop.gpx',
format: new _ol_format_GPX_() format: new GPX()
}), }),
style: function(feature) { style: function(feature) {
return style[feature.getGeometry().getType()]; return style[feature.getGeometry().getType()];
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Heatmap_ from '../src/ol/layer/Heatmap.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_source_Stamen_ from '../src/ol/source/Stamen.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_({ var vector = new _ol_layer_Heatmap_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/kml/2012_Earthquakes_Mag5.kml', url: 'data/kml/2012_Earthquakes_Mag5.kml',
format: new _ol_format_KML_({ format: new KML({
extractStyles: false extractStyles: false
}) })
}), }),
+2 -2
View File
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../src/ol/Feature.js';
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.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 LineString from '../src/ol/geom/LineString.js';
import Point from '../src/ol/geom/Point.js'; import Point from '../src/ol/geom/Point.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
@@ -58,7 +58,7 @@ function get(url, callback) {
client.send(); client.send();
} }
var igcFormat = new _ol_format_IGC_(); var igcFormat = new IGC();
for (var i = 0; i < igcUrls.length; ++i) { for (var i = 0; i < igcUrls.length; ++i) {
get(igcUrls[i], function(data) { get(igcUrls[i], function(data) {
var features = igcFormat.readFeatures(data, var features = igcFormat.readFeatures(data,
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_Vector_ from '../src/ol/source/Vector.js'; import _ol_source_Vector_ from '../src/ol/source/Vector.js';
import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js';
@@ -26,7 +26,7 @@ var map = new _ol_Map_({
renderMode: 'image', renderMode: 'image',
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}), }),
style: function(feature) { style: function(feature) {
style.getText().setText(feature.get('name')); style.getText().setText(feature.get('name'));
+2 -2
View File
@@ -2,7 +2,7 @@
// this example uses JSTS for which we don't have an externs file. // this example uses JSTS for which we don't have an externs file.
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import {fromLonLat} from '../src/ol/proj.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) { fetch('data/geojson/roads-seoul.geojson').then(function(response) {
return response.json(); return response.json();
}).then(function(json) { }).then(function(json) {
var format = new _ol_format_GeoJSON_(); var format = new GeoJSON();
var features = format.readFeatures(json, {featureProjection: 'EPSG:3857'}); var features = format.readFeatures(json, {featureProjection: 'EPSG:3857'});
var parser = new jsts.io.OL3Parser(); var parser = new jsts.io.OL3Parser();
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_Stamen_ from '../src/ol/source/Stamen.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_({ var vector = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/kml/2012_Earthquakes_Mag5.kml', url: 'data/kml/2012_Earthquakes_Mag5.kml',
format: new _ol_format_KML_({ format: new KML({
extractStyles: false extractStyles: false
}) })
}), }),
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_Stamen_ from '../src/ol/source/Stamen.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_({ var vector = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/kml/timezones.kml', url: 'data/kml/timezones.kml',
format: new _ol_format_KML_({ format: new KML({
extractStyles: false extractStyles: false
}) })
}), }),
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.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_({ var vector = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/kml/2012-02-10.kml', url: 'data/kml/2012-02-10.kml',
format: new _ol_format_KML_() format: new KML()
}) })
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_layer_VectorTile_ from '../src/ol/layer/VectorTile.js';
import {get as getProjection} from '../src/ol/proj.js'; import {get as getProjection} from '../src/ol/proj.js';
import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js';
@@ -37,7 +37,7 @@ var map = new _ol_Map_({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' + attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
'© <a href="https://www.openstreetmap.org/copyright">' + '© <a href="https://www.openstreetmap.org/copyright">' +
'OpenStreetMap contributors</a>', 'OpenStreetMap contributors</a>',
format: new _ol_format_MVT_(), format: new MVT(),
tileGrid: new _ol_tilegrid_TileGrid_({ tileGrid: new _ol_tilegrid_TileGrid_({
extent: getProjection('EPSG:3857').getExtent(), extent: getProjection('EPSG:3857').getExtent(),
resolutions: resolutions, resolutions: resolutions,
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_layer_VectorTile_ from '../src/ol/layer/VectorTile.js';
import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js';
import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js';
@@ -20,7 +20,7 @@ var map = new _ol_Map_({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' + attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
'© <a href="https://www.openstreetmap.org/copyright">' + '© <a href="https://www.openstreetmap.org/copyright">' +
'OpenStreetMap contributors</a>', 'OpenStreetMap contributors</a>',
format: new _ol_format_MVT_(), format: new MVT(),
url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' + url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
'{z}/{x}/{y}.vector.pbf?access_token=' + key '{z}/{x}/{y}.vector.pbf?access_token=' + key
}), }),
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_ from '../src/ol/interaction.js';
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js';
import _ol_interaction_Select_ from '../src/ol/interaction/Select.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_({ var vector = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new _ol_format_GeoJSON_(), format: new GeoJSON(),
wrapX: false wrapX: false
}) })
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_ from '../src/ol/interaction.js';
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js'; import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.js';
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
@@ -145,7 +145,7 @@ var geojsonObject = {
}; };
var source = new _ol_source_Vector_({ var source = new _ol_source_Vector_({
features: (new _ol_format_GeoJSON_()).readFeatures(geojsonObject) features: (new GeoJSON()).readFeatures(geojsonObject)
}); });
var layer = new _ol_layer_Vector_({ var layer = new _ol_layer_Vector_({
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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 _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js';
import {fromLonLat} from '../src/ol/proj.js'; import {fromLonLat} from '../src/ol/proj.js';
import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.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_({ source: new _ol_source_VectorTile_({
attributions: '&copy; OpenStreetMap contributors, Whos On First, ' + attributions: '&copy; OpenStreetMap contributors, Whos On First, ' +
'Natural Earth, and openstreetmapdata.com', 'Natural Earth, and openstreetmapdata.com',
format: new _ol_format_TopoJSON_({ format: new TopoJSON({
layerName: 'layer', layerName: 'layer',
layers: ['water', 'roads', 'buildings'] layers: ['water', 'roads', 'buildings']
}), }),
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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 MultiPoint from '../src/ol/geom/MultiPoint.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_Vector_ from '../src/ol/source/Vector.js'; import _ol_source_Vector_ from '../src/ol/source/Vector.js';
@@ -81,7 +81,7 @@ var geojsonObject = {
}; };
var source = new _ol_source_Vector_({ var source = new _ol_source_Vector_({
features: (new _ol_format_GeoJSON_()).readFeatures(geojsonObject) features: (new GeoJSON()).readFeatures(geojsonObject)
}); });
var layer = new _ol_layer_Vector_({ var layer = new _ol_layer_Vector_({
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_events_condition_ from '../src/ol/events/condition.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_interaction_Select_ from '../src/ol/interaction/Select.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.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_({ var vector = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}) })
}); });
+2 -2
View File
@@ -1,7 +1,7 @@
import Graticule from '../src/ol/Graticule.js'; import Graticule from '../src/ol/Graticule.js';
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_proj_Projection_ from '../src/ol/proj/Projection.js'; import _ol_proj_Projection_ from '../src/ol/proj/Projection.js';
import _ol_source_Vector_ from '../src/ol/source/Vector.js'; import _ol_source_Vector_ from '../src/ol/source/Vector.js';
@@ -28,7 +28,7 @@ var map = new _ol_Map_({
new _ol_layer_Vector_({ new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/countries-110m.geojson', url: 'data/geojson/countries-110m.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}) })
}) })
], ],
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import * as _ol_extent_ from '../src/ol/extent.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
@@ -30,7 +30,7 @@ var map = new _ol_Map_({
}), new _ol_layer_Vector_({ }), new _ol_layer_Vector_({
declutter: true, declutter: true,
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
format: new _ol_format_GeoJSON_(), format: new GeoJSON(),
url: 'data/geojson/vienna-streets.geojson' url: 'data/geojson/vienna-streets.geojson'
}), }),
style: function(feature) { style: function(feature) {
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_TileJSON_ from '../src/ol/source/TileJSON.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_({ var vector = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/topojson/world-110m.json', 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), // don't want to render the full world polygon (stored as 'land' layer),
// which repeats all countries // which repeats all countries
layers: ['countries'] layers: ['countries']
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_ from '../src/ol/interaction.js';
import _ol_interaction_Select_ from '../src/ol/interaction/Select.js'; import _ol_interaction_Select_ from '../src/ol/interaction/Select.js';
import _ol_interaction_Translate_ from '../src/ol/interaction/Translate.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_({ var vector = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}) })
}); });
+2 -2
View File
@@ -2,7 +2,7 @@
// this example uses turf.js for which we don't have an externs file. // this example uses turf.js for which we don't have an externs file.
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import {fromLonLat} from '../src/ol/proj.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) { fetch('data/geojson/roads-seoul.geojson').then(function(response) {
return response.json(); return response.json();
}).then(function(json) { }).then(function(json) {
var format = new _ol_format_GeoJSON_(); var format = new GeoJSON();
var features = format.readFeatures(json); var features = format.readFeatures(json);
var street = features[0]; var street = features[0];
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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 _ol_interaction_ from '../src/ol/interaction.js';
import Draw from '../src/ol/interaction/Draw.js'; import Draw from '../src/ol/interaction/Draw.js';
import _ol_interaction_Modify_ from '../src/ol/interaction/Modify.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/'; 'services/PDX_Pedestrian_Districts/FeatureServer/';
var layer = '0'; var layer = '0';
var esrijsonFormat = new _ol_format_EsriJSON_(); var esrijsonFormat = new EsriJSON();
var vectorSource = new _ol_source_Vector_({ var vectorSource = new _ol_source_Vector_({
loader: function(extent, resolution, projection) { loader: function(extent, resolution, projection) {
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.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/'; 'Petroleum/KSFields/FeatureServer/';
var layer = '0'; var layer = '0';
var esrijsonFormat = new _ol_format_EsriJSON_(); var esrijsonFormat = new EsriJSON();
var styleCache = { var styleCache = {
'ABANDONED': new _ol_style_Style_({ 'ABANDONED': new _ol_style_Style_({
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import * as _ol_extent_ from '../src/ol/extent.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_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_Vector_ from '../src/ol/source/Vector.js'; import _ol_source_Vector_ from '../src/ol/source/Vector.js';
import _ol_style_Fill_ from '../src/ol/style/Fill.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_({ var vectorLayer = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}), }),
style: function(feature) { style: function(feature) {
labelStyle.getText().setText(feature.get('name')); labelStyle.getText().setText(feature.get('name'));
+4 -4
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.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_({ var vectorPolygons = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/polygon-samples.geojson', url: 'data/geojson/polygon-samples.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}), }),
style: polygonStyleFunction style: polygonStyleFunction
}); });
@@ -163,7 +163,7 @@ function lineStyleFunction(feature, resolution) {
var vectorLines = new _ol_layer_Vector_({ var vectorLines = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/line-samples.geojson', url: 'data/geojson/line-samples.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}), }),
style: lineStyleFunction style: lineStyleFunction
}); });
@@ -184,7 +184,7 @@ function pointStyleFunction(feature, resolution) {
var vectorPoints = new _ol_layer_Vector_({ var vectorPoints = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/point-samples.geojson', url: 'data/geojson/point-samples.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}), }),
style: pointStyleFunction style: pointStyleFunction
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_Vector_ from '../src/ol/source/Vector.js'; import _ol_source_Vector_ from '../src/ol/source/Vector.js';
import _ol_style_Fill_ from '../src/ol/style/Fill.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_({ var vectorLayer = new _ol_layer_Vector_({
source: new _ol_source_Vector_({ source: new _ol_source_Vector_({
url: 'data/geojson/countries.geojson', url: 'data/geojson/countries.geojson',
format: new _ol_format_GeoJSON_() format: new GeoJSON()
}), }),
style: function(feature) { style: function(feature) {
style.getText().setText(feature.get('name')); style.getText().setText(feature.get('name'));
+3 -3
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js'; import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.js';
@@ -78,13 +78,13 @@ var styles = {
}; };
var vectorSource = new _ol_source_Vector_({ var vectorSource = new _ol_source_Vector_({
format: new _ol_format_OSMXML_(), format: new OSMXML(),
loader: function(extent, resolution, projection) { loader: function(extent, resolution, projection) {
var epsg4326Extent = transformExtent(extent, projection, 'EPSG:4326'); var epsg4326Extent = transformExtent(extent, projection, 'EPSG:4326');
var client = new XMLHttpRequest(); var client = new XMLHttpRequest();
client.open('POST', 'https://overpass-api.de/api/interpreter'); client.open('POST', 'https://overpass-api.de/api/interpreter');
client.addEventListener('load', function() { client.addEventListener('load', function() {
var features = new _ol_format_OSMXML_().readFeatures(client.responseText, { var features = new OSMXML().readFeatures(client.responseText, {
featureProjection: map.getView().getProjection() featureProjection: map.getView().getProjection()
}); });
vectorSource.addFeatures(features); vectorSource.addFeatures(features);
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_layer_VectorTile_ from '../src/ol/layer/VectorTile.js';
import _ol_source_VectorTile_ from '../src/ol/source/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_({ layers: [new _ol_layer_VectorTile_({
source: new _ol_source_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' url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf'
}) })
})] })]
+4 -4
View File
@@ -1,8 +1,8 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_format_filter_ from '../src/ol/format/filter.js'; import _ol_format_filter_ from '../src/ol/format/filter.js';
import _ol_format_WFS_ from '../src/ol/format/WFS.js'; import WFS from '../src/ol/format/WFS.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js'; import _ol_source_BingMaps_ from '../src/ol/source/BingMaps.js';
@@ -40,7 +40,7 @@ var map = new _ol_Map_({
}); });
// generate a GetFeature request // generate a GetFeature request
var featureRequest = new _ol_format_WFS_().writeGetFeature({ var featureRequest = new WFS().writeGetFeature({
srsName: 'EPSG:3857', srsName: 'EPSG:3857',
featureNS: 'http://openstreemap.org', featureNS: 'http://openstreemap.org',
featurePrefix: 'osm', featurePrefix: 'osm',
@@ -59,7 +59,7 @@ fetch('https://ahocevar.com/geoserver/wfs', {
}).then(function(response) { }).then(function(response) {
return response.json(); return response.json();
}).then(function(json) { }).then(function(json) {
var features = new _ol_format_GeoJSON_().readFeatures(json); var features = new GeoJSON().readFeatures(json);
vectorSource.addFeatures(features); vectorSource.addFeatures(features);
map.getView().fit(vectorSource.getExtent()); map.getView().fit(vectorSource.getExtent());
}); });
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_loadingstrategy_ from '../src/ol/loadingstrategy.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_({ var vectorSource = new _ol_source_Vector_({
format: new _ol_format_GeoJSON_(), format: new GeoJSON(),
url: function(extent) { url: function(extent) {
return 'https://ahocevar.com/geoserver/wfs?service=WFS&' + return 'https://ahocevar.com/geoserver/wfs?service=WFS&' +
'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
+2 -2
View File
@@ -1,6 +1,6 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.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_Tile_ from '../src/ol/layer/Tile.js';
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.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 ' + '-20.170, 38.814 -35.639, 13.502 ' +
'-39.155, 10.689 -25.092))'; '-39.155, 10.689 -25.092))';
var format = new _ol_format_WKT_(); var format = new WKT();
var feature = format.readFeature(wkt, { var feature = format.readFeature(wkt, {
dataProjection: 'EPSG:4326', dataProjection: 'EPSG:4326',
+2 -2
View File
@@ -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) { fetch('data/ogcsample.xml').then(function(response) {
return response.text(); return response.text();
+83 -83
View File
@@ -5,8 +5,8 @@ import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js'; import _ol_Feature_ from '../Feature.js';
import _ol_asserts_ from '../asserts.js'; import _ol_asserts_ from '../asserts.js';
import {containsExtent} from '../extent.js'; import {containsExtent} from '../extent.js';
import _ol_format_Feature_ from '../format/Feature.js'; import FeatureFormat from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js'; import JSONFeature from '../format/JSONFeature.js';
import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryLayout from '../geom/GeometryLayout.js';
import GeometryType from '../geom/GeometryType.js'; import GeometryType from '../geom/GeometryType.js';
import LineString from '../geom/LineString.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. * @param {olx.format.EsriJSONOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_format_EsriJSON_ = function(opt_options) { var EsriJSON = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
_ol_format_JSONFeature_.call(this); JSONFeature.call(this);
/** /**
* Name of the geometry attribute for features. * 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 * @private
* @return {ol.geom.Geometry} Geometry. * @return {ol.geom.Geometry} Geometry.
*/ */
_ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) { EsriJSON.readGeometry_ = function(object, opt_options) {
if (!object) { if (!object) {
return null; return null;
} }
@@ -71,8 +71,8 @@ _ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) {
type = GeometryType.MULTI_LINE_STRING; type = GeometryType.MULTI_LINE_STRING;
} }
} else if (object.rings) { } else if (object.rings) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); var layout = EsriJSON.getGeometryLayout_(object);
var rings = _ol_format_EsriJSON_.convertRings_(object.rings, layout); var rings = EsriJSON.convertRings_(object.rings, layout);
object = /** @type {EsriJSONGeometry} */(_ol_obj_.assign({}, object)); object = /** @type {EsriJSONGeometry} */(_ol_obj_.assign({}, object));
if (rings.length === 1) { if (rings.length === 1) {
type = GeometryType.POLYGON; type = GeometryType.POLYGON;
@@ -82,9 +82,9 @@ _ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) {
object.rings = rings; object.rings = rings;
} }
} }
var geometryReader = _ol_format_EsriJSON_.GEOMETRY_READERS_[type]; var geometryReader = EsriJSON.GEOMETRY_READERS_[type];
return ( return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions( /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions(
geometryReader(object), false, opt_options) geometryReader(object), false, opt_options)
); );
}; };
@@ -100,7 +100,7 @@ _ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) {
* @private * @private
* @return {Array.<!Array.<!Array.<number>>>} Transformed rings. * @return {Array.<!Array.<!Array.<number>>>} Transformed rings.
*/ */
_ol_format_EsriJSON_.convertRings_ = function(rings, layout) { EsriJSON.convertRings_ = function(rings, layout) {
var flatRing = []; var flatRing = [];
var outerRings = []; var outerRings = [];
var holes = []; var holes = [];
@@ -149,7 +149,7 @@ _ol_format_EsriJSON_.convertRings_ = function(rings, layout) {
* @private * @private
* @return {ol.geom.Geometry} Point. * @return {ol.geom.Geometry} Point.
*/ */
_ol_format_EsriJSON_.readPointGeometry_ = function(object) { EsriJSON.readPointGeometry_ = function(object) {
var point; var point;
if (object.m !== undefined && object.z !== undefined) { if (object.m !== undefined && object.z !== undefined) {
point = new Point([object.x, object.y, object.z, object.m], point = new Point([object.x, object.y, object.z, object.m],
@@ -172,8 +172,8 @@ _ol_format_EsriJSON_.readPointGeometry_ = function(object) {
* @private * @private
* @return {ol.geom.Geometry} LineString. * @return {ol.geom.Geometry} LineString.
*/ */
_ol_format_EsriJSON_.readLineStringGeometry_ = function(object) { EsriJSON.readLineStringGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); var layout = EsriJSON.getGeometryLayout_(object);
return new LineString(object.paths[0], layout); return new LineString(object.paths[0], layout);
}; };
@@ -183,8 +183,8 @@ _ol_format_EsriJSON_.readLineStringGeometry_ = function(object) {
* @private * @private
* @return {ol.geom.Geometry} MultiLineString. * @return {ol.geom.Geometry} MultiLineString.
*/ */
_ol_format_EsriJSON_.readMultiLineStringGeometry_ = function(object) { EsriJSON.readMultiLineStringGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); var layout = EsriJSON.getGeometryLayout_(object);
return new MultiLineString(object.paths, layout); return new MultiLineString(object.paths, layout);
}; };
@@ -194,7 +194,7 @@ _ol_format_EsriJSON_.readMultiLineStringGeometry_ = function(object) {
* @private * @private
* @return {ol.geom.GeometryLayout} The geometry layout to use. * @return {ol.geom.GeometryLayout} The geometry layout to use.
*/ */
_ol_format_EsriJSON_.getGeometryLayout_ = function(object) { EsriJSON.getGeometryLayout_ = function(object) {
var layout = GeometryLayout.XY; var layout = GeometryLayout.XY;
if (object.hasZ === true && object.hasM === true) { if (object.hasZ === true && object.hasM === true) {
layout = GeometryLayout.XYZM; layout = GeometryLayout.XYZM;
@@ -212,8 +212,8 @@ _ol_format_EsriJSON_.getGeometryLayout_ = function(object) {
* @private * @private
* @return {ol.geom.Geometry} MultiPoint. * @return {ol.geom.Geometry} MultiPoint.
*/ */
_ol_format_EsriJSON_.readMultiPointGeometry_ = function(object) { EsriJSON.readMultiPointGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); var layout = EsriJSON.getGeometryLayout_(object);
return new MultiPoint(object.points, layout); return new MultiPoint(object.points, layout);
}; };
@@ -223,8 +223,8 @@ _ol_format_EsriJSON_.readMultiPointGeometry_ = function(object) {
* @private * @private
* @return {ol.geom.Geometry} MultiPolygon. * @return {ol.geom.Geometry} MultiPolygon.
*/ */
_ol_format_EsriJSON_.readMultiPolygonGeometry_ = function(object) { EsriJSON.readMultiPolygonGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); var layout = EsriJSON.getGeometryLayout_(object);
return new MultiPolygon( return new MultiPolygon(
/** @type {Array.<Array.<Array.<Array.<number>>>>} */(object.rings), /** @type {Array.<Array.<Array.<Array.<number>>>>} */(object.rings),
layout); layout);
@@ -236,8 +236,8 @@ _ol_format_EsriJSON_.readMultiPolygonGeometry_ = function(object) {
* @private * @private
* @return {ol.geom.Geometry} Polygon. * @return {ol.geom.Geometry} Polygon.
*/ */
_ol_format_EsriJSON_.readPolygonGeometry_ = function(object) { EsriJSON.readPolygonGeometry_ = function(object) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object); var layout = EsriJSON.getGeometryLayout_(object);
return new Polygon(object.rings, layout); return new Polygon(object.rings, layout);
}; };
@@ -248,7 +248,7 @@ _ol_format_EsriJSON_.readPolygonGeometry_ = function(object) {
* @private * @private
* @return {EsriJSONGeometry} EsriJSON geometry. * @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 coordinates = /** @type {ol.geom.Point} */ (geometry).getCoordinates();
var esriJSON; var esriJSON;
var layout = /** @type {ol.geom.Point} */ (geometry).getLayout(); var layout = /** @type {ol.geom.Point} */ (geometry).getLayout();
@@ -288,7 +288,7 @@ _ol_format_EsriJSON_.writePointGeometry_ = function(geometry, opt_options) {
* @private * @private
* @return {Object} Object with boolean hasZ and hasM keys. * @return {Object} Object with boolean hasZ and hasM keys.
*/ */
_ol_format_EsriJSON_.getHasZM_ = function(geometry) { EsriJSON.getHasZM_ = function(geometry) {
var layout = geometry.getLayout(); var layout = geometry.getLayout();
return { return {
hasZ: (layout === GeometryLayout.XYZ || hasZ: (layout === GeometryLayout.XYZ ||
@@ -305,8 +305,8 @@ _ol_format_EsriJSON_.getHasZM_ = function(geometry) {
* @private * @private
* @return {EsriJSONPolyline} EsriJSON geometry. * @return {EsriJSONPolyline} EsriJSON geometry.
*/ */
_ol_format_EsriJSON_.writeLineStringGeometry_ = function(geometry, opt_options) { EsriJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.LineString} */(geometry)); var hasZM = EsriJSON.getHasZM_(/** @type {ol.geom.LineString} */(geometry));
return /** @type {EsriJSONPolyline} */ ({ return /** @type {EsriJSONPolyline} */ ({
hasZ: hasZM.hasZ, hasZ: hasZM.hasZ,
hasM: hasZM.hasM, hasM: hasZM.hasM,
@@ -323,9 +323,9 @@ _ol_format_EsriJSON_.writeLineStringGeometry_ = function(geometry, opt_options)
* @private * @private
* @return {EsriJSONPolygon} EsriJSON geometry. * @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 // 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} */ ({ return /** @type {EsriJSONPolygon} */ ({
hasZ: hasZM.hasZ, hasZ: hasZM.hasZ,
hasM: hasZM.hasM, hasM: hasZM.hasM,
@@ -340,8 +340,8 @@ _ol_format_EsriJSON_.writePolygonGeometry_ = function(geometry, opt_options) {
* @private * @private
* @return {EsriJSONPolyline} EsriJSON geometry. * @return {EsriJSONPolyline} EsriJSON geometry.
*/ */
_ol_format_EsriJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_options) { EsriJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiLineString} */(geometry)); var hasZM = EsriJSON.getHasZM_(/** @type {ol.geom.MultiLineString} */(geometry));
return /** @type {EsriJSONPolyline} */ ({ return /** @type {EsriJSONPolyline} */ ({
hasZ: hasZM.hasZ, hasZ: hasZM.hasZ,
hasM: hasZM.hasM, hasM: hasZM.hasM,
@@ -356,8 +356,8 @@ _ol_format_EsriJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_opti
* @private * @private
* @return {EsriJSONMultipoint} EsriJSON geometry. * @return {EsriJSONMultipoint} EsriJSON geometry.
*/ */
_ol_format_EsriJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) { EsriJSON.writeMultiPointGeometry_ = function(geometry, opt_options) {
var hasZM = _ol_format_EsriJSON_.getHasZM_(/** @type {ol.geom.MultiPoint} */(geometry)); var hasZM = EsriJSON.getHasZM_(/** @type {ol.geom.MultiPoint} */(geometry));
return /** @type {EsriJSONMultipoint} */ ({ return /** @type {EsriJSONMultipoint} */ ({
hasZ: hasZM.hasZ, hasZ: hasZM.hasZ,
hasM: hasZM.hasM, hasM: hasZM.hasM,
@@ -372,9 +372,9 @@ _ol_format_EsriJSON_.writeMultiPointGeometry_ = function(geometry, opt_options)
* @private * @private
* @return {EsriJSONPolygon} EsriJSON geometry. * @return {EsriJSONPolygon} EsriJSON geometry.
*/ */
_ol_format_EsriJSON_.writeMultiPolygonGeometry_ = function(geometry, EsriJSON.writeMultiPolygonGeometry_ = function(geometry,
opt_options) { 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 coordinates = /** @type {ol.geom.MultiPolygon} */ (geometry).getCoordinates(false);
var output = []; var output = [];
for (var i = 0; i < coordinates.length; i++) { for (var i = 0; i < coordinates.length; i++) {
@@ -395,19 +395,19 @@ _ol_format_EsriJSON_.writeMultiPolygonGeometry_ = function(geometry,
* @private * @private
* @type {Object.<ol.geom.GeometryType, function(EsriJSONGeometry): ol.geom.Geometry>} * @type {Object.<ol.geom.GeometryType, function(EsriJSONGeometry): ol.geom.Geometry>}
*/ */
_ol_format_EsriJSON_.GEOMETRY_READERS_ = {}; EsriJSON.GEOMETRY_READERS_ = {};
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.POINT] = EsriJSON.GEOMETRY_READERS_[GeometryType.POINT] =
_ol_format_EsriJSON_.readPointGeometry_; EsriJSON.readPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.LINE_STRING] = EsriJSON.GEOMETRY_READERS_[GeometryType.LINE_STRING] =
_ol_format_EsriJSON_.readLineStringGeometry_; EsriJSON.readLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.POLYGON] = EsriJSON.GEOMETRY_READERS_[GeometryType.POLYGON] =
_ol_format_EsriJSON_.readPolygonGeometry_; EsriJSON.readPolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_POINT] = EsriJSON.GEOMETRY_READERS_[GeometryType.MULTI_POINT] =
_ol_format_EsriJSON_.readMultiPointGeometry_; EsriJSON.readMultiPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_LINE_STRING] = EsriJSON.GEOMETRY_READERS_[GeometryType.MULTI_LINE_STRING] =
_ol_format_EsriJSON_.readMultiLineStringGeometry_; EsriJSON.readMultiLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_POLYGON] = EsriJSON.GEOMETRY_READERS_[GeometryType.MULTI_POLYGON] =
_ol_format_EsriJSON_.readMultiPolygonGeometry_; EsriJSON.readMultiPolygonGeometry_;
/** /**
@@ -415,19 +415,19 @@ _ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_POLYGON] =
* @private * @private
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (EsriJSONGeometry)>} * @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (EsriJSONGeometry)>}
*/ */
_ol_format_EsriJSON_.GEOMETRY_WRITERS_ = {}; EsriJSON.GEOMETRY_WRITERS_ = {};
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.POINT] = EsriJSON.GEOMETRY_WRITERS_[GeometryType.POINT] =
_ol_format_EsriJSON_.writePointGeometry_; EsriJSON.writePointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.LINE_STRING] = EsriJSON.GEOMETRY_WRITERS_[GeometryType.LINE_STRING] =
_ol_format_EsriJSON_.writeLineStringGeometry_; EsriJSON.writeLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.POLYGON] = EsriJSON.GEOMETRY_WRITERS_[GeometryType.POLYGON] =
_ol_format_EsriJSON_.writePolygonGeometry_; EsriJSON.writePolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_POINT] = EsriJSON.GEOMETRY_WRITERS_[GeometryType.MULTI_POINT] =
_ol_format_EsriJSON_.writeMultiPointGeometry_; EsriJSON.writeMultiPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_LINE_STRING] = EsriJSON.GEOMETRY_WRITERS_[GeometryType.MULTI_LINE_STRING] =
_ol_format_EsriJSON_.writeMultiLineStringGeometry_; EsriJSON.writeMultiLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_POLYGON] = EsriJSON.GEOMETRY_WRITERS_[GeometryType.MULTI_POLYGON] =
_ol_format_EsriJSON_.writeMultiPolygonGeometry_; EsriJSON.writeMultiPolygonGeometry_;
/** /**
@@ -440,7 +440,7 @@ _ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_POLYGON] =
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
* @api * @api
*/ */
_ol_format_EsriJSON_.prototype.readFeature; EsriJSON.prototype.readFeature;
/** /**
@@ -453,16 +453,16 @@ _ol_format_EsriJSON_.prototype.readFeature;
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_EsriJSON_.prototype.readFeatures; EsriJSON.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_EsriJSON_.prototype.readFeatureFromObject = function( EsriJSON.prototype.readFeatureFromObject = function(
object, opt_options) { object, opt_options) {
var esriJSONFeature = /** @type {EsriJSONFeature} */ (object); var esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
var geometry = _ol_format_EsriJSON_.readGeometry_(esriJSONFeature.geometry, var geometry = EsriJSON.readGeometry_(esriJSONFeature.geometry,
opt_options); opt_options);
var feature = new _ol_Feature_(); var feature = new _ol_Feature_();
if (this.geometryName_) { if (this.geometryName_) {
@@ -484,7 +484,7 @@ _ol_format_EsriJSON_.prototype.readFeatureFromObject = function(
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_EsriJSON_.prototype.readFeaturesFromObject = function( EsriJSON.prototype.readFeaturesFromObject = function(
object, opt_options) { object, opt_options) {
var esriJSONObject = /** @type {EsriJSONObject} */ (object); var esriJSONObject = /** @type {EsriJSONObject} */ (object);
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
@@ -516,15 +516,15 @@ _ol_format_EsriJSON_.prototype.readFeaturesFromObject = function(
* @return {ol.geom.Geometry} Geometry. * @return {ol.geom.Geometry} Geometry.
* @api * @api
*/ */
_ol_format_EsriJSON_.prototype.readGeometry; EsriJSON.prototype.readGeometry;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_EsriJSON_.prototype.readGeometryFromObject = function( EsriJSON.prototype.readGeometryFromObject = function(
object, opt_options) { object, opt_options) {
return _ol_format_EsriJSON_.readGeometry_( return EsriJSON.readGeometry_(
/** @type {EsriJSONGeometry} */(object), opt_options); /** @type {EsriJSONGeometry} */(object), opt_options);
}; };
@@ -537,13 +537,13 @@ _ol_format_EsriJSON_.prototype.readGeometryFromObject = function(
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
* @api * @api
*/ */
_ol_format_EsriJSON_.prototype.readProjection; EsriJSON.prototype.readProjection;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_EsriJSON_.prototype.readProjectionFromObject = function(object) { EsriJSON.prototype.readProjectionFromObject = function(object) {
var esriJSONObject = /** @type {EsriJSONObject} */ (object); var esriJSONObject = /** @type {EsriJSONObject} */ (object);
if (esriJSONObject.spatialReference && esriJSONObject.spatialReference.wkid) { if (esriJSONObject.spatialReference && esriJSONObject.spatialReference.wkid) {
var crs = esriJSONObject.spatialReference.wkid; var crs = esriJSONObject.spatialReference.wkid;
@@ -560,10 +560,10 @@ _ol_format_EsriJSON_.prototype.readProjectionFromObject = function(object) {
* @private * @private
* @return {EsriJSONGeometry} EsriJSON geometry. * @return {EsriJSONGeometry} EsriJSON geometry.
*/ */
_ol_format_EsriJSON_.writeGeometry_ = function(geometry, opt_options) { EsriJSON.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = _ol_format_EsriJSON_.GEOMETRY_WRITERS_[geometry.getType()]; var geometryWriter = EsriJSON.GEOMETRY_WRITERS_[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */( return geometryWriter(/** @type {ol.geom.Geometry} */(
_ol_format_Feature_.transformWithOptions(geometry, true, opt_options)), FeatureFormat.transformWithOptions(geometry, true, opt_options)),
opt_options); opt_options);
}; };
@@ -577,7 +577,7 @@ _ol_format_EsriJSON_.writeGeometry_ = function(geometry, opt_options) {
* @return {string} EsriJSON. * @return {string} EsriJSON.
* @api * @api
*/ */
_ol_format_EsriJSON_.prototype.writeGeometry; EsriJSON.prototype.writeGeometry;
/** /**
@@ -589,9 +589,9 @@ _ol_format_EsriJSON_.prototype.writeGeometry;
* @override * @override
* @api * @api
*/ */
_ol_format_EsriJSON_.prototype.writeGeometryObject = function(geometry, EsriJSON.prototype.writeGeometryObject = function(geometry,
opt_options) { opt_options) {
return _ol_format_EsriJSON_.writeGeometry_(geometry, return EsriJSON.writeGeometry_(geometry,
this.adaptOptions(opt_options)); this.adaptOptions(opt_options));
}; };
@@ -605,7 +605,7 @@ _ol_format_EsriJSON_.prototype.writeGeometryObject = function(geometry,
* @return {string} EsriJSON. * @return {string} EsriJSON.
* @api * @api
*/ */
_ol_format_EsriJSON_.prototype.writeFeature; EsriJSON.prototype.writeFeature;
/** /**
@@ -617,14 +617,14 @@ _ol_format_EsriJSON_.prototype.writeFeature;
* @override * @override
* @api * @api
*/ */
_ol_format_EsriJSON_.prototype.writeFeatureObject = function( EsriJSON.prototype.writeFeatureObject = function(
feature, opt_options) { feature, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
var object = {}; var object = {};
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
object['geometry'] = object['geometry'] =
_ol_format_EsriJSON_.writeGeometry_(geometry, opt_options); EsriJSON.writeGeometry_(geometry, opt_options);
if (opt_options && opt_options.featureProjection) { if (opt_options && opt_options.featureProjection) {
object['geometry']['spatialReference'] = /** @type {EsriJSONCRS} */({ object['geometry']['spatialReference'] = /** @type {EsriJSONCRS} */({
wkid: getProjection(opt_options.featureProjection).getCode().split(':').pop() wkid: getProjection(opt_options.featureProjection).getCode().split(':').pop()
@@ -651,7 +651,7 @@ _ol_format_EsriJSON_.prototype.writeFeatureObject = function(
* @return {string} EsriJSON. * @return {string} EsriJSON.
* @api * @api
*/ */
_ol_format_EsriJSON_.prototype.writeFeatures; EsriJSON.prototype.writeFeatures;
/** /**
@@ -663,7 +663,7 @@ _ol_format_EsriJSON_.prototype.writeFeatures;
* @override * @override
* @api * @api
*/ */
_ol_format_EsriJSON_.prototype.writeFeaturesObject = function(features, opt_options) { EsriJSON.prototype.writeFeaturesObject = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
var objects = []; var objects = [];
var i, ii; var i, ii;
@@ -674,4 +674,4 @@ _ol_format_EsriJSON_.prototype.writeFeaturesObject = function(features, opt_opti
'features': objects 'features': objects
}); });
}; };
export default _ol_format_EsriJSON_; export default EsriJSON;
+14 -14
View File
@@ -18,7 +18,7 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten
* @abstract * @abstract
* @api * @api
*/ */
var _ol_format_Feature_ = function() { var FeatureFormat = function() {
/** /**
* @protected * @protected
@@ -42,7 +42,7 @@ var _ol_format_Feature_ = function() {
* @return {olx.format.ReadOptions|undefined} Options. * @return {olx.format.ReadOptions|undefined} Options.
* @protected * @protected
*/ */
_ol_format_Feature_.prototype.getReadOptions = function(source, opt_options) { FeatureFormat.prototype.getReadOptions = function(source, opt_options) {
var options; var options;
if (opt_options) { if (opt_options) {
options = { options = {
@@ -64,7 +64,7 @@ _ol_format_Feature_.prototype.getReadOptions = function(source, opt_options) {
* @return {olx.format.WriteOptions|olx.format.ReadOptions|undefined} * @return {olx.format.WriteOptions|olx.format.ReadOptions|undefined}
* Updated options. * Updated options.
*/ */
_ol_format_Feature_.prototype.adaptOptions = function(options) { FeatureFormat.prototype.adaptOptions = function(options) {
return _ol_obj_.assign({ return _ol_obj_.assign({
dataProjection: this.defaultDataProjection, dataProjection: this.defaultDataProjection,
featureProjection: this.defaultFeatureProjection 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. * Get the extent from the source of the last {@link readFeatures} call.
* @return {ol.Extent} Tile extent. * @return {ol.Extent} Tile extent.
*/ */
_ol_format_Feature_.prototype.getLastExtent = function() { FeatureFormat.prototype.getLastExtent = function() {
return null; return null;
}; };
@@ -85,7 +85,7 @@ _ol_format_Feature_.prototype.getLastExtent = function() {
* @abstract * @abstract
* @return {ol.format.FormatType} Format. * @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. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature} Feature. * @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. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} 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. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.geom.Geometry} Geometry. * @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. * @param {Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection. * @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. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} Result. * @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. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} Result. * @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. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} Result. * @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. * @return {ol.geom.Geometry|ol.Extent} Transformed geometry.
* @protected * @protected
*/ */
_ol_format_Feature_.transformWithOptions = function( FeatureFormat.transformWithOptions = function(
geometry, write, opt_options) { geometry, write, opt_options) {
var featureProjection = opt_options ? var featureProjection = opt_options ?
getProjection(opt_options.featureProjection) : null; getProjection(opt_options.featureProjection) : null;
@@ -219,4 +219,4 @@ _ol_format_Feature_.transformWithOptions = function(
} }
return transformed; return transformed;
}; };
export default _ol_format_Feature_; export default FeatureFormat;
+2 -2
View File
@@ -1,7 +1,7 @@
/** /**
* @module ol/format/GML * @module ol/format/GML
*/ */
import _ol_format_GML3_ from '../format/GML3.js'; import GML3 from '../format/GML3.js';
/** /**
* @classdesc * @classdesc
@@ -15,7 +15,7 @@ import _ol_format_GML3_ from '../format/GML3.js';
* @extends {ol.format.GMLBase} * @extends {ol.format.GMLBase}
* @api * @api
*/ */
var _ol_format_GML_ = _ol_format_GML3_; var _ol_format_GML_ = GML3;
/** /**
+92 -92
View File
@@ -3,9 +3,9 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import {createOrUpdate} from '../extent.js'; import {createOrUpdate} from '../extent.js';
import _ol_format_Feature_ from '../format/Feature.js'; import FeatureFormat from '../format/Feature.js';
import _ol_format_GMLBase_ from '../format/GMLBase.js'; import GMLBase from '../format/GMLBase.js';
import _ol_format_XSD_ from '../format/XSD.js'; import XSD from '../format/XSD.js';
import Geometry from '../geom/Geometry.js'; import Geometry from '../geom/Geometry.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
import {get as getProjection, transformExtent} from '../proj.js'; import {get as getProjection, transformExtent} from '../proj.js';
@@ -21,25 +21,25 @@ import _ol_xml_ from '../xml.js';
* @extends {ol.format.GMLBase} * @extends {ol.format.GMLBase}
* @api * @api
*/ */
var _ol_format_GML2_ = function(opt_options) { var GML2 = function(opt_options) {
var options = /** @type {olx.format.GMLOptions} */ var options = /** @type {olx.format.GMLOptions} */
(opt_options ? opt_options : {}); (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'] = 'featureMember'] =
_ol_xml_.makeArrayPusher(_ol_format_GMLBase_.prototype.readFeaturesInternal); _ol_xml_.makeArrayPusher(GMLBase.prototype.readFeaturesInternal);
/** /**
* @inheritDoc * @inheritDoc
*/ */
this.schemaLocation = options.schemaLocation ? 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} * @type {string}
* @private * @private
*/ */
_ol_format_GML2_.schemaLocation_ = _ol_format_GMLBase_.GMLNS + GML2.schemaLocation_ = GMLBase.GMLNS +
' http://schemas.opengis.net/gml/2.1.2/feature.xsd'; ' http://schemas.opengis.net/gml/2.1.2/feature.xsd';
@@ -57,7 +57,7 @@ _ol_format_GML2_.schemaLocation_ = _ol_format_GMLBase_.GMLNS +
* @private * @private
* @return {Array.<number>|undefined} Flat coordinates. * @return {Array.<number>|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 s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]); var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]);
var containerSrs = context['srsName']; var containerSrs = context['srsName'];
@@ -92,7 +92,7 @@ _ol_format_GML2_.prototype.readFlatCoordinates_ = function(node, objectStack) {
* @private * @private
* @return {ol.Extent|undefined} Envelope. * @return {ol.Extent|undefined} Envelope.
*/ */
_ol_format_GML2_.prototype.readBox_ = function(node, objectStack) { GML2.prototype.readBox_ = function(node, objectStack) {
/** @type {Array.<number>} */ /** @type {Array.<number>} */
var flatCoordinates = _ol_xml_.pushParseAndPop([null], var flatCoordinates = _ol_xml_.pushParseAndPop([null],
this.BOX_PARSERS_, node, objectStack, this); this.BOX_PARSERS_, node, objectStack, this);
@@ -107,7 +107,7 @@ _ol_format_GML2_.prototype.readBox_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.innerBoundaryIsParser_ = function(node, objectStack) { GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
/** @type {Array.<number>|undefined} */ /** @type {Array.<number>|undefined} */
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this); this.RING_PARSERS, node, objectStack, this);
@@ -124,7 +124,7 @@ _ol_format_GML2_.prototype.innerBoundaryIsParser_ = function(node, objectStack)
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.outerBoundaryIsParser_ = function(node, objectStack) { GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
/** @type {Array.<number>|undefined} */ /** @type {Array.<number>|undefined} */
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this); this.RING_PARSERS, node, objectStack, this);
@@ -141,10 +141,10 @@ _ol_format_GML2_.prototype.outerBoundaryIsParser_ = function(node, objectStack)
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML2_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'coordinates': _ol_xml_.makeReplacer( '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.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML2_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'innerBoundaryIs': _ol_format_GML2_.prototype.innerBoundaryIsParser_, 'innerBoundaryIs': GML2.prototype.innerBoundaryIsParser_,
'outerBoundaryIs': _ol_format_GML2_.prototype.outerBoundaryIsParser_ 'outerBoundaryIs': GML2.prototype.outerBoundaryIsParser_
} }
}; };
@@ -167,10 +167,10 @@ _ol_format_GML2_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML2_.prototype.BOX_PARSERS_ = { GML2.prototype.BOX_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'coordinates': _ol_xml_.makeArrayPusher( 'coordinates': _ol_xml_.makeArrayPusher(
_ol_format_GML2_.prototype.readFlatCoordinates_) GML2.prototype.readFlatCoordinates_)
} }
}; };
@@ -180,21 +180,21 @@ _ol_format_GML2_.prototype.BOX_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML2_.prototype.GEOMETRY_PARSERS_ = { GML2.prototype.GEOMETRY_PARSERS_ = {
'http://www.opengis.net/gml': { '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( 'MultiPoint': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiPoint), GMLBase.prototype.readMultiPoint),
'LineString': _ol_xml_.makeReplacer( 'LineString': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readLineString), GMLBase.prototype.readLineString),
'MultiLineString': _ol_xml_.makeReplacer( 'MultiLineString': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiLineString), GMLBase.prototype.readMultiLineString),
'LinearRing': _ol_xml_.makeReplacer( 'LinearRing': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readLinearRing), GMLBase.prototype.readLinearRing),
'Polygon': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPolygon), 'Polygon': _ol_xml_.makeReplacer(GMLBase.prototype.readPolygon),
'MultiPolygon': _ol_xml_.makeReplacer( 'MultiPolygon': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiPolygon), GMLBase.prototype.readMultiPolygon),
'Box': _ol_xml_.makeReplacer(_ol_format_GML2_.prototype.readBox_) 'Box': _ol_xml_.makeReplacer(GML2.prototype.readBox_)
} }
}; };
@@ -207,7 +207,7 @@ _ol_format_GML2_.prototype.GEOMETRY_PARSERS_ = {
* @return {Node|undefined} Node. * @return {Node|undefined} Node.
* @private * @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 context = objectStack[objectStack.length - 1];
var multiSurface = context['multiSurface']; var multiSurface = context['multiSurface'];
var surface = context['surface']; var surface = context['surface'];
@@ -235,7 +235,7 @@ _ol_format_GML2_.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack,
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack. * @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(); var fid = feature.getId();
if (fid) { if (fid) {
node.setAttribute('fid', fid); node.setAttribute('fid', fid);
@@ -262,7 +262,7 @@ _ol_format_GML2_.prototype.writeFeatureElement = function(node, feature, objectS
} else { } else {
if (!(key in context.serializers[featureNS])) { if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender( 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 {ol.geom.Geometry|ol.Extent} geometry Geometry.
* @param {Array.<*>} objectStack Node stack. * @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 context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
var item = _ol_obj_.assign({}, context); var item = _ol_obj_.assign({}, context);
item.node = node; item.node = node;
@@ -296,10 +296,10 @@ _ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objec
} }
} else { } else {
value = 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} */ _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), _ol_format_GML2_.GEOMETRY_SERIALIZERS_, (item), GML2.GEOMETRY_SERIALIZERS_,
this.GEOMETRY_NODE_FACTORY_, [value], this.GEOMETRY_NODE_FACTORY_, [value],
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -311,7 +311,7 @@ _ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objec
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) { GML2.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
if (node.nodeName !== 'LineStringSegment' && srsName) { if (node.nodeName !== 'LineStringSegment' && srsName) {
@@ -336,7 +336,7 @@ _ol_format_GML2_.prototype.writeCurveOrLineString_ = function(node, geometry, ob
* @returns {Node} coordinates node. * @returns {Node} coordinates node.
* @private * @private
*/ */
_ol_format_GML2_.prototype.createCoordinatesNode_ = function(namespaceURI) { GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
var coordinates = _ol_xml_.createElementNS(namespaceURI, 'coordinates'); var coordinates = _ol_xml_.createElementNS(namespaceURI, 'coordinates');
coordinates.setAttribute('decimal', '.'); coordinates.setAttribute('decimal', '.');
coordinates.setAttribute('cs', ','); coordinates.setAttribute('cs', ',');
@@ -352,7 +352,7 @@ _ol_format_GML2_.prototype.createCoordinatesNode_ = function(namespaceURI) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeCoordinates_ = function(node, value, objectStack) { GML2.prototype.writeCoordinates_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -365,7 +365,7 @@ _ol_format_GML2_.prototype.writeCoordinates_ = function(node, value, objectStack
point = points[i]; point = points[i];
parts[i] = this.getCoords_(point, srsName, hasZ); 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeCurveSegments_ = function(node, line, objectStack) { GML2.prototype.writeCurveSegments_ = function(node, line, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI, var child = _ol_xml_.createElementNS(node.namespaceURI,
'LineStringSegment'); 'LineStringSegment');
node.appendChild(child); node.appendChild(child);
@@ -389,7 +389,7 @@ _ol_format_GML2_.prototype.writeCurveSegments_ = function(node, line, objectStac
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) { GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -400,7 +400,7 @@ _ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, obj
var rings = geometry.getLinearRings(); var rings = geometry.getLinearRings();
_ol_xml_.pushSerializeAndPop( _ol_xml_.pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName}, {node: node, hasZ: hasZ, srsName: srsName},
_ol_format_GML2_.RING_SERIALIZERS_, GML2.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_, this.RING_NODE_FACTORY_,
rings, objectStack, undefined, this); rings, objectStack, undefined, this);
} else if (node.nodeName === 'Surface') { } else if (node.nodeName === 'Surface') {
@@ -419,7 +419,7 @@ _ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, obj
* @return {Node} Node. * @return {Node} Node.
* @private * @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 context = objectStack[objectStack.length - 1];
var parentNode = context.node; var parentNode = context.node;
var exteriorWritten = context['exteriorWritten']; var exteriorWritten = context['exteriorWritten'];
@@ -437,7 +437,7 @@ _ol_format_GML2_.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @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'); var child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch');
node.appendChild(child); node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack); this.writeSurfaceOrPolygon_(child, polygon, objectStack);
@@ -450,7 +450,7 @@ _ol_format_GML2_.prototype.writeSurfacePatches_ = function(node, polygon, object
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @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'); var linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing');
node.appendChild(linearRing); node.appendChild(linearRing);
this.writeLinearRing_(linearRing, ring, objectStack); this.writeLinearRing_(linearRing, ring, objectStack);
@@ -464,7 +464,7 @@ _ol_format_GML2_.prototype.writeRing_ = function(node, ring, objectStack) {
* @return {string} The coords string. * @return {string} The coords string.
* @private * @private
*/ */
_ol_format_GML2_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) { GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu'; var axisOrientation = 'enu';
if (opt_srsName) { if (opt_srsName) {
axisOrientation = getProjection(opt_srsName).getAxisOrientation(); 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) { GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -498,7 +498,7 @@ _ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometr
} }
var lines = geometry.getLineStrings(); var lines = geometry.getLineStrings();
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve}, _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, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -510,7 +510,7 @@ _ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometr
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writePoint_ = function(node, geometry, objectStack) { GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -521,7 +521,7 @@ _ol_format_GML2_.prototype.writePoint_ = function(node, geometry, objectStack) {
node.appendChild(coordinates); node.appendChild(coordinates);
var point = geometry.getCoordinates(); var point = geometry.getCoordinates();
var coord = this.getCoords_(point, srsName, hasZ); 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry, GML2.prototype.writeMultiPoint_ = function(node, geometry,
objectStack) { objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
@@ -541,7 +541,7 @@ _ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry,
} }
var points = geometry.getPoints(); var points = geometry.getPoints();
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName}, _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
_ol_format_GML2_.POINTMEMBER_SERIALIZERS_, GML2.POINTMEMBER_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('pointMember'), points, _ol_xml_.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -553,7 +553,7 @@ _ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry,
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @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'); var child = _ol_xml_.createElementNS(node.namespaceURI, 'Point');
node.appendChild(child); node.appendChild(child);
this.writePoint_(child, point, objectStack); this.writePoint_(child, point, objectStack);
@@ -566,7 +566,7 @@ _ol_format_GML2_.prototype.writePointMember_ = function(node, point, objectStack
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @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); var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
if (child) { if (child) {
node.appendChild(child); node.appendChild(child);
@@ -581,7 +581,7 @@ _ol_format_GML2_.prototype.writeLineStringOrCurveMember_ = function(node, line,
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeLinearRing_ = function(node, geometry, objectStack) { GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
if (srsName) { if (srsName) {
@@ -599,7 +599,7 @@ _ol_format_GML2_.prototype.writeLinearRing_ = function(node, geometry, objectSta
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) { GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -609,7 +609,7 @@ _ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry
} }
var polygons = geometry.getPolygons(); var polygons = geometry.getPolygons();
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface}, _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, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -621,7 +621,7 @@ _ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) { GML2.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_( var child = this.GEOMETRY_NODE_FACTORY_(
polygon, objectStack); polygon, objectStack);
if (child) { if (child) {
@@ -637,7 +637,7 @@ _ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) { GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
if (srsName) { if (srsName) {
@@ -646,7 +646,7 @@ _ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) {
var keys = ['lowerCorner', 'upperCorner']; var keys = ['lowerCorner', 'upperCorner'];
var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]]; var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node}), _ol_format_GML2_.ENVELOPE_SERIALIZERS_, ({node: node}), GML2.ENVELOPE_SERIALIZERS_,
_ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values, values,
objectStack, keys, this); objectStack, keys, this);
@@ -658,31 +658,31 @@ _ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.GEOMETRY_SERIALIZERS_ = { GML2.GEOMETRY_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Curve': _ol_xml_.makeChildAppender( 'Curve': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeCurveOrLineString_), GML2.prototype.writeCurveOrLineString_),
'MultiCurve': _ol_xml_.makeChildAppender( 'MultiCurve': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_), GML2.prototype.writeMultiCurveOrLineString_),
'Point': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writePoint_), 'Point': _ol_xml_.makeChildAppender(GML2.prototype.writePoint_),
'MultiPoint': _ol_xml_.makeChildAppender( 'MultiPoint': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiPoint_), GML2.prototype.writeMultiPoint_),
'LineString': _ol_xml_.makeChildAppender( 'LineString': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeCurveOrLineString_), GML2.prototype.writeCurveOrLineString_),
'MultiLineString': _ol_xml_.makeChildAppender( 'MultiLineString': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_), GML2.prototype.writeMultiCurveOrLineString_),
'LinearRing': _ol_xml_.makeChildAppender( 'LinearRing': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLinearRing_), GML2.prototype.writeLinearRing_),
'Polygon': _ol_xml_.makeChildAppender( 'Polygon': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_), GML2.prototype.writeSurfaceOrPolygon_),
'MultiPolygon': _ol_xml_.makeChildAppender( 'MultiPolygon': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_), GML2.prototype.writeMultiSurfaceOrPolygon_),
'Surface': _ol_xml_.makeChildAppender( 'Surface': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_), GML2.prototype.writeSurfaceOrPolygon_),
'MultiSurface': _ol_xml_.makeChildAppender( 'MultiSurface': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_), GML2.prototype.writeMultiSurfaceOrPolygon_),
'Envelope': _ol_xml_.makeChildAppender( 'Envelope': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeEnvelope) GML2.prototype.writeEnvelope)
} }
}; };
@@ -691,10 +691,10 @@ _ol_format_GML2_.GEOMETRY_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.RING_SERIALIZERS_ = { GML2.RING_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'outerBoundaryIs': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writeRing_), 'outerBoundaryIs': _ol_xml_.makeChildAppender(GML2.prototype.writeRing_),
'innerBoundaryIs': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writeRing_) 'innerBoundaryIs': _ol_xml_.makeChildAppender(GML2.prototype.writeRing_)
} }
}; };
@@ -703,10 +703,10 @@ _ol_format_GML2_.RING_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.POINTMEMBER_SERIALIZERS_ = { GML2.POINTMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'pointMember': _ol_xml_.makeChildAppender( 'pointMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writePointMember_) GML2.prototype.writePointMember_)
} }
}; };
@@ -715,12 +715,12 @@ _ol_format_GML2_.POINTMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lineStringMember': _ol_xml_.makeChildAppender( 'lineStringMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLineStringOrCurveMember_), GML2.prototype.writeLineStringOrCurveMember_),
'curveMember': _ol_xml_.makeChildAppender( '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. * @return {Node|undefined} Node.
* @private * @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; var parentNode = objectStack[objectStack.length - 1].node;
return _ol_xml_.createElementNS('http://www.opengis.net/gml', 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.<string, string>} * @type {Object.<string, string>}
* @private * @private
*/ */
_ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
'MultiLineString': 'lineStringMember', 'MultiLineString': 'lineStringMember',
'MultiCurve': 'curveMember', 'MultiCurve': 'curveMember',
'MultiPolygon': 'polygonMember', 'MultiPolygon': 'polygonMember',
@@ -757,12 +757,12 @@ _ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'surfaceMember': _ol_xml_.makeChildAppender( 'surfaceMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_), GML2.prototype.writeSurfaceOrPolygonMember_),
'polygonMember': _ol_xml_.makeChildAppender( 'polygonMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_) GML2.prototype.writeSurfaceOrPolygonMember_)
} }
}; };
@@ -771,10 +771,10 @@ _ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.ENVELOPE_SERIALIZERS_ = { GML2.ENVELOPE_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lowerCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'lowerCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'upperCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) 'upperCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode)
} }
}; };
export default _ol_format_GML2_; export default GML2;
+135 -135
View File
@@ -4,9 +4,9 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_array_ from '../array.js'; import _ol_array_ from '../array.js';
import {createOrUpdate} from '../extent.js'; import {createOrUpdate} from '../extent.js';
import _ol_format_Feature_ from '../format/Feature.js'; import FeatureFormat from '../format/Feature.js';
import _ol_format_GMLBase_ from '../format/GMLBase.js'; import GMLBase from '../format/GMLBase.js';
import _ol_format_XSD_ from '../format/XSD.js'; import XSD from '../format/XSD.js';
import Geometry from '../geom/Geometry.js'; import Geometry from '../geom/Geometry.js';
import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryLayout from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
@@ -29,11 +29,11 @@ import _ol_xml_ from '../xml.js';
* @extends {ol.format.GMLBase} * @extends {ol.format.GMLBase}
* @api * @api
*/ */
var _ol_format_GML3_ = function(opt_options) { var GML3 = function(opt_options) {
var options = /** @type {olx.format.GMLOptions} */ var options = /** @type {olx.format.GMLOptions} */
(opt_options ? opt_options : {}); (opt_options ? opt_options : {});
_ol_format_GMLBase_.call(this, options); GMLBase.call(this, options);
/** /**
* @private * @private
@@ -65,7 +65,7 @@ var _ol_format_GML3_ = function(opt_options) {
* @inheritDoc * @inheritDoc
*/ */
this.schemaLocation = options.schemaLocation ? this.schemaLocation = options.schemaLocation ?
options.schemaLocation : _ol_format_GML3_.schemaLocation_; options.schemaLocation : GML3.schemaLocation_;
/** /**
* @private * @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} * @type {string}
* @private * @private
*/ */
_ol_format_GML3_.schemaLocation_ = _ol_format_GMLBase_.GMLNS + GML3.schemaLocation_ = GMLBase.GMLNS +
' http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/' + ' http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/' +
'1.0.0/gmlsf.xsd'; '1.0.0/gmlsf.xsd';
@@ -95,7 +95,7 @@ _ol_format_GML3_.schemaLocation_ = _ol_format_GMLBase_.GMLNS +
* @private * @private
* @return {ol.geom.MultiLineString|undefined} MultiLineString. * @return {ol.geom.MultiLineString|undefined} MultiLineString.
*/ */
_ol_format_GML3_.prototype.readMultiCurve_ = function(node, objectStack) { GML3.prototype.readMultiCurve_ = function(node, objectStack) {
/** @type {Array.<ol.geom.LineString>} */ /** @type {Array.<ol.geom.LineString>} */
var lineStrings = _ol_xml_.pushParseAndPop([], var lineStrings = _ol_xml_.pushParseAndPop([],
this.MULTICURVE_PARSERS_, node, objectStack, this); this.MULTICURVE_PARSERS_, node, objectStack, this);
@@ -115,7 +115,7 @@ _ol_format_GML3_.prototype.readMultiCurve_ = function(node, objectStack) {
* @private * @private
* @return {ol.geom.MultiPolygon|undefined} MultiPolygon. * @return {ol.geom.MultiPolygon|undefined} MultiPolygon.
*/ */
_ol_format_GML3_.prototype.readMultiSurface_ = function(node, objectStack) { GML3.prototype.readMultiSurface_ = function(node, objectStack) {
/** @type {Array.<ol.geom.Polygon>} */ /** @type {Array.<ol.geom.Polygon>} */
var polygons = _ol_xml_.pushParseAndPop([], var polygons = _ol_xml_.pushParseAndPop([],
this.MULTISURFACE_PARSERS_, node, objectStack, this); this.MULTISURFACE_PARSERS_, node, objectStack, this);
@@ -134,7 +134,7 @@ _ol_format_GML3_.prototype.readMultiSurface_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.curveMemberParser_ = function(node, objectStack) { GML3.prototype.curveMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.CURVEMEMBER_PARSERS_, node, objectStack, this); _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. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.surfaceMemberParser_ = function(node, objectStack) { GML3.prototype.surfaceMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.SURFACEMEMBER_PARSERS_, _ol_xml_.parseNode(this.SURFACEMEMBER_PARSERS_,
node, objectStack, this); node, objectStack, this);
}; };
@@ -156,7 +156,7 @@ _ol_format_GML3_.prototype.surfaceMemberParser_ = function(node, objectStack) {
* @private * @private
* @return {Array.<(Array.<number>)>|undefined} flat coordinates. * @return {Array.<(Array.<number>)>|undefined} flat coordinates.
*/ */
_ol_format_GML3_.prototype.readPatch_ = function(node, objectStack) { GML3.prototype.readPatch_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop([null], return _ol_xml_.pushParseAndPop([null],
this.PATCHES_PARSERS_, node, objectStack, this); this.PATCHES_PARSERS_, node, objectStack, this);
}; };
@@ -168,7 +168,7 @@ _ol_format_GML3_.prototype.readPatch_ = function(node, objectStack) {
* @private * @private
* @return {Array.<number>|undefined} flat coordinates. * @return {Array.<number>|undefined} flat coordinates.
*/ */
_ol_format_GML3_.prototype.readSegment_ = function(node, objectStack) { GML3.prototype.readSegment_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop([null], return _ol_xml_.pushParseAndPop([null],
this.SEGMENTS_PARSERS_, node, objectStack, this); this.SEGMENTS_PARSERS_, node, objectStack, this);
}; };
@@ -180,7 +180,7 @@ _ol_format_GML3_.prototype.readSegment_ = function(node, objectStack) {
* @private * @private
* @return {Array.<(Array.<number>)>|undefined} flat coordinates. * @return {Array.<(Array.<number>)>|undefined} flat coordinates.
*/ */
_ol_format_GML3_.prototype.readPolygonPatch_ = function(node, objectStack) { GML3.prototype.readPolygonPatch_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop([null], return _ol_xml_.pushParseAndPop([null],
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
}; };
@@ -192,7 +192,7 @@ _ol_format_GML3_.prototype.readPolygonPatch_ = function(node, objectStack) {
* @private * @private
* @return {Array.<number>|undefined} flat coordinates. * @return {Array.<number>|undefined} flat coordinates.
*/ */
_ol_format_GML3_.prototype.readLineStringSegment_ = function(node, objectStack) { GML3.prototype.readLineStringSegment_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop([null], return _ol_xml_.pushParseAndPop([null],
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, this.GEOMETRY_FLAT_COORDINATES_PARSERS_,
node, objectStack, this); node, objectStack, this);
@@ -204,7 +204,7 @@ _ol_format_GML3_.prototype.readLineStringSegment_ = function(node, objectStack)
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.interiorParser_ = function(node, objectStack) { GML3.prototype.interiorParser_ = function(node, objectStack) {
/** @type {Array.<number>|undefined} */ /** @type {Array.<number>|undefined} */
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this); this.RING_PARSERS, node, objectStack, this);
@@ -221,7 +221,7 @@ _ol_format_GML3_.prototype.interiorParser_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.exteriorParser_ = function(node, objectStack) { GML3.prototype.exteriorParser_ = function(node, objectStack) {
/** @type {Array.<number>|undefined} */ /** @type {Array.<number>|undefined} */
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this); this.RING_PARSERS, node, objectStack, this);
@@ -239,7 +239,7 @@ _ol_format_GML3_.prototype.exteriorParser_ = function(node, objectStack) {
* @private * @private
* @return {ol.geom.Polygon|undefined} Polygon. * @return {ol.geom.Polygon|undefined} Polygon.
*/ */
_ol_format_GML3_.prototype.readSurface_ = function(node, objectStack) { GML3.prototype.readSurface_ = function(node, objectStack) {
/** @type {Array.<Array.<number>>} */ /** @type {Array.<Array.<number>>} */
var flatLinearRings = _ol_xml_.pushParseAndPop([null], var flatLinearRings = _ol_xml_.pushParseAndPop([null],
this.SURFACE_PARSERS_, node, objectStack, this); this.SURFACE_PARSERS_, node, objectStack, this);
@@ -267,7 +267,7 @@ _ol_format_GML3_.prototype.readSurface_ = function(node, objectStack) {
* @private * @private
* @return {ol.geom.LineString|undefined} LineString. * @return {ol.geom.LineString|undefined} LineString.
*/ */
_ol_format_GML3_.prototype.readCurve_ = function(node, objectStack) { GML3.prototype.readCurve_ = function(node, objectStack) {
/** @type {Array.<number>} */ /** @type {Array.<number>} */
var flatCoordinates = _ol_xml_.pushParseAndPop([null], var flatCoordinates = _ol_xml_.pushParseAndPop([null],
this.CURVE_PARSERS_, node, objectStack, this); this.CURVE_PARSERS_, node, objectStack, this);
@@ -287,7 +287,7 @@ _ol_format_GML3_.prototype.readCurve_ = function(node, objectStack) {
* @private * @private
* @return {ol.Extent|undefined} Envelope. * @return {ol.Extent|undefined} Envelope.
*/ */
_ol_format_GML3_.prototype.readEnvelope_ = function(node, objectStack) { GML3.prototype.readEnvelope_ = function(node, objectStack) {
/** @type {Array.<number>} */ /** @type {Array.<number>} */
var flatCoordinates = _ol_xml_.pushParseAndPop([null], var flatCoordinates = _ol_xml_.pushParseAndPop([null],
this.ENVELOPE_PARSERS_, node, objectStack, this); this.ENVELOPE_PARSERS_, node, objectStack, this);
@@ -303,7 +303,7 @@ _ol_format_GML3_.prototype.readEnvelope_ = function(node, objectStack) {
* @private * @private
* @return {Array.<number>|undefined} Flat coordinates. * @return {Array.<number>|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 s = _ol_xml_.getAllTextContent(node, false);
var re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/; var re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/;
/** @type {Array.<number>} */ /** @type {Array.<number>} */
@@ -349,7 +349,7 @@ _ol_format_GML3_.prototype.readFlatPos_ = function(node, objectStack) {
* @private * @private
* @return {Array.<number>|undefined} Flat coordinates. * @return {Array.<number>|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 s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
var context = objectStack[0]; var context = objectStack[0];
var containerSrs = context['srsName']; 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. // The "dimension" attribute is from the GML 3.0.1 spec.
var dim = 2; var dim = 2;
if (node.getAttribute('srsDimension')) { if (node.getAttribute('srsDimension')) {
dim = _ol_format_XSD_.readNonNegativeIntegerString( dim = XSD.readNonNegativeIntegerString(
node.getAttribute('srsDimension')); node.getAttribute('srsDimension'));
} else if (node.getAttribute('dimension')) { } else if (node.getAttribute('dimension')) {
dim = _ol_format_XSD_.readNonNegativeIntegerString( dim = XSD.readNonNegativeIntegerString(
node.getAttribute('dimension')); node.getAttribute('dimension'));
} else if (node.parentNode.getAttribute('srsDimension')) { } else if (node.parentNode.getAttribute('srsDimension')) {
dim = _ol_format_XSD_.readNonNegativeIntegerString( dim = XSD.readNonNegativeIntegerString(
node.parentNode.getAttribute('srsDimension')); node.parentNode.getAttribute('srsDimension'));
} else if (contextDimension) { } else if (contextDimension) {
dim = _ol_format_XSD_.readNonNegativeIntegerString(contextDimension); dim = XSD.readNonNegativeIntegerString(contextDimension);
} }
var x, y, z; var x, y, z;
var flatCoordinates = []; var flatCoordinates = [];
@@ -395,10 +395,10 @@ _ol_format_GML3_.prototype.readFlatPosList_ = function(node, objectStack) {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'pos': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readFlatPos_), 'pos': _ol_xml_.makeReplacer(GML3.prototype.readFlatPos_),
'posList': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readFlatPosList_) 'posList': _ol_xml_.makeReplacer(GML3.prototype.readFlatPosList_)
} }
}; };
@@ -408,10 +408,10 @@ _ol_format_GML3_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'interior': _ol_format_GML3_.prototype.interiorParser_, 'interior': GML3.prototype.interiorParser_,
'exterior': _ol_format_GML3_.prototype.exteriorParser_ 'exterior': GML3.prototype.exteriorParser_
} }
}; };
@@ -421,27 +421,27 @@ _ol_format_GML3_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.GEOMETRY_PARSERS_ = { GML3.prototype.GEOMETRY_PARSERS_ = {
'http://www.opengis.net/gml': { '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( 'MultiPoint': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiPoint), GMLBase.prototype.readMultiPoint),
'LineString': _ol_xml_.makeReplacer( 'LineString': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readLineString), GMLBase.prototype.readLineString),
'MultiLineString': _ol_xml_.makeReplacer( 'MultiLineString': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiLineString), GMLBase.prototype.readMultiLineString),
'LinearRing': _ol_xml_.makeReplacer( 'LinearRing': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readLinearRing), GMLBase.prototype.readLinearRing),
'Polygon': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPolygon), 'Polygon': _ol_xml_.makeReplacer(GMLBase.prototype.readPolygon),
'MultiPolygon': _ol_xml_.makeReplacer( 'MultiPolygon': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiPolygon), GMLBase.prototype.readMultiPolygon),
'Surface': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readSurface_), 'Surface': _ol_xml_.makeReplacer(GML3.prototype.readSurface_),
'MultiSurface': _ol_xml_.makeReplacer( 'MultiSurface': _ol_xml_.makeReplacer(
_ol_format_GML3_.prototype.readMultiSurface_), GML3.prototype.readMultiSurface_),
'Curve': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readCurve_), 'Curve': _ol_xml_.makeReplacer(GML3.prototype.readCurve_),
'MultiCurve': _ol_xml_.makeReplacer( 'MultiCurve': _ol_xml_.makeReplacer(
_ol_format_GML3_.prototype.readMultiCurve_), GML3.prototype.readMultiCurve_),
'Envelope': _ol_xml_.makeReplacer(_ol_format_GML3_.prototype.readEnvelope_) 'Envelope': _ol_xml_.makeReplacer(GML3.prototype.readEnvelope_)
} }
}; };
@@ -451,12 +451,12 @@ _ol_format_GML3_.prototype.GEOMETRY_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.MULTICURVE_PARSERS_ = { GML3.prototype.MULTICURVE_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'curveMember': _ol_xml_.makeArrayPusher( 'curveMember': _ol_xml_.makeArrayPusher(
_ol_format_GML3_.prototype.curveMemberParser_), GML3.prototype.curveMemberParser_),
'curveMembers': _ol_xml_.makeArrayPusher( 'curveMembers': _ol_xml_.makeArrayPusher(
_ol_format_GML3_.prototype.curveMemberParser_) GML3.prototype.curveMemberParser_)
} }
}; };
@@ -466,12 +466,12 @@ _ol_format_GML3_.prototype.MULTICURVE_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.MULTISURFACE_PARSERS_ = { GML3.prototype.MULTISURFACE_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'surfaceMember': _ol_xml_.makeArrayPusher( 'surfaceMember': _ol_xml_.makeArrayPusher(
_ol_format_GML3_.prototype.surfaceMemberParser_), GML3.prototype.surfaceMemberParser_),
'surfaceMembers': _ol_xml_.makeArrayPusher( 'surfaceMembers': _ol_xml_.makeArrayPusher(
_ol_format_GML3_.prototype.surfaceMemberParser_) GML3.prototype.surfaceMemberParser_)
} }
}; };
@@ -481,11 +481,11 @@ _ol_format_GML3_.prototype.MULTISURFACE_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.CURVEMEMBER_PARSERS_ = { GML3.prototype.CURVEMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'LineString': _ol_xml_.makeArrayPusher( 'LineString': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.readLineString), GMLBase.prototype.readLineString),
'Curve': _ol_xml_.makeArrayPusher(_ol_format_GML3_.prototype.readCurve_) 'Curve': _ol_xml_.makeArrayPusher(GML3.prototype.readCurve_)
} }
}; };
@@ -495,10 +495,10 @@ _ol_format_GML3_.prototype.CURVEMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.SURFACEMEMBER_PARSERS_ = { GML3.prototype.SURFACEMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Polygon': _ol_xml_.makeArrayPusher(_ol_format_GMLBase_.prototype.readPolygon), 'Polygon': _ol_xml_.makeArrayPusher(GMLBase.prototype.readPolygon),
'Surface': _ol_xml_.makeArrayPusher(_ol_format_GML3_.prototype.readSurface_) 'Surface': _ol_xml_.makeArrayPusher(GML3.prototype.readSurface_)
} }
}; };
@@ -508,9 +508,9 @@ _ol_format_GML3_.prototype.SURFACEMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.SURFACE_PARSERS_ = { GML3.prototype.SURFACE_PARSERS_ = {
'http://www.opengis.net/gml': { '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.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.CURVE_PARSERS_ = { GML3.prototype.CURVE_PARSERS_ = {
'http://www.opengis.net/gml': { '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.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.ENVELOPE_PARSERS_ = { GML3.prototype.ENVELOPE_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lowerCorner': _ol_xml_.makeArrayPusher( 'lowerCorner': _ol_xml_.makeArrayPusher(
_ol_format_GML3_.prototype.readFlatPosList_), GML3.prototype.readFlatPosList_),
'upperCorner': _ol_xml_.makeArrayPusher( 'upperCorner': _ol_xml_.makeArrayPusher(
_ol_format_GML3_.prototype.readFlatPosList_) GML3.prototype.readFlatPosList_)
} }
}; };
@@ -547,10 +547,10 @@ _ol_format_GML3_.prototype.ENVELOPE_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.PATCHES_PARSERS_ = { GML3.prototype.PATCHES_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'PolygonPatch': _ol_xml_.makeReplacer( 'PolygonPatch': _ol_xml_.makeReplacer(
_ol_format_GML3_.prototype.readPolygonPatch_) GML3.prototype.readPolygonPatch_)
} }
}; };
@@ -560,10 +560,10 @@ _ol_format_GML3_.prototype.PATCHES_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML3_.prototype.SEGMENTS_PARSERS_ = { GML3.prototype.SEGMENTS_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'LineStringSegment': _ol_xml_.makeReplacer( '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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writePos_ = function(node, value, objectStack) { GML3.prototype.writePos_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsDimension = hasZ ? 3 : 2; var srsDimension = hasZ ? 3 : 2;
@@ -597,7 +597,7 @@ _ol_format_GML3_.prototype.writePos_ = function(node, value, objectStack) {
var z = point[2] || 0; var z = point[2] || 0;
coords += ' ' + z; 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. * @return {string} The coords string.
* @private * @private
*/ */
_ol_format_GML3_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) { GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu'; var axisOrientation = 'enu';
if (opt_srsName) { if (opt_srsName) {
axisOrientation = getProjection(opt_srsName).getAxisOrientation(); 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writePosList_ = function(node, value, objectStack) { GML3.prototype.writePosList_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsDimension = hasZ ? 3 : 2; var srsDimension = hasZ ? 3 : 2;
@@ -647,7 +647,7 @@ _ol_format_GML3_.prototype.writePosList_ = function(node, value, objectStack) {
point = points[i]; point = points[i];
parts[i] = this.getCoords_(point, srsName, hasZ); 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writePoint_ = function(node, geometry, objectStack) { GML3.prototype.writePoint_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
if (srsName) { if (srsName) {
@@ -673,10 +673,10 @@ _ol_format_GML3_.prototype.writePoint_ = function(node, geometry, objectStack) {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML3_.ENVELOPE_SERIALIZERS_ = { GML3.ENVELOPE_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lowerCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'lowerCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'upperCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) 'upperCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode)
} }
}; };
@@ -686,7 +686,7 @@ _ol_format_GML3_.ENVELOPE_SERIALIZERS_ = {
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {Array.<*>} objectStack Node stack. * @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 context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
if (srsName) { if (srsName) {
@@ -695,7 +695,7 @@ _ol_format_GML3_.prototype.writeEnvelope = function(node, extent, objectStack) {
var keys = ['lowerCorner', 'upperCorner']; var keys = ['lowerCorner', 'upperCorner'];
var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]]; var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node}), _ol_format_GML3_.ENVELOPE_SERIALIZERS_, ({node: node}), GML3.ENVELOPE_SERIALIZERS_,
_ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values, values,
objectStack, keys, this); objectStack, keys, this);
@@ -708,7 +708,7 @@ _ol_format_GML3_.prototype.writeEnvelope = function(node, extent, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writeLinearRing_ = function(node, geometry, objectStack) { GML3.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
if (srsName) { if (srsName) {
@@ -727,7 +727,7 @@ _ol_format_GML3_.prototype.writeLinearRing_ = function(node, geometry, objectSta
* @return {Node} Node. * @return {Node} Node.
* @private * @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 context = objectStack[objectStack.length - 1];
var parentNode = context.node; var parentNode = context.node;
var exteriorWritten = context['exteriorWritten']; var exteriorWritten = context['exteriorWritten'];
@@ -745,7 +745,7 @@ _ol_format_GML3_.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) { GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -756,7 +756,7 @@ _ol_format_GML3_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, obj
var rings = geometry.getLinearRings(); var rings = geometry.getLinearRings();
_ol_xml_.pushSerializeAndPop( _ol_xml_.pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName}, {node: node, hasZ: hasZ, srsName: srsName},
_ol_format_GML3_.RING_SERIALIZERS_, GML3.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_, this.RING_NODE_FACTORY_,
rings, objectStack, undefined, this); rings, objectStack, undefined, this);
} else if (node.nodeName === 'Surface') { } else if (node.nodeName === 'Surface') {
@@ -774,7 +774,7 @@ _ol_format_GML3_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, obj
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) { GML3.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
if (node.nodeName !== 'LineStringSegment' && srsName) { if (node.nodeName !== 'LineStringSegment' && srsName) {
@@ -800,7 +800,7 @@ _ol_format_GML3_.prototype.writeCurveOrLineString_ = function(node, geometry, ob
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) { GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -810,7 +810,7 @@ _ol_format_GML3_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry
} }
var polygons = geometry.getPolygons(); var polygons = geometry.getPolygons();
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface}, _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, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -822,7 +822,7 @@ _ol_format_GML3_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writeMultiPoint_ = function(node, geometry, GML3.prototype.writeMultiPoint_ = function(node, geometry,
objectStack) { objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -832,7 +832,7 @@ _ol_format_GML3_.prototype.writeMultiPoint_ = function(node, geometry,
} }
var points = geometry.getPoints(); var points = geometry.getPoints();
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName}, _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
_ol_format_GML3_.POINTMEMBER_SERIALIZERS_, GML3.POINTMEMBER_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('pointMember'), points, _ol_xml_.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -844,7 +844,7 @@ _ol_format_GML3_.prototype.writeMultiPoint_ = function(node, geometry,
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) { GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -854,7 +854,7 @@ _ol_format_GML3_.prototype.writeMultiCurveOrLineString_ = function(node, geometr
} }
var lines = geometry.getLineStrings(); var lines = geometry.getLineStrings();
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve}, _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, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -866,7 +866,7 @@ _ol_format_GML3_.prototype.writeMultiCurveOrLineString_ = function(node, geometr
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @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'); var linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing');
node.appendChild(linearRing); node.appendChild(linearRing);
this.writeLinearRing_(linearRing, ring, objectStack); this.writeLinearRing_(linearRing, ring, objectStack);
@@ -879,7 +879,7 @@ _ol_format_GML3_.prototype.writeRing_ = function(node, ring, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) { GML3.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_( var child = this.GEOMETRY_NODE_FACTORY_(
polygon, objectStack); polygon, objectStack);
if (child) { if (child) {
@@ -895,7 +895,7 @@ _ol_format_GML3_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @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'); var child = _ol_xml_.createElementNS(node.namespaceURI, 'Point');
node.appendChild(child); node.appendChild(child);
this.writePoint_(child, point, objectStack); this.writePoint_(child, point, objectStack);
@@ -908,7 +908,7 @@ _ol_format_GML3_.prototype.writePointMember_ = function(node, point, objectStack
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @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); var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
if (child) { if (child) {
node.appendChild(child); node.appendChild(child);
@@ -923,7 +923,7 @@ _ol_format_GML3_.prototype.writeLineStringOrCurveMember_ = function(node, line,
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @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'); var child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch');
node.appendChild(child); node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack); this.writeSurfaceOrPolygon_(child, polygon, objectStack);
@@ -936,7 +936,7 @@ _ol_format_GML3_.prototype.writeSurfacePatches_ = function(node, polygon, object
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML3_.prototype.writeCurveSegments_ = function(node, line, objectStack) { GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI, var child = _ol_xml_.createElementNS(node.namespaceURI,
'LineStringSegment'); 'LineStringSegment');
node.appendChild(child); 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 {ol.geom.Geometry|ol.Extent} geometry Geometry.
* @param {Array.<*>} objectStack Node stack. * @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 context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
var item = _ol_obj_.assign({}, context); var item = _ol_obj_.assign({}, context);
item.node = node; item.node = node;
@@ -963,10 +963,10 @@ _ol_format_GML3_.prototype.writeGeometryElement = function(node, geometry, objec
} }
} else { } else {
value = 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} */ _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), _ol_format_GML3_.GEOMETRY_SERIALIZERS_, (item), GML3.GEOMETRY_SERIALIZERS_,
this.GEOMETRY_NODE_FACTORY_, [value], this.GEOMETRY_NODE_FACTORY_, [value],
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -977,7 +977,7 @@ _ol_format_GML3_.prototype.writeGeometryElement = function(node, geometry, objec
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack. * @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(); var fid = feature.getId();
if (fid) { if (fid) {
node.setAttribute('fid', fid); node.setAttribute('fid', fid);
@@ -1004,7 +1004,7 @@ _ol_format_GML3_.prototype.writeFeatureElement = function(node, feature, objectS
} else { } else {
if (!(key in context.serializers[featureNS])) { if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender( 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. * @param {Array.<*>} objectStack Node stack.
* @private * @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 context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var featureType = context['featureType']; var featureType = context['featureType'];
var featureNS = context['featureNS']; var featureNS = context['featureNS'];
@@ -1047,12 +1047,12 @@ _ol_format_GML3_.prototype.writeFeatureMembers_ = function(node, features, objec
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML3_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'surfaceMember': _ol_xml_.makeChildAppender( 'surfaceMember': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeSurfaceOrPolygonMember_), GML3.prototype.writeSurfaceOrPolygonMember_),
'polygonMember': _ol_xml_.makeChildAppender( 'polygonMember': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeSurfaceOrPolygonMember_) GML3.prototype.writeSurfaceOrPolygonMember_)
} }
}; };
@@ -1061,10 +1061,10 @@ _ol_format_GML3_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML3_.POINTMEMBER_SERIALIZERS_ = { GML3.POINTMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'pointMember': _ol_xml_.makeChildAppender( 'pointMember': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writePointMember_) GML3.prototype.writePointMember_)
} }
}; };
@@ -1073,12 +1073,12 @@ _ol_format_GML3_.POINTMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML3_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lineStringMember': _ol_xml_.makeChildAppender( 'lineStringMember': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeLineStringOrCurveMember_), GML3.prototype.writeLineStringOrCurveMember_),
'curveMember': _ol_xml_.makeChildAppender( 'curveMember': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeLineStringOrCurveMember_) GML3.prototype.writeLineStringOrCurveMember_)
} }
}; };
@@ -1087,10 +1087,10 @@ _ol_format_GML3_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML3_.RING_SERIALIZERS_ = { GML3.RING_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'exterior': _ol_xml_.makeChildAppender(_ol_format_GML3_.prototype.writeRing_), 'exterior': _ol_xml_.makeChildAppender(GML3.prototype.writeRing_),
'interior': _ol_xml_.makeChildAppender(_ol_format_GML3_.prototype.writeRing_) 'interior': _ol_xml_.makeChildAppender(GML3.prototype.writeRing_)
} }
}; };
@@ -1099,31 +1099,31 @@ _ol_format_GML3_.RING_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML3_.GEOMETRY_SERIALIZERS_ = { GML3.GEOMETRY_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Curve': _ol_xml_.makeChildAppender( 'Curve': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeCurveOrLineString_), GML3.prototype.writeCurveOrLineString_),
'MultiCurve': _ol_xml_.makeChildAppender( 'MultiCurve': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeMultiCurveOrLineString_), GML3.prototype.writeMultiCurveOrLineString_),
'Point': _ol_xml_.makeChildAppender(_ol_format_GML3_.prototype.writePoint_), 'Point': _ol_xml_.makeChildAppender(GML3.prototype.writePoint_),
'MultiPoint': _ol_xml_.makeChildAppender( 'MultiPoint': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeMultiPoint_), GML3.prototype.writeMultiPoint_),
'LineString': _ol_xml_.makeChildAppender( 'LineString': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeCurveOrLineString_), GML3.prototype.writeCurveOrLineString_),
'MultiLineString': _ol_xml_.makeChildAppender( 'MultiLineString': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeMultiCurveOrLineString_), GML3.prototype.writeMultiCurveOrLineString_),
'LinearRing': _ol_xml_.makeChildAppender( 'LinearRing': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeLinearRing_), GML3.prototype.writeLinearRing_),
'Polygon': _ol_xml_.makeChildAppender( 'Polygon': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeSurfaceOrPolygon_), GML3.prototype.writeSurfaceOrPolygon_),
'MultiPolygon': _ol_xml_.makeChildAppender( 'MultiPolygon': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeMultiSurfaceOrPolygon_), GML3.prototype.writeMultiSurfaceOrPolygon_),
'Surface': _ol_xml_.makeChildAppender( 'Surface': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeSurfaceOrPolygon_), GML3.prototype.writeSurfaceOrPolygon_),
'MultiSurface': _ol_xml_.makeChildAppender( 'MultiSurface': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeMultiSurfaceOrPolygon_), GML3.prototype.writeMultiSurfaceOrPolygon_),
'Envelope': _ol_xml_.makeChildAppender( 'Envelope': _ol_xml_.makeChildAppender(
_ol_format_GML3_.prototype.writeEnvelope) GML3.prototype.writeEnvelope)
} }
}; };
@@ -1133,7 +1133,7 @@ _ol_format_GML3_.GEOMETRY_SERIALIZERS_ = {
* @type {Object.<string, string>} * @type {Object.<string, string>}
* @private * @private
*/ */
_ol_format_GML3_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
'MultiLineString': 'lineStringMember', 'MultiLineString': 'lineStringMember',
'MultiCurve': 'curveMember', 'MultiCurve': 'curveMember',
'MultiPolygon': 'polygonMember', 'MultiPolygon': 'polygonMember',
@@ -1149,10 +1149,10 @@ _ol_format_GML3_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
* @return {Node|undefined} Node. * @return {Node|undefined} Node.
* @private * @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; var parentNode = objectStack[objectStack.length - 1].node;
return _ol_xml_.createElementNS('http://www.opengis.net/gml', 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. * @return {Node|undefined} Node.
* @private * @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 context = objectStack[objectStack.length - 1];
var multiSurface = context['multiSurface']; var multiSurface = context['multiSurface'];
var surface = context['surface']; var surface = context['surface'];
@@ -1199,7 +1199,7 @@ _ol_format_GML3_.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack,
* @override * @override
* @api * @api
*/ */
_ol_format_GML3_.prototype.writeGeometryNode = function(geometry, opt_options) { GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
var geom = _ol_xml_.createElementNS('http://www.opengis.net/gml', 'geom'); var geom = _ol_xml_.createElementNS('http://www.opengis.net/gml', 'geom');
var context = {node: geom, hasZ: this.hasZ, srsName: this.srsName, 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. * @return {string} Result.
* @api * @api
*/ */
_ol_format_GML3_.prototype.writeFeatures; GML3.prototype.writeFeatures;
/** /**
@@ -1234,7 +1234,7 @@ _ol_format_GML3_.prototype.writeFeatures;
* @override * @override
* @api * @api
*/ */
_ol_format_GML3_.prototype.writeFeaturesNode = function(features, opt_options) { GML3.prototype.writeFeaturesNode = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
var node = _ol_xml_.createElementNS('http://www.opengis.net/gml', var node = _ol_xml_.createElementNS('http://www.opengis.net/gml',
'featureMembers'); 'featureMembers');
@@ -1256,4 +1256,4 @@ _ol_format_GML3_.prototype.writeFeaturesNode = function(features, opt_options) {
this.writeFeatureMembers_(node, features, [context]); this.writeFeatureMembers_(node, features, [context]);
return node; return node;
}; };
export default _ol_format_GML3_; export default GML3;
+50 -50
View File
@@ -7,8 +7,8 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_array_ from '../array.js'; import _ol_array_ from '../array.js';
import _ol_Feature_ from '../Feature.js'; import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js'; import FeatureFormat from '../format/Feature.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; import XMLFeature from '../format/XMLFeature.js';
import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryLayout from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
import LinearRing from '../geom/LinearRing.js'; import LinearRing from '../geom/LinearRing.js';
@@ -36,7 +36,7 @@ import _ol_xml_ from '../xml.js';
* Optional configuration object. * Optional configuration object.
* @extends {ol.format.XMLFeature} * @extends {ol.format.XMLFeature}
*/ */
var _ol_format_GMLBase_ = function(opt_options) { var GMLBase = function(opt_options) {
var options = /** @type {olx.format.GMLOptions} */ var options = /** @type {olx.format.GMLOptions} */
(opt_options ? opt_options : {}); (opt_options ? opt_options : {});
@@ -68,24 +68,24 @@ var _ol_format_GMLBase_ = function(opt_options) {
* @type {Object.<string, Object.<string, Object>>} * @type {Object.<string, Object.<string, Object>>}
*/ */
this.FEATURE_COLLECTION_PARSERS = {}; this.FEATURE_COLLECTION_PARSERS = {};
this.FEATURE_COLLECTION_PARSERS[_ol_format_GMLBase_.GMLNS] = { this.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS] = {
'featureMember': _ol_xml_.makeReplacer( 'featureMember': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readFeaturesInternal), GMLBase.prototype.readFeaturesInternal),
'featureMembers': _ol_xml_.makeReplacer( '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 * @const
* @type {string} * @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} * @type {RegExp}
* @private * @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. * @param {Array.<*>} objectStack Object stack.
* @return {Array.<ol.Feature> | undefined} Features. * @return {Array.<ol.Feature> | undefined} Features.
*/ */
_ol_format_GMLBase_.prototype.readFeaturesInternal = function(node, objectStack) { GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
var localName = node.localName; var localName = node.localName;
var features = null; var features = null;
if (localName == 'FeatureCollection') { if (localName == 'FeatureCollection') {
@@ -196,7 +196,7 @@ _ol_format_GMLBase_.prototype.readFeaturesInternal = function(node, objectStack)
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Geometry|undefined} Geometry. * @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]); var context = /** @type {Object} */ (objectStack[0]);
context['srsName'] = node.firstElementChild.getAttribute('srsName'); context['srsName'] = node.firstElementChild.getAttribute('srsName');
context['srsDimension'] = node.firstElementChild.getAttribute('srsDimension'); context['srsDimension'] = node.firstElementChild.getAttribute('srsDimension');
@@ -205,7 +205,7 @@ _ol_format_GMLBase_.prototype.readGeometryElement = function(node, objectStack)
this.GEOMETRY_PARSERS_, node, objectStack, this); this.GEOMETRY_PARSERS_, node, objectStack, this);
if (geometry) { if (geometry) {
return ( return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(geometry, false, context) /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions(geometry, false, context)
); );
} else { } else {
return undefined; return undefined;
@@ -218,10 +218,10 @@ _ol_format_GMLBase_.prototype.readGeometryElement = function(node, objectStack)
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
*/ */
_ol_format_GMLBase_.prototype.readFeatureElement = function(node, objectStack) { GMLBase.prototype.readFeatureElement = function(node, objectStack) {
var n; var n;
var fid = node.getAttribute('fid') || var fid = node.getAttribute('fid') ||
_ol_xml_.getAttributeNS(node, _ol_format_GMLBase_.GMLNS, 'id'); _ol_xml_.getAttributeNS(node, GMLBase.GMLNS, 'id');
var values = {}, geometryName; var values = {}, geometryName;
for (n = node.firstElementChild; n; n = n.nextElementSibling) { for (n = node.firstElementChild; n; n = n.nextElementSibling) {
var localName = n.localName; var localName = n.localName;
@@ -232,7 +232,7 @@ _ol_format_GMLBase_.prototype.readFeatureElement = function(node, objectStack) {
(n.childNodes.length === 1 && (n.childNodes.length === 1 &&
(n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))) { (n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))) {
var value = _ol_xml_.getAllTextContent(n, false); 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; value = undefined;
} }
values[localName] = value; values[localName] = value;
@@ -260,7 +260,7 @@ _ol_format_GMLBase_.prototype.readFeatureElement = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Point|undefined} Point. * @return {ol.geom.Point|undefined} Point.
*/ */
_ol_format_GMLBase_.prototype.readPoint = function(node, objectStack) { GMLBase.prototype.readPoint = function(node, objectStack) {
var flatCoordinates = var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack); this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) { if (flatCoordinates) {
@@ -276,7 +276,7 @@ _ol_format_GMLBase_.prototype.readPoint = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiPoint|undefined} MultiPoint. * @return {ol.geom.MultiPoint|undefined} MultiPoint.
*/ */
_ol_format_GMLBase_.prototype.readMultiPoint = function(node, objectStack) { GMLBase.prototype.readMultiPoint = function(node, objectStack) {
/** @type {Array.<Array.<number>>} */ /** @type {Array.<Array.<number>>} */
var coordinates = _ol_xml_.pushParseAndPop([], var coordinates = _ol_xml_.pushParseAndPop([],
this.MULTIPOINT_PARSERS_, node, objectStack, this); this.MULTIPOINT_PARSERS_, node, objectStack, this);
@@ -293,7 +293,7 @@ _ol_format_GMLBase_.prototype.readMultiPoint = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiLineString|undefined} MultiLineString. * @return {ol.geom.MultiLineString|undefined} MultiLineString.
*/ */
_ol_format_GMLBase_.prototype.readMultiLineString = function(node, objectStack) { GMLBase.prototype.readMultiLineString = function(node, objectStack) {
/** @type {Array.<ol.geom.LineString>} */ /** @type {Array.<ol.geom.LineString>} */
var lineStrings = _ol_xml_.pushParseAndPop([], var lineStrings = _ol_xml_.pushParseAndPop([],
this.MULTILINESTRING_PARSERS_, node, objectStack, this); this.MULTILINESTRING_PARSERS_, node, objectStack, this);
@@ -312,7 +312,7 @@ _ol_format_GMLBase_.prototype.readMultiLineString = function(node, objectStack)
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.MultiPolygon|undefined} MultiPolygon. * @return {ol.geom.MultiPolygon|undefined} MultiPolygon.
*/ */
_ol_format_GMLBase_.prototype.readMultiPolygon = function(node, objectStack) { GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
/** @type {Array.<ol.geom.Polygon>} */ /** @type {Array.<ol.geom.Polygon>} */
var polygons = _ol_xml_.pushParseAndPop([], var polygons = _ol_xml_.pushParseAndPop([],
this.MULTIPOLYGON_PARSERS_, node, objectStack, this); this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
@@ -331,7 +331,7 @@ _ol_format_GMLBase_.prototype.readMultiPolygon = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GMLBase_.prototype.pointMemberParser_ = function(node, objectStack) { GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.POINTMEMBER_PARSERS_, _ol_xml_.parseNode(this.POINTMEMBER_PARSERS_,
node, objectStack, this); node, objectStack, this);
}; };
@@ -342,7 +342,7 @@ _ol_format_GMLBase_.prototype.pointMemberParser_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GMLBase_.prototype.lineStringMemberParser_ = function(node, objectStack) { GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.LINESTRINGMEMBER_PARSERS_, _ol_xml_.parseNode(this.LINESTRINGMEMBER_PARSERS_,
node, objectStack, this); node, objectStack, this);
}; };
@@ -353,7 +353,7 @@ _ol_format_GMLBase_.prototype.lineStringMemberParser_ = function(node, objectSta
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GMLBase_.prototype.polygonMemberParser_ = function(node, objectStack) { GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) {
_ol_xml_.parseNode(this.POLYGONMEMBER_PARSERS_, node, _ol_xml_.parseNode(this.POLYGONMEMBER_PARSERS_, node,
objectStack, this); objectStack, this);
}; };
@@ -364,7 +364,7 @@ _ol_format_GMLBase_.prototype.polygonMemberParser_ = function(node, objectStack)
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.LineString|undefined} LineString. * @return {ol.geom.LineString|undefined} LineString.
*/ */
_ol_format_GMLBase_.prototype.readLineString = function(node, objectStack) { GMLBase.prototype.readLineString = function(node, objectStack) {
var flatCoordinates = var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack); this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) { if (flatCoordinates) {
@@ -383,7 +383,7 @@ _ol_format_GMLBase_.prototype.readLineString = function(node, objectStack) {
* @private * @private
* @return {Array.<number>|undefined} LinearRing flat coordinates. * @return {Array.<number>|undefined} LinearRing flat coordinates.
*/ */
_ol_format_GMLBase_.prototype.readFlatLinearRing_ = function(node, objectStack) { GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
var ring = _ol_xml_.pushParseAndPop(null, var ring = _ol_xml_.pushParseAndPop(null,
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this); objectStack, this);
@@ -400,7 +400,7 @@ _ol_format_GMLBase_.prototype.readFlatLinearRing_ = function(node, objectStack)
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.LinearRing|undefined} LinearRing. * @return {ol.geom.LinearRing|undefined} LinearRing.
*/ */
_ol_format_GMLBase_.prototype.readLinearRing = function(node, objectStack) { GMLBase.prototype.readLinearRing = function(node, objectStack) {
var flatCoordinates = var flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack); this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) { if (flatCoordinates) {
@@ -418,7 +418,7 @@ _ol_format_GMLBase_.prototype.readLinearRing = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {ol.geom.Polygon|undefined} Polygon. * @return {ol.geom.Polygon|undefined} Polygon.
*/ */
_ol_format_GMLBase_.prototype.readPolygon = function(node, objectStack) { GMLBase.prototype.readPolygon = function(node, objectStack) {
/** @type {Array.<Array.<number>>} */ /** @type {Array.<Array.<number>>} */
var flatLinearRings = _ol_xml_.pushParseAndPop([null], var flatLinearRings = _ol_xml_.pushParseAndPop([null],
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
@@ -446,7 +446,7 @@ _ol_format_GMLBase_.prototype.readPolygon = function(node, objectStack) {
* @private * @private
* @return {Array.<number>} Flat coordinates. * @return {Array.<number>} Flat coordinates.
*/ */
_ol_format_GMLBase_.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) { GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop(null, return _ol_xml_.pushParseAndPop(null,
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this); objectStack, this);
@@ -458,12 +458,12 @@ _ol_format_GMLBase_.prototype.readFlatCoordinatesFromNode_ = function(node, obje
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GMLBase_.prototype.MULTIPOINT_PARSERS_ = { GMLBase.prototype.MULTIPOINT_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'pointMember': _ol_xml_.makeArrayPusher( 'pointMember': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.pointMemberParser_), GMLBase.prototype.pointMemberParser_),
'pointMembers': _ol_xml_.makeArrayPusher( 'pointMembers': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.pointMemberParser_) GMLBase.prototype.pointMemberParser_)
} }
}; };
@@ -473,12 +473,12 @@ _ol_format_GMLBase_.prototype.MULTIPOINT_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GMLBase_.prototype.MULTILINESTRING_PARSERS_ = { GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lineStringMember': _ol_xml_.makeArrayPusher( 'lineStringMember': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.lineStringMemberParser_), GMLBase.prototype.lineStringMemberParser_),
'lineStringMembers': _ol_xml_.makeArrayPusher( 'lineStringMembers': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.lineStringMemberParser_) GMLBase.prototype.lineStringMemberParser_)
} }
}; };
@@ -488,12 +488,12 @@ _ol_format_GMLBase_.prototype.MULTILINESTRING_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GMLBase_.prototype.MULTIPOLYGON_PARSERS_ = { GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'polygonMember': _ol_xml_.makeArrayPusher( 'polygonMember': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.polygonMemberParser_), GMLBase.prototype.polygonMemberParser_),
'polygonMembers': _ol_xml_.makeArrayPusher( 'polygonMembers': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.polygonMemberParser_) GMLBase.prototype.polygonMemberParser_)
} }
}; };
@@ -503,10 +503,10 @@ _ol_format_GMLBase_.prototype.MULTIPOLYGON_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GMLBase_.prototype.POINTMEMBER_PARSERS_ = { GMLBase.prototype.POINTMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Point': _ol_xml_.makeArrayPusher( 'Point': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.readFlatCoordinatesFromNode_) GMLBase.prototype.readFlatCoordinatesFromNode_)
} }
}; };
@@ -516,10 +516,10 @@ _ol_format_GMLBase_.prototype.POINTMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GMLBase_.prototype.LINESTRINGMEMBER_PARSERS_ = { GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'LineString': _ol_xml_.makeArrayPusher( 'LineString': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.readLineString) GMLBase.prototype.readLineString)
} }
}; };
@@ -529,10 +529,10 @@ _ol_format_GMLBase_.prototype.LINESTRINGMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GMLBase_.prototype.POLYGONMEMBER_PARSERS_ = { GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Polygon': _ol_xml_.makeArrayPusher( 'Polygon': _ol_xml_.makeArrayPusher(
_ol_format_GMLBase_.prototype.readPolygon) GMLBase.prototype.readPolygon)
} }
}; };
@@ -542,10 +542,10 @@ _ol_format_GMLBase_.prototype.POLYGONMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @protected * @protected
*/ */
_ol_format_GMLBase_.prototype.RING_PARSERS = { GMLBase.prototype.RING_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'LinearRing': _ol_xml_.makeReplacer( 'LinearRing': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readFlatLinearRing_) GMLBase.prototype.readFlatLinearRing_)
} }
}; };
@@ -553,7 +553,7 @@ _ol_format_GMLBase_.prototype.RING_PARSERS = {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_GMLBase_.prototype.readGeometryFromNode = function(node, opt_options) { GMLBase.prototype.readGeometryFromNode = function(node, opt_options) {
var geometry = this.readGeometryElement(node, var geometry = this.readGeometryElement(node,
[this.getReadOptions(node, opt_options ? opt_options : {})]); [this.getReadOptions(node, opt_options ? opt_options : {})]);
return geometry ? geometry : null; return geometry ? geometry : null;
@@ -569,13 +569,13 @@ _ol_format_GMLBase_.prototype.readGeometryFromNode = function(node, opt_options)
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_GMLBase_.prototype.readFeatures; GMLBase.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_GMLBase_.prototype.readFeaturesFromNode = function(node, opt_options) { GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
var options = { var options = {
featureType: this.featureType, featureType: this.featureType,
featureNS: this.featureNS featureNS: this.featureNS
@@ -591,8 +591,8 @@ _ol_format_GMLBase_.prototype.readFeaturesFromNode = function(node, opt_options)
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_GMLBase_.prototype.readProjectionFromNode = function(node) { GMLBase.prototype.readProjectionFromNode = function(node) {
return getProjection(this.srsName ? this.srsName : return getProjection(this.srsName ? this.srsName :
node.firstElementChild.getAttribute('srsName')); node.firstElementChild.getAttribute('srsName'));
}; };
export default _ol_format_GMLBase_; export default GMLBase;
+202 -202
View File
@@ -4,9 +4,9 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js'; import _ol_Feature_ from '../Feature.js';
import _ol_array_ from '../array.js'; import _ol_array_ from '../array.js';
import _ol_format_Feature_ from '../format/Feature.js'; import FeatureFormat from '../format/Feature.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; import XMLFeature from '../format/XMLFeature.js';
import _ol_format_XSD_ from '../format/XSD.js'; import XSD from '../format/XSD.js';
import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryLayout from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
import MultiLineString from '../geom/MultiLineString.js'; import MultiLineString from '../geom/MultiLineString.js';
@@ -23,11 +23,11 @@ import _ol_xml_ from '../xml.js';
* @param {olx.format.GPXOptions=} opt_options Options. * @param {olx.format.GPXOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_format_GPX_ = function(opt_options) { var GPX = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
_ol_format_XMLFeature_.call(this); XMLFeature.call(this);
/** /**
* @inheritDoc * @inheritDoc
@@ -41,7 +41,7 @@ var _ol_format_GPX_ = function(opt_options) {
this.readExtensions_ = options.readExtensions; 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 * @private
* @type {Array.<string>} * @type {Array.<string>}
*/ */
_ol_format_GPX_.NAMESPACE_URIS_ = [ GPX.NAMESPACE_URIS_ = [
null, null,
'http://www.topografix.com/GPX/1/0', 'http://www.topografix.com/GPX/1/0',
'http://www.topografix.com/GPX/1/1' 'http://www.topografix.com/GPX/1/1'
@@ -61,7 +61,7 @@ _ol_format_GPX_.NAMESPACE_URIS_ = [
* @type {string} * @type {string}
* @private * @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'; '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 * @private
* @return {Array.<number>} Flat coordinates. * @return {Array.<number>} Flat coordinates.
*/ */
_ol_format_GPX_.appendCoordinate_ = function(flatCoordinates, layoutOptions, node, values) { GPX.appendCoordinate_ = function(flatCoordinates, layoutOptions, node, values) {
flatCoordinates.push( flatCoordinates.push(
parseFloat(node.getAttribute('lon')), parseFloat(node.getAttribute('lon')),
parseFloat(node.getAttribute('lat'))); parseFloat(node.getAttribute('lat')));
@@ -104,7 +104,7 @@ _ol_format_GPX_.appendCoordinate_ = function(flatCoordinates, layoutOptions, nod
* @param {Array.<number>=} ends Ends. * @param {Array.<number>=} ends Ends.
* @return {ol.geom.GeometryLayout} Layout. * @return {ol.geom.GeometryLayout} Layout.
*/ */
_ol_format_GPX_.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, ends) { GPX.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, ends) {
var layout = GeometryLayout.XY; var layout = GeometryLayout.XY;
var stride = 2; var stride = 2;
if (layoutOptions.hasZ && layoutOptions.hasM) { if (layoutOptions.hasZ && layoutOptions.hasM) {
@@ -145,13 +145,13 @@ _ol_format_GPX_.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, e
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GPX_.parseLink_ = function(node, objectStack) { GPX.parseLink_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var href = node.getAttribute('href'); var href = node.getAttribute('href');
if (href !== null) { if (href !== null) {
values['link'] = href; 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. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GPX_.parseExtensions_ = function(node, objectStack) { GPX.parseExtensions_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
values['extensionsNode_'] = node; values['extensionsNode_'] = node;
}; };
@@ -171,16 +171,16 @@ _ol_format_GPX_.parseExtensions_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GPX_.parseRtePt_ = function(node, objectStack) { GPX.parseRtePt_ = function(node, objectStack) {
var values = _ol_xml_.pushParseAndPop( var values = _ol_xml_.pushParseAndPop(
{}, _ol_format_GPX_.RTEPT_PARSERS_, node, objectStack); {}, GPX.RTEPT_PARSERS_, node, objectStack);
if (values) { if (values) {
var rteValues = /** @type {Object} */ (objectStack[objectStack.length - 1]); var rteValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var flatCoordinates = /** @type {Array.<number>} */ var flatCoordinates = /** @type {Array.<number>} */
(rteValues['flatCoordinates']); (rteValues['flatCoordinates']);
var layoutOptions = /** @type {ol.LayoutOptions} */ var layoutOptions = /** @type {ol.LayoutOptions} */
(rteValues['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. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GPX_.parseTrkPt_ = function(node, objectStack) { GPX.parseTrkPt_ = function(node, objectStack) {
var values = _ol_xml_.pushParseAndPop( var values = _ol_xml_.pushParseAndPop(
{}, _ol_format_GPX_.TRKPT_PARSERS_, node, objectStack); {}, GPX.TRKPT_PARSERS_, node, objectStack);
if (values) { if (values) {
var trkValues = /** @type {Object} */ (objectStack[objectStack.length - 1]); var trkValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var flatCoordinates = /** @type {Array.<number>} */ var flatCoordinates = /** @type {Array.<number>} */
(trkValues['flatCoordinates']); (trkValues['flatCoordinates']);
var layoutOptions = /** @type {ol.LayoutOptions} */ var layoutOptions = /** @type {ol.LayoutOptions} */
(trkValues['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. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GPX_.parseTrkSeg_ = function(node, objectStack) { GPX.parseTrkSeg_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); 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.<number>} */ var flatCoordinates = /** @type {Array.<number>} */
(values['flatCoordinates']); (values['flatCoordinates']);
var ends = /** @type {Array.<number>} */ (values['ends']); var ends = /** @type {Array.<number>} */ (values['ends']);
@@ -225,12 +225,12 @@ _ol_format_GPX_.parseTrkSeg_ = function(node, objectStack) {
* @private * @private
* @return {ol.Feature|undefined} Track. * @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 options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = _ol_xml_.pushParseAndPop({ var values = _ol_xml_.pushParseAndPop({
'flatCoordinates': [], 'flatCoordinates': [],
'layoutOptions': {} 'layoutOptions': {}
}, _ol_format_GPX_.RTE_PARSERS_, node, objectStack); }, GPX.RTE_PARSERS_, node, objectStack);
if (!values) { if (!values) {
return undefined; return undefined;
} }
@@ -239,10 +239,10 @@ _ol_format_GPX_.readRte_ = function(node, objectStack) {
delete values['flatCoordinates']; delete values['flatCoordinates'];
var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']); var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']);
delete values['layoutOptions']; delete values['layoutOptions'];
var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, flatCoordinates); var layout = GPX.applyLayoutOptions_(layoutOptions, flatCoordinates);
var geometry = new LineString(null); var geometry = new LineString(null);
geometry.setFlatCoordinates(layout, flatCoordinates); geometry.setFlatCoordinates(layout, flatCoordinates);
_ol_format_Feature_.transformWithOptions(geometry, false, options); FeatureFormat.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry); var feature = new _ol_Feature_(geometry);
feature.setProperties(values); feature.setProperties(values);
return feature; return feature;
@@ -255,13 +255,13 @@ _ol_format_GPX_.readRte_ = function(node, objectStack) {
* @private * @private
* @return {ol.Feature|undefined} Track. * @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 options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = _ol_xml_.pushParseAndPop({ var values = _ol_xml_.pushParseAndPop({
'flatCoordinates': [], 'flatCoordinates': [],
'ends': [], 'ends': [],
'layoutOptions': {} 'layoutOptions': {}
}, _ol_format_GPX_.TRK_PARSERS_, node, objectStack); }, GPX.TRK_PARSERS_, node, objectStack);
if (!values) { if (!values) {
return undefined; return undefined;
} }
@@ -272,10 +272,10 @@ _ol_format_GPX_.readTrk_ = function(node, objectStack) {
delete values['ends']; delete values['ends'];
var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']); var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']);
delete 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); var geometry = new MultiLineString(null);
geometry.setFlatCoordinates(layout, flatCoordinates, ends); geometry.setFlatCoordinates(layout, flatCoordinates, ends);
_ol_format_Feature_.transformWithOptions(geometry, false, options); FeatureFormat.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry); var feature = new _ol_Feature_(geometry);
feature.setProperties(values); feature.setProperties(values);
return feature; return feature;
@@ -288,18 +288,18 @@ _ol_format_GPX_.readTrk_ = function(node, objectStack) {
* @private * @private
* @return {ol.Feature|undefined} Waypoint. * @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 options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = _ol_xml_.pushParseAndPop( var values = _ol_xml_.pushParseAndPop(
{}, _ol_format_GPX_.WPT_PARSERS_, node, objectStack); {}, GPX.WPT_PARSERS_, node, objectStack);
if (!values) { if (!values) {
return undefined; return undefined;
} }
var layoutOptions = /** @type {ol.LayoutOptions} */ ({}); var layoutOptions = /** @type {ol.LayoutOptions} */ ({});
var coordinates = _ol_format_GPX_.appendCoordinate_([], layoutOptions, node, values); var coordinates = GPX.appendCoordinate_([], layoutOptions, node, values);
var layout = _ol_format_GPX_.applyLayoutOptions_(layoutOptions, coordinates); var layout = GPX.applyLayoutOptions_(layoutOptions, coordinates);
var geometry = new Point(coordinates, layout); var geometry = new Point(coordinates, layout);
_ol_format_Feature_.transformWithOptions(geometry, false, options); FeatureFormat.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry); var feature = new _ol_Feature_(geometry);
feature.setProperties(values); feature.setProperties(values);
return feature; return feature;
@@ -311,10 +311,10 @@ _ol_format_GPX_.readWpt_ = function(node, objectStack) {
* @type {Object.<string, function(Node, Array.<*>): (ol.Feature|undefined)>} * @type {Object.<string, function(Node, Array.<*>): (ol.Feature|undefined)>}
* @private * @private
*/ */
_ol_format_GPX_.FEATURE_READER_ = { GPX.FEATURE_READER_ = {
'rte': _ol_format_GPX_.readRte_, 'rte': GPX.readRte_,
'trk': _ol_format_GPX_.readTrk_, 'trk': GPX.readTrk_,
'wpt': _ol_format_GPX_.readWpt_ 'wpt': GPX.readWpt_
}; };
@@ -323,11 +323,11 @@ _ol_format_GPX_.FEATURE_READER_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GPX_.GPX_PARSERS_ = _ol_xml_.makeStructureNS( GPX.GPX_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'rte': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readRte_), 'rte': _ol_xml_.makeArrayPusher(GPX.readRte_),
'trk': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readTrk_), 'trk': _ol_xml_.makeArrayPusher(GPX.readTrk_),
'wpt': _ol_xml_.makeArrayPusher(_ol_format_GPX_.readWpt_) 'wpt': _ol_xml_.makeArrayPusher(GPX.readWpt_)
}); });
@@ -336,12 +336,12 @@ _ol_format_GPX_.GPX_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GPX_.LINK_PARSERS_ = _ol_xml_.makeStructureNS( GPX.LINK_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'text': 'text':
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString, 'linkText'), _ol_xml_.makeObjectPropertySetter(XSD.readString, 'linkText'),
'type': '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.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GPX_.RTE_PARSERS_ = _ol_xml_.makeStructureNS( GPX.RTE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'src': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'link': _ol_format_GPX_.parseLink_, 'link': GPX.parseLink_,
'number': 'number':
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger), _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger),
'extensions': _ol_format_GPX_.parseExtensions_, 'extensions': GPX.parseExtensions_,
'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'type': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'rtept': _ol_format_GPX_.parseRtePt_ 'rtept': GPX.parseRtePt_
}); });
@@ -370,10 +370,10 @@ _ol_format_GPX_.RTE_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GPX_.RTEPT_PARSERS_ = _ol_xml_.makeStructureNS( GPX.RTEPT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime) 'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime)
}); });
@@ -382,18 +382,18 @@ _ol_format_GPX_.RTEPT_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GPX_.TRK_PARSERS_ = _ol_xml_.makeStructureNS( GPX.TRK_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'src': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'link': _ol_format_GPX_.parseLink_, 'link': GPX.parseLink_,
'number': 'number':
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger), _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger),
'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'type': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'extensions': _ol_format_GPX_.parseExtensions_, 'extensions': GPX.parseExtensions_,
'trkseg': _ol_format_GPX_.parseTrkSeg_ 'trkseg': GPX.parseTrkSeg_
}); });
@@ -402,9 +402,9 @@ _ol_format_GPX_.TRK_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GPX_.TRKSEG_PARSERS_ = _ol_xml_.makeStructureNS( GPX.TRKSEG_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'trkpt': _ol_format_GPX_.parseTrkPt_ 'trkpt': GPX.parseTrkPt_
}); });
@@ -413,10 +413,10 @@ _ol_format_GPX_.TRKSEG_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GPX_.TRKPT_PARSERS_ = _ol_xml_.makeStructureNS( GPX.TRKPT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime) 'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime)
}); });
@@ -425,30 +425,30 @@ _ol_format_GPX_.TRKPT_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GPX_.WPT_PARSERS_ = _ol_xml_.makeStructureNS( GPX.WPT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
'time': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDateTime), 'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime),
'magvar': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'magvar': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
'geoidheight': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'geoidheight': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
'name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'cmt': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'desc': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'src': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'src': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'link': _ol_format_GPX_.parseLink_, 'link': GPX.parseLink_,
'sym': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'sym': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'type': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'type': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'fix': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'fix': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'sat': _ol_xml_.makeObjectPropertySetter( 'sat': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'hdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'hdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
'vdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'vdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
'pdop': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), 'pdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
'ageofdgpsdata': 'ageofdgpsdata':
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readDecimal), _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
'dgpsid': 'dgpsid':
_ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readNonNegativeInteger), _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger),
'extensions': _ol_format_GPX_.parseExtensions_ 'extensions': GPX.parseExtensions_
}); });
@@ -456,7 +456,7 @@ _ol_format_GPX_.WPT_PARSERS_ = _ol_xml_.makeStructureNS(
* @param {Array.<ol.Feature>} features List of features. * @param {Array.<ol.Feature>} features List of features.
* @private * @private
*/ */
_ol_format_GPX_.prototype.handleReadExtensions_ = function(features) { GPX.prototype.handleReadExtensions_ = function(features) {
if (!features) { if (!features) {
features = []; features = [];
} }
@@ -482,17 +482,17 @@ _ol_format_GPX_.prototype.handleReadExtensions_ = function(features) {
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
* @api * @api
*/ */
_ol_format_GPX_.prototype.readFeature; GPX.prototype.readFeature;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_GPX_.prototype.readFeatureFromNode = function(node, opt_options) { GPX.prototype.readFeatureFromNode = function(node, opt_options) {
if (!_ol_array_.includes(_ol_format_GPX_.NAMESPACE_URIS_, node.namespaceURI)) { if (!_ol_array_.includes(GPX.NAMESPACE_URIS_, node.namespaceURI)) {
return null; return null;
} }
var featureReader = _ol_format_GPX_.FEATURE_READER_[node.localName]; var featureReader = GPX.FEATURE_READER_[node.localName];
if (!featureReader) { if (!featureReader) {
return null; return null;
} }
@@ -516,19 +516,19 @@ _ol_format_GPX_.prototype.readFeatureFromNode = function(node, opt_options) {
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_GPX_.prototype.readFeatures; GPX.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_GPX_.prototype.readFeaturesFromNode = function(node, opt_options) { GPX.prototype.readFeaturesFromNode = function(node, opt_options) {
if (!_ol_array_.includes(_ol_format_GPX_.NAMESPACE_URIS_, node.namespaceURI)) { if (!_ol_array_.includes(GPX.NAMESPACE_URIS_, node.namespaceURI)) {
return []; return [];
} }
if (node.localName == 'gpx') { if (node.localName == 'gpx') {
/** @type {Array.<ol.Feature>} */ /** @type {Array.<ol.Feature>} */
var features = _ol_xml_.pushParseAndPop([], _ol_format_GPX_.GPX_PARSERS_, var features = _ol_xml_.pushParseAndPop([], GPX.GPX_PARSERS_,
node, [this.getReadOptions(node, opt_options)]); node, [this.getReadOptions(node, opt_options)]);
if (features) { if (features) {
this.handleReadExtensions_(features); this.handleReadExtensions_(features);
@@ -549,7 +549,7 @@ _ol_format_GPX_.prototype.readFeaturesFromNode = function(node, opt_options) {
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
* @api * @api
*/ */
_ol_format_GPX_.prototype.readProjection; GPX.prototype.readProjection;
/** /**
@@ -558,7 +558,7 @@ _ol_format_GPX_.prototype.readProjection;
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GPX_.writeLink_ = function(node, value, objectStack) { GPX.writeLink_ = function(node, value, objectStack) {
node.setAttribute('href', value); node.setAttribute('href', value);
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var properties = context['properties']; var properties = context['properties'];
@@ -567,8 +567,8 @@ _ol_format_GPX_.writeLink_ = function(node, value, objectStack) {
properties['linkType'] properties['linkType']
]; ];
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node}), _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node}),
_ol_format_GPX_.LINK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, GPX.LINK_SERIALIZERS_, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
link, objectStack, _ol_format_GPX_.LINK_SEQUENCE_); link, objectStack, GPX.LINK_SEQUENCE_);
}; };
@@ -578,7 +578,7 @@ _ol_format_GPX_.writeLink_ = function(node, value, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GPX_.writeWptType_ = function(node, coordinate, objectStack) { GPX.writeWptType_ = function(node, coordinate, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var parentNode = context.node; var parentNode = context.node;
var namespaceURI = parentNode.namespaceURI; var namespaceURI = parentNode.namespaceURI;
@@ -607,12 +607,12 @@ _ol_format_GPX_.writeWptType_ = function(node, coordinate, objectStack) {
// pass // pass
} }
var orderedKeys = (node.nodeName == 'rtept') ? var orderedKeys = (node.nodeName == 'rtept') ?
_ol_format_GPX_.RTEPT_TYPE_SEQUENCE_[namespaceURI] : GPX.RTEPT_TYPE_SEQUENCE_[namespaceURI] :
_ol_format_GPX_.WPT_TYPE_SEQUENCE_[namespaceURI]; GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
var values = _ol_xml_.makeSequence(properties, orderedKeys); var values = _ol_xml_.makeSequence(properties, orderedKeys);
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node, 'properties': properties}), ({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); values, objectStack, orderedKeys);
}; };
@@ -623,22 +623,22 @@ _ol_format_GPX_.writeWptType_ = function(node, coordinate, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GPX_.writeRte_ = function(node, feature, objectStack) { GPX.writeRte_ = function(node, feature, objectStack) {
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
var properties = feature.getProperties(); var properties = feature.getProperties();
var context = {node: node, 'properties': properties}; var context = {node: node, 'properties': properties};
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
geometry = /** @type {ol.geom.LineString} */ geometry = /** @type {ol.geom.LineString} */
(_ol_format_Feature_.transformWithOptions(geometry, true, options)); (FeatureFormat.transformWithOptions(geometry, true, options));
context['geometryLayout'] = geometry.getLayout(); context['geometryLayout'] = geometry.getLayout();
properties['rtept'] = geometry.getCoordinates(); properties['rtept'] = geometry.getCoordinates();
} }
var parentNode = objectStack[objectStack.length - 1].node; 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); var values = _ol_xml_.makeSequence(properties, orderedKeys);
_ol_xml_.pushSerializeAndPop(context, _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); values, objectStack, orderedKeys);
}; };
@@ -649,7 +649,7 @@ _ol_format_GPX_.writeRte_ = function(node, feature, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GPX_.writeTrk_ = function(node, feature, objectStack) { GPX.writeTrk_ = function(node, feature, objectStack) {
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
var properties = feature.getProperties(); var properties = feature.getProperties();
/** @type {ol.XmlNodeStackItem} */ /** @type {ol.XmlNodeStackItem} */
@@ -657,14 +657,14 @@ _ol_format_GPX_.writeTrk_ = function(node, feature, objectStack) {
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
geometry = /** @type {ol.geom.MultiLineString} */ geometry = /** @type {ol.geom.MultiLineString} */
(_ol_format_Feature_.transformWithOptions(geometry, true, options)); (FeatureFormat.transformWithOptions(geometry, true, options));
properties['trkseg'] = geometry.getLineStrings(); properties['trkseg'] = geometry.getLineStrings();
} }
var parentNode = objectStack[objectStack.length - 1].node; 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); var values = _ol_xml_.makeSequence(properties, orderedKeys);
_ol_xml_.pushSerializeAndPop(context, _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); values, objectStack, orderedKeys);
}; };
@@ -675,12 +675,12 @@ _ol_format_GPX_.writeTrk_ = function(node, feature, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GPX_.writeTrkSeg_ = function(node, lineString, objectStack) { GPX.writeTrkSeg_ = function(node, lineString, objectStack) {
/** @type {ol.XmlNodeStackItem} */ /** @type {ol.XmlNodeStackItem} */
var context = {node: node, 'geometryLayout': lineString.getLayout(), var context = {node: node, 'geometryLayout': lineString.getLayout(),
'properties': {}}; 'properties': {}};
_ol_xml_.pushSerializeAndPop(context, _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); lineString.getCoordinates(), objectStack);
}; };
@@ -691,16 +691,16 @@ _ol_format_GPX_.writeTrkSeg_ = function(node, lineString, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GPX_.writeWpt_ = function(node, feature, objectStack) { GPX.writeWpt_ = function(node, feature, objectStack) {
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
context['properties'] = feature.getProperties(); context['properties'] = feature.getProperties();
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
geometry = /** @type {ol.geom.Point} */ geometry = /** @type {ol.geom.Point} */
(_ol_format_Feature_.transformWithOptions(geometry, true, options)); (FeatureFormat.transformWithOptions(geometry, true, options));
context['geometryLayout'] = geometry.getLayout(); 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.<string>} * @type {Array.<string>}
* @private * @private
*/ */
_ol_format_GPX_.LINK_SEQUENCE_ = ['text', 'type']; GPX.LINK_SEQUENCE_ = ['text', 'type'];
/** /**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GPX_.LINK_SERIALIZERS_ = _ol_xml_.makeStructureNS( GPX.LINK_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'text': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'text': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode)
}); });
@@ -729,8 +729,8 @@ _ol_format_GPX_.LINK_SERIALIZERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Array.<string>>} * @type {Object.<string, Array.<string>>}
* @private * @private
*/ */
_ol_format_GPX_.RTE_SEQUENCE_ = _ol_xml_.makeStructureNS( GPX.RTE_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [ GPX.NAMESPACE_URIS_, [
'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'rtept' 'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'rtept'
]); ]);
@@ -740,18 +740,18 @@ _ol_format_GPX_.RTE_SEQUENCE_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GPX_.RTE_SERIALIZERS_ = _ol_xml_.makeStructureNS( GPX.RTE_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_), 'link': _ol_xml_.makeChildAppender(GPX.writeLink_),
'number': _ol_xml_.makeChildAppender( 'number': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode), XSD.writeNonNegativeIntegerTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'rtept': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender( '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.<string, Array.<string>>} * @type {Object.<string, Array.<string>>}
* @private * @private
*/ */
_ol_format_GPX_.RTEPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS( GPX.RTEPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [ GPX.NAMESPACE_URIS_, [
'ele', 'time' 'ele', 'time'
]); ]);
@@ -771,8 +771,8 @@ _ol_format_GPX_.RTEPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Array.<string>>} * @type {Object.<string, Array.<string>>}
* @private * @private
*/ */
_ol_format_GPX_.TRK_SEQUENCE_ = _ol_xml_.makeStructureNS( GPX.TRK_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [ GPX.NAMESPACE_URIS_, [
'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'trkseg' 'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'trkseg'
]); ]);
@@ -782,18 +782,18 @@ _ol_format_GPX_.TRK_SEQUENCE_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GPX_.TRK_SERIALIZERS_ = _ol_xml_.makeStructureNS( GPX.TRK_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_), 'link': _ol_xml_.makeChildAppender(GPX.writeLink_),
'number': _ol_xml_.makeChildAppender( 'number': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode), XSD.writeNonNegativeIntegerTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'trkseg': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender( '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)} * @type {function(*, Array.<*>, string=): (Node|undefined)}
* @private * @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.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GPX_.TRKSEG_SERIALIZERS_ = _ol_xml_.makeStructureNS( GPX.TRKSEG_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'trkpt': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeWptType_) 'trkpt': _ol_xml_.makeChildAppender(GPX.writeWptType_)
}); });
@@ -821,8 +821,8 @@ _ol_format_GPX_.TRKSEG_SERIALIZERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Array.<string>>} * @type {Object.<string, Array.<string>>}
* @private * @private
*/ */
_ol_format_GPX_.WPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS( GPX.WPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, [ GPX.NAMESPACE_URIS_, [
'ele', 'time', 'magvar', 'geoidheight', 'name', 'cmt', 'desc', 'src', 'ele', 'time', 'magvar', 'geoidheight', 'name', 'cmt', 'desc', 'src',
'link', 'sym', 'type', 'fix', 'sat', 'hdop', 'vdop', 'pdop', 'link', 'sym', 'type', 'fix', 'sat', 'hdop', 'vdop', 'pdop',
'ageofdgpsdata', 'dgpsid' 'ageofdgpsdata', 'dgpsid'
@@ -833,30 +833,30 @@ _ol_format_GPX_.WPT_TYPE_SEQUENCE_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GPX_.WPT_TYPE_SERIALIZERS_ = _ol_xml_.makeStructureNS( GPX.WPT_TYPE_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'ele': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), 'ele': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
'time': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDateTimeTextNode), 'time': _ol_xml_.makeChildAppender(XSD.writeDateTimeTextNode),
'magvar': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), 'magvar': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
'geoidheight': _ol_xml_.makeChildAppender( 'geoidheight': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeDecimalTextNode), XSD.writeDecimalTextNode),
'name': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'cmt': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'desc': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'src': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'link': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeLink_), 'link': _ol_xml_.makeChildAppender(GPX.writeLink_),
'sym': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'sym': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'type': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'fix': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'fix': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
'sat': _ol_xml_.makeChildAppender( 'sat': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeNonNegativeIntegerTextNode), XSD.writeNonNegativeIntegerTextNode),
'hdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), 'hdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
'vdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), 'vdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
'pdop': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeDecimalTextNode), 'pdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
'ageofdgpsdata': _ol_xml_.makeChildAppender( 'ageofdgpsdata': _ol_xml_.makeChildAppender(
_ol_format_XSD_.writeDecimalTextNode), XSD.writeDecimalTextNode),
'dgpsid': _ol_xml_.makeChildAppender( '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.<string, string>} * @type {Object.<string, string>}
* @private * @private
*/ */
_ol_format_GPX_.GEOMETRY_TYPE_TO_NODENAME_ = { GPX.GEOMETRY_TYPE_TO_NODENAME_ = {
'Point': 'wpt', 'Point': 'wpt',
'LineString': 'rte', 'LineString': 'rte',
'MultiLineString': 'trk' 'MultiLineString': 'trk'
@@ -880,10 +880,10 @@ _ol_format_GPX_.GEOMETRY_TYPE_TO_NODENAME_ = {
* @return {Node|undefined} Node. * @return {Node|undefined} Node.
* @private * @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(); var geometry = /** @type {ol.Feature} */ (value).getGeometry();
if (geometry) { if (geometry) {
var nodeName = _ol_format_GPX_.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()]; var nodeName = GPX.GEOMETRY_TYPE_TO_NODENAME_[geometry.getType()];
if (nodeName) { if (nodeName) {
var parentNode = objectStack[objectStack.length - 1].node; var parentNode = objectStack[objectStack.length - 1].node;
return _ol_xml_.createElementNS(parentNode.namespaceURI, nodeName); return _ol_xml_.createElementNS(parentNode.namespaceURI, nodeName);
@@ -897,11 +897,11 @@ _ol_format_GPX_.GPX_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GPX_.GPX_SERIALIZERS_ = _ol_xml_.makeStructureNS( GPX.GPX_SERIALIZERS_ = _ol_xml_.makeStructureNS(
_ol_format_GPX_.NAMESPACE_URIS_, { GPX.NAMESPACE_URIS_, {
'rte': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeRte_), 'rte': _ol_xml_.makeChildAppender(GPX.writeRte_),
'trk': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeTrk_), 'trk': _ol_xml_.makeChildAppender(GPX.writeTrk_),
'wpt': _ol_xml_.makeChildAppender(_ol_format_GPX_.writeWpt_) 'wpt': _ol_xml_.makeChildAppender(GPX.writeWpt_)
}); });
@@ -916,7 +916,7 @@ _ol_format_GPX_.GPX_SERIALIZERS_ = _ol_xml_.makeStructureNS(
* @return {string} Result. * @return {string} Result.
* @api * @api
*/ */
_ol_format_GPX_.prototype.writeFeatures; GPX.prototype.writeFeatures;
/** /**
@@ -930,7 +930,7 @@ _ol_format_GPX_.prototype.writeFeatures;
* @override * @override
* @api * @api
*/ */
_ol_format_GPX_.prototype.writeFeaturesNode = function(features, opt_options) { GPX.prototype.writeFeaturesNode = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
//FIXME Serialize metadata //FIXME Serialize metadata
var gpx = _ol_xml_.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx'); 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'; var xmlSchemaInstanceUri = 'http://www.w3.org/2001/XMLSchema-instance';
_ol_xml_.setAttributeNS(gpx, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri); _ol_xml_.setAttributeNS(gpx, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri);
_ol_xml_.setAttributeNS(gpx, xmlSchemaInstanceUri, 'xsi:schemaLocation', _ol_xml_.setAttributeNS(gpx, xmlSchemaInstanceUri, 'xsi:schemaLocation',
_ol_format_GPX_.SCHEMA_LOCATION_); GPX.SCHEMA_LOCATION_);
gpx.setAttribute('version', '1.1'); gpx.setAttribute('version', '1.1');
gpx.setAttribute('creator', 'OpenLayers'); gpx.setAttribute('creator', 'OpenLayers');
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: gpx}), _ol_format_GPX_.GPX_SERIALIZERS_, ({node: gpx}), GPX.GPX_SERIALIZERS_,
_ol_format_GPX_.GPX_NODE_FACTORY_, features, [opt_options]); GPX.GPX_NODE_FACTORY_, features, [opt_options]);
return gpx; return gpx;
}; };
export default _ol_format_GPX_; export default GPX;
+64 -64
View File
@@ -7,8 +7,8 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_asserts_ from '../asserts.js'; import _ol_asserts_ from '../asserts.js';
import _ol_Feature_ from '../Feature.js'; import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js'; import FeatureFormat from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js'; import JSONFeature from '../format/JSONFeature.js';
import GeometryCollection from '../geom/GeometryCollection.js'; import GeometryCollection from '../geom/GeometryCollection.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
import MultiLineString from '../geom/MultiLineString.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. * @param {olx.format.GeoJSONOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_format_GeoJSON_ = function(opt_options) { var GeoJSON = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
_ol_format_JSONFeature_.call(this); JSONFeature.call(this);
/** /**
* @inheritDoc * @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 * @private
* @return {ol.geom.Geometry} Geometry. * @return {ol.geom.Geometry} Geometry.
*/ */
_ol_format_GeoJSON_.readGeometry_ = function(object, opt_options) { GeoJSON.readGeometry_ = function(object, opt_options) {
if (!object) { if (!object) {
return null; return null;
} }
var geometryReader = _ol_format_GeoJSON_.GEOMETRY_READERS_[object.type]; var geometryReader = GeoJSON.GEOMETRY_READERS_[object.type];
return ( return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions( /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions(
geometryReader(object), false, opt_options) geometryReader(object), false, opt_options)
); );
}; };
@@ -89,7 +89,7 @@ _ol_format_GeoJSON_.readGeometry_ = function(object, opt_options) {
* @private * @private
* @return {ol.geom.GeometryCollection} Geometry collection. * @return {ol.geom.GeometryCollection} Geometry collection.
*/ */
_ol_format_GeoJSON_.readGeometryCollectionGeometry_ = function( GeoJSON.readGeometryCollectionGeometry_ = function(
object, opt_options) { object, opt_options) {
var geometries = object.geometries.map( var geometries = object.geometries.map(
/** /**
@@ -97,7 +97,7 @@ _ol_format_GeoJSON_.readGeometryCollectionGeometry_ = function(
* @return {ol.geom.Geometry} geometry Geometry. * @return {ol.geom.Geometry} geometry Geometry.
*/ */
function(geometry) { function(geometry) {
return _ol_format_GeoJSON_.readGeometry_(geometry, opt_options); return GeoJSON.readGeometry_(geometry, opt_options);
}); });
return new GeometryCollection(geometries); return new GeometryCollection(geometries);
}; };
@@ -108,7 +108,7 @@ _ol_format_GeoJSON_.readGeometryCollectionGeometry_ = function(
* @private * @private
* @return {ol.geom.Point} Point. * @return {ol.geom.Point} Point.
*/ */
_ol_format_GeoJSON_.readPointGeometry_ = function(object) { GeoJSON.readPointGeometry_ = function(object) {
return new Point(object.coordinates); return new Point(object.coordinates);
}; };
@@ -118,7 +118,7 @@ _ol_format_GeoJSON_.readPointGeometry_ = function(object) {
* @private * @private
* @return {ol.geom.LineString} LineString. * @return {ol.geom.LineString} LineString.
*/ */
_ol_format_GeoJSON_.readLineStringGeometry_ = function(object) { GeoJSON.readLineStringGeometry_ = function(object) {
return new LineString(object.coordinates); return new LineString(object.coordinates);
}; };
@@ -128,7 +128,7 @@ _ol_format_GeoJSON_.readLineStringGeometry_ = function(object) {
* @private * @private
* @return {ol.geom.MultiLineString} MultiLineString. * @return {ol.geom.MultiLineString} MultiLineString.
*/ */
_ol_format_GeoJSON_.readMultiLineStringGeometry_ = function(object) { GeoJSON.readMultiLineStringGeometry_ = function(object) {
return new MultiLineString(object.coordinates); return new MultiLineString(object.coordinates);
}; };
@@ -138,7 +138,7 @@ _ol_format_GeoJSON_.readMultiLineStringGeometry_ = function(object) {
* @private * @private
* @return {ol.geom.MultiPoint} MultiPoint. * @return {ol.geom.MultiPoint} MultiPoint.
*/ */
_ol_format_GeoJSON_.readMultiPointGeometry_ = function(object) { GeoJSON.readMultiPointGeometry_ = function(object) {
return new MultiPoint(object.coordinates); return new MultiPoint(object.coordinates);
}; };
@@ -148,7 +148,7 @@ _ol_format_GeoJSON_.readMultiPointGeometry_ = function(object) {
* @private * @private
* @return {ol.geom.MultiPolygon} MultiPolygon. * @return {ol.geom.MultiPolygon} MultiPolygon.
*/ */
_ol_format_GeoJSON_.readMultiPolygonGeometry_ = function(object) { GeoJSON.readMultiPolygonGeometry_ = function(object) {
return new MultiPolygon(object.coordinates); return new MultiPolygon(object.coordinates);
}; };
@@ -158,7 +158,7 @@ _ol_format_GeoJSON_.readMultiPolygonGeometry_ = function(object) {
* @private * @private
* @return {ol.geom.Polygon} Polygon. * @return {ol.geom.Polygon} Polygon.
*/ */
_ol_format_GeoJSON_.readPolygonGeometry_ = function(object) { GeoJSON.readPolygonGeometry_ = function(object) {
return new Polygon(object.coordinates); return new Polygon(object.coordinates);
}; };
@@ -169,10 +169,10 @@ _ol_format_GeoJSON_.readPolygonGeometry_ = function(object) {
* @private * @private
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry. * @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry.
*/ */
_ol_format_GeoJSON_.writeGeometry_ = function(geometry, opt_options) { GeoJSON.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = _ol_format_GeoJSON_.GEOMETRY_WRITERS_[geometry.getType()]; var geometryWriter = GeoJSON.GEOMETRY_WRITERS_[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */ ( return geometryWriter(/** @type {ol.geom.Geometry} */ (
_ol_format_Feature_.transformWithOptions(geometry, true, opt_options)), FeatureFormat.transformWithOptions(geometry, true, opt_options)),
opt_options); opt_options);
}; };
@@ -182,7 +182,7 @@ _ol_format_GeoJSON_.writeGeometry_ = function(geometry, opt_options) {
* @private * @private
* @return {GeoJSONGeometryCollection} Empty GeoJSON geometry collection. * @return {GeoJSONGeometryCollection} Empty GeoJSON geometry collection.
*/ */
_ol_format_GeoJSON_.writeEmptyGeometryCollectionGeometry_ = function(geometry) { GeoJSON.writeEmptyGeometryCollectionGeometry_ = function(geometry) {
return /** @type {GeoJSONGeometryCollection} */ ({ return /** @type {GeoJSONGeometryCollection} */ ({
type: 'GeometryCollection', type: 'GeometryCollection',
geometries: [] geometries: []
@@ -196,12 +196,12 @@ _ol_format_GeoJSON_.writeEmptyGeometryCollectionGeometry_ = function(geometry) {
* @private * @private
* @return {GeoJSONGeometryCollection} GeoJSON geometry collection. * @return {GeoJSONGeometryCollection} GeoJSON geometry collection.
*/ */
_ol_format_GeoJSON_.writeGeometryCollectionGeometry_ = function( GeoJSON.writeGeometryCollectionGeometry_ = function(
geometry, opt_options) { geometry, opt_options) {
var geometries = geometry.getGeometriesArray().map(function(geometry) { var geometries = geometry.getGeometriesArray().map(function(geometry) {
var options = _ol_obj_.assign({}, opt_options); var options = _ol_obj_.assign({}, opt_options);
delete options.featureProjection; delete options.featureProjection;
return _ol_format_GeoJSON_.writeGeometry_(geometry, options); return GeoJSON.writeGeometry_(geometry, options);
}); });
return /** @type {GeoJSONGeometryCollection} */ ({ return /** @type {GeoJSONGeometryCollection} */ ({
type: 'GeometryCollection', type: 'GeometryCollection',
@@ -216,7 +216,7 @@ _ol_format_GeoJSON_.writeGeometryCollectionGeometry_ = function(
* @private * @private
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
_ol_format_GeoJSON_.writeLineStringGeometry_ = function(geometry, opt_options) { GeoJSON.writeLineStringGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({ return /** @type {GeoJSONGeometry} */ ({
type: 'LineString', type: 'LineString',
coordinates: geometry.getCoordinates() coordinates: geometry.getCoordinates()
@@ -230,7 +230,7 @@ _ol_format_GeoJSON_.writeLineStringGeometry_ = function(geometry, opt_options) {
* @private * @private
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
_ol_format_GeoJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_options) { GeoJSON.writeMultiLineStringGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({ return /** @type {GeoJSONGeometry} */ ({
type: 'MultiLineString', type: 'MultiLineString',
coordinates: geometry.getCoordinates() coordinates: geometry.getCoordinates()
@@ -244,7 +244,7 @@ _ol_format_GeoJSON_.writeMultiLineStringGeometry_ = function(geometry, opt_optio
* @private * @private
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
_ol_format_GeoJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) { GeoJSON.writeMultiPointGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({ return /** @type {GeoJSONGeometry} */ ({
type: 'MultiPoint', type: 'MultiPoint',
coordinates: geometry.getCoordinates() coordinates: geometry.getCoordinates()
@@ -258,7 +258,7 @@ _ol_format_GeoJSON_.writeMultiPointGeometry_ = function(geometry, opt_options) {
* @private * @private
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
_ol_format_GeoJSON_.writeMultiPolygonGeometry_ = function(geometry, opt_options) { GeoJSON.writeMultiPolygonGeometry_ = function(geometry, opt_options) {
var right; var right;
if (opt_options) { if (opt_options) {
right = opt_options.rightHanded; right = opt_options.rightHanded;
@@ -276,7 +276,7 @@ _ol_format_GeoJSON_.writeMultiPolygonGeometry_ = function(geometry, opt_options)
* @private * @private
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
_ol_format_GeoJSON_.writePointGeometry_ = function(geometry, opt_options) { GeoJSON.writePointGeometry_ = function(geometry, opt_options) {
return /** @type {GeoJSONGeometry} */ ({ return /** @type {GeoJSONGeometry} */ ({
type: 'Point', type: 'Point',
coordinates: geometry.getCoordinates() coordinates: geometry.getCoordinates()
@@ -290,7 +290,7 @@ _ol_format_GeoJSON_.writePointGeometry_ = function(geometry, opt_options) {
* @private * @private
* @return {GeoJSONGeometry} GeoJSON geometry. * @return {GeoJSONGeometry} GeoJSON geometry.
*/ */
_ol_format_GeoJSON_.writePolygonGeometry_ = function(geometry, opt_options) { GeoJSON.writePolygonGeometry_ = function(geometry, opt_options) {
var right; var right;
if (opt_options) { if (opt_options) {
right = opt_options.rightHanded; right = opt_options.rightHanded;
@@ -307,14 +307,14 @@ _ol_format_GeoJSON_.writePolygonGeometry_ = function(geometry, opt_options) {
* @private * @private
* @type {Object.<string, function(GeoJSONObject): ol.geom.Geometry>} * @type {Object.<string, function(GeoJSONObject): ol.geom.Geometry>}
*/ */
_ol_format_GeoJSON_.GEOMETRY_READERS_ = { GeoJSON.GEOMETRY_READERS_ = {
'Point': _ol_format_GeoJSON_.readPointGeometry_, 'Point': GeoJSON.readPointGeometry_,
'LineString': _ol_format_GeoJSON_.readLineStringGeometry_, 'LineString': GeoJSON.readLineStringGeometry_,
'Polygon': _ol_format_GeoJSON_.readPolygonGeometry_, 'Polygon': GeoJSON.readPolygonGeometry_,
'MultiPoint': _ol_format_GeoJSON_.readMultiPointGeometry_, 'MultiPoint': GeoJSON.readMultiPointGeometry_,
'MultiLineString': _ol_format_GeoJSON_.readMultiLineStringGeometry_, 'MultiLineString': GeoJSON.readMultiLineStringGeometry_,
'MultiPolygon': _ol_format_GeoJSON_.readMultiPolygonGeometry_, 'MultiPolygon': GeoJSON.readMultiPolygonGeometry_,
'GeometryCollection': _ol_format_GeoJSON_.readGeometryCollectionGeometry_ 'GeometryCollection': GeoJSON.readGeometryCollectionGeometry_
}; };
@@ -323,15 +323,15 @@ _ol_format_GeoJSON_.GEOMETRY_READERS_ = {
* @private * @private
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>} * @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (GeoJSONGeometry|GeoJSONGeometryCollection)>}
*/ */
_ol_format_GeoJSON_.GEOMETRY_WRITERS_ = { GeoJSON.GEOMETRY_WRITERS_ = {
'Point': _ol_format_GeoJSON_.writePointGeometry_, 'Point': GeoJSON.writePointGeometry_,
'LineString': _ol_format_GeoJSON_.writeLineStringGeometry_, 'LineString': GeoJSON.writeLineStringGeometry_,
'Polygon': _ol_format_GeoJSON_.writePolygonGeometry_, 'Polygon': GeoJSON.writePolygonGeometry_,
'MultiPoint': _ol_format_GeoJSON_.writeMultiPointGeometry_, 'MultiPoint': GeoJSON.writeMultiPointGeometry_,
'MultiLineString': _ol_format_GeoJSON_.writeMultiLineStringGeometry_, 'MultiLineString': GeoJSON.writeMultiLineStringGeometry_,
'MultiPolygon': _ol_format_GeoJSON_.writeMultiPolygonGeometry_, 'MultiPolygon': GeoJSON.writeMultiPolygonGeometry_,
'GeometryCollection': _ol_format_GeoJSON_.writeGeometryCollectionGeometry_, 'GeometryCollection': GeoJSON.writeGeometryCollectionGeometry_,
'Circle': _ol_format_GeoJSON_.writeEmptyGeometryCollectionGeometry_ 'Circle': GeoJSON.writeEmptyGeometryCollectionGeometry_
}; };
@@ -347,7 +347,7 @@ _ol_format_GeoJSON_.GEOMETRY_WRITERS_ = {
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
* @api * @api
*/ */
_ol_format_GeoJSON_.prototype.readFeature; GeoJSON.prototype.readFeature;
/** /**
@@ -361,13 +361,13 @@ _ol_format_GeoJSON_.prototype.readFeature;
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_GeoJSON_.prototype.readFeatures; GeoJSON.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_GeoJSON_.prototype.readFeatureFromObject = function( GeoJSON.prototype.readFeatureFromObject = function(
object, opt_options) { object, opt_options) {
/** /**
* @type {GeoJSONFeature} * @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_(); var feature = new _ol_Feature_();
if (this.geometryName_) { if (this.geometryName_) {
feature.setGeometryName(this.geometryName_); feature.setGeometryName(this.geometryName_);
@@ -403,7 +403,7 @@ _ol_format_GeoJSON_.prototype.readFeatureFromObject = function(
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_GeoJSON_.prototype.readFeaturesFromObject = function( GeoJSON.prototype.readFeaturesFromObject = function(
object, opt_options) { object, opt_options) {
var geoJSONObject = /** @type {GeoJSONObject} */ (object); var geoJSONObject = /** @type {GeoJSONObject} */ (object);
/** @type {Array.<ol.Feature>} */ /** @type {Array.<ol.Feature>} */
@@ -434,15 +434,15 @@ _ol_format_GeoJSON_.prototype.readFeaturesFromObject = function(
* @return {ol.geom.Geometry} Geometry. * @return {ol.geom.Geometry} Geometry.
* @api * @api
*/ */
_ol_format_GeoJSON_.prototype.readGeometry; GeoJSON.prototype.readGeometry;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_GeoJSON_.prototype.readGeometryFromObject = function( GeoJSON.prototype.readGeometryFromObject = function(
object, opt_options) { object, opt_options) {
return _ol_format_GeoJSON_.readGeometry_( return GeoJSON.readGeometry_(
/** @type {GeoJSONGeometry} */ (object), opt_options); /** @type {GeoJSONGeometry} */ (object), opt_options);
}; };
@@ -455,13 +455,13 @@ _ol_format_GeoJSON_.prototype.readGeometryFromObject = function(
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
* @api * @api
*/ */
_ol_format_GeoJSON_.prototype.readProjection; GeoJSON.prototype.readProjection;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_GeoJSON_.prototype.readProjectionFromObject = function(object) { GeoJSON.prototype.readProjectionFromObject = function(object) {
var geoJSONObject = /** @type {GeoJSONObject} */ (object); var geoJSONObject = /** @type {GeoJSONObject} */ (object);
var crs = geoJSONObject.crs; var crs = geoJSONObject.crs;
var projection; var projection;
@@ -488,7 +488,7 @@ _ol_format_GeoJSON_.prototype.readProjectionFromObject = function(object) {
* @override * @override
* @api * @api
*/ */
_ol_format_GeoJSON_.prototype.writeFeature; GeoJSON.prototype.writeFeature;
/** /**
@@ -500,7 +500,7 @@ _ol_format_GeoJSON_.prototype.writeFeature;
* @override * @override
* @api * @api
*/ */
_ol_format_GeoJSON_.prototype.writeFeatureObject = function(feature, opt_options) { GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
var object = /** @type {GeoJSONFeature} */ ({ var object = /** @type {GeoJSONFeature} */ ({
@@ -513,7 +513,7 @@ _ol_format_GeoJSON_.prototype.writeFeatureObject = function(feature, opt_options
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
object.geometry = object.geometry =
_ol_format_GeoJSON_.writeGeometry_(geometry, opt_options); GeoJSON.writeGeometry_(geometry, opt_options);
} else { } else {
object.geometry = null; object.geometry = null;
} }
@@ -537,7 +537,7 @@ _ol_format_GeoJSON_.prototype.writeFeatureObject = function(feature, opt_options
* @return {string} GeoJSON. * @return {string} GeoJSON.
* @api * @api
*/ */
_ol_format_GeoJSON_.prototype.writeFeatures; GeoJSON.prototype.writeFeatures;
/** /**
@@ -549,7 +549,7 @@ _ol_format_GeoJSON_.prototype.writeFeatures;
* @override * @override
* @api * @api
*/ */
_ol_format_GeoJSON_.prototype.writeFeaturesObject = function(features, opt_options) { GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
var objects = []; var objects = [];
var i, ii; var i, ii;
@@ -572,7 +572,7 @@ _ol_format_GeoJSON_.prototype.writeFeaturesObject = function(features, opt_optio
* @return {string} GeoJSON. * @return {string} GeoJSON.
* @api * @api
*/ */
_ol_format_GeoJSON_.prototype.writeGeometry; GeoJSON.prototype.writeGeometry;
/** /**
@@ -584,9 +584,9 @@ _ol_format_GeoJSON_.prototype.writeGeometry;
* @override * @override
* @api * @api
*/ */
_ol_format_GeoJSON_.prototype.writeGeometryObject = function(geometry, GeoJSON.prototype.writeGeometryObject = function(geometry,
opt_options) { opt_options) {
return _ol_format_GeoJSON_.writeGeometry_(geometry, return GeoJSON.writeGeometry_(geometry,
this.adaptOptions(opt_options)); this.adaptOptions(opt_options));
}; };
export default _ol_format_GeoJSON_; export default GeoJSON;
+24 -24
View File
@@ -3,9 +3,9 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.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_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 GeometryLayout from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
import {get as getProjection} from '../proj.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. * @param {olx.format.IGCOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_format_IGC_ = function(opt_options) { var IGC = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
_ol_format_TextFeature_.call(this); TextFeature.call(this);
/** /**
* @inheritDoc * @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} * @type {RegExp}
* @private * @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})/; /^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} * @type {RegExp}
* @private * @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} * @type {RegExp}
* @private * @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} * @type {RegExp}
* @private * @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. * @return {ol.Feature} Feature.
* @api * @api
*/ */
_ol_format_IGC_.prototype.readFeature; IGC.prototype.readFeature;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) { IGC.prototype.readFeatureFromText = function(text, opt_options) {
var altitudeMode = this.altitudeMode_; var altitudeMode = this.altitudeMode_;
var lines = text.split(_ol_format_IGC_.NEWLINE_RE_); var lines = text.split(IGC.NEWLINE_RE_);
/** @type {Object.<string, string>} */ /** @type {Object.<string, string>} */
var properties = {}; var properties = {};
var flatCoordinates = []; var flatCoordinates = [];
@@ -107,7 +107,7 @@ _ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) {
var line = lines[i]; var line = lines[i];
var m; var m;
if (line.charAt(0) == 'B') { if (line.charAt(0) == 'B') {
m = _ol_format_IGC_.B_RECORD_RE_.exec(line); m = IGC.B_RECORD_RE_.exec(line);
if (m) { if (m) {
var hour = parseInt(m[1], 10); var hour = parseInt(m[1], 10);
var minute = parseInt(m[2], 10); var minute = parseInt(m[2], 10);
@@ -141,13 +141,13 @@ _ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) {
lastDateTime = dateTime; lastDateTime = dateTime;
} }
} else if (line.charAt(0) == 'H') { } else if (line.charAt(0) == 'H') {
m = _ol_format_IGC_.HFDTE_RECORD_RE_.exec(line); m = IGC.HFDTE_RECORD_RE_.exec(line);
if (m) { if (m) {
day = parseInt(m[1], 10); day = parseInt(m[1], 10);
month = parseInt(m[2], 10) - 1; month = parseInt(m[2], 10) - 1;
year = 2000 + parseInt(m[3], 10); year = 2000 + parseInt(m[3], 10);
} else { } else {
m = _ol_format_IGC_.H_RECORD_RE_.exec(line); m = IGC.H_RECORD_RE_.exec(line);
if (m) { if (m) {
properties[m[1]] = m[2].trim(); 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 ? var layout = altitudeMode == _ol_format_IGCZ_.NONE ?
GeometryLayout.XYM : GeometryLayout.XYZM; GeometryLayout.XYM : GeometryLayout.XYZM;
lineString.setFlatCoordinates(layout, flatCoordinates); lineString.setFlatCoordinates(layout, flatCoordinates);
var feature = new _ol_Feature_(_ol_format_Feature_.transformWithOptions( var feature = new _ol_Feature_(FeatureFormat.transformWithOptions(
lineString, false, opt_options)); lineString, false, opt_options));
feature.setProperties(properties); feature.setProperties(properties);
return feature; return feature;
@@ -178,13 +178,13 @@ _ol_format_IGC_.prototype.readFeatureFromText = function(text, opt_options) {
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_IGC_.prototype.readFeatures; IGC.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_IGC_.prototype.readFeaturesFromText = function(text, opt_options) { IGC.prototype.readFeaturesFromText = function(text, opt_options) {
var feature = this.readFeatureFromText(text, opt_options); var feature = this.readFeatureFromText(text, opt_options);
if (feature) { if (feature) {
return [feature]; return [feature];
@@ -202,33 +202,33 @@ _ol_format_IGC_.prototype.readFeaturesFromText = function(text, opt_options) {
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
* @api * @api
*/ */
_ol_format_IGC_.prototype.readProjection; IGC.prototype.readProjection;
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_IGC_.prototype.writeFeatureText = function(feature, opt_options) {}; IGC.prototype.writeFeatureText = function(feature, opt_options) {};
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_IGC_.prototype.writeFeaturesText = function(features, opt_options) {}; IGC.prototype.writeFeaturesText = function(features, opt_options) {};
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_IGC_.prototype.writeGeometryText = function(geometry, opt_options) {}; IGC.prototype.writeGeometryText = function(geometry, opt_options) {};
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_IGC_.prototype.readGeometryFromText = function(text, opt_options) {}; IGC.prototype.readGeometryFromText = function(text, opt_options) {};
export default _ol_format_IGC_; export default IGC;
+21 -21
View File
@@ -2,7 +2,7 @@
* @module ol/format/JSONFeature * @module ol/format/JSONFeature
*/ */
import {inherits} from '../index.js'; 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'; import _ol_format_FormatType_ from '../format/FormatType.js';
/** /**
@@ -15,11 +15,11 @@ import _ol_format_FormatType_ from '../format/FormatType.js';
* @abstract * @abstract
* @extends {ol.format.Feature} * @extends {ol.format.Feature}
*/ */
var _ol_format_JSONFeature_ = function() { var JSONFeature = function() {
_ol_format_Feature_.call(this); 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 * @private
* @return {Object} Object. * @return {Object} Object.
*/ */
_ol_format_JSONFeature_.prototype.getObject_ = function(source) { JSONFeature.prototype.getObject_ = function(source) {
if (typeof source === 'string') { if (typeof source === 'string') {
var object = JSON.parse(source); var object = JSON.parse(source);
return object ? /** @type {Object} */ (object) : null; return object ? /** @type {Object} */ (object) : null;
@@ -42,7 +42,7 @@ _ol_format_JSONFeature_.prototype.getObject_ = function(source) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_JSONFeature_.prototype.getType = function() { JSONFeature.prototype.getType = function() {
return _ol_format_FormatType_.JSON; return _ol_format_FormatType_.JSON;
}; };
@@ -50,7 +50,7 @@ _ol_format_JSONFeature_.prototype.getType = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_JSONFeature_.prototype.readFeature = function(source, opt_options) { JSONFeature.prototype.readFeature = function(source, opt_options) {
return this.readFeatureFromObject( return this.readFeatureFromObject(
this.getObject_(source), this.getReadOptions(source, opt_options)); this.getObject_(source), this.getReadOptions(source, opt_options));
}; };
@@ -59,7 +59,7 @@ _ol_format_JSONFeature_.prototype.readFeature = function(source, opt_options) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_JSONFeature_.prototype.readFeatures = function(source, opt_options) { JSONFeature.prototype.readFeatures = function(source, opt_options) {
return this.readFeaturesFromObject( return this.readFeaturesFromObject(
this.getObject_(source), this.getReadOptions(source, opt_options)); this.getObject_(source), this.getReadOptions(source, opt_options));
}; };
@@ -72,7 +72,7 @@ _ol_format_JSONFeature_.prototype.readFeatures = function(source, opt_options) {
* @protected * @protected
* @return {ol.Feature} Feature. * @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 * @protected
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
*/ */
_ol_format_JSONFeature_.prototype.readFeaturesFromObject = function(object, opt_options) {}; JSONFeature.prototype.readFeaturesFromObject = function(object, opt_options) {};
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_JSONFeature_.prototype.readGeometry = function(source, opt_options) { JSONFeature.prototype.readGeometry = function(source, opt_options) {
return this.readGeometryFromObject( return this.readGeometryFromObject(
this.getObject_(source), this.getReadOptions(source, opt_options)); this.getObject_(source), this.getReadOptions(source, opt_options));
}; };
@@ -101,13 +101,13 @@ _ol_format_JSONFeature_.prototype.readGeometry = function(source, opt_options) {
* @protected * @protected
* @return {ol.geom.Geometry} Geometry. * @return {ol.geom.Geometry} Geometry.
*/ */
_ol_format_JSONFeature_.prototype.readGeometryFromObject = function(object, opt_options) {}; JSONFeature.prototype.readGeometryFromObject = function(object, opt_options) {};
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_JSONFeature_.prototype.readProjection = function(source) { JSONFeature.prototype.readProjection = function(source) {
return this.readProjectionFromObject(this.getObject_(source)); return this.readProjectionFromObject(this.getObject_(source));
}; };
@@ -118,13 +118,13 @@ _ol_format_JSONFeature_.prototype.readProjection = function(source) {
* @protected * @protected
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
*/ */
_ol_format_JSONFeature_.prototype.readProjectionFromObject = function(object) {}; JSONFeature.prototype.readProjectionFromObject = function(object) {};
/** /**
* @inheritDoc * @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)); 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. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Object} Object. * @return {Object} Object.
*/ */
_ol_format_JSONFeature_.prototype.writeFeatureObject = function(feature, opt_options) {}; JSONFeature.prototype.writeFeatureObject = function(feature, opt_options) {};
/** /**
* @inheritDoc * @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)); 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. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Object} Object. * @return {Object} Object.
*/ */
_ol_format_JSONFeature_.prototype.writeFeaturesObject = function(features, opt_options) {}; JSONFeature.prototype.writeFeaturesObject = function(features, opt_options) {};
/** /**
* @inheritDoc * @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)); 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. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {Object} Object. * @return {Object} Object.
*/ */
_ol_format_JSONFeature_.prototype.writeGeometryObject = function(geometry, opt_options) {}; JSONFeature.prototype.writeGeometryObject = function(geometry, opt_options) {};
export default _ol_format_JSONFeature_; export default JSONFeature;
+511 -516
View File
File diff suppressed because it is too large Load Diff
+27 -27
View File
@@ -6,7 +6,7 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_asserts_ from '../asserts.js'; import _ol_asserts_ from '../asserts.js';
import PBF from 'pbf'; 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 _ol_format_FormatType_ from '../format/FormatType.js';
import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryLayout from '../geom/GeometryLayout.js';
import GeometryType from '../geom/GeometryType.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. * @param {olx.format.MVTOptions=} opt_options Options.
* @api * @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 : {}; 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. * Reader callbacks for parsing the PBF.
* @type {Object.<string, function(number, Object, ol.ext.PBF)>} * @type {Object.<string, function(number, Object, ol.ext.PBF)>}
*/ */
_ol_format_MVT_.pbfReaders_ = { MVT.pbfReaders_ = {
layers: function(tag, layers, pbf) { layers: function(tag, layers, pbf) {
if (tag === 3) { if (tag === 3) {
var layer = { var layer = {
@@ -95,7 +95,7 @@ _ol_format_MVT_.pbfReaders_ = {
features: [] features: []
}; };
var end = pbf.readVarint() + pbf.pos; 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; layer.length = layer.features.length;
if (layer.length) { if (layer.length) {
layers[layer.name] = layer; 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. * @param {number} i Index of the feature in the raw layer's `features` array.
* @return {Object} Raw feature. * @return {Object} Raw feature.
*/ */
_ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) { MVT.readRawFeature_ = function(pbf, layer, i) {
pbf.pos = layer.features[i]; pbf.pos = layer.features[i];
var end = pbf.readVarint() + pbf.pos; var end = pbf.readVarint() + pbf.pos;
@@ -166,7 +166,7 @@ _ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) {
type: 0, type: 0,
properties: {} properties: {}
}; };
pbf.readFields(_ol_format_MVT_.pbfReaders_.feature, feature, end); pbf.readFields(MVT.pbfReaders_.feature, feature, end);
return feature; return feature;
}; };
@@ -181,7 +181,7 @@ _ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) {
* @param {Array.<number>} flatCoordinates Array to store flat coordinates in. * @param {Array.<number>} flatCoordinates Array to store flat coordinates in.
* @param {Array.<number>} ends Array to store ends in. * @param {Array.<number>} 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; pbf.pos = feature.geometry;
var end = pbf.readVarint() + pbf.pos; var end = pbf.readVarint() + pbf.pos;
@@ -245,7 +245,7 @@ _ol_format_MVT_.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends)
* geometry. * geometry.
* @return {ol.geom.GeometryType} The geometry type. * @return {ol.geom.GeometryType} The geometry type.
*/ */
_ol_format_MVT_.getGeometryType_ = function(type, numEnds) { MVT.getGeometryType_ = function(type, numEnds) {
/** @type {ol.geom.GeometryType} */ /** @type {ol.geom.GeometryType} */
var geometryType; var geometryType;
if (type === 1) { if (type === 1) {
@@ -270,7 +270,7 @@ _ol_format_MVT_.getGeometryType_ = function(type, numEnds) {
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature|ol.render.Feature} Feature. * @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; var type = rawFeature.type;
if (type === 0) { if (type === 0) {
return null; return null;
@@ -283,9 +283,9 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options
var flatCoordinates = []; var flatCoordinates = [];
var ends = []; 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_) { if (this.featureClass_ === _ol_render_Feature_) {
feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id); 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_) { if (this.geometryName_) {
feature.setGeometryName(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.setGeometry(geometry);
feature.setId(id); feature.setId(id);
feature.setProperties(values); feature.setProperties(values);
@@ -336,7 +336,7 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_format_MVT_.prototype.getLastExtent = function() { MVT.prototype.getLastExtent = function() {
return this.extent_; return this.extent_;
}; };
@@ -344,7 +344,7 @@ _ol_format_MVT_.prototype.getLastExtent = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_MVT_.prototype.getType = function() { MVT.prototype.getType = function() {
return _ol_format_FormatType_.ARRAY_BUFFER; return _ol_format_FormatType_.ARRAY_BUFFER;
}; };
@@ -353,11 +353,11 @@ _ol_format_MVT_.prototype.getType = function() {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_format_MVT_.prototype.readFeatures = function(source, opt_options) { MVT.prototype.readFeatures = function(source, opt_options) {
var layers = this.layers_; var layers = this.layers_;
var pbf = new PBF(/** @type {ArrayBuffer} */ (source)); 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.<ol.Feature|ol.render.Feature>} */ /** @type {Array.<ol.Feature|ol.render.Feature>} */
var features = []; var features = [];
var pbfLayer; var pbfLayer;
@@ -369,7 +369,7 @@ _ol_format_MVT_.prototype.readFeatures = function(source, opt_options) {
var rawFeature; var rawFeature;
for (var i = 0, ii = pbfLayer.length; i < ii; ++i) { 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)); features.push(this.createFeature_(pbf, rawFeature));
} }
this.extent_ = pbfLayer ? [0, 0, pbfLayer.extent, pbfLayer.extent] : null; this.extent_ = pbfLayer ? [0, 0, pbfLayer.extent, pbfLayer.extent] : null;
@@ -383,7 +383,7 @@ _ol_format_MVT_.prototype.readFeatures = function(source, opt_options) {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_format_MVT_.prototype.readProjection = function(source) { MVT.prototype.readProjection = function(source) {
return this.defaultDataProjection; return this.defaultDataProjection;
}; };
@@ -393,7 +393,7 @@ _ol_format_MVT_.prototype.readProjection = function(source) {
* @param {Array.<string>} layers Layers. * @param {Array.<string>} layers Layers.
* @api * @api
*/ */
_ol_format_MVT_.prototype.setLayers = function(layers) { MVT.prototype.setLayers = function(layers) {
this.layers_ = layers; this.layers_ = layers;
}; };
@@ -402,33 +402,33 @@ _ol_format_MVT_.prototype.setLayers = function(layers) {
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_MVT_.prototype.readFeature = function() {}; MVT.prototype.readFeature = function() {};
/** /**
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_MVT_.prototype.readGeometry = function() {}; MVT.prototype.readGeometry = function() {};
/** /**
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_MVT_.prototype.writeFeature = function() {}; MVT.prototype.writeFeature = function() {};
/** /**
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_MVT_.prototype.writeGeometry = function() {}; MVT.prototype.writeGeometry = function() {};
/** /**
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_MVT_.prototype.writeFeatures = function() {}; MVT.prototype.writeFeatures = function() {};
export default _ol_format_MVT_; export default MVT;
+33 -33
View File
@@ -5,8 +5,8 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_array_ from '../array.js'; import _ol_array_ from '../array.js';
import _ol_Feature_ from '../Feature.js'; import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js'; import FeatureFormat from '../format/Feature.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; import XMLFeature from '../format/XMLFeature.js';
import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryLayout from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
import Point from '../geom/Point.js'; import Point from '../geom/Point.js';
@@ -24,8 +24,8 @@ import _ol_xml_ from '../xml.js';
* @extends {ol.format.XMLFeature} * @extends {ol.format.XMLFeature}
* @api * @api
*/ */
var _ol_format_OSMXML_ = function() { var OSMXML = function() {
_ol_format_XMLFeature_.call(this); XMLFeature.call(this);
/** /**
* @inheritDoc * @inheritDoc
@@ -33,7 +33,7 @@ var _ol_format_OSMXML_ = function() {
this.defaultDataProjection = getProjection('EPSG:4326'); 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. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_OSMXML_.readNode_ = function(node, objectStack) { OSMXML.readNode_ = function(node, objectStack) {
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]); var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var id = node.getAttribute('id'); var id = node.getAttribute('id');
@@ -54,10 +54,10 @@ _ol_format_OSMXML_.readNode_ = function(node, objectStack) {
var values = _ol_xml_.pushParseAndPop({ var values = _ol_xml_.pushParseAndPop({
tags: {} tags: {}
}, _ol_format_OSMXML_.NODE_PARSERS_, node, objectStack); }, OSMXML.NODE_PARSERS_, node, objectStack);
if (!_ol_obj_.isEmpty(values.tags)) { if (!_ol_obj_.isEmpty(values.tags)) {
var geometry = new Point(coordinates); var geometry = new Point(coordinates);
_ol_format_Feature_.transformWithOptions(geometry, false, options); FeatureFormat.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry); var feature = new _ol_Feature_(geometry);
feature.setId(id); feature.setId(id);
feature.setProperties(values.tags); feature.setProperties(values.tags);
@@ -71,13 +71,13 @@ _ol_format_OSMXML_.readNode_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_OSMXML_.readWay_ = function(node, objectStack) { OSMXML.readWay_ = function(node, objectStack) {
var id = node.getAttribute('id'); var id = node.getAttribute('id');
var values = _ol_xml_.pushParseAndPop({ var values = _ol_xml_.pushParseAndPop({
id: id, id: id,
ndrefs: [], ndrefs: [],
tags: {} tags: {}
}, _ol_format_OSMXML_.WAY_PARSERS_, node, objectStack); }, OSMXML.WAY_PARSERS_, node, objectStack);
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]); var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
state.ways.push(values); state.ways.push(values);
}; };
@@ -88,7 +88,7 @@ _ol_format_OSMXML_.readWay_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_OSMXML_.readNd_ = function(node, objectStack) { OSMXML.readNd_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
values.ndrefs.push(node.getAttribute('ref')); values.ndrefs.push(node.getAttribute('ref'));
}; };
@@ -99,7 +99,7 @@ _ol_format_OSMXML_.readNd_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_OSMXML_.readTag_ = function(node, objectStack) { OSMXML.readTag_ = function(node, objectStack) {
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
values.tags[node.getAttribute('k')] = node.getAttribute('v'); values.tags[node.getAttribute('k')] = node.getAttribute('v');
}; };
@@ -110,7 +110,7 @@ _ol_format_OSMXML_.readTag_ = function(node, objectStack) {
* @private * @private
* @type {Array.<string>} * @type {Array.<string>}
*/ */
_ol_format_OSMXML_.NAMESPACE_URIS_ = [ OSMXML.NAMESPACE_URIS_ = [
null null
]; ];
@@ -120,10 +120,10 @@ _ol_format_OSMXML_.NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OSMXML_.WAY_PARSERS_ = _ol_xml_.makeStructureNS( OSMXML.WAY_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OSMXML_.NAMESPACE_URIS_, { OSMXML.NAMESPACE_URIS_, {
'nd': _ol_format_OSMXML_.readNd_, 'nd': OSMXML.readNd_,
'tag': _ol_format_OSMXML_.readTag_ 'tag': OSMXML.readTag_
}); });
@@ -132,10 +132,10 @@ _ol_format_OSMXML_.WAY_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OSMXML_.PARSERS_ = _ol_xml_.makeStructureNS( OSMXML.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OSMXML_.NAMESPACE_URIS_, { OSMXML.NAMESPACE_URIS_, {
'node': _ol_format_OSMXML_.readNode_, 'node': OSMXML.readNode_,
'way': _ol_format_OSMXML_.readWay_ 'way': OSMXML.readWay_
}); });
@@ -144,9 +144,9 @@ _ol_format_OSMXML_.PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OSMXML_.NODE_PARSERS_ = _ol_xml_.makeStructureNS( OSMXML.NODE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OSMXML_.NAMESPACE_URIS_, { OSMXML.NAMESPACE_URIS_, {
'tag': _ol_format_OSMXML_.readTag_ 'tag': OSMXML.readTag_
}); });
@@ -159,20 +159,20 @@ _ol_format_OSMXML_.NODE_PARSERS_ = _ol_xml_.makeStructureNS(
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_OSMXML_.prototype.readFeatures; OSMXML.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_OSMXML_.prototype.readFeaturesFromNode = function(node, opt_options) { OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
var options = this.getReadOptions(node, opt_options); var options = this.getReadOptions(node, opt_options);
if (node.localName == 'osm') { if (node.localName == 'osm') {
var state = _ol_xml_.pushParseAndPop({ var state = _ol_xml_.pushParseAndPop({
nodes: {}, nodes: {},
ways: [], ways: [],
features: [] features: []
}, _ol_format_OSMXML_.PARSERS_, node, [options]); }, OSMXML.PARSERS_, node, [options]);
// parse nodes in ways // parse nodes in ways
for (var j = 0; j < state.ways.length; j++) { for (var j = 0; j < state.ways.length; j++) {
var values = /** @type {Object} */ (state.ways[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 = new LineString(null);
geometry.setFlatCoordinates(GeometryLayout.XY, flatCoordinates); geometry.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
} }
_ol_format_Feature_.transformWithOptions(geometry, false, options); FeatureFormat.transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry); var feature = new _ol_Feature_(geometry);
feature.setId(values.id); feature.setId(values.id);
feature.setProperties(values.tags); feature.setProperties(values.tags);
@@ -214,26 +214,26 @@ _ol_format_OSMXML_.prototype.readFeaturesFromNode = function(node, opt_options)
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
* @api * @api
*/ */
_ol_format_OSMXML_.prototype.readProjection; OSMXML.prototype.readProjection;
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_OSMXML_.prototype.writeFeatureNode = function(feature, opt_options) {}; OSMXML.prototype.writeFeatureNode = function(feature, opt_options) {};
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_OSMXML_.prototype.writeFeaturesNode = function(features, opt_options) {}; OSMXML.prototype.writeFeaturesNode = function(features, opt_options) {};
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_OSMXML_.prototype.writeGeometryNode = function(geometry, opt_options) {}; OSMXML.prototype.writeGeometryNode = function(geometry, opt_options) {};
export default _ol_format_OSMXML_; export default OSMXML;
+100 -100
View File
@@ -2,26 +2,26 @@
* @module ol/format/OWS * @module ol/format/OWS
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_format_XLink_ from '../format/XLink.js'; import XLink from '../format/XLink.js';
import _ol_format_XML_ from '../format/XML.js'; import XML from '../format/XML.js';
import _ol_format_XSD_ from '../format/XSD.js'; import XSD from '../format/XSD.js';
import _ol_xml_ from '../xml.js'; import _ol_xml_ from '../xml.js';
/** /**
* @constructor * @constructor
* @extends {ol.format.XML} * @extends {ol.format.XML}
*/ */
var _ol_format_OWS_ = function() { var OWS = function() {
_ol_format_XML_.call(this); XML.call(this);
}; };
inherits(_ol_format_OWS_, _ol_format_XML_); inherits(OWS, XML);
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_OWS_.prototype.readFromDocument = function(doc) { OWS.prototype.readFromDocument = function(doc) {
for (var n = doc.firstChild; n; n = n.nextSibling) { for (var n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) { if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n); return this.readFromNode(n);
@@ -34,9 +34,9 @@ _ol_format_OWS_.prototype.readFromDocument = function(doc) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_OWS_.prototype.readFromNode = function(node) { OWS.prototype.readFromNode = function(node) {
var owsObject = _ol_xml_.pushParseAndPop({}, var owsObject = _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.PARSERS_, node, []); OWS.PARSERS_, node, []);
return owsObject ? owsObject : null; return owsObject ? owsObject : null;
}; };
@@ -47,9 +47,9 @@ _ol_format_OWS_.prototype.readFromNode = function(node) {
* @private * @private
* @return {Object|undefined} The address. * @return {Object|undefined} The address.
*/ */
_ol_format_OWS_.readAddress_ = function(node, objectStack) { OWS.readAddress_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, 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 * @private
* @return {Object|undefined} The values. * @return {Object|undefined} The values.
*/ */
_ol_format_OWS_.readAllowedValues_ = function(node, objectStack) { OWS.readAllowedValues_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, 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 * @private
* @return {Object|undefined} The constraint. * @return {Object|undefined} The constraint.
*/ */
_ol_format_OWS_.readConstraint_ = function(node, objectStack) { OWS.readConstraint_ = function(node, objectStack) {
var name = node.getAttribute('name'); var name = node.getAttribute('name');
if (!name) { if (!name) {
return undefined; return undefined;
} }
return _ol_xml_.pushParseAndPop({'name': name}, return _ol_xml_.pushParseAndPop({'name': name},
_ol_format_OWS_.CONSTRAINT_PARSERS_, node, OWS.CONSTRAINT_PARSERS_, node,
objectStack); objectStack);
}; };
@@ -88,9 +88,9 @@ _ol_format_OWS_.readConstraint_ = function(node, objectStack) {
* @private * @private
* @return {Object|undefined} The contact info. * @return {Object|undefined} The contact info.
*/ */
_ol_format_OWS_.readContactInfo_ = function(node, objectStack) { OWS.readContactInfo_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, 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 * @private
* @return {Object|undefined} The DCP. * @return {Object|undefined} The DCP.
*/ */
_ol_format_OWS_.readDcp_ = function(node, objectStack) { OWS.readDcp_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, 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 * @private
* @return {Object|undefined} The GET object. * @return {Object|undefined} The GET object.
*/ */
_ol_format_OWS_.readGet_ = function(node, objectStack) { OWS.readGet_ = function(node, objectStack) {
var href = _ol_format_XLink_.readHref(node); var href = XLink.readHref(node);
if (!href) { if (!href) {
return undefined; return undefined;
} }
return _ol_xml_.pushParseAndPop({'href': href}, 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 * @private
* @return {Object|undefined} The HTTP object. * @return {Object|undefined} The HTTP object.
*/ */
_ol_format_OWS_.readHttp_ = function(node, objectStack) { OWS.readHttp_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, _ol_format_OWS_.HTTP_PARSERS_, return _ol_xml_.pushParseAndPop({}, OWS.HTTP_PARSERS_,
node, objectStack); node, objectStack);
}; };
@@ -140,10 +140,10 @@ _ol_format_OWS_.readHttp_ = function(node, objectStack) {
* @private * @private
* @return {Object|undefined} The operation. * @return {Object|undefined} The operation.
*/ */
_ol_format_OWS_.readOperation_ = function(node, objectStack) { OWS.readOperation_ = function(node, objectStack) {
var name = node.getAttribute('name'); var name = node.getAttribute('name');
var value = _ol_xml_.pushParseAndPop({}, var value = _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.OPERATION_PARSERS_, node, objectStack); OWS.OPERATION_PARSERS_, node, objectStack);
if (!value) { if (!value) {
return undefined; return undefined;
} }
@@ -159,10 +159,10 @@ _ol_format_OWS_.readOperation_ = function(node, objectStack) {
* @private * @private
* @return {Object|undefined} The operations metadata. * @return {Object|undefined} The operations metadata.
*/ */
_ol_format_OWS_.readOperationsMetadata_ = function(node, OWS.readOperationsMetadata_ = function(node,
objectStack) { objectStack) {
return _ol_xml_.pushParseAndPop({}, return _ol_xml_.pushParseAndPop({},
_ol_format_OWS_.OPERATIONS_METADATA_PARSERS_, node, OWS.OPERATIONS_METADATA_PARSERS_, node,
objectStack); objectStack);
}; };
@@ -173,9 +173,9 @@ _ol_format_OWS_.readOperationsMetadata_ = function(node,
* @private * @private
* @return {Object|undefined} The phone. * @return {Object|undefined} The phone.
*/ */
_ol_format_OWS_.readPhone_ = function(node, objectStack) { OWS.readPhone_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop({}, 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 * @private
* @return {Object|undefined} The service identification. * @return {Object|undefined} The service identification.
*/ */
_ol_format_OWS_.readServiceIdentification_ = function(node, OWS.readServiceIdentification_ = function(node,
objectStack) { objectStack) {
return _ol_xml_.pushParseAndPop( return _ol_xml_.pushParseAndPop(
{}, _ol_format_OWS_.SERVICE_IDENTIFICATION_PARSERS_, node, {}, OWS.SERVICE_IDENTIFICATION_PARSERS_, node,
objectStack); objectStack);
}; };
@@ -199,9 +199,9 @@ _ol_format_OWS_.readServiceIdentification_ = function(node,
* @private * @private
* @return {Object|undefined} The service contact. * @return {Object|undefined} The service contact.
*/ */
_ol_format_OWS_.readServiceContact_ = function(node, objectStack) { OWS.readServiceContact_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( return _ol_xml_.pushParseAndPop(
{}, _ol_format_OWS_.SERVICE_CONTACT_PARSERS_, node, {}, OWS.SERVICE_CONTACT_PARSERS_, node,
objectStack); objectStack);
}; };
@@ -212,9 +212,9 @@ _ol_format_OWS_.readServiceContact_ = function(node, objectStack) {
* @private * @private
* @return {Object|undefined} The service provider. * @return {Object|undefined} The service provider.
*/ */
_ol_format_OWS_.readServiceProvider_ = function(node, objectStack) { OWS.readServiceProvider_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( return _ol_xml_.pushParseAndPop(
{}, _ol_format_OWS_.SERVICE_PROVIDER_PARSERS_, node, {}, OWS.SERVICE_PROVIDER_PARSERS_, node,
objectStack); objectStack);
}; };
@@ -225,8 +225,8 @@ _ol_format_OWS_.readServiceProvider_ = function(node, objectStack) {
* @private * @private
* @return {string|undefined} The value. * @return {string|undefined} The value.
*/ */
_ol_format_OWS_.readValue_ = function(node, objectStack) { OWS.readValue_ = function(node, objectStack) {
return _ol_format_XSD_.readString(node); return XSD.readString(node);
}; };
@@ -235,7 +235,7 @@ _ol_format_OWS_.readValue_ = function(node, objectStack) {
* @type {Array.<string>} * @type {Array.<string>}
* @private * @private
*/ */
_ol_format_OWS_.NAMESPACE_URIS_ = [ OWS.NAMESPACE_URIS_ = [
null, null,
'http://www.opengis.net/ows/1.1' 'http://www.opengis.net/ows/1.1'
]; ];
@@ -246,14 +246,14 @@ _ol_format_OWS_.NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.PARSERS_ = _ol_xml_.makeStructureNS( OWS.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'ServiceIdentification': _ol_xml_.makeObjectPropertySetter( 'ServiceIdentification': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readServiceIdentification_), OWS.readServiceIdentification_),
'ServiceProvider': _ol_xml_.makeObjectPropertySetter( 'ServiceProvider': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readServiceProvider_), OWS.readServiceProvider_),
'OperationsMetadata': _ol_xml_.makeObjectPropertySetter( 'OperationsMetadata': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readOperationsMetadata_) OWS.readOperationsMetadata_)
}); });
@@ -262,17 +262,17 @@ _ol_format_OWS_.PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( OWS.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'DeliveryPoint': _ol_xml_.makeObjectPropertySetter( 'DeliveryPoint': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'City': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'City': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'AdministrativeArea': _ol_xml_.makeObjectPropertySetter( 'AdministrativeArea': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'PostalCode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'PostalCode': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Country': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Country': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'ElectronicMailAddress': _ol_xml_.makeObjectPropertySetter( 'ElectronicMailAddress': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString) XSD.readString)
}); });
@@ -281,9 +281,9 @@ _ol_format_OWS_.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.ALLOWED_VALUES_PARSERS_ = _ol_xml_.makeStructureNS( OWS.ALLOWED_VALUES_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'Value': _ol_xml_.makeObjectPropertyPusher(_ol_format_OWS_.readValue_) 'Value': _ol_xml_.makeObjectPropertyPusher(OWS.readValue_)
}); });
@@ -292,10 +292,10 @@ _ol_format_OWS_.ALLOWED_VALUES_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.CONSTRAINT_PARSERS_ = _ol_xml_.makeStructureNS( OWS.CONSTRAINT_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'AllowedValues': _ol_xml_.makeObjectPropertySetter( 'AllowedValues': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readAllowedValues_) OWS.readAllowedValues_)
}); });
@@ -304,10 +304,10 @@ _ol_format_OWS_.CONSTRAINT_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.CONTACT_INFO_PARSERS_ = _ol_xml_.makeStructureNS( OWS.CONTACT_INFO_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'Phone': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readPhone_), 'Phone': _ol_xml_.makeObjectPropertySetter(OWS.readPhone_),
'Address': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readAddress_) 'Address': _ol_xml_.makeObjectPropertySetter(OWS.readAddress_)
}); });
@@ -316,9 +316,9 @@ _ol_format_OWS_.CONTACT_INFO_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.DCP_PARSERS_ = _ol_xml_.makeStructureNS( OWS.DCP_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'HTTP': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readHttp_) 'HTTP': _ol_xml_.makeObjectPropertySetter(OWS.readHttp_)
}); });
@@ -327,9 +327,9 @@ _ol_format_OWS_.DCP_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS( OWS.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'Get': _ol_xml_.makeObjectPropertyPusher(_ol_format_OWS_.readGet_), 'Get': _ol_xml_.makeObjectPropertyPusher(OWS.readGet_),
'Post': undefined // TODO 'Post': undefined // TODO
}); });
@@ -339,9 +339,9 @@ _ol_format_OWS_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.OPERATION_PARSERS_ = _ol_xml_.makeStructureNS( OWS.OPERATION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'DCP': _ol_xml_.makeObjectPropertySetter(_ol_format_OWS_.readDcp_) 'DCP': _ol_xml_.makeObjectPropertySetter(OWS.readDcp_)
}); });
@@ -350,9 +350,9 @@ _ol_format_OWS_.OPERATION_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS( OWS.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'Operation': _ol_format_OWS_.readOperation_ 'Operation': OWS.readOperation_
}); });
@@ -361,10 +361,10 @@ _ol_format_OWS_.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.PHONE_PARSERS_ = _ol_xml_.makeStructureNS( OWS.PHONE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'Voice': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Voice': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Facsimile': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) 'Facsimile': _ol_xml_.makeObjectPropertySetter(XSD.readString)
}); });
@@ -373,10 +373,10 @@ _ol_format_OWS_.PHONE_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.REQUEST_METHOD_PARSERS_ = _ol_xml_.makeStructureNS( OWS.REQUEST_METHOD_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'Constraint': _ol_xml_.makeObjectPropertyPusher( '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.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.SERVICE_CONTACT_PARSERS_ = OWS.SERVICE_CONTACT_PARSERS_ =
_ol_xml_.makeStructureNS( _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'IndividualName': _ol_xml_.makeObjectPropertySetter( 'IndividualName': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'PositionName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'PositionName': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'ContactInfo': _ol_xml_.makeObjectPropertySetter( 'ContactInfo': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readContactInfo_) OWS.readContactInfo_)
}); });
@@ -401,16 +401,16 @@ _ol_format_OWS_.SERVICE_CONTACT_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.SERVICE_IDENTIFICATION_PARSERS_ = OWS.SERVICE_IDENTIFICATION_PARSERS_ =
_ol_xml_.makeStructureNS( _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'AccessConstraints': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'AccessConstraints': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Fees': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Fees': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'ServiceTypeVersion': _ol_xml_.makeObjectPropertySetter( 'ServiceTypeVersion': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'ServiceType': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) 'ServiceType': _ol_xml_.makeObjectPropertySetter(XSD.readString)
}); });
@@ -419,12 +419,12 @@ _ol_format_OWS_.SERVICE_IDENTIFICATION_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_OWS_.SERVICE_PROVIDER_PARSERS_ = OWS.SERVICE_PROVIDER_PARSERS_ =
_ol_xml_.makeStructureNS( _ol_xml_.makeStructureNS(
_ol_format_OWS_.NAMESPACE_URIS_, { OWS.NAMESPACE_URIS_, {
'ProviderName': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'ProviderName': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'ProviderSite': _ol_xml_.makeObjectPropertySetter(_ol_format_XLink_.readHref), 'ProviderSite': _ol_xml_.makeObjectPropertySetter(XLink.readHref),
'ServiceContact': _ol_xml_.makeObjectPropertySetter( 'ServiceContact': _ol_xml_.makeObjectPropertySetter(
_ol_format_OWS_.readServiceContact_) OWS.readServiceContact_)
}); });
export default _ol_format_OWS_; export default OWS;
+37 -37
View File
@@ -4,8 +4,8 @@
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_asserts_ from '../asserts.js'; import _ol_asserts_ from '../asserts.js';
import _ol_Feature_ from '../Feature.js'; import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js'; import FeatureFormat from '../format/Feature.js';
import _ol_format_TextFeature_ from '../format/TextFeature.js'; import TextFeature from '../format/TextFeature.js';
import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryLayout from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
import SimpleGeometry from '../geom/SimpleGeometry.js'; import SimpleGeometry from '../geom/SimpleGeometry.js';
@@ -24,11 +24,11 @@ import {get as getProjection} from '../proj.js';
* Optional configuration object. * Optional configuration object.
* @api * @api
*/ */
var _ol_format_Polyline_ = function(opt_options) { var Polyline = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
_ol_format_TextFeature_.call(this); TextFeature.call(this);
/** /**
* @inheritDoc * @inheritDoc
@@ -49,7 +49,7 @@ var _ol_format_Polyline_ = function(opt_options) {
options.geometryLayout : GeometryLayout.XY; 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. * @return {string} The encoded string.
* @api * @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 factor = opt_factor ? opt_factor : 1e5;
var d; 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.<number>} A list of n-dimensional points. * @return {Array.<number>} A list of n-dimensional points.
* @api * @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 factor = opt_factor ? opt_factor : 1e5;
var d; var d;
@@ -110,7 +110,7 @@ _ol_format_Polyline_.decodeDeltas = function(encoded, stride, opt_factor) {
lastNumbers[d] = 0; lastNumbers[d] = 0;
} }
var numbers = _ol_format_Polyline_.decodeFloats(encoded, factor); var numbers = Polyline.decodeFloats(encoded, factor);
var i, ii; var i, ii;
for (i = 0, ii = numbers.length; 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. * @return {string} The encoded string.
* @api * @api
*/ */
_ol_format_Polyline_.encodeFloats = function(numbers, opt_factor) { Polyline.encodeFloats = function(numbers, opt_factor) {
var factor = opt_factor ? opt_factor : 1e5; var factor = opt_factor ? opt_factor : 1e5;
var i, ii; var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) { for (i = 0, ii = numbers.length; i < ii; ++i) {
numbers[i] = Math.round(numbers[i] * factor); 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.<number>} A list of floating point numbers. * @return {Array.<number>} A list of floating point numbers.
* @api * @api
*/ */
_ol_format_Polyline_.decodeFloats = function(encoded, opt_factor) { Polyline.decodeFloats = function(encoded, opt_factor) {
var factor = opt_factor ? opt_factor : 1e5; var factor = opt_factor ? opt_factor : 1e5;
var numbers = _ol_format_Polyline_.decodeSignedIntegers(encoded); var numbers = Polyline.decodeSignedIntegers(encoded);
var i, ii; var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) { for (i = 0, ii = numbers.length; i < ii; ++i) {
numbers[i] /= factor; numbers[i] /= factor;
@@ -176,13 +176,13 @@ _ol_format_Polyline_.decodeFloats = function(encoded, opt_factor) {
* @param {Array.<number>} numbers A list of signed integers. * @param {Array.<number>} numbers A list of signed integers.
* @return {string} The encoded string. * @return {string} The encoded string.
*/ */
_ol_format_Polyline_.encodeSignedIntegers = function(numbers) { Polyline.encodeSignedIntegers = function(numbers) {
var i, ii; var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) { for (i = 0, ii = numbers.length; i < ii; ++i) {
var num = numbers[i]; var num = numbers[i];
numbers[i] = (num < 0) ? ~(num << 1) : (num << 1); 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. * @param {string} encoded An encoded string.
* @return {Array.<number>} A list of signed integers. * @return {Array.<number>} A list of signed integers.
*/ */
_ol_format_Polyline_.decodeSignedIntegers = function(encoded) { Polyline.decodeSignedIntegers = function(encoded) {
var numbers = _ol_format_Polyline_.decodeUnsignedIntegers(encoded); var numbers = Polyline.decodeUnsignedIntegers(encoded);
var i, ii; var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) { for (i = 0, ii = numbers.length; i < ii; ++i) {
var num = numbers[i]; var num = numbers[i];
@@ -209,11 +209,11 @@ _ol_format_Polyline_.decodeSignedIntegers = function(encoded) {
* @param {Array.<number>} numbers A list of unsigned integers. * @param {Array.<number>} numbers A list of unsigned integers.
* @return {string} The encoded string. * @return {string} The encoded string.
*/ */
_ol_format_Polyline_.encodeUnsignedIntegers = function(numbers) { Polyline.encodeUnsignedIntegers = function(numbers) {
var encoded = ''; var encoded = '';
var i, ii; var i, ii;
for (i = 0, ii = numbers.length; i < ii; ++i) { for (i = 0, ii = numbers.length; i < ii; ++i) {
encoded += _ol_format_Polyline_.encodeUnsignedInteger(numbers[i]); encoded += Polyline.encodeUnsignedInteger(numbers[i]);
} }
return encoded; return encoded;
}; };
@@ -225,7 +225,7 @@ _ol_format_Polyline_.encodeUnsignedIntegers = function(numbers) {
* @param {string} encoded An encoded string. * @param {string} encoded An encoded string.
* @return {Array.<number>} A list of unsigned integers. * @return {Array.<number>} A list of unsigned integers.
*/ */
_ol_format_Polyline_.decodeUnsignedIntegers = function(encoded) { Polyline.decodeUnsignedIntegers = function(encoded) {
var numbers = []; var numbers = [];
var current = 0; var current = 0;
var shift = 0; var shift = 0;
@@ -251,7 +251,7 @@ _ol_format_Polyline_.decodeUnsignedIntegers = function(encoded) {
* @param {number} num Unsigned integer that should be encoded. * @param {number} num Unsigned integer that should be encoded.
* @return {string} The encoded string. * @return {string} The encoded string.
*/ */
_ol_format_Polyline_.encodeUnsignedInteger = function(num) { Polyline.encodeUnsignedInteger = function(num) {
var value, encoded = ''; var value, encoded = '';
while (num >= 0x20) { while (num >= 0x20) {
value = (0x20 | (num & 0x1f)) + 63; value = (0x20 | (num & 0x1f)) + 63;
@@ -274,13 +274,13 @@ _ol_format_Polyline_.encodeUnsignedInteger = function(num) {
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
* @api * @api
*/ */
_ol_format_Polyline_.prototype.readFeature; Polyline.prototype.readFeature;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_Polyline_.prototype.readFeatureFromText = function(text, opt_options) { Polyline.prototype.readFeatureFromText = function(text, opt_options) {
var geometry = this.readGeometryFromText(text, opt_options); var geometry = this.readGeometryFromText(text, opt_options);
return new _ol_Feature_(geometry); return new _ol_Feature_(geometry);
}; };
@@ -296,13 +296,13 @@ _ol_format_Polyline_.prototype.readFeatureFromText = function(text, opt_options)
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_Polyline_.prototype.readFeatures; Polyline.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_Polyline_.prototype.readFeaturesFromText = function(text, opt_options) { Polyline.prototype.readFeaturesFromText = function(text, opt_options) {
var feature = this.readFeatureFromText(text, opt_options); var feature = this.readFeatureFromText(text, opt_options);
return [feature]; return [feature];
}; };
@@ -317,15 +317,15 @@ _ol_format_Polyline_.prototype.readFeaturesFromText = function(text, opt_options
* @return {ol.geom.Geometry} Geometry. * @return {ol.geom.Geometry} Geometry.
* @api * @api
*/ */
_ol_format_Polyline_.prototype.readGeometry; Polyline.prototype.readGeometry;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_Polyline_.prototype.readGeometryFromText = function(text, opt_options) { Polyline.prototype.readGeometryFromText = function(text, opt_options) {
var stride = SimpleGeometry.getStrideForLayout(this.geometryLayout_); var stride = SimpleGeometry.getStrideForLayout(this.geometryLayout_);
var flatCoordinates = _ol_format_Polyline_.decodeDeltas( var flatCoordinates = Polyline.decodeDeltas(
text, stride, this.factor_); text, stride, this.factor_);
_ol_geom_flat_flip_.flipXY( _ol_geom_flat_flip_.flipXY(
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates); flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
@@ -333,7 +333,7 @@ _ol_format_Polyline_.prototype.readGeometryFromText = function(text, opt_options
flatCoordinates, 0, flatCoordinates.length, stride); flatCoordinates, 0, flatCoordinates.length, stride);
return ( return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions( /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions(
new LineString(coordinates, this.geometryLayout_), false, new LineString(coordinates, this.geometryLayout_), false,
this.adaptOptions(opt_options)) this.adaptOptions(opt_options))
); );
@@ -348,13 +348,13 @@ _ol_format_Polyline_.prototype.readGeometryFromText = function(text, opt_options
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
* @api * @api
*/ */
_ol_format_Polyline_.prototype.readProjection; Polyline.prototype.readProjection;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_Polyline_.prototype.writeFeatureText = function(feature, opt_options) { Polyline.prototype.writeFeatureText = function(feature, opt_options) {
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
return this.writeGeometryText(geometry, opt_options); return this.writeGeometryText(geometry, opt_options);
@@ -368,7 +368,7 @@ _ol_format_Polyline_.prototype.writeFeatureText = function(feature, opt_options)
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_Polyline_.prototype.writeFeaturesText = function(features, opt_options) { Polyline.prototype.writeFeaturesText = function(features, opt_options) {
return this.writeFeatureText(features[0], 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. * @return {string} Geometry.
* @api * @api
*/ */
_ol_format_Polyline_.prototype.writeGeometry; Polyline.prototype.writeGeometry;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_Polyline_.prototype.writeGeometryText = function(geometry, opt_options) { Polyline.prototype.writeGeometryText = function(geometry, opt_options) {
geometry = /** @type {ol.geom.LineString} */ geometry = /** @type {ol.geom.LineString} */
(_ol_format_Feature_.transformWithOptions( (FeatureFormat.transformWithOptions(
geometry, true, this.adaptOptions(opt_options))); geometry, true, this.adaptOptions(opt_options)));
var flatCoordinates = geometry.getFlatCoordinates(); var flatCoordinates = geometry.getFlatCoordinates();
var stride = geometry.getStride(); var stride = geometry.getStride();
_ol_geom_flat_flip_.flipXY( _ol_geom_flat_flip_.flipXY(
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates); 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;
+21 -21
View File
@@ -2,7 +2,7 @@
* @module ol/format/TextFeature * @module ol/format/TextFeature
*/ */
import {inherits} from '../index.js'; 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'; import _ol_format_FormatType_ from '../format/FormatType.js';
/** /**
@@ -15,11 +15,11 @@ import _ol_format_FormatType_ from '../format/FormatType.js';
* @abstract * @abstract
* @extends {ol.format.Feature} * @extends {ol.format.Feature}
*/ */
var _ol_format_TextFeature_ = function() { var TextFeature = function() {
_ol_format_Feature_.call(this); 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 * @private
* @return {string} Text. * @return {string} Text.
*/ */
_ol_format_TextFeature_.prototype.getText_ = function(source) { TextFeature.prototype.getText_ = function(source) {
if (typeof source === 'string') { if (typeof source === 'string') {
return source; return source;
} else { } else {
@@ -39,7 +39,7 @@ _ol_format_TextFeature_.prototype.getText_ = function(source) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TextFeature_.prototype.getType = function() { TextFeature.prototype.getType = function() {
return _ol_format_FormatType_.TEXT; return _ol_format_FormatType_.TEXT;
}; };
@@ -47,7 +47,7 @@ _ol_format_TextFeature_.prototype.getType = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TextFeature_.prototype.readFeature = function(source, opt_options) { TextFeature.prototype.readFeature = function(source, opt_options) {
return this.readFeatureFromText( return this.readFeatureFromText(
this.getText_(source), this.adaptOptions(opt_options)); this.getText_(source), this.adaptOptions(opt_options));
}; };
@@ -60,13 +60,13 @@ _ol_format_TextFeature_.prototype.readFeature = function(source, opt_options) {
* @protected * @protected
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
*/ */
_ol_format_TextFeature_.prototype.readFeatureFromText = function(text, opt_options) {}; TextFeature.prototype.readFeatureFromText = function(text, opt_options) {};
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TextFeature_.prototype.readFeatures = function(source, opt_options) { TextFeature.prototype.readFeatures = function(source, opt_options) {
return this.readFeaturesFromText( return this.readFeaturesFromText(
this.getText_(source), this.adaptOptions(opt_options)); this.getText_(source), this.adaptOptions(opt_options));
}; };
@@ -79,13 +79,13 @@ _ol_format_TextFeature_.prototype.readFeatures = function(source, opt_options) {
* @protected * @protected
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
*/ */
_ol_format_TextFeature_.prototype.readFeaturesFromText = function(text, opt_options) {}; TextFeature.prototype.readFeaturesFromText = function(text, opt_options) {};
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TextFeature_.prototype.readGeometry = function(source, opt_options) { TextFeature.prototype.readGeometry = function(source, opt_options) {
return this.readGeometryFromText( return this.readGeometryFromText(
this.getText_(source), this.adaptOptions(opt_options)); this.getText_(source), this.adaptOptions(opt_options));
}; };
@@ -98,13 +98,13 @@ _ol_format_TextFeature_.prototype.readGeometry = function(source, opt_options) {
* @protected * @protected
* @return {ol.geom.Geometry} Geometry. * @return {ol.geom.Geometry} Geometry.
*/ */
_ol_format_TextFeature_.prototype.readGeometryFromText = function(text, opt_options) {}; TextFeature.prototype.readGeometryFromText = function(text, opt_options) {};
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TextFeature_.prototype.readProjection = function(source) { TextFeature.prototype.readProjection = function(source) {
return this.readProjectionFromText(this.getText_(source)); return this.readProjectionFromText(this.getText_(source));
}; };
@@ -114,7 +114,7 @@ _ol_format_TextFeature_.prototype.readProjection = function(source) {
* @protected * @protected
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
*/ */
_ol_format_TextFeature_.prototype.readProjectionFromText = function(text) { TextFeature.prototype.readProjectionFromText = function(text) {
return this.defaultDataProjection; return this.defaultDataProjection;
}; };
@@ -122,7 +122,7 @@ _ol_format_TextFeature_.prototype.readProjectionFromText = function(text) {
/** /**
* @inheritDoc * @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)); return this.writeFeatureText(feature, this.adaptOptions(opt_options));
}; };
@@ -134,13 +134,13 @@ _ol_format_TextFeature_.prototype.writeFeature = function(feature, opt_options)
* @protected * @protected
* @return {string} Text. * @return {string} Text.
*/ */
_ol_format_TextFeature_.prototype.writeFeatureText = function(feature, opt_options) {}; TextFeature.prototype.writeFeatureText = function(feature, opt_options) {};
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TextFeature_.prototype.writeFeatures = function( TextFeature.prototype.writeFeatures = function(
features, opt_options) { features, opt_options) {
return this.writeFeaturesText(features, this.adaptOptions(opt_options)); return this.writeFeaturesText(features, this.adaptOptions(opt_options));
}; };
@@ -153,13 +153,13 @@ _ol_format_TextFeature_.prototype.writeFeatures = function(
* @protected * @protected
* @return {string} Text. * @return {string} Text.
*/ */
_ol_format_TextFeature_.prototype.writeFeaturesText = function(features, opt_options) {}; TextFeature.prototype.writeFeaturesText = function(features, opt_options) {};
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TextFeature_.prototype.writeGeometry = function( TextFeature.prototype.writeGeometry = function(
geometry, opt_options) { geometry, opt_options) {
return this.writeGeometryText(geometry, this.adaptOptions(opt_options)); return this.writeGeometryText(geometry, this.adaptOptions(opt_options));
}; };
@@ -172,5 +172,5 @@ _ol_format_TextFeature_.prototype.writeGeometry = function(
* @protected * @protected
* @return {string} Text. * @return {string} Text.
*/ */
_ol_format_TextFeature_.prototype.writeGeometryText = function(geometry, opt_options) {}; TextFeature.prototype.writeGeometryText = function(geometry, opt_options) {};
export default _ol_format_TextFeature_; export default TextFeature;
+48 -48
View File
@@ -3,8 +3,8 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js'; import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js'; import FeatureFormat from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js'; import JSONFeature from '../format/JSONFeature.js';
import LineString from '../geom/LineString.js'; import LineString from '../geom/LineString.js';
import MultiLineString from '../geom/MultiLineString.js'; import MultiLineString from '../geom/MultiLineString.js';
import MultiPoint from '../geom/MultiPoint.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. * @param {olx.format.TopoJSONOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_format_TopoJSON_ = function(opt_options) { var TopoJSON = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
_ol_format_JSONFeature_.call(this); JSONFeature.call(this);
/** /**
* @private * @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.<ol.Coordinate>} Coordinates array. * @return {Array.<ol.Coordinate>} Coordinates array.
* @private * @private
*/ */
_ol_format_TopoJSON_.concatenateArcs_ = function(indices, arcs) { TopoJSON.concatenateArcs_ = function(indices, arcs) {
/** @type {Array.<ol.Coordinate>} */ /** @type {Array.<ol.Coordinate>} */
var coordinates = []; var coordinates = [];
var index, arc; var index, arc;
@@ -99,10 +99,10 @@ _ol_format_TopoJSON_.concatenateArcs_ = function(indices, arcs) {
* @return {ol.geom.Point} Geometry. * @return {ol.geom.Point} Geometry.
* @private * @private
*/ */
_ol_format_TopoJSON_.readPointGeometry_ = function(object, scale, translate) { TopoJSON.readPointGeometry_ = function(object, scale, translate) {
var coordinates = object.coordinates; var coordinates = object.coordinates;
if (scale && translate) { if (scale && translate) {
_ol_format_TopoJSON_.transformVertex_(coordinates, scale, translate); TopoJSON.transformVertex_(coordinates, scale, translate);
} }
return new Point(coordinates); return new Point(coordinates);
}; };
@@ -117,13 +117,13 @@ _ol_format_TopoJSON_.readPointGeometry_ = function(object, scale, translate) {
* @return {ol.geom.MultiPoint} Geometry. * @return {ol.geom.MultiPoint} Geometry.
* @private * @private
*/ */
_ol_format_TopoJSON_.readMultiPointGeometry_ = function(object, scale, TopoJSON.readMultiPointGeometry_ = function(object, scale,
translate) { translate) {
var coordinates = object.coordinates; var coordinates = object.coordinates;
var i, ii; var i, ii;
if (scale && translate) { if (scale && translate) {
for (i = 0, ii = coordinates.length; i < ii; ++i) { 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); return new MultiPoint(coordinates);
@@ -138,8 +138,8 @@ _ol_format_TopoJSON_.readMultiPointGeometry_ = function(object, scale,
* @return {ol.geom.LineString} Geometry. * @return {ol.geom.LineString} Geometry.
* @private * @private
*/ */
_ol_format_TopoJSON_.readLineStringGeometry_ = function(object, arcs) { TopoJSON.readLineStringGeometry_ = function(object, arcs) {
var coordinates = _ol_format_TopoJSON_.concatenateArcs_(object.arcs, arcs); var coordinates = TopoJSON.concatenateArcs_(object.arcs, arcs);
return new LineString(coordinates); return new LineString(coordinates);
}; };
@@ -152,11 +152,11 @@ _ol_format_TopoJSON_.readLineStringGeometry_ = function(object, arcs) {
* @return {ol.geom.MultiLineString} Geometry. * @return {ol.geom.MultiLineString} Geometry.
* @private * @private
*/ */
_ol_format_TopoJSON_.readMultiLineStringGeometry_ = function(object, arcs) { TopoJSON.readMultiLineStringGeometry_ = function(object, arcs) {
var coordinates = []; var coordinates = [];
var i, ii; var i, ii;
for (i = 0, ii = object.arcs.length; i < ii; ++i) { 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); return new MultiLineString(coordinates);
}; };
@@ -170,11 +170,11 @@ _ol_format_TopoJSON_.readMultiLineStringGeometry_ = function(object, arcs) {
* @return {ol.geom.Polygon} Geometry. * @return {ol.geom.Polygon} Geometry.
* @private * @private
*/ */
_ol_format_TopoJSON_.readPolygonGeometry_ = function(object, arcs) { TopoJSON.readPolygonGeometry_ = function(object, arcs) {
var coordinates = []; var coordinates = [];
var i, ii; var i, ii;
for (i = 0, ii = object.arcs.length; i < ii; ++i) { 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); return new Polygon(coordinates);
}; };
@@ -188,7 +188,7 @@ _ol_format_TopoJSON_.readPolygonGeometry_ = function(object, arcs) {
* @return {ol.geom.MultiPolygon} Geometry. * @return {ol.geom.MultiPolygon} Geometry.
* @private * @private
*/ */
_ol_format_TopoJSON_.readMultiPolygonGeometry_ = function(object, arcs) { TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
var coordinates = []; var coordinates = [];
var polyArray, ringCoords, j, jj; var polyArray, ringCoords, j, jj;
var i, ii; var i, ii;
@@ -198,7 +198,7 @@ _ol_format_TopoJSON_.readMultiPolygonGeometry_ = function(object, arcs) {
ringCoords = []; ringCoords = [];
for (j = 0, jj = polyArray.length; j < jj; ++j) { for (j = 0, jj = polyArray.length; j < jj; ++j) {
// for each ring // for each ring
ringCoords[j] = _ol_format_TopoJSON_.concatenateArcs_(polyArray[j], arcs); ringCoords[j] = TopoJSON.concatenateArcs_(polyArray[j], arcs);
} }
coordinates[i] = ringCoords; coordinates[i] = ringCoords;
} }
@@ -221,13 +221,13 @@ _ol_format_TopoJSON_.readMultiPolygonGeometry_ = function(object, arcs) {
* @return {Array.<ol.Feature>} Array of features. * @return {Array.<ol.Feature>} Array of features.
* @private * @private
*/ */
_ol_format_TopoJSON_.readFeaturesFromGeometryCollection_ = function( TopoJSON.readFeaturesFromGeometryCollection_ = function(
collection, arcs, scale, translate, property, name, opt_options) { collection, arcs, scale, translate, property, name, opt_options) {
var geometries = collection.geometries; var geometries = collection.geometries;
var features = []; var features = [];
var i, ii; var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) { 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); geometries[i], arcs, scale, translate, property, name, opt_options);
} }
return features; return features;
@@ -248,11 +248,11 @@ _ol_format_TopoJSON_.readFeaturesFromGeometryCollection_ = function(
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
* @private * @private
*/ */
_ol_format_TopoJSON_.readFeatureFromGeometry_ = function(object, arcs, TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
scale, translate, property, name, opt_options) { scale, translate, property, name, opt_options) {
var geometry; var geometry;
var type = object.type; var type = object.type;
var geometryReader = _ol_format_TopoJSON_.GEOMETRY_READERS_[type]; var geometryReader = TopoJSON.GEOMETRY_READERS_[type];
if ((type === 'Point') || (type === 'MultiPoint')) { if ((type === 'Point') || (type === 'MultiPoint')) {
geometry = geometryReader(object, scale, translate); geometry = geometryReader(object, scale, translate);
} else { } else {
@@ -260,7 +260,7 @@ _ol_format_TopoJSON_.readFeatureFromGeometry_ = function(object, arcs,
} }
var feature = new _ol_Feature_(); var feature = new _ol_Feature_();
feature.setGeometry(/** @type {ol.geom.Geometry} */ ( feature.setGeometry(/** @type {ol.geom.Geometry} */ (
_ol_format_Feature_.transformWithOptions(geometry, false, opt_options))); FeatureFormat.transformWithOptions(geometry, false, opt_options)));
if (object.id !== undefined) { if (object.id !== undefined) {
feature.setId(object.id); feature.setId(object.id);
} }
@@ -286,13 +286,13 @@ _ol_format_TopoJSON_.readFeatureFromGeometry_ = function(object, arcs,
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_TopoJSON_.prototype.readFeatures; TopoJSON.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TopoJSON_.prototype.readFeaturesFromObject = function( TopoJSON.prototype.readFeaturesFromObject = function(
object, opt_options) { object, opt_options) {
if (object.type == 'Topology') { if (object.type == 'Topology') {
var topoJSONTopology = /** @type {TopoJSONTopology} */ (object); var topoJSONTopology = /** @type {TopoJSONTopology} */ (object);
@@ -304,7 +304,7 @@ _ol_format_TopoJSON_.prototype.readFeaturesFromObject = function(
} }
var arcs = topoJSONTopology.arcs; var arcs = topoJSONTopology.arcs;
if (transform) { if (transform) {
_ol_format_TopoJSON_.transformArcs_(arcs, scale, translate); TopoJSON.transformArcs_(arcs, scale, translate);
} }
/** @type {Array.<ol.Feature>} */ /** @type {Array.<ol.Feature>} */
var features = []; var features = [];
@@ -319,12 +319,12 @@ _ol_format_TopoJSON_.prototype.readFeaturesFromObject = function(
feature = /** @type {TopoJSONGeometryCollection} */ feature = /** @type {TopoJSONGeometryCollection} */
(topoJSONFeatures[objectName]); (topoJSONFeatures[objectName]);
features.push.apply(features, features.push.apply(features,
_ol_format_TopoJSON_.readFeaturesFromGeometryCollection_( TopoJSON.readFeaturesFromGeometryCollection_(
feature, arcs, scale, translate, property, objectName, opt_options)); feature, arcs, scale, translate, property, objectName, opt_options));
} else { } else {
feature = /** @type {TopoJSONGeometry} */ feature = /** @type {TopoJSONGeometry} */
(topoJSONFeatures[objectName]); (topoJSONFeatures[objectName]);
features.push(_ol_format_TopoJSON_.readFeatureFromGeometry_( features.push(TopoJSON.readFeatureFromGeometry_(
feature, arcs, scale, translate, property, objectName, opt_options)); feature, arcs, scale, translate, property, objectName, opt_options));
} }
} }
@@ -344,10 +344,10 @@ _ol_format_TopoJSON_.prototype.readFeaturesFromObject = function(
* @param {Array.<number>} translate Translation for each dimension. * @param {Array.<number>} translate Translation for each dimension.
* @private * @private
*/ */
_ol_format_TopoJSON_.transformArcs_ = function(arcs, scale, translate) { TopoJSON.transformArcs_ = function(arcs, scale, translate) {
var i, ii; var i, ii;
for (i = 0, ii = arcs.length; i < ii; ++i) { 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.<number>} translate Translation for each dimension. * @param {Array.<number>} translate Translation for each dimension.
* @private * @private
*/ */
_ol_format_TopoJSON_.transformArc_ = function(arc, scale, translate) { TopoJSON.transformArc_ = function(arc, scale, translate) {
var x = 0; var x = 0;
var y = 0; var y = 0;
var vertex; var vertex;
@@ -371,7 +371,7 @@ _ol_format_TopoJSON_.transformArc_ = function(arc, scale, translate) {
y += vertex[1]; y += vertex[1];
vertex[0] = x; vertex[0] = x;
vertex[1] = y; 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.<number>} translate Translation for each dimension. * @param {Array.<number>} translate Translation for each dimension.
* @private * @private
*/ */
_ol_format_TopoJSON_.transformVertex_ = function(vertex, scale, translate) { TopoJSON.transformVertex_ = function(vertex, scale, translate) {
vertex[0] = vertex[0] * scale[0] + translate[0]; vertex[0] = vertex[0] * scale[0] + translate[0];
vertex[1] = vertex[1] * scale[1] + translate[1]; vertex[1] = vertex[1] * scale[1] + translate[1];
}; };
@@ -399,13 +399,13 @@ _ol_format_TopoJSON_.transformVertex_ = function(vertex, scale, translate) {
* @override * @override
* @api * @api
*/ */
_ol_format_TopoJSON_.prototype.readProjection; TopoJSON.prototype.readProjection;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TopoJSON_.prototype.readProjectionFromObject = function(object) { TopoJSON.prototype.readProjectionFromObject = function(object) {
return this.defaultDataProjection; return this.defaultDataProjection;
}; };
@@ -415,13 +415,13 @@ _ol_format_TopoJSON_.prototype.readProjectionFromObject = function(object) {
* @private * @private
* @type {Object.<string, function(TopoJSONGeometry, Array, ...Array): ol.geom.Geometry>} * @type {Object.<string, function(TopoJSONGeometry, Array, ...Array): ol.geom.Geometry>}
*/ */
_ol_format_TopoJSON_.GEOMETRY_READERS_ = { TopoJSON.GEOMETRY_READERS_ = {
'Point': _ol_format_TopoJSON_.readPointGeometry_, 'Point': TopoJSON.readPointGeometry_,
'LineString': _ol_format_TopoJSON_.readLineStringGeometry_, 'LineString': TopoJSON.readLineStringGeometry_,
'Polygon': _ol_format_TopoJSON_.readPolygonGeometry_, 'Polygon': TopoJSON.readPolygonGeometry_,
'MultiPoint': _ol_format_TopoJSON_.readMultiPointGeometry_, 'MultiPoint': TopoJSON.readMultiPointGeometry_,
'MultiLineString': _ol_format_TopoJSON_.readMultiLineStringGeometry_, 'MultiLineString': TopoJSON.readMultiLineStringGeometry_,
'MultiPolygon': _ol_format_TopoJSON_.readMultiPolygonGeometry_ 'MultiPolygon': TopoJSON.readMultiPolygonGeometry_
}; };
@@ -429,33 +429,33 @@ _ol_format_TopoJSON_.GEOMETRY_READERS_ = {
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TopoJSON_.prototype.writeFeatureObject = function(feature, opt_options) {}; TopoJSON.prototype.writeFeatureObject = function(feature, opt_options) {};
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TopoJSON_.prototype.writeFeaturesObject = function(features, opt_options) {}; TopoJSON.prototype.writeFeaturesObject = function(features, opt_options) {};
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_TopoJSON_.prototype.writeGeometryObject = function(geometry, opt_options) {}; TopoJSON.prototype.writeGeometryObject = function(geometry, opt_options) {};
/** /**
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_TopoJSON_.prototype.readGeometryFromObject = function() {}; TopoJSON.prototype.readGeometryFromObject = function() {};
/** /**
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_TopoJSON_.prototype.readFeatureFromObject = function() {}; TopoJSON.prototype.readFeatureFromObject = function() {};
export default _ol_format_TopoJSON_; export default TopoJSON;
+181 -181
View File
@@ -3,12 +3,12 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_asserts_ from '../asserts.js'; import _ol_asserts_ from '../asserts.js';
import _ol_format_GML2_ from '../format/GML2.js'; import GML2 from '../format/GML2.js';
import _ol_format_GML3_ from '../format/GML3.js'; import GML3 from '../format/GML3.js';
import _ol_format_GMLBase_ from '../format/GMLBase.js'; import GMLBase from '../format/GMLBase.js';
import _ol_format_filter_ from '../format/filter.js'; import _ol_format_filter_ from '../format/filter.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; import XMLFeature from '../format/XMLFeature.js';
import _ol_format_XSD_ from '../format/XSD.js'; import XSD from '../format/XSD.js';
import Geometry from '../geom/Geometry.js'; import Geometry from '../geom/Geometry.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
import {get as getProjection} from '../proj.js'; import {get as getProjection} from '../proj.js';
@@ -27,7 +27,7 @@ import _ol_xml_ from '../xml.js';
* @extends {ol.format.XMLFeature} * @extends {ol.format.XMLFeature}
* @api * @api
*/ */
var _ol_format_WFS_ = function(opt_options) { var WFS = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
/** /**
@@ -47,7 +47,7 @@ var _ol_format_WFS_ = function(opt_options) {
* @type {ol.format.GMLBase} * @type {ol.format.GMLBase}
*/ */
this.gmlFormat_ = options.gmlFormat ? this.gmlFormat_ = options.gmlFormat ?
options.gmlFormat : new _ol_format_GML3_(); options.gmlFormat : new GML3();
/** /**
* @private * @private
@@ -55,54 +55,54 @@ var _ol_format_WFS_ = function(opt_options) {
*/ */
this.schemaLocation_ = options.schemaLocation ? this.schemaLocation_ = options.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 * @const
* @type {string} * @type {string}
*/ */
_ol_format_WFS_.FEATURE_PREFIX = 'feature'; WFS.FEATURE_PREFIX = 'feature';
/** /**
* @const * @const
* @type {string} * @type {string}
*/ */
_ol_format_WFS_.XMLNS = 'http://www.w3.org/2000/xmlns/'; WFS.XMLNS = 'http://www.w3.org/2000/xmlns/';
/** /**
* @const * @const
* @type {string} * @type {string}
*/ */
_ol_format_WFS_.OGCNS = 'http://www.opengis.net/ogc'; WFS.OGCNS = 'http://www.opengis.net/ogc';
/** /**
* @const * @const
* @type {string} * @type {string}
*/ */
_ol_format_WFS_.WFSNS = 'http://www.opengis.net/wfs'; WFS.WFSNS = 'http://www.opengis.net/wfs';
/** /**
* @const * @const
* @type {string} * @type {string}
*/ */
_ol_format_WFS_.FESNS = 'http://www.opengis.net/fes'; WFS.FESNS = 'http://www.opengis.net/fes';
/** /**
* @const * @const
* @type {Object.<string, string>} * @type {Object.<string, string>}
*/ */
_ol_format_WFS_.SCHEMA_LOCATIONS = { WFS.SCHEMA_LOCATIONS = {
'1.1.0': 'http://www.opengis.net/wfs ' + '1.1.0': 'http://www.opengis.net/wfs ' +
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd', 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd',
'1.0.0': 'http://www.opengis.net/wfs ' + '1.0.0': 'http://www.opengis.net/wfs ' +
@@ -114,13 +114,13 @@ _ol_format_WFS_.SCHEMA_LOCATIONS = {
* @const * @const
* @type {string} * @type {string}
*/ */
_ol_format_WFS_.DEFAULT_VERSION = '1.1.0'; WFS.DEFAULT_VERSION = '1.1.0';
/** /**
* @return {Array.<string>|string|undefined} featureType * @return {Array.<string>|string|undefined} featureType
*/ */
_ol_format_WFS_.prototype.getFeatureType = function() { WFS.prototype.getFeatureType = function() {
return this.featureType_; return this.featureType_;
}; };
@@ -128,7 +128,7 @@ _ol_format_WFS_.prototype.getFeatureType = function() {
/** /**
* @param {Array.<string>|string|undefined} featureType Feature type(s) to parse. * @param {Array.<string>|string|undefined} featureType Feature type(s) to parse.
*/ */
_ol_format_WFS_.prototype.setFeatureType = function(featureType) { WFS.prototype.setFeatureType = function(featureType) {
this.featureType_ = featureType; this.featureType_ = featureType;
}; };
@@ -142,13 +142,13 @@ _ol_format_WFS_.prototype.setFeatureType = function(featureType) {
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_WFS_.prototype.readFeatures; WFS.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WFS_.prototype.readFeaturesFromNode = function(node, opt_options) { WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
var context = /** @type {ol.XmlNodeStackItem} */ ({ var context = /** @type {ol.XmlNodeStackItem} */ ({
'featureType': this.featureType_, 'featureType': this.featureType_,
'featureNS': this.featureNS_ 'featureNS': this.featureNS_
@@ -156,9 +156,9 @@ _ol_format_WFS_.prototype.readFeaturesFromNode = function(node, opt_options) {
_ol_obj_.assign(context, this.getReadOptions(node, _ol_obj_.assign(context, this.getReadOptions(node,
opt_options ? opt_options : {})); opt_options ? opt_options : {}));
var objectStack = [context]; var objectStack = [context];
this.gmlFormat_.FEATURE_COLLECTION_PARSERS[_ol_format_GMLBase_.GMLNS][ this.gmlFormat_.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS][
'featureMember'] = 'featureMember'] =
_ol_xml_.makeArrayPusher(_ol_format_GMLBase_.prototype.readFeaturesInternal); _ol_xml_.makeArrayPusher(GMLBase.prototype.readFeaturesInternal);
var features = _ol_xml_.pushParseAndPop([], var features = _ol_xml_.pushParseAndPop([],
this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node, this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node,
objectStack, this.gmlFormat_); objectStack, this.gmlFormat_);
@@ -176,7 +176,7 @@ _ol_format_WFS_.prototype.readFeaturesFromNode = function(node, opt_options) {
* @return {ol.WFSTransactionResponse|undefined} Transaction response. * @return {ol.WFSTransactionResponse|undefined} Transaction response.
* @api * @api
*/ */
_ol_format_WFS_.prototype.readTransactionResponse = function(source) { WFS.prototype.readTransactionResponse = function(source) {
if (_ol_xml_.isDocument(source)) { if (_ol_xml_.isDocument(source)) {
return this.readTransactionResponseFromDocument( return this.readTransactionResponseFromDocument(
/** @type {Document} */ (source)); /** @type {Document} */ (source));
@@ -199,7 +199,7 @@ _ol_format_WFS_.prototype.readTransactionResponse = function(source) {
* FeatureCollection metadata. * FeatureCollection metadata.
* @api * @api
*/ */
_ol_format_WFS_.prototype.readFeatureCollectionMetadata = function(source) { WFS.prototype.readFeatureCollectionMetadata = function(source) {
if (_ol_xml_.isDocument(source)) { if (_ol_xml_.isDocument(source)) {
return this.readFeatureCollectionMetadataFromDocument( return this.readFeatureCollectionMetadataFromDocument(
/** @type {Document} */ (source)); /** @type {Document} */ (source));
@@ -220,7 +220,7 @@ _ol_format_WFS_.prototype.readFeatureCollectionMetadata = function(source) {
* @return {ol.WFSFeatureCollectionMetadata|undefined} * @return {ol.WFSFeatureCollectionMetadata|undefined}
* FeatureCollection metadata. * FeatureCollection metadata.
*/ */
_ol_format_WFS_.prototype.readFeatureCollectionMetadataFromDocument = function(doc) { WFS.prototype.readFeatureCollectionMetadataFromDocument = function(doc) {
for (var n = doc.firstChild; n; n = n.nextSibling) { for (var n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) { if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFeatureCollectionMetadataFromNode(n); return this.readFeatureCollectionMetadataFromNode(n);
@@ -235,10 +235,10 @@ _ol_format_WFS_.prototype.readFeatureCollectionMetadataFromDocument = function(d
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WFS_.FEATURE_COLLECTION_PARSERS_ = { WFS.FEATURE_COLLECTION_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'boundedBy': _ol_xml_.makeObjectPropertySetter( '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} * @return {ol.WFSFeatureCollectionMetadata|undefined}
* FeatureCollection metadata. * FeatureCollection metadata.
*/ */
_ol_format_WFS_.prototype.readFeatureCollectionMetadataFromNode = function(node) { WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) {
var result = {}; var result = {};
var value = _ol_format_XSD_.readNonNegativeIntegerString( var value = XSD.readNonNegativeIntegerString(
node.getAttribute('numberOfFeatures')); node.getAttribute('numberOfFeatures'));
result['numberOfFeatures'] = value; result['numberOfFeatures'] = value;
return _ol_xml_.pushParseAndPop( return _ol_xml_.pushParseAndPop(
/** @type {ol.WFSFeatureCollectionMetadata} */ (result), /** @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.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WFS_.TRANSACTION_SUMMARY_PARSERS_ = { WFS.TRANSACTION_SUMMARY_PARSERS_ = {
'http://www.opengis.net/wfs': { 'http://www.opengis.net/wfs': {
'totalInserted': _ol_xml_.makeObjectPropertySetter( 'totalInserted': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'totalUpdated': _ol_xml_.makeObjectPropertySetter( 'totalUpdated': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'totalDeleted': _ol_xml_.makeObjectPropertySetter( '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. * @return {Object|undefined} Transaction Summary.
* @private * @private
*/ */
_ol_format_WFS_.readTransactionSummary_ = function(node, objectStack) { WFS.readTransactionSummary_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WFS_.OGC_FID_PARSERS_ = { WFS.OGC_FID_PARSERS_ = {
'http://www.opengis.net/ogc': { 'http://www.opengis.net/ogc': {
'FeatureId': _ol_xml_.makeArrayPusher(function(node, objectStack) { 'FeatureId': _ol_xml_.makeArrayPusher(function(node, objectStack) {
return node.getAttribute('fid'); return node.getAttribute('fid');
@@ -307,8 +307,8 @@ _ol_format_WFS_.OGC_FID_PARSERS_ = {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_WFS_.fidParser_ = function(node, objectStack) { WFS.fidParser_ = function(node, objectStack) {
_ol_xml_.parseNode(_ol_format_WFS_.OGC_FID_PARSERS_, node, objectStack); _ol_xml_.parseNode(WFS.OGC_FID_PARSERS_, node, objectStack);
}; };
@@ -317,9 +317,9 @@ _ol_format_WFS_.fidParser_ = function(node, objectStack) {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WFS_.INSERT_RESULTS_PARSERS_ = { WFS.INSERT_RESULTS_PARSERS_ = {
'http://www.opengis.net/wfs': { '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.<string>|undefined} Insert results. * @return {Array.<string>|undefined} Insert results.
* @private * @private
*/ */
_ol_format_WFS_.readInsertResults_ = function(node, objectStack) { WFS.readInsertResults_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WFS_.TRANSACTION_RESPONSE_PARSERS_ = { WFS.TRANSACTION_RESPONSE_PARSERS_ = {
'http://www.opengis.net/wfs': { 'http://www.opengis.net/wfs': {
'TransactionSummary': _ol_xml_.makeObjectPropertySetter( 'TransactionSummary': _ol_xml_.makeObjectPropertySetter(
_ol_format_WFS_.readTransactionSummary_, 'transactionSummary'), WFS.readTransactionSummary_, 'transactionSummary'),
'InsertResults': _ol_xml_.makeObjectPropertySetter( '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. * @param {Document} doc Document.
* @return {ol.WFSTransactionResponse|undefined} Transaction response. * @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) { for (var n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) { if (n.nodeType == Node.ELEMENT_NODE) {
return this.readTransactionResponseFromNode(n); return this.readTransactionResponseFromNode(n);
@@ -369,10 +369,10 @@ _ol_format_WFS_.prototype.readTransactionResponseFromDocument = function(doc) {
* @param {Node} node Node. * @param {Node} node Node.
* @return {ol.WFSTransactionResponse|undefined} Transaction response. * @return {ol.WFSTransactionResponse|undefined} Transaction response.
*/ */
_ol_format_WFS_.prototype.readTransactionResponseFromNode = function(node) { WFS.prototype.readTransactionResponseFromNode = function(node) {
return _ol_xml_.pushParseAndPop( return _ol_xml_.pushParseAndPop(
/** @type {ol.WFSTransactionResponse} */({}), /** @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.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_WFS_.QUERY_SERIALIZERS_ = { WFS.QUERY_SERIALIZERS_ = {
'http://www.opengis.net/wfs': { '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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeFeature_ = function(node, feature, objectStack) { WFS.writeFeature_ = function(node, feature, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var featureType = context['featureType']; var featureType = context['featureType'];
var featureNS = context['featureNS']; var featureNS = context['featureNS'];
@@ -401,9 +401,9 @@ _ol_format_WFS_.writeFeature_ = function(node, feature, objectStack) {
var child = _ol_xml_.createElementNS(featureNS, featureType); var child = _ol_xml_.createElementNS(featureNS, featureType);
node.appendChild(child); node.appendChild(child);
if (gmlVersion === 2) { if (gmlVersion === 2) {
_ol_format_GML2_.prototype.writeFeatureElement(child, feature, objectStack); GML2.prototype.writeFeatureElement(child, feature, objectStack);
} else { } 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeOgcFidFilter_ = function(node, fid, objectStack) { WFS.writeOgcFidFilter_ = function(node, fid, objectStack) {
var filter = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'Filter'); var filter = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter');
var child = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'FeatureId'); var child = _ol_xml_.createElementNS(WFS.OGCNS, 'FeatureId');
filter.appendChild(child); filter.appendChild(child);
child.setAttribute('fid', fid); child.setAttribute('fid', fid);
node.appendChild(filter); node.appendChild(filter);
@@ -429,9 +429,9 @@ _ol_format_WFS_.writeOgcFidFilter_ = function(node, fid, objectStack) {
* @returns {string} The value of the typeName property. * @returns {string} The value of the typeName property.
* @private * @private
*/ */
_ol_format_WFS_.getTypeName_ = function(featurePrefix, featureType) { WFS.getTypeName_ = function(featurePrefix, featureType) {
featurePrefix = featurePrefix ? featurePrefix : featurePrefix = featurePrefix ? featurePrefix :
_ol_format_WFS_.FEATURE_PREFIX; WFS.FEATURE_PREFIX;
var prefix = featurePrefix + ':'; var prefix = featurePrefix + ':';
// The featureType already contains the prefix. // The featureType already contains the prefix.
if (featureType.indexOf(prefix) === 0) { if (featureType.indexOf(prefix) === 0) {
@@ -448,19 +448,19 @@ _ol_format_WFS_.getTypeName_ = function(featurePrefix, featureType) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeDelete_ = function(node, feature, objectStack) { WFS.writeDelete_ = function(node, feature, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
_ol_asserts_.assert(feature.getId() !== undefined, 26); // Features must have an id set _ol_asserts_.assert(feature.getId() !== undefined, 26); // Features must have an id set
var featureType = context['featureType']; var featureType = context['featureType'];
var featurePrefix = context['featurePrefix']; var featurePrefix = context['featurePrefix'];
var featureNS = context['featureNS']; var featureNS = context['featureNS'];
var typeName = _ol_format_WFS_.getTypeName_(featurePrefix, featureType); var typeName = WFS.getTypeName_(featurePrefix, featureType);
node.setAttribute('typeName', typeName); node.setAttribute('typeName', typeName);
_ol_xml_.setAttributeNS(node, _ol_format_WFS_.XMLNS, 'xmlns:' + featurePrefix, _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS); featureNS);
var fid = feature.getId(); var fid = feature.getId();
if (fid !== undefined) { 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeUpdate_ = function(node, feature, objectStack) { WFS.writeUpdate_ = function(node, feature, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
_ol_asserts_.assert(feature.getId() !== undefined, 27); // Features must have an id set _ol_asserts_.assert(feature.getId() !== undefined, 27); // Features must have an id set
var featureType = context['featureType']; var featureType = context['featureType'];
var featurePrefix = context['featurePrefix']; var featurePrefix = context['featurePrefix'];
var featureNS = context['featureNS']; var featureNS = context['featureNS'];
var typeName = _ol_format_WFS_.getTypeName_(featurePrefix, featureType); var typeName = WFS.getTypeName_(featurePrefix, featureType);
var geometryName = feature.getGeometryName(); var geometryName = feature.getGeometryName();
node.setAttribute('typeName', typeName); node.setAttribute('typeName', typeName);
_ol_xml_.setAttributeNS(node, _ol_format_WFS_.XMLNS, 'xmlns:' + featurePrefix, _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS); featureNS);
var fid = feature.getId(); var fid = feature.getId();
if (fid !== undefined) { if (fid !== undefined) {
@@ -499,10 +499,10 @@ _ol_format_WFS_.writeUpdate_ = function(node, feature, objectStack) {
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ( _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (
{'gmlVersion': context['gmlVersion'], node: node, {'gmlVersion': context['gmlVersion'], node: node,
'hasZ': context['hasZ'], 'srsName': context['srsName']}), 'hasZ': context['hasZ'], 'srsName': context['srsName']}),
_ol_format_WFS_.TRANSACTION_SERIALIZERS_, WFS.TRANSACTION_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('Property'), values, _ol_xml_.makeSimpleNodeFactory('Property'), values,
objectStack); 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeProperty_ = function(node, pair, objectStack) { WFS.writeProperty_ = function(node, pair, objectStack) {
var name = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'Name'); var name = _ol_xml_.createElementNS(WFS.WFSNS, 'Name');
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var gmlVersion = context['gmlVersion']; var gmlVersion = context['gmlVersion'];
node.appendChild(name); node.appendChild(name);
_ol_format_XSD_.writeStringTextNode(name, pair.name); XSD.writeStringTextNode(name, pair.name);
if (pair.value !== undefined && pair.value !== null) { 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); node.appendChild(value);
if (pair.value instanceof Geometry) { if (pair.value instanceof Geometry) {
if (gmlVersion === 2) { if (gmlVersion === 2) {
_ol_format_GML2_.prototype.writeGeometryElement(value, GML2.prototype.writeGeometryElement(value,
pair.value, objectStack); pair.value, objectStack);
} else { } else {
_ol_format_GML3_.prototype.writeGeometryElement(value, GML3.prototype.writeGeometryElement(value,
pair.value, objectStack); pair.value, objectStack);
} }
} else { } 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeNative_ = function(node, nativeElement, objectStack) { WFS.writeNative_ = function(node, nativeElement, objectStack) {
if (nativeElement.vendorId) { if (nativeElement.vendorId) {
node.setAttribute('vendorId', nativeElement.vendorId); node.setAttribute('vendorId', nativeElement.vendorId);
} }
@@ -552,7 +552,7 @@ _ol_format_WFS_.writeNative_ = function(node, nativeElement, objectStack) {
node.setAttribute('safeToIgnore', nativeElement.safeToIgnore); node.setAttribute('safeToIgnore', nativeElement.safeToIgnore);
} }
if (nativeElement.value !== undefined) { 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.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_WFS_.TRANSACTION_SERIALIZERS_ = { WFS.TRANSACTION_SERIALIZERS_ = {
'http://www.opengis.net/wfs': { 'http://www.opengis.net/wfs': {
'Insert': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeFeature_), 'Insert': _ol_xml_.makeChildAppender(WFS.writeFeature_),
'Update': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeUpdate_), 'Update': _ol_xml_.makeChildAppender(WFS.writeUpdate_),
'Delete': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeDelete_), 'Delete': _ol_xml_.makeChildAppender(WFS.writeDelete_),
'Property': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeProperty_), 'Property': _ol_xml_.makeChildAppender(WFS.writeProperty_),
'Native': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeNative_) 'Native': _ol_xml_.makeChildAppender(WFS.writeNative_)
} }
}; };
@@ -578,7 +578,7 @@ _ol_format_WFS_.TRANSACTION_SERIALIZERS_ = {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) { WFS.writeQuery_ = function(node, featureType, objectStack) {
var context = /** @type {Object} */ (objectStack[objectStack.length - 1]); var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var featurePrefix = context['featurePrefix']; var featurePrefix = context['featurePrefix'];
var featureNS = context['featureNS']; var featureNS = context['featureNS'];
@@ -587,7 +587,7 @@ _ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) {
var typeName; var typeName;
// If feature prefix is not defined, we must not use the default prefix. // If feature prefix is not defined, we must not use the default prefix.
if (featurePrefix) { if (featurePrefix) {
typeName = _ol_format_WFS_.getTypeName_(featurePrefix, featureType); typeName = WFS.getTypeName_(featurePrefix, featureType);
} else { } else {
typeName = featureType; typeName = featureType;
} }
@@ -596,20 +596,20 @@ _ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
} }
if (featureNS) { if (featureNS) {
_ol_xml_.setAttributeNS(node, _ol_format_WFS_.XMLNS, 'xmlns:' + featurePrefix, _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS); featureNS);
} }
var item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context)); var item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context));
item.node = node; item.node = node;
_ol_xml_.pushSerializeAndPop(item, _ol_xml_.pushSerializeAndPop(item,
_ol_format_WFS_.QUERY_SERIALIZERS_, WFS.QUERY_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('PropertyName'), propertyNames, _ol_xml_.makeSimpleNodeFactory('PropertyName'), propertyNames,
objectStack); objectStack);
var filter = context['filter']; var filter = context['filter'];
if (filter) { if (filter) {
var child = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'Filter'); var child = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter');
node.appendChild(child); 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeFilterCondition_ = function(node, filter, objectStack) { WFS.writeFilterCondition_ = function(node, filter, objectStack) {
/** @type {ol.XmlNodeStackItem} */ /** @type {ol.XmlNodeStackItem} */
var item = {node: node}; var item = {node: node};
_ol_xml_.pushSerializeAndPop(item, _ol_xml_.pushSerializeAndPop(item,
_ol_format_WFS_.GETFEATURE_SERIALIZERS_, WFS.GETFEATURE_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory(filter.getTagName()), _ol_xml_.makeSimpleNodeFactory(filter.getTagName()),
[filter], objectStack); [filter], objectStack);
}; };
@@ -636,12 +636,12 @@ _ol_format_WFS_.writeFilterCondition_ = function(node, filter, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeBboxFilter_ = function(node, filter, objectStack) { WFS.writeBboxFilter_ = function(node, filter, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
context['srsName'] = filter.srsName; context['srsName'] = filter.srsName;
_ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); WFS.writeOgcPropertyName_(node, filter.geometryName);
_ol_format_GML3_.prototype.writeGeometryElement(node, filter.extent, objectStack); GML3.prototype.writeGeometryElement(node, filter.extent, objectStack);
}; };
@@ -651,12 +651,12 @@ _ol_format_WFS_.writeBboxFilter_ = function(node, filter, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeContainsFilter_ = function(node, filter, objectStack) { WFS.writeContainsFilter_ = function(node, filter, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
context['srsName'] = filter.srsName; context['srsName'] = filter.srsName;
_ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); WFS.writeOgcPropertyName_(node, filter.geometryName);
_ol_format_GML3_.prototype.writeGeometryElement(node, filter.geometry, objectStack); GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack);
}; };
@@ -666,12 +666,12 @@ _ol_format_WFS_.writeContainsFilter_ = function(node, filter, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeIntersectsFilter_ = function(node, filter, objectStack) { WFS.writeIntersectsFilter_ = function(node, filter, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
context['srsName'] = filter.srsName; context['srsName'] = filter.srsName;
_ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); WFS.writeOgcPropertyName_(node, filter.geometryName);
_ol_format_GML3_.prototype.writeGeometryElement(node, filter.geometry, objectStack); GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack);
}; };
@@ -681,12 +681,12 @@ _ol_format_WFS_.writeIntersectsFilter_ = function(node, filter, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeWithinFilter_ = function(node, filter, objectStack) { WFS.writeWithinFilter_ = function(node, filter, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
context['srsName'] = filter.srsName; context['srsName'] = filter.srsName;
_ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); WFS.writeOgcPropertyName_(node, filter.geometryName);
_ol_format_GML3_.prototype.writeGeometryElement(node, filter.geometry, objectStack); GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack);
}; };
@@ -696,23 +696,23 @@ _ol_format_WFS_.writeWithinFilter_ = function(node, filter, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @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'); var valueReference = _ol_xml_.createElementNS(WFS.FESNS, 'ValueReference');
_ol_format_XSD_.writeStringTextNode(valueReference, filter.propertyName); XSD.writeStringTextNode(valueReference, filter.propertyName);
node.appendChild(valueReference); node.appendChild(valueReference);
var timePeriod = _ol_xml_.createElementNS(_ol_format_GMLBase_.GMLNS, 'TimePeriod'); var timePeriod = _ol_xml_.createElementNS(GMLBase.GMLNS, 'TimePeriod');
node.appendChild(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); 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); 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeLogicalFilter_ = function(node, filter, objectStack) { WFS.writeLogicalFilter_ = function(node, filter, objectStack) {
/** @type {ol.XmlNodeStackItem} */ /** @type {ol.XmlNodeStackItem} */
var item = {node: node}; var item = {node: node};
var conditions = filter.conditions; var conditions = filter.conditions;
for (var i = 0, ii = conditions.length; i < ii; ++i) { for (var i = 0, ii = conditions.length; i < ii; ++i) {
var condition = conditions[i]; var condition = conditions[i];
_ol_xml_.pushSerializeAndPop(item, _ol_xml_.pushSerializeAndPop(item,
_ol_format_WFS_.GETFEATURE_SERIALIZERS_, WFS.GETFEATURE_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory(condition.getTagName()), _ol_xml_.makeSimpleNodeFactory(condition.getTagName()),
[condition], objectStack); [condition], objectStack);
} }
@@ -742,12 +742,12 @@ _ol_format_WFS_.writeLogicalFilter_ = function(node, filter, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeNotFilter_ = function(node, filter, objectStack) { WFS.writeNotFilter_ = function(node, filter, objectStack) {
/** @type {ol.XmlNodeStackItem} */ /** @type {ol.XmlNodeStackItem} */
var item = {node: node}; var item = {node: node};
var condition = filter.condition; var condition = filter.condition;
_ol_xml_.pushSerializeAndPop(item, _ol_xml_.pushSerializeAndPop(item,
_ol_format_WFS_.GETFEATURE_SERIALIZERS_, WFS.GETFEATURE_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory(condition.getTagName()), _ol_xml_.makeSimpleNodeFactory(condition.getTagName()),
[condition], objectStack); [condition], objectStack);
}; };
@@ -759,12 +759,12 @@ _ol_format_WFS_.writeNotFilter_ = function(node, filter, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeComparisonFilter_ = function(node, filter, objectStack) { WFS.writeComparisonFilter_ = function(node, filter, objectStack) {
if (filter.matchCase !== undefined) { if (filter.matchCase !== undefined) {
node.setAttribute('matchCase', filter.matchCase.toString()); node.setAttribute('matchCase', filter.matchCase.toString());
} }
_ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); WFS.writeOgcPropertyName_(node, filter.propertyName);
_ol_format_WFS_.writeOgcLiteral_(node, '' + filter.expression); WFS.writeOgcLiteral_(node, '' + filter.expression);
}; };
@@ -774,8 +774,8 @@ _ol_format_WFS_.writeComparisonFilter_ = function(node, filter, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeIsNullFilter_ = function(node, filter, objectStack) { WFS.writeIsNullFilter_ = function(node, filter, objectStack) {
_ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); WFS.writeOgcPropertyName_(node, filter.propertyName);
}; };
@@ -785,16 +785,16 @@ _ol_format_WFS_.writeIsNullFilter_ = function(node, filter, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeIsBetweenFilter_ = function(node, filter, objectStack) { WFS.writeIsBetweenFilter_ = function(node, filter, objectStack) {
_ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); 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); 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); 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. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeIsLikeFilter_ = function(node, filter, objectStack) { WFS.writeIsLikeFilter_ = function(node, filter, objectStack) {
node.setAttribute('wildCard', filter.wildCard); node.setAttribute('wildCard', filter.wildCard);
node.setAttribute('singleChar', filter.singleChar); node.setAttribute('singleChar', filter.singleChar);
node.setAttribute('escapeChar', filter.escapeChar); node.setAttribute('escapeChar', filter.escapeChar);
if (filter.matchCase !== undefined) { if (filter.matchCase !== undefined) {
node.setAttribute('matchCase', filter.matchCase.toString()); node.setAttribute('matchCase', filter.matchCase.toString());
} }
_ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); WFS.writeOgcPropertyName_(node, filter.propertyName);
_ol_format_WFS_.writeOgcLiteral_(node, '' + filter.pattern); WFS.writeOgcLiteral_(node, '' + filter.pattern);
}; };
@@ -822,9 +822,9 @@ _ol_format_WFS_.writeIsLikeFilter_ = function(node, filter, objectStack) {
* @param {string} value Value. * @param {string} value Value.
* @private * @private
*/ */
_ol_format_WFS_.writeOgcExpression_ = function(tagName, node, value) { WFS.writeOgcExpression_ = function(tagName, node, value) {
var property = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, tagName); var property = _ol_xml_.createElementNS(WFS.OGCNS, tagName);
_ol_format_XSD_.writeStringTextNode(property, value); XSD.writeStringTextNode(property, value);
node.appendChild(property); node.appendChild(property);
}; };
@@ -834,8 +834,8 @@ _ol_format_WFS_.writeOgcExpression_ = function(tagName, node, value) {
* @param {string} value PropertyName value. * @param {string} value PropertyName value.
* @private * @private
*/ */
_ol_format_WFS_.writeOgcPropertyName_ = function(node, value) { WFS.writeOgcPropertyName_ = function(node, value) {
_ol_format_WFS_.writeOgcExpression_('PropertyName', node, value); WFS.writeOgcExpression_('PropertyName', node, value);
}; };
@@ -844,8 +844,8 @@ _ol_format_WFS_.writeOgcPropertyName_ = function(node, value) {
* @param {string} value PropertyName value. * @param {string} value PropertyName value.
* @private * @private
*/ */
_ol_format_WFS_.writeOgcLiteral_ = function(node, value) { WFS.writeOgcLiteral_ = function(node, value) {
_ol_format_WFS_.writeOgcExpression_('Literal', node, value); WFS.writeOgcExpression_('Literal', node, value);
}; };
@@ -854,13 +854,13 @@ _ol_format_WFS_.writeOgcLiteral_ = function(node, value) {
* @param {string} time PropertyName value. * @param {string} time PropertyName value.
* @private * @private
*/ */
_ol_format_WFS_.writeTimeInstant_ = function(node, time) { WFS.writeTimeInstant_ = function(node, time) {
var timeInstant = _ol_xml_.createElementNS(_ol_format_GMLBase_.GMLNS, 'TimeInstant'); var timeInstant = _ol_xml_.createElementNS(GMLBase.GMLNS, 'TimeInstant');
node.appendChild(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); 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.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_WFS_.GETFEATURE_SERIALIZERS_ = { WFS.GETFEATURE_SERIALIZERS_ = {
'http://www.opengis.net/wfs': { 'http://www.opengis.net/wfs': {
'Query': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeQuery_) 'Query': _ol_xml_.makeChildAppender(WFS.writeQuery_)
}, },
'http://www.opengis.net/ogc': { 'http://www.opengis.net/ogc': {
'During': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeDuringFilter_), 'During': _ol_xml_.makeChildAppender(WFS.writeDuringFilter_),
'And': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeLogicalFilter_), 'And': _ol_xml_.makeChildAppender(WFS.writeLogicalFilter_),
'Or': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeLogicalFilter_), 'Or': _ol_xml_.makeChildAppender(WFS.writeLogicalFilter_),
'Not': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeNotFilter_), 'Not': _ol_xml_.makeChildAppender(WFS.writeNotFilter_),
'BBOX': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeBboxFilter_), 'BBOX': _ol_xml_.makeChildAppender(WFS.writeBboxFilter_),
'Contains': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeContainsFilter_), 'Contains': _ol_xml_.makeChildAppender(WFS.writeContainsFilter_),
'Intersects': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIntersectsFilter_), 'Intersects': _ol_xml_.makeChildAppender(WFS.writeIntersectsFilter_),
'Within': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeWithinFilter_), 'Within': _ol_xml_.makeChildAppender(WFS.writeWithinFilter_),
'PropertyIsEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), 'PropertyIsEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
'PropertyIsNotEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), 'PropertyIsNotEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
'PropertyIsLessThan': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), 'PropertyIsLessThan': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
'PropertyIsLessThanOrEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), 'PropertyIsLessThanOrEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
'PropertyIsGreaterThan': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), 'PropertyIsGreaterThan': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
'PropertyIsGreaterThanOrEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), 'PropertyIsGreaterThanOrEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
'PropertyIsNull': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIsNullFilter_), 'PropertyIsNull': _ol_xml_.makeChildAppender(WFS.writeIsNullFilter_),
'PropertyIsBetween': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIsBetweenFilter_), 'PropertyIsBetween': _ol_xml_.makeChildAppender(WFS.writeIsBetweenFilter_),
'PropertyIsLike': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIsLikeFilter_) 'PropertyIsLike': _ol_xml_.makeChildAppender(WFS.writeIsLikeFilter_)
} }
}; };
@@ -901,9 +901,9 @@ _ol_format_WFS_.GETFEATURE_SERIALIZERS_ = {
* @return {Node} Result. * @return {Node} Result.
* @api * @api
*/ */
_ol_format_WFS_.writeFilter = function(filter) { WFS.writeFilter = function(filter) {
var child = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'Filter'); var child = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter');
_ol_format_WFS_.writeFilterCondition_(child, filter, []); WFS.writeFilterCondition_(child, filter, []);
return child; return child;
}; };
@@ -914,12 +914,12 @@ _ol_format_WFS_.writeFilter = function(filter) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_WFS_.writeGetFeature_ = function(node, featureTypes, objectStack) { WFS.writeGetFeature_ = function(node, featureTypes, objectStack) {
var context = /** @type {Object} */ (objectStack[objectStack.length - 1]); var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context)); var item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context));
item.node = node; item.node = node;
_ol_xml_.pushSerializeAndPop(item, _ol_xml_.pushSerializeAndPop(item,
_ol_format_WFS_.GETFEATURE_SERIALIZERS_, WFS.GETFEATURE_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('Query'), featureTypes, _ol_xml_.makeSimpleNodeFactory('Query'), featureTypes,
objectStack); objectStack);
}; };
@@ -932,8 +932,8 @@ _ol_format_WFS_.writeGetFeature_ = function(node, featureTypes, objectStack) {
* @return {Node} Result. * @return {Node} Result.
* @api * @api
*/ */
_ol_format_WFS_.prototype.writeGetFeature = function(options) { WFS.prototype.writeGetFeature = function(options) {
var node = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'GetFeature'); var node = _ol_xml_.createElementNS(WFS.WFSNS, 'GetFeature');
node.setAttribute('service', 'WFS'); node.setAttribute('service', 'WFS');
node.setAttribute('version', '1.1.0'); node.setAttribute('version', '1.1.0');
var filter; var filter;
@@ -984,7 +984,7 @@ _ol_format_WFS_.prototype.writeGetFeature = function(options) {
}; };
_ol_asserts_.assert(Array.isArray(options.featureTypes), _ol_asserts_.assert(Array.isArray(options.featureTypes),
11); // `options.featureTypes` should be an Array 11); // `options.featureTypes` should be an Array
_ol_format_WFS_.writeGetFeature_(node, /** @type {!Array.<string>} */ (options.featureTypes), [context]); WFS.writeGetFeature_(node, /** @type {!Array.<string>} */ (options.featureTypes), [context]);
return node; return node;
}; };
@@ -999,12 +999,12 @@ _ol_format_WFS_.prototype.writeGetFeature = function(options) {
* @return {Node} Result. * @return {Node} Result.
* @api * @api
*/ */
_ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, WFS.prototype.writeTransaction = function(inserts, updates, deletes,
options) { options) {
var objectStack = []; var objectStack = [];
var node = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'Transaction'); var node = _ol_xml_.createElementNS(WFS.WFSNS, 'Transaction');
var version = options.version ? var version = options.version ?
options.version : _ol_format_WFS_.DEFAULT_VERSION; options.version : WFS.DEFAULT_VERSION;
var gmlVersion = version === '1.0.0' ? 2 : 3; var gmlVersion = version === '1.0.0' ? 2 : 3;
node.setAttribute('service', 'WFS'); node.setAttribute('service', 'WFS');
node.setAttribute('version', version); node.setAttribute('version', version);
@@ -1017,17 +1017,17 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes,
node.setAttribute('handle', options.handle); 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', _ol_xml_.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation', schemaLocation); '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) { if (inserts) {
obj = {node: node, 'featureNS': options.featureNS, obj = {node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': featurePrefix, 'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; 'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
_ol_obj_.assign(obj, baseObj); _ol_obj_.assign(obj, baseObj);
_ol_xml_.pushSerializeAndPop(obj, _ol_xml_.pushSerializeAndPop(obj,
_ol_format_WFS_.TRANSACTION_SERIALIZERS_, WFS.TRANSACTION_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('Insert'), inserts, _ol_xml_.makeSimpleNodeFactory('Insert'), inserts,
objectStack); objectStack);
} }
@@ -1037,7 +1037,7 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes,
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; 'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
_ol_obj_.assign(obj, baseObj); _ol_obj_.assign(obj, baseObj);
_ol_xml_.pushSerializeAndPop(obj, _ol_xml_.pushSerializeAndPop(obj,
_ol_format_WFS_.TRANSACTION_SERIALIZERS_, WFS.TRANSACTION_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('Update'), updates, _ol_xml_.makeSimpleNodeFactory('Update'), updates,
objectStack); objectStack);
} }
@@ -1045,7 +1045,7 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes,
_ol_xml_.pushSerializeAndPop({node: node, 'featureNS': options.featureNS, _ol_xml_.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': featurePrefix, 'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'srsName': options.srsName}, 'gmlVersion': gmlVersion, 'srsName': options.srsName},
_ol_format_WFS_.TRANSACTION_SERIALIZERS_, WFS.TRANSACTION_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('Delete'), deletes, _ol_xml_.makeSimpleNodeFactory('Delete'), deletes,
objectStack); objectStack);
} }
@@ -1053,7 +1053,7 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes,
_ol_xml_.pushSerializeAndPop({node: node, 'featureNS': options.featureNS, _ol_xml_.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': featurePrefix, 'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'srsName': options.srsName}, 'gmlVersion': gmlVersion, 'srsName': options.srsName},
_ol_format_WFS_.TRANSACTION_SERIALIZERS_, WFS.TRANSACTION_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('Native'), options.nativeElements, _ol_xml_.makeSimpleNodeFactory('Native'), options.nativeElements,
objectStack); objectStack);
} }
@@ -1069,13 +1069,13 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes,
* @return {?ol.proj.Projection} Projection. * @return {?ol.proj.Projection} Projection.
* @api * @api
*/ */
_ol_format_WFS_.prototype.readProjection; WFS.prototype.readProjection;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WFS_.prototype.readProjectionFromDocument = function(doc) { WFS.prototype.readProjectionFromDocument = function(doc) {
for (var n = doc.firstChild; n; n = n.nextSibling) { for (var n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) { if (n.nodeType == Node.ELEMENT_NODE) {
return this.readProjectionFromNode(n); return this.readProjectionFromNode(n);
@@ -1088,7 +1088,7 @@ _ol_format_WFS_.prototype.readProjectionFromDocument = function(doc) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WFS_.prototype.readProjectionFromNode = function(node) { WFS.prototype.readProjectionFromNode = function(node) {
if (node.firstElementChild && if (node.firstElementChild &&
node.firstElementChild.firstElementChild) { node.firstElementChild.firstElementChild) {
node = node.firstElementChild.firstElementChild; node = node.firstElementChild.firstElementChild;
@@ -1105,4 +1105,4 @@ _ol_format_WFS_.prototype.readProjectionFromNode = function(node) {
return null; return null;
}; };
export default _ol_format_WFS_; export default WFS;
+129 -129
View File
@@ -3,8 +3,8 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js'; import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js'; import FeatureFormat from '../format/Feature.js';
import _ol_format_TextFeature_ from '../format/TextFeature.js'; import TextFeature from '../format/TextFeature.js';
import GeometryCollection from '../geom/GeometryCollection.js'; import GeometryCollection from '../geom/GeometryCollection.js';
import GeometryType from '../geom/GeometryType.js'; import GeometryType from '../geom/GeometryType.js';
import GeometryLayout from '../geom/GeometryLayout.js'; import GeometryLayout from '../geom/GeometryLayout.js';
@@ -26,11 +26,11 @@ import SimpleGeometry from '../geom/SimpleGeometry.js';
* @param {olx.format.WKTOptions=} opt_options Options. * @param {olx.format.WKTOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_format_WKT_ = function(opt_options) { var WKT = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
_ol_format_TextFeature_.call(this); TextFeature.call(this);
/** /**
* Split GeometryCollection into multiple features. * 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 * @const
* @type {string} * @type {string}
*/ */
_ol_format_WKT_.EMPTY = 'EMPTY'; WKT.EMPTY = 'EMPTY';
/** /**
* @const * @const
* @type {string} * @type {string}
*/ */
_ol_format_WKT_.Z = 'Z'; WKT.Z = 'Z';
/** /**
* @const * @const
* @type {string} * @type {string}
*/ */
_ol_format_WKT_.M = 'M'; WKT.M = 'M';
/** /**
* @const * @const
* @type {string} * @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. * @return {string} Coordinates part of Point as WKT.
* @private * @private
*/ */
_ol_format_WKT_.encodePointGeometry_ = function(geom) { WKT.encodePointGeometry_ = function(geom) {
var coordinates = geom.getCoordinates(); var coordinates = geom.getCoordinates();
if (coordinates.length === 0) { if (coordinates.length === 0) {
return ''; return '';
@@ -92,11 +92,11 @@ _ol_format_WKT_.encodePointGeometry_ = function(geom) {
* @return {string} Coordinates part of MultiPoint as WKT. * @return {string} Coordinates part of MultiPoint as WKT.
* @private * @private
*/ */
_ol_format_WKT_.encodeMultiPointGeometry_ = function(geom) { WKT.encodeMultiPointGeometry_ = function(geom) {
var array = []; var array = [];
var components = geom.getPoints(); var components = geom.getPoints();
for (var i = 0, ii = components.length; i < ii; ++i) { 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(','); return array.join(',');
}; };
@@ -107,11 +107,11 @@ _ol_format_WKT_.encodeMultiPointGeometry_ = function(geom) {
* @return {string} Coordinates part of GeometryCollection as WKT. * @return {string} Coordinates part of GeometryCollection as WKT.
* @private * @private
*/ */
_ol_format_WKT_.encodeGeometryCollectionGeometry_ = function(geom) { WKT.encodeGeometryCollectionGeometry_ = function(geom) {
var array = []; var array = [];
var geoms = geom.getGeometries(); var geoms = geom.getGeometries();
for (var i = 0, ii = geoms.length; i < ii; ++i) { 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(','); return array.join(',');
}; };
@@ -122,7 +122,7 @@ _ol_format_WKT_.encodeGeometryCollectionGeometry_ = function(geom) {
* @return {string} Coordinates part of LineString as WKT. * @return {string} Coordinates part of LineString as WKT.
* @private * @private
*/ */
_ol_format_WKT_.encodeLineStringGeometry_ = function(geom) { WKT.encodeLineStringGeometry_ = function(geom) {
var coordinates = geom.getCoordinates(); var coordinates = geom.getCoordinates();
var array = []; var array = [];
for (var i = 0, ii = coordinates.length; i < ii; ++i) { 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. * @return {string} Coordinates part of MultiLineString as WKT.
* @private * @private
*/ */
_ol_format_WKT_.encodeMultiLineStringGeometry_ = function(geom) { WKT.encodeMultiLineStringGeometry_ = function(geom) {
var array = []; var array = [];
var components = geom.getLineStrings(); var components = geom.getLineStrings();
for (var i = 0, ii = components.length; i < ii; ++i) { for (var i = 0, ii = components.length; i < ii; ++i) {
array.push('(' + _ol_format_WKT_.encodeLineStringGeometry_( array.push('(' + WKT.encodeLineStringGeometry_(
components[i]) + ')'); components[i]) + ')');
} }
return array.join(','); return array.join(',');
@@ -153,11 +153,11 @@ _ol_format_WKT_.encodeMultiLineStringGeometry_ = function(geom) {
* @return {string} Coordinates part of Polygon as WKT. * @return {string} Coordinates part of Polygon as WKT.
* @private * @private
*/ */
_ol_format_WKT_.encodePolygonGeometry_ = function(geom) { WKT.encodePolygonGeometry_ = function(geom) {
var array = []; var array = [];
var rings = geom.getLinearRings(); var rings = geom.getLinearRings();
for (var i = 0, ii = rings.length; i < ii; ++i) { for (var i = 0, ii = rings.length; i < ii; ++i) {
array.push('(' + _ol_format_WKT_.encodeLineStringGeometry_( array.push('(' + WKT.encodeLineStringGeometry_(
rings[i]) + ')'); rings[i]) + ')');
} }
return array.join(','); return array.join(',');
@@ -169,11 +169,11 @@ _ol_format_WKT_.encodePolygonGeometry_ = function(geom) {
* @return {string} Coordinates part of MultiPolygon as WKT. * @return {string} Coordinates part of MultiPolygon as WKT.
* @private * @private
*/ */
_ol_format_WKT_.encodeMultiPolygonGeometry_ = function(geom) { WKT.encodeMultiPolygonGeometry_ = function(geom) {
var array = []; var array = [];
var components = geom.getPolygons(); var components = geom.getPolygons();
for (var i = 0, ii = components.length; i < ii; ++i) { for (var i = 0, ii = components.length; i < ii; ++i) {
array.push('(' + _ol_format_WKT_.encodePolygonGeometry_( array.push('(' + WKT.encodePolygonGeometry_(
components[i]) + ')'); components[i]) + ')');
} }
return array.join(','); return array.join(',');
@@ -184,14 +184,14 @@ _ol_format_WKT_.encodeMultiPolygonGeometry_ = function(geom) {
* @return {string} Potential dimensional information for WKT type. * @return {string} Potential dimensional information for WKT type.
* @private * @private
*/ */
_ol_format_WKT_.encodeGeometryLayout_ = function(geom) { WKT.encodeGeometryLayout_ = function(geom) {
var layout = geom.getLayout(); var layout = geom.getLayout();
var dimInfo = ''; var dimInfo = '';
if (layout === GeometryLayout.XYZ || layout === GeometryLayout.XYZM) { if (layout === GeometryLayout.XYZ || layout === GeometryLayout.XYZM) {
dimInfo += _ol_format_WKT_.Z; dimInfo += WKT.Z;
} }
if (layout === GeometryLayout.XYM || layout === GeometryLayout.XYZM) { if (layout === GeometryLayout.XYM || layout === GeometryLayout.XYZM) {
dimInfo += _ol_format_WKT_.M; dimInfo += WKT.M;
} }
return dimInfo; return dimInfo;
}; };
@@ -203,19 +203,19 @@ _ol_format_WKT_.encodeGeometryLayout_ = function(geom) {
* @return {string} WKT string for the geometry. * @return {string} WKT string for the geometry.
* @private * @private
*/ */
_ol_format_WKT_.encode_ = function(geom) { WKT.encode_ = function(geom) {
var type = geom.getType(); var type = geom.getType();
var geometryEncoder = _ol_format_WKT_.GeometryEncoder_[type]; var geometryEncoder = WKT.GeometryEncoder_[type];
var enc = geometryEncoder(geom); var enc = geometryEncoder(geom);
type = type.toUpperCase(); type = type.toUpperCase();
if (geom instanceof SimpleGeometry) { if (geom instanceof SimpleGeometry) {
var dimInfo = _ol_format_WKT_.encodeGeometryLayout_(geom); var dimInfo = WKT.encodeGeometryLayout_(geom);
if (dimInfo.length > 0) { if (dimInfo.length > 0) {
type += ' ' + dimInfo; type += ' ' + dimInfo;
} }
} }
if (enc.length === 0) { if (enc.length === 0) {
return type + ' ' + _ol_format_WKT_.EMPTY; return type + ' ' + WKT.EMPTY;
} }
return type + '(' + enc + ')'; return type + '(' + enc + ')';
}; };
@@ -226,14 +226,14 @@ _ol_format_WKT_.encode_ = function(geom) {
* @type {Object.<string, function(ol.geom.Geometry): string>} * @type {Object.<string, function(ol.geom.Geometry): string>}
* @private * @private
*/ */
_ol_format_WKT_.GeometryEncoder_ = { WKT.GeometryEncoder_ = {
'Point': _ol_format_WKT_.encodePointGeometry_, 'Point': WKT.encodePointGeometry_,
'LineString': _ol_format_WKT_.encodeLineStringGeometry_, 'LineString': WKT.encodeLineStringGeometry_,
'Polygon': _ol_format_WKT_.encodePolygonGeometry_, 'Polygon': WKT.encodePolygonGeometry_,
'MultiPoint': _ol_format_WKT_.encodeMultiPointGeometry_, 'MultiPoint': WKT.encodeMultiPointGeometry_,
'MultiLineString': _ol_format_WKT_.encodeMultiLineStringGeometry_, 'MultiLineString': WKT.encodeMultiLineStringGeometry_,
'MultiPolygon': _ol_format_WKT_.encodeMultiPolygonGeometry_, 'MultiPolygon': WKT.encodeMultiPolygonGeometry_,
'GeometryCollection': _ol_format_WKT_.encodeGeometryCollectionGeometry_ 'GeometryCollection': WKT.encodeGeometryCollectionGeometry_
}; };
@@ -244,9 +244,9 @@ _ol_format_WKT_.GeometryEncoder_ = {
* The geometry created. * The geometry created.
* @private * @private
*/ */
_ol_format_WKT_.prototype.parse_ = function(wkt) { WKT.prototype.parse_ = function(wkt) {
var lexer = new _ol_format_WKT_.Lexer(wkt); var lexer = new WKT.Lexer(wkt);
var parser = new _ol_format_WKT_.Parser(lexer); var parser = new WKT.Parser(lexer);
return parser.parse(); return parser.parse();
}; };
@@ -260,13 +260,13 @@ _ol_format_WKT_.prototype.parse_ = function(wkt) {
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
* @api * @api
*/ */
_ol_format_WKT_.prototype.readFeature; WKT.prototype.readFeature;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WKT_.prototype.readFeatureFromText = function(text, opt_options) { WKT.prototype.readFeatureFromText = function(text, opt_options) {
var geom = this.readGeometryFromText(text, opt_options); var geom = this.readGeometryFromText(text, opt_options);
if (geom) { if (geom) {
var feature = new _ol_Feature_(); var feature = new _ol_Feature_();
@@ -286,13 +286,13 @@ _ol_format_WKT_.prototype.readFeatureFromText = function(text, opt_options) {
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_WKT_.prototype.readFeatures; WKT.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WKT_.prototype.readFeaturesFromText = function(text, opt_options) { WKT.prototype.readFeaturesFromText = function(text, opt_options) {
var geometries = []; var geometries = [];
var geometry = this.readGeometryFromText(text, opt_options); var geometry = this.readGeometryFromText(text, opt_options);
if (this.splitCollection_ && if (this.splitCollection_ &&
@@ -321,17 +321,17 @@ _ol_format_WKT_.prototype.readFeaturesFromText = function(text, opt_options) {
* @return {ol.geom.Geometry} Geometry. * @return {ol.geom.Geometry} Geometry.
* @api * @api
*/ */
_ol_format_WKT_.prototype.readGeometry; WKT.prototype.readGeometry;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WKT_.prototype.readGeometryFromText = function(text, opt_options) { WKT.prototype.readGeometryFromText = function(text, opt_options) {
var geometry = this.parse_(text); var geometry = this.parse_(text);
if (geometry) { if (geometry) {
return ( return (
/** @type {ol.geom.Geometry} */ _ol_format_Feature_.transformWithOptions(geometry, false, opt_options) /** @type {ol.geom.Geometry} */ FeatureFormat.transformWithOptions(geometry, false, opt_options)
); );
} else { } else {
return null; return null;
@@ -348,13 +348,13 @@ _ol_format_WKT_.prototype.readGeometryFromText = function(text, opt_options) {
* @return {string} WKT string. * @return {string} WKT string.
* @api * @api
*/ */
_ol_format_WKT_.prototype.writeFeature; WKT.prototype.writeFeature;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WKT_.prototype.writeFeatureText = function(feature, opt_options) { WKT.prototype.writeFeatureText = function(feature, opt_options) {
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
return this.writeGeometryText(geometry, opt_options); return this.writeGeometryText(geometry, opt_options);
@@ -372,13 +372,13 @@ _ol_format_WKT_.prototype.writeFeatureText = function(feature, opt_options) {
* @return {string} WKT string. * @return {string} WKT string.
* @api * @api
*/ */
_ol_format_WKT_.prototype.writeFeatures; WKT.prototype.writeFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WKT_.prototype.writeFeaturesText = function(features, opt_options) { WKT.prototype.writeFeaturesText = function(features, opt_options) {
if (features.length == 1) { if (features.length == 1) {
return this.writeFeatureText(features[0], opt_options); return this.writeFeatureText(features[0], opt_options);
} }
@@ -400,15 +400,15 @@ _ol_format_WKT_.prototype.writeFeaturesText = function(features, opt_options) {
* @return {string} WKT string. * @return {string} WKT string.
* @api * @api
*/ */
_ol_format_WKT_.prototype.writeGeometry; WKT.prototype.writeGeometry;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WKT_.prototype.writeGeometryText = function(geometry, opt_options) { WKT.prototype.writeGeometryText = function(geometry, opt_options) {
return _ol_format_WKT_.encode_(/** @type {ol.geom.Geometry} */ ( return WKT.encode_(/** @type {ol.geom.Geometry} */ (
_ol_format_Feature_.transformWithOptions(geometry, true, opt_options))); FeatureFormat.transformWithOptions(geometry, true, opt_options)));
}; };
@@ -417,7 +417,7 @@ _ol_format_WKT_.prototype.writeGeometryText = function(geometry, opt_options) {
* @enum {number} * @enum {number}
* @private * @private
*/ */
_ol_format_WKT_.TokenType_ = { WKT.TokenType_ = {
TEXT: 1, TEXT: 1,
LEFT_PAREN: 2, LEFT_PAREN: 2,
RIGHT_PAREN: 3, RIGHT_PAREN: 3,
@@ -433,7 +433,7 @@ _ol_format_WKT_.TokenType_ = {
* @constructor * @constructor
* @protected * @protected
*/ */
_ol_format_WKT_.Lexer = function(wkt) { WKT.Lexer = function(wkt) {
/** /**
* @type {string} * @type {string}
@@ -453,7 +453,7 @@ _ol_format_WKT_.Lexer = function(wkt) {
* @return {boolean} Whether the character is alphabetic. * @return {boolean} Whether the character is alphabetic.
* @private * @private
*/ */
_ol_format_WKT_.Lexer.prototype.isAlpha_ = function(c) { WKT.Lexer.prototype.isAlpha_ = function(c) {
return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z'; 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. * @return {boolean} Whether the character is numeric.
* @private * @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; var decimal = opt_decimal !== undefined ? opt_decimal : false;
return c >= '0' && c <= '9' || c == '.' && !decimal; 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. * @return {boolean} Whether the character is whitespace.
* @private * @private
*/ */
_ol_format_WKT_.Lexer.prototype.isWhiteSpace_ = function(c) { WKT.Lexer.prototype.isWhiteSpace_ = function(c) {
return c == ' ' || c == '\t' || c == '\r' || c == '\n'; 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. * @return {string} Next string character.
* @private * @private
*/ */
_ol_format_WKT_.Lexer.prototype.nextChar_ = function() { WKT.Lexer.prototype.nextChar_ = function() {
return this.wkt.charAt(++this.index_); return this.wkt.charAt(++this.index_);
}; };
@@ -494,26 +494,26 @@ _ol_format_WKT_.Lexer.prototype.nextChar_ = function() {
* Fetch and return the next token. * Fetch and return the next token.
* @return {!ol.WKTToken} Next string token. * @return {!ol.WKTToken} Next string token.
*/ */
_ol_format_WKT_.Lexer.prototype.nextToken = function() { WKT.Lexer.prototype.nextToken = function() {
var c = this.nextChar_(); var c = this.nextChar_();
var token = {position: this.index_, value: c}; var token = {position: this.index_, value: c};
if (c == '(') { if (c == '(') {
token.type = _ol_format_WKT_.TokenType_.LEFT_PAREN; token.type = WKT.TokenType_.LEFT_PAREN;
} else if (c == ',') { } else if (c == ',') {
token.type = _ol_format_WKT_.TokenType_.COMMA; token.type = WKT.TokenType_.COMMA;
} else if (c == ')') { } else if (c == ')') {
token.type = _ol_format_WKT_.TokenType_.RIGHT_PAREN; token.type = WKT.TokenType_.RIGHT_PAREN;
} else if (this.isNumeric_(c) || c == '-') { } else if (this.isNumeric_(c) || c == '-') {
token.type = _ol_format_WKT_.TokenType_.NUMBER; token.type = WKT.TokenType_.NUMBER;
token.value = this.readNumber_(); token.value = this.readNumber_();
} else if (this.isAlpha_(c)) { } else if (this.isAlpha_(c)) {
token.type = _ol_format_WKT_.TokenType_.TEXT; token.type = WKT.TokenType_.TEXT;
token.value = this.readText_(); token.value = this.readText_();
} else if (this.isWhiteSpace_(c)) { } else if (this.isWhiteSpace_(c)) {
return this.nextToken(); return this.nextToken();
} else if (c === '') { } else if (c === '') {
token.type = _ol_format_WKT_.TokenType_.EOF; token.type = WKT.TokenType_.EOF;
} else { } else {
throw new Error('Unexpected character: ' + c); throw new Error('Unexpected character: ' + c);
} }
@@ -526,7 +526,7 @@ _ol_format_WKT_.Lexer.prototype.nextToken = function() {
* @return {number} Numeric token value. * @return {number} Numeric token value.
* @private * @private
*/ */
_ol_format_WKT_.Lexer.prototype.readNumber_ = function() { WKT.Lexer.prototype.readNumber_ = function() {
var c, index = this.index_; var c, index = this.index_;
var decimal = false; var decimal = false;
var scientificNotation = false; var scientificNotation = false;
@@ -554,7 +554,7 @@ _ol_format_WKT_.Lexer.prototype.readNumber_ = function() {
* @return {string} String token value. * @return {string} String token value.
* @private * @private
*/ */
_ol_format_WKT_.Lexer.prototype.readText_ = function() { WKT.Lexer.prototype.readText_ = function() {
var c, index = this.index_; var c, index = this.index_;
do { do {
c = this.nextChar_(); c = this.nextChar_();
@@ -569,7 +569,7 @@ _ol_format_WKT_.Lexer.prototype.readText_ = function() {
* @constructor * @constructor
* @protected * @protected
*/ */
_ol_format_WKT_.Parser = function(lexer) { WKT.Parser = function(lexer) {
/** /**
* @type {ol.format.WKT.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. * Fetch the next token form the lexer and replace the active token.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.consume_ = function() { WKT.Parser.prototype.consume_ = function() {
this.token_ = this.lexer_.nextToken(); this.token_ = this.lexer_.nextToken();
}; };
@@ -604,7 +604,7 @@ _ol_format_WKT_.Parser.prototype.consume_ = function() {
* @param {ol.format.WKT.TokenType_} type Token type. * @param {ol.format.WKT.TokenType_} type Token type.
* @return {boolean} Whether the token matches the given 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; var isMatch = this.token_.type == type;
return isMatch; return isMatch;
}; };
@@ -615,7 +615,7 @@ _ol_format_WKT_.Parser.prototype.isTokenType = function(type) {
* @param {ol.format.WKT.TokenType_} type Token type. * @param {ol.format.WKT.TokenType_} type Token type.
* @return {boolean} Whether the token matches the given 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); var isMatch = this.isTokenType(type);
if (isMatch) { if (isMatch) {
this.consume_(); this.consume_();
@@ -628,7 +628,7 @@ _ol_format_WKT_.Parser.prototype.match = function(type) {
* Try to parse the tokens provided by the lexer. * Try to parse the tokens provided by the lexer.
* @return {ol.geom.Geometry} The geometry. * @return {ol.geom.Geometry} The geometry.
*/ */
_ol_format_WKT_.Parser.prototype.parse = function() { WKT.Parser.prototype.parse = function() {
this.consume_(); this.consume_();
var geometry = this.parseGeometry_(); var geometry = this.parseGeometry_();
return geometry; return geometry;
@@ -640,16 +640,16 @@ _ol_format_WKT_.Parser.prototype.parse = function() {
* @return {ol.geom.GeometryLayout} The layout. * @return {ol.geom.GeometryLayout} The layout.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parseGeometryLayout_ = function() { WKT.Parser.prototype.parseGeometryLayout_ = function() {
var layout = GeometryLayout.XY; var layout = GeometryLayout.XY;
var dimToken = this.token_; var dimToken = this.token_;
if (this.isTokenType(_ol_format_WKT_.TokenType_.TEXT)) { if (this.isTokenType(WKT.TokenType_.TEXT)) {
var dimInfo = dimToken.value; var dimInfo = dimToken.value;
if (dimInfo === _ol_format_WKT_.Z) { if (dimInfo === WKT.Z) {
layout = GeometryLayout.XYZ; layout = GeometryLayout.XYZ;
} else if (dimInfo === _ol_format_WKT_.M) { } else if (dimInfo === WKT.M) {
layout = GeometryLayout.XYM; layout = GeometryLayout.XYM;
} else if (dimInfo === _ol_format_WKT_.ZM) { } else if (dimInfo === WKT.ZM) {
layout = GeometryLayout.XYZM; layout = GeometryLayout.XYZM;
} }
if (layout !== GeometryLayout.XY) { if (layout !== GeometryLayout.XY) {
@@ -664,17 +664,17 @@ _ol_format_WKT_.Parser.prototype.parseGeometryLayout_ = function() {
* @return {!ol.geom.Geometry} The geometry. * @return {!ol.geom.Geometry} The geometry.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parseGeometry_ = function() { WKT.Parser.prototype.parseGeometry_ = function() {
var token = this.token_; var token = this.token_;
if (this.match(_ol_format_WKT_.TokenType_.TEXT)) { if (this.match(WKT.TokenType_.TEXT)) {
var geomType = token.value; var geomType = token.value;
this.layout_ = this.parseGeometryLayout_(); this.layout_ = this.parseGeometryLayout_();
if (geomType == GeometryType.GEOMETRY_COLLECTION.toUpperCase()) { if (geomType == GeometryType.GEOMETRY_COLLECTION.toUpperCase()) {
var geometries = this.parseGeometryCollectionText_(); var geometries = this.parseGeometryCollectionText_();
return new GeometryCollection(geometries); return new GeometryCollection(geometries);
} else { } else {
var parser = _ol_format_WKT_.Parser.GeometryParser_[geomType]; var parser = WKT.Parser.GeometryParser_[geomType];
var ctor = _ol_format_WKT_.Parser.GeometryConstructor_[geomType]; var ctor = WKT.Parser.GeometryConstructor_[geomType];
if (!parser || !ctor) { if (!parser || !ctor) {
throw new Error('Invalid geometry type: ' + geomType); throw new Error('Invalid geometry type: ' + geomType);
} }
@@ -690,13 +690,13 @@ _ol_format_WKT_.Parser.prototype.parseGeometry_ = function() {
* @return {!Array.<ol.geom.Geometry>} A collection of geometries. * @return {!Array.<ol.geom.Geometry>} A collection of geometries.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parseGeometryCollectionText_ = function() { WKT.Parser.prototype.parseGeometryCollectionText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { if (this.match(WKT.TokenType_.LEFT_PAREN)) {
var geometries = []; var geometries = [];
do { do {
geometries.push(this.parseGeometry_()); geometries.push(this.parseGeometry_());
} while (this.match(_ol_format_WKT_.TokenType_.COMMA)); } while (this.match(WKT.TokenType_.COMMA));
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { if (this.match(WKT.TokenType_.RIGHT_PAREN)) {
return geometries; return geometries;
} }
} else if (this.isEmptyGeometry_()) { } else if (this.isEmptyGeometry_()) {
@@ -710,10 +710,10 @@ _ol_format_WKT_.Parser.prototype.parseGeometryCollectionText_ = function() {
* @return {Array.<number>} All values in a point. * @return {Array.<number>} All values in a point.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parsePointText_ = function() { WKT.Parser.prototype.parsePointText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { if (this.match(WKT.TokenType_.LEFT_PAREN)) {
var coordinates = this.parsePoint_(); var coordinates = this.parsePoint_();
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { if (this.match(WKT.TokenType_.RIGHT_PAREN)) {
return coordinates; return coordinates;
} }
} else if (this.isEmptyGeometry_()) { } else if (this.isEmptyGeometry_()) {
@@ -727,10 +727,10 @@ _ol_format_WKT_.Parser.prototype.parsePointText_ = function() {
* @return {!Array.<!Array.<number>>} All points in a linestring. * @return {!Array.<!Array.<number>>} All points in a linestring.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parseLineStringText_ = function() { WKT.Parser.prototype.parseLineStringText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { if (this.match(WKT.TokenType_.LEFT_PAREN)) {
var coordinates = this.parsePointList_(); var coordinates = this.parsePointList_();
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { if (this.match(WKT.TokenType_.RIGHT_PAREN)) {
return coordinates; return coordinates;
} }
} else if (this.isEmptyGeometry_()) { } else if (this.isEmptyGeometry_()) {
@@ -744,10 +744,10 @@ _ol_format_WKT_.Parser.prototype.parseLineStringText_ = function() {
* @return {!Array.<!Array.<number>>} All points in a polygon. * @return {!Array.<!Array.<number>>} All points in a polygon.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parsePolygonText_ = function() { WKT.Parser.prototype.parsePolygonText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { if (this.match(WKT.TokenType_.LEFT_PAREN)) {
var coordinates = this.parseLineStringTextList_(); var coordinates = this.parseLineStringTextList_();
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { if (this.match(WKT.TokenType_.RIGHT_PAREN)) {
return coordinates; return coordinates;
} }
} else if (this.isEmptyGeometry_()) { } else if (this.isEmptyGeometry_()) {
@@ -761,15 +761,15 @@ _ol_format_WKT_.Parser.prototype.parsePolygonText_ = function() {
* @return {!Array.<!Array.<number>>} All points in a multipoint. * @return {!Array.<!Array.<number>>} All points in a multipoint.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parseMultiPointText_ = function() { WKT.Parser.prototype.parseMultiPointText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { if (this.match(WKT.TokenType_.LEFT_PAREN)) {
var coordinates; var coordinates;
if (this.token_.type == _ol_format_WKT_.TokenType_.LEFT_PAREN) { if (this.token_.type == WKT.TokenType_.LEFT_PAREN) {
coordinates = this.parsePointTextList_(); coordinates = this.parsePointTextList_();
} else { } else {
coordinates = this.parsePointList_(); coordinates = this.parsePointList_();
} }
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { if (this.match(WKT.TokenType_.RIGHT_PAREN)) {
return coordinates; return coordinates;
} }
} else if (this.isEmptyGeometry_()) { } else if (this.isEmptyGeometry_()) {
@@ -784,10 +784,10 @@ _ol_format_WKT_.Parser.prototype.parseMultiPointText_ = function() {
* in a multilinestring. * in a multilinestring.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parseMultiLineStringText_ = function() { WKT.Parser.prototype.parseMultiLineStringText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { if (this.match(WKT.TokenType_.LEFT_PAREN)) {
var coordinates = this.parseLineStringTextList_(); var coordinates = this.parseLineStringTextList_();
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { if (this.match(WKT.TokenType_.RIGHT_PAREN)) {
return coordinates; return coordinates;
} }
} else if (this.isEmptyGeometry_()) { } else if (this.isEmptyGeometry_()) {
@@ -801,10 +801,10 @@ _ol_format_WKT_.Parser.prototype.parseMultiLineStringText_ = function() {
* @return {!Array.<!Array.<number>>} All polygon points in a multipolygon. * @return {!Array.<!Array.<number>>} All polygon points in a multipolygon.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parseMultiPolygonText_ = function() { WKT.Parser.prototype.parseMultiPolygonText_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.LEFT_PAREN)) { if (this.match(WKT.TokenType_.LEFT_PAREN)) {
var coordinates = this.parsePolygonTextList_(); var coordinates = this.parsePolygonTextList_();
if (this.match(_ol_format_WKT_.TokenType_.RIGHT_PAREN)) { if (this.match(WKT.TokenType_.RIGHT_PAREN)) {
return coordinates; return coordinates;
} }
} else if (this.isEmptyGeometry_()) { } else if (this.isEmptyGeometry_()) {
@@ -818,12 +818,12 @@ _ol_format_WKT_.Parser.prototype.parseMultiPolygonText_ = function() {
* @return {!Array.<number>} A point. * @return {!Array.<number>} A point.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parsePoint_ = function() { WKT.Parser.prototype.parsePoint_ = function() {
var coordinates = []; var coordinates = [];
var dimensions = this.layout_.length; var dimensions = this.layout_.length;
for (var i = 0; i < dimensions; ++i) { for (var i = 0; i < dimensions; ++i) {
var token = this.token_; var token = this.token_;
if (this.match(_ol_format_WKT_.TokenType_.NUMBER)) { if (this.match(WKT.TokenType_.NUMBER)) {
coordinates.push(token.value); coordinates.push(token.value);
} else { } else {
break; break;
@@ -840,9 +840,9 @@ _ol_format_WKT_.Parser.prototype.parsePoint_ = function() {
* @return {!Array.<!Array.<number>>} An array of points. * @return {!Array.<!Array.<number>>} An array of points.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parsePointList_ = function() { WKT.Parser.prototype.parsePointList_ = function() {
var coordinates = [this.parsePoint_()]; var coordinates = [this.parsePoint_()];
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) { while (this.match(WKT.TokenType_.COMMA)) {
coordinates.push(this.parsePoint_()); coordinates.push(this.parsePoint_());
} }
return coordinates; return coordinates;
@@ -853,9 +853,9 @@ _ol_format_WKT_.Parser.prototype.parsePointList_ = function() {
* @return {!Array.<!Array.<number>>} An array of points. * @return {!Array.<!Array.<number>>} An array of points.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parsePointTextList_ = function() { WKT.Parser.prototype.parsePointTextList_ = function() {
var coordinates = [this.parsePointText_()]; var coordinates = [this.parsePointText_()];
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) { while (this.match(WKT.TokenType_.COMMA)) {
coordinates.push(this.parsePointText_()); coordinates.push(this.parsePointText_());
} }
return coordinates; return coordinates;
@@ -866,9 +866,9 @@ _ol_format_WKT_.Parser.prototype.parsePointTextList_ = function() {
* @return {!Array.<!Array.<number>>} An array of points. * @return {!Array.<!Array.<number>>} An array of points.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parseLineStringTextList_ = function() { WKT.Parser.prototype.parseLineStringTextList_ = function() {
var coordinates = [this.parseLineStringText_()]; var coordinates = [this.parseLineStringText_()];
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) { while (this.match(WKT.TokenType_.COMMA)) {
coordinates.push(this.parseLineStringText_()); coordinates.push(this.parseLineStringText_());
} }
return coordinates; return coordinates;
@@ -879,9 +879,9 @@ _ol_format_WKT_.Parser.prototype.parseLineStringTextList_ = function() {
* @return {!Array.<!Array.<number>>} An array of points. * @return {!Array.<!Array.<number>>} An array of points.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.parsePolygonTextList_ = function() { WKT.Parser.prototype.parsePolygonTextList_ = function() {
var coordinates = [this.parsePolygonText_()]; var coordinates = [this.parsePolygonText_()];
while (this.match(_ol_format_WKT_.TokenType_.COMMA)) { while (this.match(WKT.TokenType_.COMMA)) {
coordinates.push(this.parsePolygonText_()); coordinates.push(this.parsePolygonText_());
} }
return coordinates; return coordinates;
@@ -892,9 +892,9 @@ _ol_format_WKT_.Parser.prototype.parsePolygonTextList_ = function() {
* @return {boolean} Whether the token implies an empty geometry. * @return {boolean} Whether the token implies an empty geometry.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.isEmptyGeometry_ = function() { WKT.Parser.prototype.isEmptyGeometry_ = function() {
var isEmpty = this.isTokenType(_ol_format_WKT_.TokenType_.TEXT) && var isEmpty = this.isTokenType(WKT.TokenType_.TEXT) &&
this.token_.value == _ol_format_WKT_.EMPTY; this.token_.value == WKT.EMPTY;
if (isEmpty) { if (isEmpty) {
this.consume_(); this.consume_();
} }
@@ -907,7 +907,7 @@ _ol_format_WKT_.Parser.prototype.isEmptyGeometry_ = function() {
* @return {string} Error message. * @return {string} Error message.
* @private * @private
*/ */
_ol_format_WKT_.Parser.prototype.formatErrorMessage_ = function() { WKT.Parser.prototype.formatErrorMessage_ = function() {
return 'Unexpected `' + this.token_.value + '` at position ' + return 'Unexpected `' + this.token_.value + '` at position ' +
this.token_.position + ' in `' + this.lexer_.wkt + '`'; 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)} * @enum {function (new:ol.geom.Geometry, Array, ol.geom.GeometryLayout)}
* @private * @private
*/ */
_ol_format_WKT_.Parser.GeometryConstructor_ = { WKT.Parser.GeometryConstructor_ = {
'POINT': Point, 'POINT': Point,
'LINESTRING': LineString, 'LINESTRING': LineString,
'POLYGON': Polygon, 'POLYGON': Polygon,
@@ -931,12 +931,12 @@ _ol_format_WKT_.Parser.GeometryConstructor_ = {
* @enum {(function(): Array)} * @enum {(function(): Array)}
* @private * @private
*/ */
_ol_format_WKT_.Parser.GeometryParser_ = { WKT.Parser.GeometryParser_ = {
'POINT': _ol_format_WKT_.Parser.prototype.parsePointText_, 'POINT': WKT.Parser.prototype.parsePointText_,
'LINESTRING': _ol_format_WKT_.Parser.prototype.parseLineStringText_, 'LINESTRING': WKT.Parser.prototype.parseLineStringText_,
'POLYGON': _ol_format_WKT_.Parser.prototype.parsePolygonText_, 'POLYGON': WKT.Parser.prototype.parsePolygonText_,
'MULTIPOINT': _ol_format_WKT_.Parser.prototype.parseMultiPointText_, 'MULTIPOINT': WKT.Parser.prototype.parseMultiPointText_,
'MULTILINESTRING': _ol_format_WKT_.Parser.prototype.parseMultiLineStringText_, 'MULTILINESTRING': WKT.Parser.prototype.parseMultiLineStringText_,
'MULTIPOLYGON': _ol_format_WKT_.Parser.prototype.parseMultiPolygonText_ 'MULTIPOLYGON': WKT.Parser.prototype.parseMultiPolygonText_
}; };
export default _ol_format_WKT_; export default WKT;
+179 -179
View File
@@ -2,9 +2,9 @@
* @module ol/format/WMSCapabilities * @module ol/format/WMSCapabilities
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_format_XLink_ from '../format/XLink.js'; import XLink from '../format/XLink.js';
import _ol_format_XML_ from '../format/XML.js'; import XML from '../format/XML.js';
import _ol_format_XSD_ from '../format/XSD.js'; import XSD from '../format/XSD.js';
import _ol_xml_ from '../xml.js'; import _ol_xml_ from '../xml.js';
/** /**
@@ -15,9 +15,9 @@ import _ol_xml_ from '../xml.js';
* @extends {ol.format.XML} * @extends {ol.format.XML}
* @api * @api
*/ */
var _ol_format_WMSCapabilities_ = function() { var WMSCapabilities = function() {
_ol_format_XML_.call(this); XML.call(this);
/** /**
* @type {string|undefined} * @type {string|undefined}
@@ -25,7 +25,7 @@ var _ol_format_WMSCapabilities_ = function() {
this.version = undefined; 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. * @return {Object} An object representing the WMS capabilities.
* @api * @api
*/ */
_ol_format_WMSCapabilities_.prototype.read; WMSCapabilities.prototype.read;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WMSCapabilities_.prototype.readFromDocument = function(doc) { WMSCapabilities.prototype.readFromDocument = function(doc) {
for (var n = doc.firstChild; n; n = n.nextSibling) { for (var n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) { if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n); return this.readFromNode(n);
@@ -55,11 +55,11 @@ _ol_format_WMSCapabilities_.prototype.readFromDocument = function(doc) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WMSCapabilities_.prototype.readFromNode = function(node) { WMSCapabilities.prototype.readFromNode = function(node) {
this.version = node.getAttribute('version').trim(); this.version = node.getAttribute('version').trim();
var wmsCapabilityObject = _ol_xml_.pushParseAndPop({ var wmsCapabilityObject = _ol_xml_.pushParseAndPop({
'version': this.version 'version': this.version
}, _ol_format_WMSCapabilities_.PARSERS_, node, []); }, WMSCapabilities.PARSERS_, node, []);
return wmsCapabilityObject ? wmsCapabilityObject : null; return wmsCapabilityObject ? wmsCapabilityObject : null;
}; };
@@ -70,9 +70,9 @@ _ol_format_WMSCapabilities_.prototype.readFromNode = function(node) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Attribution object. * @return {Object|undefined} Attribution object.
*/ */
_ol_format_WMSCapabilities_.readAttribution_ = function(node, objectStack) { WMSCapabilities.readAttribution_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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. * @param {Array.<*>} objectStack Object stack.
* @return {Object} Bounding box object. * @return {Object} Bounding box object.
*/ */
_ol_format_WMSCapabilities_.readBoundingBox_ = function(node, objectStack) { WMSCapabilities.readBoundingBox_ = function(node, objectStack) {
var extent = [ var extent = [
_ol_format_XSD_.readDecimalString(node.getAttribute('minx')), XSD.readDecimalString(node.getAttribute('minx')),
_ol_format_XSD_.readDecimalString(node.getAttribute('miny')), XSD.readDecimalString(node.getAttribute('miny')),
_ol_format_XSD_.readDecimalString(node.getAttribute('maxx')), XSD.readDecimalString(node.getAttribute('maxx')),
_ol_format_XSD_.readDecimalString(node.getAttribute('maxy')) XSD.readDecimalString(node.getAttribute('maxy'))
]; ];
var resolutions = [ var resolutions = [
_ol_format_XSD_.readDecimalString(node.getAttribute('resx')), XSD.readDecimalString(node.getAttribute('resx')),
_ol_format_XSD_.readDecimalString(node.getAttribute('resy')) XSD.readDecimalString(node.getAttribute('resy'))
]; ];
return { return {
@@ -109,10 +109,10 @@ _ol_format_WMSCapabilities_.readBoundingBox_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {ol.Extent|undefined} Bounding box object. * @return {ol.Extent|undefined} Bounding box object.
*/ */
_ol_format_WMSCapabilities_.readEXGeographicBoundingBox_ = function(node, objectStack) { WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) {
var geographicBoundingBox = _ol_xml_.pushParseAndPop( var geographicBoundingBox = _ol_xml_.pushParseAndPop(
{}, {},
_ol_format_WMSCapabilities_.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_, WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
node, objectStack); node, objectStack);
if (!geographicBoundingBox) { if (!geographicBoundingBox) {
return undefined; return undefined;
@@ -142,9 +142,9 @@ _ol_format_WMSCapabilities_.readEXGeographicBoundingBox_ = function(node, object
* @private * @private
* @return {Object|undefined} Capability object. * @return {Object|undefined} Capability object.
*/ */
_ol_format_WMSCapabilities_.readCapability_ = function(node, objectStack) { WMSCapabilities.readCapability_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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 * @private
* @return {Object|undefined} Service object. * @return {Object|undefined} Service object.
*/ */
_ol_format_WMSCapabilities_.readService_ = function(node, objectStack) { WMSCapabilities.readService_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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 * @private
* @return {Object|undefined} Contact information object. * @return {Object|undefined} Contact information object.
*/ */
_ol_format_WMSCapabilities_.readContactInformation_ = function(node, objectStack) { WMSCapabilities.readContactInformation_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CONTACT_INFORMATION_PARSERS_, {}, WMSCapabilities.CONTACT_INFORMATION_PARSERS_,
node, objectStack); node, objectStack);
}; };
@@ -179,9 +179,9 @@ _ol_format_WMSCapabilities_.readContactInformation_ = function(node, objectStack
* @private * @private
* @return {Object|undefined} Contact person object. * @return {Object|undefined} Contact person object.
*/ */
_ol_format_WMSCapabilities_.readContactPersonPrimary_ = function(node, objectStack) { WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CONTACT_PERSON_PARSERS_, {}, WMSCapabilities.CONTACT_PERSON_PARSERS_,
node, objectStack); node, objectStack);
}; };
@@ -192,9 +192,9 @@ _ol_format_WMSCapabilities_.readContactPersonPrimary_ = function(node, objectSta
* @private * @private
* @return {Object|undefined} Contact address object. * @return {Object|undefined} Contact address object.
*/ */
_ol_format_WMSCapabilities_.readContactAddress_ = function(node, objectStack) { WMSCapabilities.readContactAddress_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.CONTACT_ADDRESS_PARSERS_, {}, WMSCapabilities.CONTACT_ADDRESS_PARSERS_,
node, objectStack); node, objectStack);
}; };
@@ -205,9 +205,9 @@ _ol_format_WMSCapabilities_.readContactAddress_ = function(node, objectStack) {
* @private * @private
* @return {Array.<string>|undefined} Format array. * @return {Array.<string>|undefined} Format array.
*/ */
_ol_format_WMSCapabilities_.readException_ = function(node, objectStack) { WMSCapabilities.readException_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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 * @private
* @return {Object|undefined} Layer object. * @return {Object|undefined} Layer object.
*/ */
_ol_format_WMSCapabilities_.readCapabilityLayer_ = function(node, objectStack) { WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Layer object. * @return {Object|undefined} Layer object.
*/ */
_ol_format_WMSCapabilities_.readLayer_ = function(node, objectStack) { WMSCapabilities.readLayer_ = function(node, objectStack) {
var parentLayerObject = /** @type {Object.<string,*>} */ var parentLayerObject = /** @type {Object.<string,*>} */
(objectStack[objectStack.length - 1]); (objectStack[objectStack.length - 1]);
var layerObject = _ol_xml_.pushParseAndPop( var layerObject = _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.LAYER_PARSERS_, node, objectStack); {}, WMSCapabilities.LAYER_PARSERS_, node, objectStack);
if (!layerObject) { if (!layerObject) {
return undefined; return undefined;
} }
var queryable = var queryable =
_ol_format_XSD_.readBooleanString(node.getAttribute('queryable')); XSD.readBooleanString(node.getAttribute('queryable'));
if (queryable === undefined) { if (queryable === undefined) {
queryable = parentLayerObject['queryable']; queryable = parentLayerObject['queryable'];
} }
layerObject['queryable'] = queryable !== undefined ? queryable : false; layerObject['queryable'] = queryable !== undefined ? queryable : false;
var cascaded = _ol_format_XSD_.readNonNegativeIntegerString( var cascaded = XSD.readNonNegativeIntegerString(
node.getAttribute('cascaded')); node.getAttribute('cascaded'));
if (cascaded === undefined) { if (cascaded === undefined) {
cascaded = parentLayerObject['cascaded']; cascaded = parentLayerObject['cascaded'];
} }
layerObject['cascaded'] = cascaded; layerObject['cascaded'] = cascaded;
var opaque = _ol_format_XSD_.readBooleanString(node.getAttribute('opaque')); var opaque = XSD.readBooleanString(node.getAttribute('opaque'));
if (opaque === undefined) { if (opaque === undefined) {
opaque = parentLayerObject['opaque']; opaque = parentLayerObject['opaque'];
} }
layerObject['opaque'] = opaque !== undefined ? opaque : false; layerObject['opaque'] = opaque !== undefined ? opaque : false;
var noSubsets = var noSubsets =
_ol_format_XSD_.readBooleanString(node.getAttribute('noSubsets')); XSD.readBooleanString(node.getAttribute('noSubsets'));
if (noSubsets === undefined) { if (noSubsets === undefined) {
noSubsets = parentLayerObject['noSubsets']; noSubsets = parentLayerObject['noSubsets'];
} }
layerObject['noSubsets'] = noSubsets !== undefined ? noSubsets : false; layerObject['noSubsets'] = noSubsets !== undefined ? noSubsets : false;
var fixedWidth = var fixedWidth =
_ol_format_XSD_.readDecimalString(node.getAttribute('fixedWidth')); XSD.readDecimalString(node.getAttribute('fixedWidth'));
if (!fixedWidth) { if (!fixedWidth) {
fixedWidth = parentLayerObject['fixedWidth']; fixedWidth = parentLayerObject['fixedWidth'];
} }
layerObject['fixedWidth'] = fixedWidth; layerObject['fixedWidth'] = fixedWidth;
var fixedHeight = var fixedHeight =
_ol_format_XSD_.readDecimalString(node.getAttribute('fixedHeight')); XSD.readDecimalString(node.getAttribute('fixedHeight'));
if (!fixedHeight) { if (!fixedHeight) {
fixedHeight = parentLayerObject['fixedHeight']; fixedHeight = parentLayerObject['fixedHeight'];
} }
@@ -308,18 +308,18 @@ _ol_format_WMSCapabilities_.readLayer_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object} Dimension object. * @return {Object} Dimension object.
*/ */
_ol_format_WMSCapabilities_.readDimension_ = function(node, objectStack) { WMSCapabilities.readDimension_ = function(node, objectStack) {
var dimensionObject = { var dimensionObject = {
'name': node.getAttribute('name'), 'name': node.getAttribute('name'),
'units': node.getAttribute('units'), 'units': node.getAttribute('units'),
'unitSymbol': node.getAttribute('unitSymbol'), 'unitSymbol': node.getAttribute('unitSymbol'),
'default': node.getAttribute('default'), 'default': node.getAttribute('default'),
'multipleValues': _ol_format_XSD_.readBooleanString( 'multipleValues': XSD.readBooleanString(
node.getAttribute('multipleValues')), node.getAttribute('multipleValues')),
'nearestValue': _ol_format_XSD_.readBooleanString( 'nearestValue': XSD.readBooleanString(
node.getAttribute('nearestValue')), node.getAttribute('nearestValue')),
'current': _ol_format_XSD_.readBooleanString(node.getAttribute('current')), 'current': XSD.readBooleanString(node.getAttribute('current')),
'values': _ol_format_XSD_.readString(node) 'values': XSD.readString(node)
}; };
return dimensionObject; return dimensionObject;
}; };
@@ -331,9 +331,9 @@ _ol_format_WMSCapabilities_.readDimension_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Online resource object. * @return {Object|undefined} Online resource object.
*/ */
_ol_format_WMSCapabilities_.readFormatOnlineresource_ = function(node, objectStack) { WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( return _ol_xml_.pushParseAndPop(
{}, _ol_format_WMSCapabilities_.FORMAT_ONLINERESOURCE_PARSERS_, {}, WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_,
node, objectStack); node, objectStack);
}; };
@@ -344,9 +344,9 @@ _ol_format_WMSCapabilities_.readFormatOnlineresource_ = function(node, objectSta
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Request object. * @return {Object|undefined} Request object.
*/ */
_ol_format_WMSCapabilities_.readRequest_ = function(node, objectStack) { WMSCapabilities.readRequest_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} DCP type object. * @return {Object|undefined} DCP type object.
*/ */
_ol_format_WMSCapabilities_.readDCPType_ = function(node, objectStack) { WMSCapabilities.readDCPType_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} HTTP object. * @return {Object|undefined} HTTP object.
*/ */
_ol_format_WMSCapabilities_.readHTTP_ = function(node, objectStack) { WMSCapabilities.readHTTP_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Operation type object. * @return {Object|undefined} Operation type object.
*/ */
_ol_format_WMSCapabilities_.readOperationType_ = function(node, objectStack) { WMSCapabilities.readOperationType_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Online resource object. * @return {Object|undefined} Online resource object.
*/ */
_ol_format_WMSCapabilities_.readSizedFormatOnlineresource_ = function(node, objectStack) { WMSCapabilities.readSizedFormatOnlineresource_ = function(node, objectStack) {
var formatOnlineresource = var formatOnlineresource =
_ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack); WMSCapabilities.readFormatOnlineresource_(node, objectStack);
if (formatOnlineresource) { if (formatOnlineresource) {
var size = [ var size = [
_ol_format_XSD_.readNonNegativeIntegerString(node.getAttribute('width')), XSD.readNonNegativeIntegerString(node.getAttribute('width')),
_ol_format_XSD_.readNonNegativeIntegerString(node.getAttribute('height')) XSD.readNonNegativeIntegerString(node.getAttribute('height'))
]; ];
formatOnlineresource['size'] = size; formatOnlineresource['size'] = size;
return formatOnlineresource; return formatOnlineresource;
@@ -413,9 +413,9 @@ _ol_format_WMSCapabilities_.readSizedFormatOnlineresource_ = function(node, obje
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Authority URL object. * @return {Object|undefined} Authority URL object.
*/ */
_ol_format_WMSCapabilities_.readAuthorityURL_ = function(node, objectStack) { WMSCapabilities.readAuthorityURL_ = function(node, objectStack) {
var authorityObject = var authorityObject =
_ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack); WMSCapabilities.readFormatOnlineresource_(node, objectStack);
if (authorityObject) { if (authorityObject) {
authorityObject['name'] = node.getAttribute('name'); authorityObject['name'] = node.getAttribute('name');
return authorityObject; return authorityObject;
@@ -430,9 +430,9 @@ _ol_format_WMSCapabilities_.readAuthorityURL_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Metadata URL object. * @return {Object|undefined} Metadata URL object.
*/ */
_ol_format_WMSCapabilities_.readMetadataURL_ = function(node, objectStack) { WMSCapabilities.readMetadataURL_ = function(node, objectStack) {
var metadataObject = var metadataObject =
_ol_format_WMSCapabilities_.readFormatOnlineresource_(node, objectStack); WMSCapabilities.readFormatOnlineresource_(node, objectStack);
if (metadataObject) { if (metadataObject) {
metadataObject['type'] = node.getAttribute('type'); metadataObject['type'] = node.getAttribute('type');
return metadataObject; return metadataObject;
@@ -447,9 +447,9 @@ _ol_format_WMSCapabilities_.readMetadataURL_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Style object. * @return {Object|undefined} Style object.
*/ */
_ol_format_WMSCapabilities_.readStyle_ = function(node, objectStack) { WMSCapabilities.readStyle_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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. * @param {Array.<*>} objectStack Object stack.
* @return {Array.<string>|undefined} Keyword list. * @return {Array.<string>|undefined} Keyword list.
*/ */
_ol_format_WMSCapabilities_.readKeywordList_ = function(node, objectStack) { WMSCapabilities.readKeywordList_ = function(node, objectStack) {
return _ol_xml_.pushParseAndPop( 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 * @private
* @type {Array.<string>} * @type {Array.<string>}
*/ */
_ol_format_WMSCapabilities_.NAMESPACE_URIS_ = [ WMSCapabilities.NAMESPACE_URIS_ = [
null, null,
'http://www.opengis.net/wms' 'http://www.opengis.net/wms'
]; ];
@@ -481,12 +481,12 @@ _ol_format_WMSCapabilities_.NAMESPACE_URIS_ = [
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'Service': _ol_xml_.makeObjectPropertySetter( 'Service': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readService_), WMSCapabilities.readService_),
'Capability': _ol_xml_.makeObjectPropertySetter( 'Capability': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readCapability_) WMSCapabilities.readCapability_)
}); });
@@ -495,14 +495,14 @@ _ol_format_WMSCapabilities_.PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'Request': _ol_xml_.makeObjectPropertySetter( 'Request': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readRequest_), WMSCapabilities.readRequest_),
'Exception': _ol_xml_.makeObjectPropertySetter( 'Exception': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readException_), WMSCapabilities.readException_),
'Layer': _ol_xml_.makeObjectPropertySetter( 'Layer': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readCapabilityLayer_) WMSCapabilities.readCapabilityLayer_)
}); });
@@ -511,26 +511,26 @@ _ol_format_WMSCapabilities_.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'KeywordList': _ol_xml_.makeObjectPropertySetter( 'KeywordList': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readKeywordList_), WMSCapabilities.readKeywordList_),
'OnlineResource': _ol_xml_.makeObjectPropertySetter( 'OnlineResource': _ol_xml_.makeObjectPropertySetter(
_ol_format_XLink_.readHref), XLink.readHref),
'ContactInformation': _ol_xml_.makeObjectPropertySetter( 'ContactInformation': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readContactInformation_), WMSCapabilities.readContactInformation_),
'Fees': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Fees': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'AccessConstraints': _ol_xml_.makeObjectPropertySetter( 'AccessConstraints': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'LayerLimit': _ol_xml_.makeObjectPropertySetter( 'LayerLimit': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'MaxWidth': _ol_xml_.makeObjectPropertySetter( 'MaxWidth': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'MaxHeight': _ol_xml_.makeObjectPropertySetter( 'MaxHeight': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger) XSD.readNonNegativeInteger)
}); });
@@ -539,20 +539,20 @@ _ol_format_WMSCapabilities_.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'ContactPersonPrimary': _ol_xml_.makeObjectPropertySetter( 'ContactPersonPrimary': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readContactPersonPrimary_), WMSCapabilities.readContactPersonPrimary_),
'ContactPosition': _ol_xml_.makeObjectPropertySetter( 'ContactPosition': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'ContactAddress': _ol_xml_.makeObjectPropertySetter( 'ContactAddress': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readContactAddress_), WMSCapabilities.readContactAddress_),
'ContactVoiceTelephone': _ol_xml_.makeObjectPropertySetter( 'ContactVoiceTelephone': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'ContactFacsimileTelephone': _ol_xml_.makeObjectPropertySetter( 'ContactFacsimileTelephone': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'ContactElectronicMailAddress': _ol_xml_.makeObjectPropertySetter( '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.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'ContactPerson': _ol_xml_.makeObjectPropertySetter( 'ContactPerson': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'ContactOrganization': _ol_xml_.makeObjectPropertySetter( '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.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'AddressType': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'AddressType': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Address': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Address': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'City': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'City': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'StateOrProvince': _ol_xml_.makeObjectPropertySetter( 'StateOrProvince': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'PostCode': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'PostCode': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Country': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString) 'Country': _ol_xml_.makeObjectPropertySetter(XSD.readString)
}); });
@@ -592,9 +592,9 @@ _ol_format_WMSCapabilities_.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'Format': _ol_xml_.makeArrayPusher(_ol_format_XSD_.readString) 'Format': _ol_xml_.makeArrayPusher(XSD.readString)
}); });
@@ -603,39 +603,39 @@ _ol_format_WMSCapabilities_.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'KeywordList': _ol_xml_.makeObjectPropertySetter( 'KeywordList': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readKeywordList_), WMSCapabilities.readKeywordList_),
'CRS': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString), 'CRS': _ol_xml_.makeObjectPropertyPusher(XSD.readString),
'EX_GeographicBoundingBox': _ol_xml_.makeObjectPropertySetter( 'EX_GeographicBoundingBox': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readEXGeographicBoundingBox_), WMSCapabilities.readEXGeographicBoundingBox_),
'BoundingBox': _ol_xml_.makeObjectPropertyPusher( 'BoundingBox': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readBoundingBox_), WMSCapabilities.readBoundingBox_),
'Dimension': _ol_xml_.makeObjectPropertyPusher( 'Dimension': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readDimension_), WMSCapabilities.readDimension_),
'Attribution': _ol_xml_.makeObjectPropertySetter( 'Attribution': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readAttribution_), WMSCapabilities.readAttribution_),
'AuthorityURL': _ol_xml_.makeObjectPropertyPusher( 'AuthorityURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readAuthorityURL_), WMSCapabilities.readAuthorityURL_),
'Identifier': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString), 'Identifier': _ol_xml_.makeObjectPropertyPusher(XSD.readString),
'MetadataURL': _ol_xml_.makeObjectPropertyPusher( 'MetadataURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readMetadataURL_), WMSCapabilities.readMetadataURL_),
'DataURL': _ol_xml_.makeObjectPropertyPusher( 'DataURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readFormatOnlineresource_), WMSCapabilities.readFormatOnlineresource_),
'FeatureListURL': _ol_xml_.makeObjectPropertyPusher( 'FeatureListURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readFormatOnlineresource_), WMSCapabilities.readFormatOnlineresource_),
'Style': _ol_xml_.makeObjectPropertyPusher( 'Style': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readStyle_), WMSCapabilities.readStyle_),
'MinScaleDenominator': _ol_xml_.makeObjectPropertySetter( 'MinScaleDenominator': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal), XSD.readDecimal),
'MaxScaleDenominator': _ol_xml_.makeObjectPropertySetter( 'MaxScaleDenominator': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal), XSD.readDecimal),
'Layer': _ol_xml_.makeObjectPropertyPusher( 'Layer': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readLayer_) WMSCapabilities.readLayer_)
}); });
@@ -644,13 +644,13 @@ _ol_format_WMSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'OnlineResource': _ol_xml_.makeObjectPropertySetter( 'OnlineResource': _ol_xml_.makeObjectPropertySetter(
_ol_format_XLink_.readHref), XLink.readHref),
'LogoURL': _ol_xml_.makeObjectPropertySetter( 'LogoURL': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readSizedFormatOnlineresource_) WMSCapabilities.readSizedFormatOnlineresource_)
}); });
@@ -659,16 +659,16 @@ _ol_format_WMSCapabilities_.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ = WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
_ol_xml_.makeStructureNS(_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { _ol_xml_.makeStructureNS(WMSCapabilities.NAMESPACE_URIS_, {
'westBoundLongitude': _ol_xml_.makeObjectPropertySetter( 'westBoundLongitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal), XSD.readDecimal),
'eastBoundLongitude': _ol_xml_.makeObjectPropertySetter( 'eastBoundLongitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal), XSD.readDecimal),
'southBoundLatitude': _ol_xml_.makeObjectPropertySetter( 'southBoundLatitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal), XSD.readDecimal),
'northBoundLatitude': _ol_xml_.makeObjectPropertySetter( 'northBoundLatitude': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal) XSD.readDecimal)
}); });
@@ -677,14 +677,14 @@ _ol_format_WMSCapabilities_.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'GetCapabilities': _ol_xml_.makeObjectPropertySetter( 'GetCapabilities': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readOperationType_), WMSCapabilities.readOperationType_),
'GetMap': _ol_xml_.makeObjectPropertySetter( 'GetMap': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readOperationType_), WMSCapabilities.readOperationType_),
'GetFeatureInfo': _ol_xml_.makeObjectPropertySetter( 'GetFeatureInfo': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readOperationType_) WMSCapabilities.readOperationType_)
}); });
@@ -693,11 +693,11 @@ _ol_format_WMSCapabilities_.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'Format': _ol_xml_.makeObjectPropertyPusher(_ol_format_XSD_.readString), 'Format': _ol_xml_.makeObjectPropertyPusher(XSD.readString),
'DCPType': _ol_xml_.makeObjectPropertyPusher( 'DCPType': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readDCPType_) WMSCapabilities.readDCPType_)
}); });
@@ -706,10 +706,10 @@ _ol_format_WMSCapabilities_.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.DCPTYPE_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.DCPTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'HTTP': _ol_xml_.makeObjectPropertySetter( 'HTTP': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readHTTP_) WMSCapabilities.readHTTP_)
}); });
@@ -718,12 +718,12 @@ _ol_format_WMSCapabilities_.DCPTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'Get': _ol_xml_.makeObjectPropertySetter( 'Get': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_), WMSCapabilities.readFormatOnlineresource_),
'Post': _ol_xml_.makeObjectPropertySetter( 'Post': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_) WMSCapabilities.readFormatOnlineresource_)
}); });
@@ -732,17 +732,17 @@ _ol_format_WMSCapabilities_.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'Name': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Title': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'LegendURL': _ol_xml_.makeObjectPropertyPusher( 'LegendURL': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMSCapabilities_.readSizedFormatOnlineresource_), WMSCapabilities.readSizedFormatOnlineresource_),
'StyleSheetURL': _ol_xml_.makeObjectPropertySetter( 'StyleSheetURL': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_), WMSCapabilities.readFormatOnlineresource_),
'StyleURL': _ol_xml_.makeObjectPropertySetter( 'StyleURL': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMSCapabilities_.readFormatOnlineresource_) WMSCapabilities.readFormatOnlineresource_)
}); });
@@ -751,11 +751,11 @@ _ol_format_WMSCapabilities_.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.FORMAT_ONLINERESOURCE_PARSERS_ = WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ =
_ol_xml_.makeStructureNS(_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { _ol_xml_.makeStructureNS(WMSCapabilities.NAMESPACE_URIS_, {
'Format': _ol_xml_.makeObjectPropertySetter(_ol_format_XSD_.readString), 'Format': _ol_xml_.makeObjectPropertySetter(XSD.readString),
'OnlineResource': _ol_xml_.makeObjectPropertySetter( 'OnlineResource': _ol_xml_.makeObjectPropertySetter(
_ol_format_XLink_.readHref) XLink.readHref)
}); });
@@ -764,8 +764,8 @@ _ol_format_WMSCapabilities_.FORMAT_ONLINERESOURCE_PARSERS_ =
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_WMSCapabilities_.KEYWORDLIST_PARSERS_ = _ol_xml_.makeStructureNS( WMSCapabilities.KEYWORDLIST_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMSCapabilities_.NAMESPACE_URIS_, { WMSCapabilities.NAMESPACE_URIS_, {
'Keyword': _ol_xml_.makeArrayPusher(_ol_format_XSD_.readString) 'Keyword': _ol_xml_.makeArrayPusher(XSD.readString)
}); });
export default _ol_format_WMSCapabilities_; export default WMSCapabilities;
+19 -19
View File
@@ -3,8 +3,8 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_array_ from '../array.js'; import _ol_array_ from '../array.js';
import _ol_format_GML2_ from '../format/GML2.js'; import GML2 from '../format/GML2.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; import XMLFeature from '../format/XMLFeature.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
import _ol_xml_ from '../xml.js'; import _ol_xml_ from '../xml.js';
@@ -18,7 +18,7 @@ import _ol_xml_ from '../xml.js';
* @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options. * @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_format_WMSGetFeatureInfo_ = function(opt_options) { var WMSGetFeatureInfo = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
@@ -33,7 +33,7 @@ var _ol_format_WMSGetFeatureInfo_ = function(opt_options) {
* @private * @private
* @type {ol.format.GML2} * @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; 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} * @type {string}
* @private * @private
*/ */
_ol_format_WMSGetFeatureInfo_.featureIdentifier_ = '_feature'; WMSGetFeatureInfo.featureIdentifier_ = '_feature';
/** /**
@@ -61,13 +61,13 @@ _ol_format_WMSGetFeatureInfo_.featureIdentifier_ = '_feature';
* @type {string} * @type {string}
* @private * @private
*/ */
_ol_format_WMSGetFeatureInfo_.layerIdentifier_ = '_layer'; WMSGetFeatureInfo.layerIdentifier_ = '_layer';
/** /**
* @return {Array.<string>} layers * @return {Array.<string>} layers
*/ */
_ol_format_WMSGetFeatureInfo_.prototype.getLayers = function() { WMSGetFeatureInfo.prototype.getLayers = function() {
return this.layers_; return this.layers_;
}; };
@@ -75,7 +75,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.getLayers = function() {
/** /**
* @param {Array.<string>} layers Layers to parse. * @param {Array.<string>} layers Layers to parse.
*/ */
_ol_format_WMSGetFeatureInfo_.prototype.setLayers = function(layers) { WMSGetFeatureInfo.prototype.setLayers = function(layers) {
this.layers_ = layers; this.layers_ = layers;
}; };
@@ -86,7 +86,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.setLayers = function(layers) {
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @private * @private
*/ */
_ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectStack) { WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) {
node.setAttribute('namespaceURI', this.featureNS_); node.setAttribute('namespaceURI', this.featureNS_);
var localName = node.localName; var localName = node.localName;
/** @type {Array.<ol.Feature>} */ /** @type {Array.<ol.Feature>} */
@@ -102,7 +102,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta
} }
var context = objectStack[0]; var context = objectStack[0];
var toRemove = _ol_format_WMSGetFeatureInfo_.layerIdentifier_; var toRemove = WMSGetFeatureInfo.layerIdentifier_;
var layerName = layer.localName.replace(toRemove, ''); var layerName = layer.localName.replace(toRemove, '');
if (this.layers_ && !_ol_array_.includes(this.layers_, layerName)) { if (this.layers_ && !_ol_array_.includes(this.layers_, layerName)) {
@@ -110,7 +110,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta
} }
var featureType = layerName + var featureType = layerName +
_ol_format_WMSGetFeatureInfo_.featureIdentifier_; WMSGetFeatureInfo.featureIdentifier_;
context['featureType'] = featureType; context['featureType'] = featureType;
context['featureNS'] = this.featureNS_; context['featureNS'] = this.featureNS_;
@@ -149,13 +149,13 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api * @api
*/ */
_ol_format_WMSGetFeatureInfo_.prototype.readFeatures; WMSGetFeatureInfo.prototype.readFeatures;
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WMSGetFeatureInfo_.prototype.readFeaturesFromNode = function(node, opt_options) { WMSGetFeatureInfo.prototype.readFeaturesFromNode = function(node, opt_options) {
var options = {}; var options = {};
if (opt_options) { if (opt_options) {
_ol_obj_.assign(options, this.getReadOptions(node, 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. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WMSGetFeatureInfo_.prototype.writeFeatureNode = function(feature, opt_options) {}; WMSGetFeatureInfo.prototype.writeFeatureNode = function(feature, opt_options) {};
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WMSGetFeatureInfo_.prototype.writeFeaturesNode = function(features, opt_options) {}; WMSGetFeatureInfo.prototype.writeFeaturesNode = function(features, opt_options) {};
/** /**
* Not implemented. * Not implemented.
* @inheritDoc * @inheritDoc
*/ */
_ol_format_WMSGetFeatureInfo_.prototype.writeGeometryNode = function(geometry, opt_options) {}; WMSGetFeatureInfo.prototype.writeGeometryNode = function(geometry, opt_options) {};
export default _ol_format_WMSGetFeatureInfo_; export default WMSGetFeatureInfo;
+33 -33
View File
@@ -3,10 +3,10 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import {boundingExtent} from '../extent.js'; import {boundingExtent} from '../extent.js';
import _ol_format_OWS_ from '../format/OWS.js'; import OWS from '../format/OWS.js';
import _ol_format_XLink_ from '../format/XLink.js'; import XLink from '../format/XLink.js';
import _ol_format_XML_ from '../format/XML.js'; import XML from '../format/XML.js';
import _ol_format_XSD_ from '../format/XSD.js'; import XSD from '../format/XSD.js';
import _ol_xml_ from '../xml.js'; import _ol_xml_ from '../xml.js';
/** /**
@@ -18,16 +18,16 @@ import _ol_xml_ from '../xml.js';
* @api * @api
*/ */
var _ol_format_WMTSCapabilities_ = function() { var _ol_format_WMTSCapabilities_ = function() {
_ol_format_XML_.call(this); XML.call(this);
/** /**
* @type {ol.format.OWS} * @type {ol.format.OWS}
* @private * @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) { _ol_format_WMTSCapabilities_.readLegendUrl_ = function(node, objectStack) {
var legend = {}; var legend = {};
legend['format'] = node.getAttribute('format'); legend['format'] = node.getAttribute('format');
legend['href'] = _ol_format_XLink_.readHref(node); legend['href'] = XLink.readHref(node);
return legend; return legend;
}; };
@@ -211,7 +211,7 @@ _ol_format_WMTSCapabilities_.readLegendUrl_ = function(node, objectStack) {
* @return {Object|undefined} Coordinates object. * @return {Object|undefined} Coordinates object.
*/ */
_ol_format_WMTSCapabilities_.readCoordinates_ = function(node, objectStack) { _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) { if (!coordinates || coordinates.length != 2) {
return undefined; return undefined;
} }
@@ -320,7 +320,7 @@ _ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
'Style': _ol_xml_.makeObjectPropertyPusher( 'Style': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readStyle_), _ol_format_WMTSCapabilities_.readStyle_),
'Format': _ol_xml_.makeObjectPropertyPusher( 'Format': _ol_xml_.makeObjectPropertyPusher(
_ol_format_XSD_.readString), XSD.readString),
'TileMatrixSetLink': _ol_xml_.makeObjectPropertyPusher( 'TileMatrixSetLink': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrixSetLink_), _ol_format_WMTSCapabilities_.readTileMatrixSetLink_),
'Dimension': _ol_xml_.makeObjectPropertyPusher( 'Dimension': _ol_xml_.makeObjectPropertyPusher(
@@ -329,13 +329,13 @@ _ol_format_WMTSCapabilities_.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.readResourceUrl_) _ol_format_WMTSCapabilities_.readResourceUrl_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter( 'Title': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'Abstract': _ol_xml_.makeObjectPropertySetter( 'Abstract': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'WGS84BoundingBox': _ol_xml_.makeObjectPropertySetter( 'WGS84BoundingBox': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readWgs84BoundingBox_), _ol_format_WMTSCapabilities_.readWgs84BoundingBox_),
'Identifier': _ol_xml_.makeObjectPropertySetter( '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_format_WMTSCapabilities_.readLegendUrl_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Title': _ol_xml_.makeObjectPropertySetter( 'Title': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'Identifier': _ol_xml_.makeObjectPropertySetter( '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_.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrixSet': _ol_xml_.makeObjectPropertySetter( 'TileMatrixSet': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'TileMatrixSetLimits': _ol_xml_.makeObjectPropertySetter( 'TileMatrixSetLimits': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readTileMatrixLimitsList_) _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_.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'TileMatrix': _ol_xml_.makeObjectPropertySetter( 'TileMatrix': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'MinTileRow': _ol_xml_.makeObjectPropertySetter( 'MinTileRow': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'MaxTileRow': _ol_xml_.makeObjectPropertySetter( 'MaxTileRow': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'MinTileCol': _ol_xml_.makeObjectPropertySetter( 'MinTileCol': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'MaxTileCol': _ol_xml_.makeObjectPropertySetter( '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_.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'Default': _ol_xml_.makeObjectPropertySetter( 'Default': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'Value': _ol_xml_.makeObjectPropertyPusher( 'Value': _ol_xml_.makeObjectPropertyPusher(
_ol_format_XSD_.readString) XSD.readString)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Identifier': _ol_xml_.makeObjectPropertySetter( '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_.TMS_PARSERS_ = _ol_xml_.makeStructureNS(
_ol_format_WMTSCapabilities_.NAMESPACE_URIS_, { _ol_format_WMTSCapabilities_.NAMESPACE_URIS_, {
'WellKnownScaleSet': _ol_xml_.makeObjectPropertySetter( 'WellKnownScaleSet': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'TileMatrix': _ol_xml_.makeObjectPropertyPusher( 'TileMatrix': _ol_xml_.makeObjectPropertyPusher(
_ol_format_WMTSCapabilities_.readTileMatrix_) _ol_format_WMTSCapabilities_.readTileMatrix_)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'SupportedCRS': _ol_xml_.makeObjectPropertySetter( 'SupportedCRS': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString), XSD.readString),
'Identifier': _ol_xml_.makeObjectPropertySetter( '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( 'TopLeftCorner': _ol_xml_.makeObjectPropertySetter(
_ol_format_WMTSCapabilities_.readCoordinates_), _ol_format_WMTSCapabilities_.readCoordinates_),
'ScaleDenominator': _ol_xml_.makeObjectPropertySetter( 'ScaleDenominator': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readDecimal), XSD.readDecimal),
'TileWidth': _ol_xml_.makeObjectPropertySetter( 'TileWidth': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'TileHeight': _ol_xml_.makeObjectPropertySetter( 'TileHeight': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'MatrixWidth': _ol_xml_.makeObjectPropertySetter( 'MatrixWidth': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger), XSD.readNonNegativeInteger),
'MatrixHeight': _ol_xml_.makeObjectPropertySetter( 'MatrixHeight': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readNonNegativeInteger) XSD.readNonNegativeInteger)
}, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, { }, _ol_xml_.makeStructureNS(_ol_format_WMTSCapabilities_.OWS_NAMESPACE_URIS_, {
'Identifier': _ol_xml_.makeObjectPropertySetter( 'Identifier': _ol_xml_.makeObjectPropertySetter(
_ol_format_XSD_.readString) XSD.readString)
})); }));
export default _ol_format_WMTSCapabilities_; export default _ol_format_WMTSCapabilities_;
+5 -5
View File
@@ -1,21 +1,21 @@
/** /**
* @module ol/format/XLink * @module ol/format/XLink
*/ */
var _ol_format_XLink_ = {}; var XLink = {};
/** /**
* @const * @const
* @type {string} * @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. * @param {Node} node Node.
* @return {boolean|undefined} Boolean. * @return {boolean|undefined} Boolean.
*/ */
_ol_format_XLink_.readHref = function(node) { XLink.readHref = function(node) {
return node.getAttributeNS(_ol_format_XLink_.NAMESPACE_URI, 'href'); return node.getAttributeNS(XLink.NAMESPACE_URI, 'href');
}; };
export default _ol_format_XLink_; export default XLink;
+5 -5
View File
@@ -11,7 +11,7 @@ import _ol_xml_ from '../xml.js';
* @abstract * @abstract
* @struct * @struct
*/ */
var _ol_format_XML_ = function() { var XML = function() {
}; };
@@ -19,7 +19,7 @@ var _ol_format_XML_ = function() {
* @param {Document|Node|string} source Source. * @param {Document|Node|string} source Source.
* @return {Object} The parsed result. * @return {Object} The parsed result.
*/ */
_ol_format_XML_.prototype.read = function(source) { XML.prototype.read = function(source) {
if (_ol_xml_.isDocument(source)) { if (_ol_xml_.isDocument(source)) {
return this.readFromDocument(/** @type {Document} */ (source)); return this.readFromDocument(/** @type {Document} */ (source));
} else if (_ol_xml_.isNode(source)) { } else if (_ol_xml_.isNode(source)) {
@@ -38,7 +38,7 @@ _ol_format_XML_.prototype.read = function(source) {
* @param {Document} doc Document. * @param {Document} doc Document.
* @return {Object} Object * @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. * @param {Node} node Node.
* @return {Object} Object * @return {Object} Object
*/ */
_ol_format_XML_.prototype.readFromNode = function(node) {}; XML.prototype.readFromNode = function(node) {};
export default _ol_format_XML_; export default XML;
+24 -24
View File
@@ -3,7 +3,7 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_array_ from '../array.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_format_FormatType_ from '../format/FormatType.js';
import _ol_xml_ from '../xml.js'; import _ol_xml_ from '../xml.js';
@@ -17,7 +17,7 @@ import _ol_xml_ from '../xml.js';
* @abstract * @abstract
* @extends {ol.format.Feature} * @extends {ol.format.Feature}
*/ */
var _ol_format_XMLFeature_ = function() { var XMLFeature = function() {
/** /**
* @type {XMLSerializer} * @type {XMLSerializer}
@@ -25,16 +25,16 @@ var _ol_format_XMLFeature_ = function() {
*/ */
this.xmlSerializer_ = new XMLSerializer(); this.xmlSerializer_ = new XMLSerializer();
_ol_format_Feature_.call(this); FeatureFormat.call(this);
}; };
inherits(_ol_format_XMLFeature_, _ol_format_Feature_); inherits(XMLFeature, FeatureFormat);
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_XMLFeature_.prototype.getType = function() { XMLFeature.prototype.getType = function() {
return _ol_format_FormatType_.XML; return _ol_format_FormatType_.XML;
}; };
@@ -42,7 +42,7 @@ _ol_format_XMLFeature_.prototype.getType = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_XMLFeature_.prototype.readFeature = function(source, opt_options) { XMLFeature.prototype.readFeature = function(source, opt_options) {
if (_ol_xml_.isDocument(source)) { if (_ol_xml_.isDocument(source)) {
return this.readFeatureFromDocument( return this.readFeatureFromDocument(
/** @type {Document} */ (source), opt_options); /** @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. * @param {olx.format.ReadOptions=} opt_options Options.
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
*/ */
_ol_format_XMLFeature_.prototype.readFeatureFromDocument = function( XMLFeature.prototype.readFeatureFromDocument = function(
doc, opt_options) { doc, opt_options) {
var features = this.readFeaturesFromDocument(doc, opt_options); var features = this.readFeaturesFromDocument(doc, opt_options);
if (features.length > 0) { if (features.length > 0) {
@@ -78,7 +78,7 @@ _ol_format_XMLFeature_.prototype.readFeatureFromDocument = function(
* @param {olx.format.ReadOptions=} opt_options Options. * @param {olx.format.ReadOptions=} opt_options Options.
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
*/ */
_ol_format_XMLFeature_.prototype.readFeatureFromNode = function(node, opt_options) { XMLFeature.prototype.readFeatureFromNode = function(node, opt_options) {
return null; // not implemented return null; // not implemented
}; };
@@ -86,7 +86,7 @@ _ol_format_XMLFeature_.prototype.readFeatureFromNode = function(node, opt_option
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_XMLFeature_.prototype.readFeatures = function(source, opt_options) { XMLFeature.prototype.readFeatures = function(source, opt_options) {
if (_ol_xml_.isDocument(source)) { if (_ol_xml_.isDocument(source)) {
return this.readFeaturesFromDocument( return this.readFeaturesFromDocument(
/** @type {Document} */ (source), opt_options); /** @type {Document} */ (source), opt_options);
@@ -107,7 +107,7 @@ _ol_format_XMLFeature_.prototype.readFeatures = function(source, opt_options) {
* @protected * @protected
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
*/ */
_ol_format_XMLFeature_.prototype.readFeaturesFromDocument = function( XMLFeature.prototype.readFeaturesFromDocument = function(
doc, opt_options) { doc, opt_options) {
/** @type {Array.<ol.Feature>} */ /** @type {Array.<ol.Feature>} */
var features = []; var features = [];
@@ -128,13 +128,13 @@ _ol_format_XMLFeature_.prototype.readFeaturesFromDocument = function(
* @protected * @protected
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
*/ */
_ol_format_XMLFeature_.prototype.readFeaturesFromNode = function(node, opt_options) {}; XMLFeature.prototype.readFeaturesFromNode = function(node, opt_options) {};
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_XMLFeature_.prototype.readGeometry = function(source, opt_options) { XMLFeature.prototype.readGeometry = function(source, opt_options) {
if (_ol_xml_.isDocument(source)) { if (_ol_xml_.isDocument(source)) {
return this.readGeometryFromDocument( return this.readGeometryFromDocument(
/** @type {Document} */ (source), opt_options); /** @type {Document} */ (source), opt_options);
@@ -155,7 +155,7 @@ _ol_format_XMLFeature_.prototype.readGeometry = function(source, opt_options) {
* @protected * @protected
* @return {ol.geom.Geometry} Geometry. * @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 return null; // not implemented
}; };
@@ -166,7 +166,7 @@ _ol_format_XMLFeature_.prototype.readGeometryFromDocument = function(doc, opt_op
* @protected * @protected
* @return {ol.geom.Geometry} Geometry. * @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 return null; // not implemented
}; };
@@ -174,7 +174,7 @@ _ol_format_XMLFeature_.prototype.readGeometryFromNode = function(node, opt_optio
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_XMLFeature_.prototype.readProjection = function(source) { XMLFeature.prototype.readProjection = function(source) {
if (_ol_xml_.isDocument(source)) { if (_ol_xml_.isDocument(source)) {
return this.readProjectionFromDocument(/** @type {Document} */ (source)); return this.readProjectionFromDocument(/** @type {Document} */ (source));
} else if (_ol_xml_.isNode(source)) { } else if (_ol_xml_.isNode(source)) {
@@ -193,7 +193,7 @@ _ol_format_XMLFeature_.prototype.readProjection = function(source) {
* @protected * @protected
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
*/ */
_ol_format_XMLFeature_.prototype.readProjectionFromDocument = function(doc) { XMLFeature.prototype.readProjectionFromDocument = function(doc) {
return this.defaultDataProjection; return this.defaultDataProjection;
}; };
@@ -203,7 +203,7 @@ _ol_format_XMLFeature_.prototype.readProjectionFromDocument = function(doc) {
* @protected * @protected
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
*/ */
_ol_format_XMLFeature_.prototype.readProjectionFromNode = function(node) { XMLFeature.prototype.readProjectionFromNode = function(node) {
return this.defaultDataProjection; return this.defaultDataProjection;
}; };
@@ -211,7 +211,7 @@ _ol_format_XMLFeature_.prototype.readProjectionFromNode = function(node) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_XMLFeature_.prototype.writeFeature = function(feature, opt_options) { XMLFeature.prototype.writeFeature = function(feature, opt_options) {
var node = this.writeFeatureNode(feature, opt_options); var node = this.writeFeatureNode(feature, opt_options);
return this.xmlSerializer_.serializeToString(node); return this.xmlSerializer_.serializeToString(node);
}; };
@@ -223,7 +223,7 @@ _ol_format_XMLFeature_.prototype.writeFeature = function(feature, opt_options) {
* @protected * @protected
* @return {Node} Node. * @return {Node} Node.
*/ */
_ol_format_XMLFeature_.prototype.writeFeatureNode = function(feature, opt_options) { XMLFeature.prototype.writeFeatureNode = function(feature, opt_options) {
return null; // not implemented return null; // not implemented
}; };
@@ -231,7 +231,7 @@ _ol_format_XMLFeature_.prototype.writeFeatureNode = function(feature, opt_option
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_XMLFeature_.prototype.writeFeatures = function(features, opt_options) { XMLFeature.prototype.writeFeatures = function(features, opt_options) {
var node = this.writeFeaturesNode(features, opt_options); var node = this.writeFeaturesNode(features, opt_options);
return this.xmlSerializer_.serializeToString(node); 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. * @param {olx.format.WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
*/ */
_ol_format_XMLFeature_.prototype.writeFeaturesNode = function(features, opt_options) { XMLFeature.prototype.writeFeaturesNode = function(features, opt_options) {
return null; // not implemented return null; // not implemented
}; };
@@ -250,7 +250,7 @@ _ol_format_XMLFeature_.prototype.writeFeaturesNode = function(features, opt_opti
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_XMLFeature_.prototype.writeGeometry = function(geometry, opt_options) { XMLFeature.prototype.writeGeometry = function(geometry, opt_options) {
var node = this.writeGeometryNode(geometry, opt_options); var node = this.writeGeometryNode(geometry, opt_options);
return this.xmlSerializer_.serializeToString(node); 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. * @param {olx.format.WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
*/ */
_ol_format_XMLFeature_.prototype.writeGeometryNode = function(geometry, opt_options) { XMLFeature.prototype.writeGeometryNode = function(geometry, opt_options) {
return null; // not implemented return null; // not implemented
}; };
export default _ol_format_XMLFeature_; export default XMLFeature;
+21 -21
View File
@@ -3,23 +3,23 @@
*/ */
import _ol_xml_ from '../xml.js'; import _ol_xml_ from '../xml.js';
import _ol_string_ from '../string.js'; import _ol_string_ from '../string.js';
var _ol_format_XSD_ = {}; var XSD = {};
/** /**
* @const * @const
* @type {string} * @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. * @param {Node} node Node.
* @return {boolean|undefined} Boolean. * @return {boolean|undefined} Boolean.
*/ */
_ol_format_XSD_.readBoolean = function(node) { XSD.readBoolean = function(node) {
var s = _ol_xml_.getAllTextContent(node, false); 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. * @param {string} string String.
* @return {boolean|undefined} Boolean. * @return {boolean|undefined} Boolean.
*/ */
_ol_format_XSD_.readBooleanString = function(string) { XSD.readBooleanString = function(string) {
var m = /^\s*(true|1)|(false|0)\s*$/.exec(string); var m = /^\s*(true|1)|(false|0)\s*$/.exec(string);
if (m) { if (m) {
return m[1] !== undefined || false; return m[1] !== undefined || false;
@@ -41,7 +41,7 @@ _ol_format_XSD_.readBooleanString = function(string) {
* @param {Node} node Node. * @param {Node} node Node.
* @return {number|undefined} DateTime in seconds. * @return {number|undefined} DateTime in seconds.
*/ */
_ol_format_XSD_.readDateTime = function(node) { XSD.readDateTime = function(node) {
var s = _ol_xml_.getAllTextContent(node, false); var s = _ol_xml_.getAllTextContent(node, false);
var dateTime = Date.parse(s); var dateTime = Date.parse(s);
return isNaN(dateTime) ? undefined : dateTime / 1000; return isNaN(dateTime) ? undefined : dateTime / 1000;
@@ -52,9 +52,9 @@ _ol_format_XSD_.readDateTime = function(node) {
* @param {Node} node Node. * @param {Node} node Node.
* @return {number|undefined} Decimal. * @return {number|undefined} Decimal.
*/ */
_ol_format_XSD_.readDecimal = function(node) { XSD.readDecimal = function(node) {
var s = _ol_xml_.getAllTextContent(node, false); 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. * @param {string} string String.
* @return {number|undefined} Decimal. * @return {number|undefined} Decimal.
*/ */
_ol_format_XSD_.readDecimalString = function(string) { XSD.readDecimalString = function(string) {
// FIXME check spec // FIXME check spec
var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(string); var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(string);
if (m) { if (m) {
@@ -77,9 +77,9 @@ _ol_format_XSD_.readDecimalString = function(string) {
* @param {Node} node Node. * @param {Node} node Node.
* @return {number|undefined} Non negative integer. * @return {number|undefined} Non negative integer.
*/ */
_ol_format_XSD_.readNonNegativeInteger = function(node) { XSD.readNonNegativeInteger = function(node) {
var s = _ol_xml_.getAllTextContent(node, false); 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. * @param {string} string String.
* @return {number|undefined} Non negative integer. * @return {number|undefined} Non negative integer.
*/ */
_ol_format_XSD_.readNonNegativeIntegerString = function(string) { XSD.readNonNegativeIntegerString = function(string) {
var m = /^\s*(\d+)\s*$/.exec(string); var m = /^\s*(\d+)\s*$/.exec(string);
if (m) { if (m) {
return parseInt(m[1], 10); return parseInt(m[1], 10);
@@ -101,7 +101,7 @@ _ol_format_XSD_.readNonNegativeIntegerString = function(string) {
* @param {Node} node Node. * @param {Node} node Node.
* @return {string|undefined} String. * @return {string|undefined} String.
*/ */
_ol_format_XSD_.readString = function(node) { XSD.readString = function(node) {
return _ol_xml_.getAllTextContent(node, false).trim(); 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 {Node} node Node to append a TextNode with the boolean to.
* @param {boolean} bool Boolean. * @param {boolean} bool Boolean.
*/ */
_ol_format_XSD_.writeBooleanTextNode = function(node, bool) { XSD.writeBooleanTextNode = function(node, bool) {
_ol_format_XSD_.writeStringTextNode(node, (bool) ? '1' : '0'); 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 {Node} node Node to append a CDATA Section with the string to.
* @param {string} string String. * @param {string} string String.
*/ */
_ol_format_XSD_.writeCDATASection = function(node, string) { XSD.writeCDATASection = function(node, string) {
node.appendChild(_ol_xml_.DOCUMENT.createCDATASection(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 {Node} node Node to append a TextNode with the dateTime to.
* @param {number} dateTime DateTime in seconds. * @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 date = new Date(dateTime * 1000);
var string = date.getUTCFullYear() + '-' + var string = date.getUTCFullYear() + '-' +
_ol_string_.padNumber(date.getUTCMonth() + 1, 2) + '-' + _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 {Node} node Node to append a TextNode with the decimal to.
* @param {number} decimal Decimal. * @param {number} decimal Decimal.
*/ */
_ol_format_XSD_.writeDecimalTextNode = function(node, decimal) { XSD.writeDecimalTextNode = function(node, decimal) {
var string = decimal.toPrecision(); var string = decimal.toPrecision();
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string)); 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 {Node} node Node to append a TextNode with the decimal to.
* @param {number} nonNegativeInteger Non negative integer. * @param {number} nonNegativeInteger Non negative integer.
*/ */
_ol_format_XSD_.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) { XSD.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) {
var string = nonNegativeInteger.toString(); var string = nonNegativeInteger.toString();
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string)); 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 {Node} node Node to append a TextNode with the string to.
* @param {string} string String. * @param {string} string String.
*/ */
_ol_format_XSD_.writeStringTextNode = function(node, string) { XSD.writeStringTextNode = function(node, string) {
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string)); node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string));
}; };
export default _ol_format_XSD_; export default XSD;
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_Map_ from '../../../../src/ol/Map.js'; import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.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 Circle from '../../../../src/ol/geom/Circle.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
@@ -463,7 +463,7 @@ describe('ol.rendering.layer.Vector', function() {
properties: {} properties: {}
}; };
var format = new _ol_format_GeoJSON_({featureProjection: 'EPSG:3857'}); var format = new GeoJSON({featureProjection: 'EPSG:3857'});
var feature = format.readFeature(json); var feature = format.readFeature(json);
var layer = new _ol_layer_Vector_({ var layer = new _ol_layer_Vector_({
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_Map_ from '../../../../src/ol/Map.js'; import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.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 Point from '../../../../src/ol/geom/Point.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js';
@@ -70,7 +70,7 @@ describe('ol.rendering.layer.VectorTile', function() {
beforeEach(function() { beforeEach(function() {
source = new _ol_source_VectorTile_({ source = new _ol_source_VectorTile_({
format: new _ol_format_MVT_(), format: new MVT(),
tileGrid: _ol_tilegrid_.createXYZ(), tileGrid: _ol_tilegrid_.createXYZ(),
url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf', url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf',
transition: 0 transition: 0
+2 -2
View File
@@ -1,5 +1,5 @@
import _ol_featureloader_ from '../../../src/ol/featureloader.js'; 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'; import _ol_source_Vector_ from '../../../src/ol/source/Vector.js';
@@ -13,7 +13,7 @@ describe('ol.featureloader', function() {
beforeEach(function() { beforeEach(function() {
url = 'spec/ol/data/point.json'; url = 'spec/ol/data/point.json';
format = new _ol_format_GeoJSON_(); format = new GeoJSON();
source = new _ol_source_Vector_(); source = new _ol_source_Vector_();
}); });
+3 -3
View File
@@ -1,6 +1,6 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import * as _ol_extent_ from '../../../../src/ol/extent.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 LineString from '../../../../src/ol/geom/LineString.js';
import LinearRing from '../../../../src/ol/geom/LinearRing.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js';
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
@@ -15,7 +15,7 @@ describe('ol.format.EsriJSON', function() {
var format; var format;
beforeEach(function() { beforeEach(function() {
format = new _ol_format_EsriJSON_(); format = new EsriJSON();
}); });
var pointEsriJSON = { var pointEsriJSON = {
@@ -265,7 +265,7 @@ describe('ol.format.EsriJSON', function() {
}); });
it('can create a feature with a specific geometryName', 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); readFeature(pointEsriJSON);
expect(feature.getGeometryName()).to.be('the_geom'); expect(feature.getGeometryName()).to.be('the_geom');
expect(feature.getGeometry()).to.be.an(Point); expect(feature.getGeometry()).to.be.an(Point);
+7 -7
View File
@@ -1,6 +1,6 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import * as _ol_extent_ from '../../../../src/ol/extent.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 Circle from '../../../../src/ol/geom/Circle.js';
import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js'; import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
@@ -15,7 +15,7 @@ describe('ol.format.GeoJSON', function() {
var format; var format;
beforeEach(function() { beforeEach(function() {
format = new _ol_format_GeoJSON_(); format = new GeoJSON();
}); });
var pointGeoJSON = { var pointGeoJSON = {
@@ -215,7 +215,7 @@ describe('ol.format.GeoJSON', function() {
}); });
it('uses featureProjection passed to the constructor', 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); var feature = format.readFeatures(pointGeoJSON);
expect(feature[0].getGeometry()).to.be.an(Point); expect(feature[0].getGeometry()).to.be.an(Point);
expect(feature[0].getGeometry().getCoordinates()).to.eql( 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() { 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, { var feature = format.readFeatures(pointGeoJSON, {
featureProjection: 'EPSG:3857' featureProjection: 'EPSG:3857'
}); });
@@ -254,7 +254,7 @@ describe('ol.format.GeoJSON', function() {
}); });
it('can create a feature with a specific geometryName', 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); readFeature(pointGeoJSON);
expect(feature.getGeometryName()).to.be('the_geom'); expect(feature.getGeometryName()).to.be('the_geom');
expect(feature.getGeometry()).to.be.an(Point); 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() { it('generates an array of features for Feature', function() {
var format = new _ol_format_GeoJSON_(); var format = new GeoJSON();
var json = { var json = {
type: 'Feature', type: 'Feature',
properties: { properties: {
@@ -604,7 +604,7 @@ describe('ol.format.GeoJSON', function() {
}); });
it('respects featureProjection passed to constructor', 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 point = new Point(fromLonLat([10, 20]));
var geojson = format.writeGeometry(point); var geojson = format.writeGeometry(point);
var obj = JSON.parse(geojson); var obj = JSON.parse(geojson);
+3 -3
View File
@@ -1,6 +1,6 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_format_GML_ from '../../../../src/ol/format/GML.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 LineString from '../../../../src/ol/geom/LineString.js';
import LinearRing from '../../../../src/ol/geom/LinearRing.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js';
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
@@ -23,7 +23,7 @@ describe('ol.format.GML2', function() {
var format; var format;
beforeEach(function() { beforeEach(function() {
format = new _ol_format_GML2_({srsName: 'CRS:84'}); format = new GML2({srsName: 'CRS:84'});
}); });
describe('#readFeatures', function() { describe('#readFeatures', function() {
@@ -32,7 +32,7 @@ describe('ol.format.GML2', function() {
var url = 'spec/ol/format/gml/osm-wfs-10.xml'; var url = 'spec/ol/format/gml/osm-wfs-10.xml';
afterLoadText(url, function(xml) { afterLoadText(url, function(xml) {
try { try {
features = new _ol_format_GML2_().readFeatures(xml); features = new GML2().readFeatures(xml);
} catch (e) { } catch (e) {
done(e); done(e);
} }
+5 -5
View File
@@ -1,5 +1,5 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; 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 LineString from '../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
@@ -11,7 +11,7 @@ describe('ol.format.GPX', function() {
var format; var format;
beforeEach(function() { beforeEach(function() {
format = new _ol_format_GPX_(); format = new GPX();
}); });
describe('#readProjection', function() { describe('#readProjection', function() {
@@ -550,7 +550,7 @@ describe('ol.format.GPX', function() {
describe('XML namespace support', function() { describe('XML namespace support', function() {
beforeEach(function() { beforeEach(function() {
format = new _ol_format_GPX_(); format = new GPX();
}); });
it('can read features with a version 1.0 namespace', function() { it('can read features with a version 1.0 namespace', function() {
@@ -591,7 +591,7 @@ describe('ol.format.GPX', function() {
describe('extensions support', function() { describe('extensions support', function() {
beforeEach(function() { beforeEach(function() {
format = new _ol_format_GPX_({ format = new GPX({
readExtensions: function(feature, extensionsNode) { readExtensions: function(feature, extensionsNode) {
var nodes = extensionsNode.getElementsByTagName('id'); var nodes = extensionsNode.getElementsByTagName('id');
var id = nodes.item(0).textContent; var id = nodes.item(0).textContent;
@@ -657,7 +657,7 @@ describe('ol.format.GPX', function() {
describe('write unsupported geometries', function() { describe('write unsupported geometries', function() {
beforeEach(function() { beforeEach(function() {
format = new _ol_format_GPX_(); format = new GPX();
}); });
it('does not fail', function() { it('does not fail', function() {
+2 -2
View File
@@ -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 _ol_Feature_ from '../../../../src/ol/Feature.js';
import {get as getProjection, transform} from '../../../../src/ol/proj.js'; import {get as getProjection, transform} from '../../../../src/ol/proj.js';
@@ -29,7 +29,7 @@ describe('ol.format.IGC', function() {
'G60189641B00B00800019000000000000'; 'G60189641B00B00800019000000000000';
beforeEach(function() { beforeEach(function() {
format = new _ol_format_IGC_(); format = new IGC();
}); });
describe('#readProjectionFromText', function() { describe('#readProjectionFromText', function() {
+40 -40
View File
@@ -1,7 +1,7 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_array_ from '../../../../src/ol/array.js'; import _ol_array_ from '../../../../src/ol/array.js';
import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js'; import GeoJSON from '../../../../src/ol/format/GeoJSON.js';
import _ol_format_KML_ from '../../../../src/ol/format/KML.js'; import KML from '../../../../src/ol/format/KML.js';
import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js'; import GeometryCollection from '../../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
import LinearRing from '../../../../src/ol/geom/LinearRing.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js';
@@ -33,13 +33,13 @@ describe('ol.format.KML', function() {
var dfltStyle = new _ol_style_Style_(); var dfltStyle = new _ol_style_Style_();
beforeEach(function() { beforeEach(function() {
format = new _ol_format_KML_({ format = new KML({
defaultStyle: [dfltStyle] defaultStyle: [dfltStyle]
}); });
}); });
it('set constant variables', function() { 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() { describe('#readFeatures', function() {
@@ -70,11 +70,11 @@ describe('ol.format.KML', function() {
describe('without parameters', function() { describe('without parameters', function() {
beforeEach(function() { beforeEach(function() {
format = new _ol_format_KML_(); format = new KML();
}); });
it('set constant variables', function() { 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() { describe('#readProjection', function() {
@@ -1720,11 +1720,11 @@ describe('ol.format.KML', function() {
expect(styleArray).to.have.length(1); expect(styleArray).to.have.length(1);
var style = styleArray[0]; var style = styleArray[0];
expect(style).to.be.an(_ol_style_Style_); 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.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 // 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().getColor()).to.eql([255, 255, 255, 1]);
expect(style.getStroke().getWidth()).to.be(1); expect(style.getStroke().getWidth()).to.be(1);
}); });
@@ -1753,8 +1753,8 @@ describe('ol.format.KML', function() {
expect(styleArray).to.have.length(1); expect(styleArray).to.have.length(1);
var style = styleArray[0]; var style = styleArray[0];
expect(style).to.be.an(_ol_style_Style_); 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.getStroke()).to.be(_ol_format_KML_.DEFAULT_STROKE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_);
var imageStyle = style.getImage(); var imageStyle = style.getImage();
expect(imageStyle).to.be.an(_ol_style_Icon_); expect(imageStyle).to.be.an(_ol_style_Icon_);
expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://foo.png').href); 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.getRotation()).to.eql(0);
expect(imageStyle.getSize()).to.be(null); expect(imageStyle.getSize()).to.be(null);
expect(imageStyle.getScale()).to.be(1); 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); expect(style.getZIndex()).to.be(undefined);
}); });
@@ -1833,8 +1833,8 @@ describe('ol.format.KML', function() {
expect(styleArray).to.have.length(1); expect(styleArray).to.have.length(1);
var style = styleArray[0]; var style = styleArray[0];
expect(style).to.be.an(_ol_style_Style_); 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.getStroke()).to.be(_ol_format_KML_.DEFAULT_STROKE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_);
var imageStyle = style.getImage(); var imageStyle = style.getImage();
expect(imageStyle).to.be.an(_ol_style_Icon_); expect(imageStyle).to.be.an(_ol_style_Icon_);
expect(new URL(imageStyle.getSrc()).href).to.eql(new URL('http://foo.png').href); 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.getRotation()).to.eql(0);
expect(imageStyle.getSize()).to.be(null); expect(imageStyle.getSize()).to.be(null);
expect(imageStyle.getScale()).to.be(1); 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); expect(style.getZIndex()).to.be(undefined);
}); });
}); });
@@ -1904,8 +1904,8 @@ describe('ol.format.KML', function() {
expect(styleArray).to.have.length(1); expect(styleArray).to.have.length(1);
var style = styleArray[0]; var style = styleArray[0];
expect(style).to.be.an(_ol_style_Style_); 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.getStroke()).to.be(_ol_format_KML_.DEFAULT_STROKE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_);
var imageStyle = style.getImage(); var imageStyle = style.getImage();
imageStyle.iconImage_.size_ = [144, 192]; imageStyle.iconImage_.size_ = [144, 192];
expect(imageStyle.getSize()).to.eql([48, 48]); 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.getOrigin()).to.eql([24, 108]);
expect(imageStyle.getRotation()).to.eql(0); expect(imageStyle.getRotation()).to.eql(0);
expect(imageStyle.getScale()).to.eql(3.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); expect(style.getZIndex()).to.be(undefined);
}); });
@@ -1940,9 +1940,9 @@ describe('ol.format.KML', function() {
expect(styleArray).to.have.length(1); expect(styleArray).to.have.length(1);
var style = styleArray[0]; var style = styleArray[0];
expect(style).to.be.an(_ol_style_Style_); 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.getImage()).to.be(_ol_format_KML_.DEFAULT_IMAGE_STYLE_); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_);
expect(style.getStroke()).to.be(_ol_format_KML_.DEFAULT_STROKE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_);
var textStyle = style.getText(); var textStyle = style.getText();
expect(textStyle).to.be.an(_ol_style_Text_); expect(textStyle).to.be.an(_ol_style_Text_);
expect(textStyle.getScale()).to.be(0.25); expect(textStyle.getScale()).to.be(0.25);
@@ -1975,13 +1975,13 @@ describe('ol.format.KML', function() {
expect(styleArray).to.have.length(1); expect(styleArray).to.have.length(1);
var style = styleArray[0]; var style = styleArray[0];
expect(style).to.be.an(_ol_style_Style_); 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.getImage()).to.be(_ol_format_KML_.DEFAULT_IMAGE_STYLE_); expect(style.getImage()).to.be(KML.DEFAULT_IMAGE_STYLE_);
var strokeStyle = style.getStroke(); var strokeStyle = style.getStroke();
expect(strokeStyle).to.be.an(_ol_style_Stroke_); expect(strokeStyle).to.be.an(_ol_style_Stroke_);
expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]);
expect(strokeStyle.getWidth()).to.be(9); 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); expect(style.getZIndex()).to.be(undefined);
}); });
@@ -2010,9 +2010,9 @@ describe('ol.format.KML', function() {
var fillStyle = style.getFill(); var fillStyle = style.getFill();
expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle).to.be.an(_ol_style_Fill_);
expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); 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(_ol_format_KML_.DEFAULT_STROKE_STYLE_); expect(style.getStroke()).to.be(KML.DEFAULT_STROKE_STYLE_);
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); expect(style.getZIndex()).to.be(undefined);
}); });
@@ -2047,12 +2047,12 @@ describe('ol.format.KML', function() {
var fillStyle = style.getFill(); var fillStyle = style.getFill();
expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle).to.be.an(_ol_style_Fill_);
expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); 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(); var strokeStyle = style.getStroke();
expect(strokeStyle).to.be.an(_ol_style_Stroke_); expect(strokeStyle).to.be.an(_ol_style_Stroke_);
expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]);
expect(strokeStyle.getWidth()).to.be(9); 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); expect(style.getZIndex()).to.be(undefined);
}); });
@@ -2084,12 +2084,12 @@ describe('ol.format.KML', function() {
var style = styleArray[0]; var style = styleArray[0];
expect(style).to.be.an(_ol_style_Style_); expect(style).to.be.an(_ol_style_Style_);
expect(style.getFill()).to.be(null); 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(); var strokeStyle = style.getStroke();
expect(strokeStyle).to.be.an(_ol_style_Stroke_); expect(strokeStyle).to.be.an(_ol_style_Stroke_);
expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); expect(strokeStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]);
expect(strokeStyle.getWidth()).to.be(9); 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); expect(style.getZIndex()).to.be(undefined);
}); });
@@ -2123,9 +2123,9 @@ describe('ol.format.KML', function() {
var fillStyle = style.getFill(); var fillStyle = style.getFill();
expect(fillStyle).to.be.an(_ol_style_Fill_); expect(fillStyle).to.be.an(_ol_style_Fill_);
expect(fillStyle.getColor()).to.eql([0x78, 0x56, 0x34, 0x12 / 255]); 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.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); expect(style.getZIndex()).to.be(undefined);
}); });
@@ -2159,9 +2159,9 @@ describe('ol.format.KML', function() {
var style = styleArray[0]; var style = styleArray[0];
expect(style).to.be.an(_ol_style_Style_); expect(style).to.be.an(_ol_style_Style_);
expect(style.getFill()).to.be(null); 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.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); 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() { 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_({ var style = new _ol_style_Style_({
image: new _ol_style_Icon_({ image: new _ol_style_Icon_({
src: 'http://foo.png' src: 'http://foo.png'
@@ -2547,7 +2547,7 @@ describe('ol.format.KML', function() {
expect(styleArray).to.have.length(1); expect(styleArray).to.have.length(1);
var s = styleArray[0]; var s = styleArray[0];
expect(s).to.be.an(_ol_style_Style_); 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); expect(styleArray).to.have.length(1);
var s = styleArray[0]; var s = styleArray[0];
expect(s).to.be.an(_ol_style_Style_); 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() { 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() { it('should ignore invalid coordinates', function() {
var doc = new DOMParser().parseFromString('<coordinates>INVALID</coordinates>', 'application/xml'); var doc = new DOMParser().parseFromString('<coordinates>INVALID</coordinates>', 'application/xml');
var node = doc.firstChild; 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() { 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() { it('feature must not have a properties property', function() {
var geojsonFormat = new _ol_format_GeoJSON_(); var geojsonFormat = new GeoJSON();
features.forEach(function(feature) { features.forEach(function(feature) {
var geojsonFeature = geojsonFormat.writeFeatureObject(feature); var geojsonFeature = geojsonFormat.writeFeatureObject(feature);
expect(geojsonFeature.properties).to.be(null); expect(geojsonFeature.properties).to.be(null);
+23 -23
View File
@@ -1,6 +1,6 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import * as _ol_extent_ from '../../../../src/ol/extent.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 Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../src/ol/geom/Polygon.js';
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
@@ -23,19 +23,19 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
describe('#readFeatures', function() { describe('#readFeatures', function() {
it('uses ol.render.Feature as feature class by default', 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); var features = format.readFeatures(data);
expect(features[0]).to.be.a(_ol_render_Feature_); expect(features[0]).to.be.a(_ol_render_Feature_);
}); });
it('parses only specified layers', function() { 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); var features = format.readFeatures(data);
expect(features.length).to.be(10); expect(features.length).to.be(10);
}); });
it('parses geometries correctly', function() { it('parses geometries correctly', function() {
var format = new _ol_format_MVT_({ var format = new MVT({
featureClass: _ol_Feature_, featureClass: _ol_Feature_,
layers: ['poi_label'] layers: ['poi_label']
}); });
@@ -60,14 +60,14 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
it('parses id property', function() { it('parses id property', function() {
// ol.Feature // ol.Feature
var format = new _ol_format_MVT_({ var format = new MVT({
featureClass: _ol_Feature_, featureClass: _ol_Feature_,
layers: ['building'] layers: ['building']
}); });
var features = format.readFeatures(data); var features = format.readFeatures(data);
expect(features[0].getId()).to.be(2); expect(features[0].getId()).to.be(2);
// ol.render.Feature // ol.render.Feature
format = new _ol_format_MVT_({ format = new MVT({
layers: ['building'] layers: ['building']
}); });
features = format.readFeatures(data); 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() { it('sets the extent of the last readFeatures call', function() {
var format = new _ol_format_MVT_(); var format = new MVT();
format.readFeatures(data); format.readFeatures(data);
var extent = format.getLastExtent(); var extent = format.getLastExtent();
expect(_ol_extent_.getWidth(extent)).to.be(4096); expect(_ol_extent_.getWidth(extent)).to.be(4096);
@@ -89,7 +89,7 @@ describe('ol.format.MVT', function() {
describe('#createFeature_', function() { describe('#createFeature_', function() {
it('accepts a geometryName', function() { it('accepts a geometryName', function() {
var format = new _ol_format_MVT_({ var format = new MVT({
featureClass: _ol_Feature_, featureClass: _ol_Feature_,
geometryName: 'myGeom' geometryName: 'myGeom'
}); });
@@ -103,13 +103,13 @@ describe('ol.format.MVT', function() {
name: 'layer1' name: 'layer1'
} }
}; };
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; var readRawGeometry_ = MVT.readRawGeometry_;
_ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
flatCoordinates.push(0, 0); flatCoordinates.push(0, 0);
ends.push(2); ends.push(2);
}; };
var feature = format.createFeature_({}, rawFeature); var feature = format.createFeature_({}, rawFeature);
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_; MVT.readRawGeometry_ = readRawGeometry_;
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
expect(geometry).to.be.a(Point); expect(geometry).to.be.a(Point);
expect(feature.get('myGeom')).to.equal(geometry); expect(feature.get('myGeom')).to.equal(geometry);
@@ -117,7 +117,7 @@ describe('ol.format.MVT', function() {
}); });
it('detects a Polygon', function() { it('detects a Polygon', function() {
var format = new _ol_format_MVT_({ var format = new MVT({
featureClass: _ol_Feature_ featureClass: _ol_Feature_
}); });
var rawFeature = { var rawFeature = {
@@ -127,20 +127,20 @@ describe('ol.format.MVT', function() {
name: 'layer1' name: 'layer1'
} }
}; };
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; var readRawGeometry_ = MVT.readRawGeometry_;
_ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
flatCoordinates.push(0, 0, 3, 0, 3, 3, 3, 0, 0, 0); flatCoordinates.push(0, 0, 3, 0, 3, 3, 3, 0, 0, 0);
flatCoordinates.push(1, 1, 1, 2, 2, 2, 2, 1, 1, 1); flatCoordinates.push(1, 1, 1, 2, 2, 2, 2, 1, 1, 1);
ends.push(10, 20); ends.push(10, 20);
}; };
var feature = format.createFeature_({}, rawFeature); var feature = format.createFeature_({}, rawFeature);
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_; MVT.readRawGeometry_ = readRawGeometry_;
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
expect(geometry).to.be.a(Polygon); expect(geometry).to.be.a(Polygon);
}); });
it('detects a MultiPolygon', function() { it('detects a MultiPolygon', function() {
var format = new _ol_format_MVT_({ var format = new MVT({
featureClass: _ol_Feature_ featureClass: _ol_Feature_
}); });
var rawFeature = { var rawFeature = {
@@ -150,20 +150,20 @@ describe('ol.format.MVT', function() {
name: 'layer1' name: 'layer1'
} }
}; };
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; var readRawGeometry_ = MVT.readRawGeometry_;
_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(0, 0, 1, 0, 1, 1, 1, 0, 0, 0);
flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1); flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1);
ends.push(10, 20); ends.push(10, 20);
}; };
var feature = format.createFeature_({}, rawFeature); var feature = format.createFeature_({}, rawFeature);
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_; MVT.readRawGeometry_ = readRawGeometry_;
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
expect(geometry).to.be.a(MultiPolygon); expect(geometry).to.be.a(MultiPolygon);
}); });
it('creates ol.render.Feature instances', function() { it('creates ol.render.Feature instances', function() {
var format = new _ol_format_MVT_(); var format = new MVT();
var rawFeature = { var rawFeature = {
type: 3, type: 3,
properties: { properties: {
@@ -173,10 +173,10 @@ describe('ol.format.MVT', function() {
name: 'layer1' name: 'layer1'
} }
}; };
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; var readRawGeometry_ = MVT.readRawGeometry_;
var createdFlatCoordinates; var createdFlatCoordinates;
var createdEnds; 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(0, 0, 1, 0, 1, 1, 1, 0, 0, 0);
flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1); flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1);
createdFlatCoordinates = flatCoordinates; createdFlatCoordinates = flatCoordinates;
@@ -184,7 +184,7 @@ describe('ol.format.MVT', function() {
createdEnds = ends; createdEnds = ends;
}; };
var feature = format.createFeature_({}, rawFeature); var feature = format.createFeature_({}, rawFeature);
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_; MVT.readRawGeometry_ = readRawGeometry_;
expect(feature).to.be.a(_ol_render_Feature_); expect(feature).to.be.a(_ol_render_Feature_);
expect(feature.getType()).to.be('Polygon'); expect(feature.getType()).to.be('Polygon');
expect(feature.getFlatCoordinates()).to.equal(createdFlatCoordinates); expect(feature.getFlatCoordinates()).to.equal(createdFlatCoordinates);
+2 -2
View File
@@ -1,5 +1,5 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; 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 Point from '../../../../src/ol/geom/Point.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
import {get as getProjection, transform} from '../../../../src/ol/proj.js'; import {get as getProjection, transform} from '../../../../src/ol/proj.js';
@@ -9,7 +9,7 @@ describe('ol.format.OSMXML', function() {
var format; var format;
beforeEach(function() { beforeEach(function() {
format = new _ol_format_OSMXML_(); format = new OSMXML();
}); });
describe('#readProjection', function() { describe('#readProjection', function() {
+2 -2
View File
@@ -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'; import _ol_xml_ from '../../../../src/ol/xml.js';
describe('ol.format.OWS 1.1', function() { describe('ol.format.OWS 1.1', function() {
var parser = new _ol_format_OWS_(); var parser = new OWS();
it('should read ServiceProvider tag properly', function() { it('should read ServiceProvider tag properly', function() {
var doc = _ol_xml_.parse( var doc = _ol_xml_.parse(
+18 -18
View File
@@ -1,5 +1,5 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; 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 LineString from '../../../../src/ol/geom/LineString.js';
import {get as getProjection, transform} from '../../../../src/ol/proj.js'; import {get as getProjection, transform} from '../../../../src/ol/proj.js';
@@ -14,7 +14,7 @@ describe('ol.format.Polyline', function() {
var points3857; var points3857;
function resetTestingData() { function resetTestingData() {
format = new _ol_format_Polyline_(); format = new Polyline();
points = [ points = [
[-120.20000, 38.50000], [-120.20000, 38.50000],
[-120.95000, 40.70000], [-120.95000, 40.70000],
@@ -60,7 +60,7 @@ describe('ol.format.Polyline', function() {
describe('encodeDeltas', function() { describe('encodeDeltas', function() {
it('returns expected value', function() { it('returns expected value', function() {
var encodeDeltas = _ol_format_Polyline_.encodeDeltas; var encodeDeltas = Polyline.encodeDeltas;
expect(encodeDeltas(flippedFlatPoints, 2)).to.eql(encodedFlatPoints); expect(encodeDeltas(flippedFlatPoints, 2)).to.eql(encodedFlatPoints);
}); });
@@ -68,7 +68,7 @@ describe('ol.format.Polyline', function() {
describe('decodeDeltas', function() { describe('decodeDeltas', function() {
it('returns expected value', function() { it('returns expected value', function() {
var decodeDeltas = _ol_format_Polyline_.decodeDeltas; var decodeDeltas = Polyline.decodeDeltas;
expect(decodeDeltas(encodedFlatPoints, 2)).to.eql(flippedFlatPoints); expect(decodeDeltas(encodedFlatPoints, 2)).to.eql(flippedFlatPoints);
}); });
@@ -77,7 +77,7 @@ describe('ol.format.Polyline', function() {
describe('encodeFloats', function() { describe('encodeFloats', function() {
it('returns expected value', function() { it('returns expected value', function() {
var encodeFloats = _ol_format_Polyline_.encodeFloats; var encodeFloats = Polyline.encodeFloats;
expect(encodeFloats(smallFloats)).to.eql(encodedFloats); expect(encodeFloats(smallFloats)).to.eql(encodedFloats);
@@ -90,7 +90,7 @@ describe('ol.format.Polyline', function() {
describe('decodeFloats', function() { describe('decodeFloats', function() {
it('returns expected value', 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)).to.eql(smallFloats);
expect(decodeFloats(encodedFloats, 1e5)).to.eql(smallFloats); expect(decodeFloats(encodedFloats, 1e5)).to.eql(smallFloats);
@@ -101,7 +101,7 @@ describe('ol.format.Polyline', function() {
describe('encodeSignedIntegers', function() { describe('encodeSignedIntegers', function() {
it('returns expected value', function() { it('returns expected value', function() {
var encodeSignedIntegers = _ol_format_Polyline_.encodeSignedIntegers; var encodeSignedIntegers = Polyline.encodeSignedIntegers;
expect(encodeSignedIntegers( expect(encodeSignedIntegers(
signedIntegers)).to.eql(encodedSignedIntegers); signedIntegers)).to.eql(encodedSignedIntegers);
@@ -110,7 +110,7 @@ describe('ol.format.Polyline', function() {
describe('decodeSignedIntegers', function() { describe('decodeSignedIntegers', function() {
it('returns expected value', function() { it('returns expected value', function() {
var decodeSignedIntegers = _ol_format_Polyline_.decodeSignedIntegers; var decodeSignedIntegers = Polyline.decodeSignedIntegers;
expect(decodeSignedIntegers( expect(decodeSignedIntegers(
encodedSignedIntegers)).to.eql(signedIntegers); encodedSignedIntegers)).to.eql(signedIntegers);
@@ -120,7 +120,7 @@ describe('ol.format.Polyline', function() {
describe('encodeUnsignedIntegers', function() { describe('encodeUnsignedIntegers', function() {
it('returns expected value', function() { it('returns expected value', function() {
var encodeUnsignedIntegers = _ol_format_Polyline_.encodeUnsignedIntegers; var encodeUnsignedIntegers = Polyline.encodeUnsignedIntegers;
expect(encodeUnsignedIntegers( expect(encodeUnsignedIntegers(
unsignedIntegers)).to.eql(encodedUnsignedIntegers); unsignedIntegers)).to.eql(encodedUnsignedIntegers);
@@ -129,7 +129,7 @@ describe('ol.format.Polyline', function() {
describe('decodeUnsignedIntegers', function() { describe('decodeUnsignedIntegers', function() {
it('returns expected value', function() { it('returns expected value', function() {
var decodeUnsignedIntegers = _ol_format_Polyline_.decodeUnsignedIntegers; var decodeUnsignedIntegers = Polyline.decodeUnsignedIntegers;
expect(decodeUnsignedIntegers( expect(decodeUnsignedIntegers(
encodedUnsignedIntegers)).to.eql(unsignedIntegers); encodedUnsignedIntegers)).to.eql(unsignedIntegers);
@@ -139,7 +139,7 @@ describe('ol.format.Polyline', function() {
describe('encodeFloat', function() { describe('encodeFloat', function() {
it('returns expected value', 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.00000])).to.eql('?');
expect(encodeFloats([-0.00001])).to.eql('@'); expect(encodeFloats([-0.00001])).to.eql('@');
@@ -162,7 +162,7 @@ describe('ol.format.Polyline', function() {
describe('decodeFloat', function() { describe('decodeFloat', function() {
it('returns expected value', 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.00000]);
expect(decodeFloats('@')).to.eql([-0.00001]); expect(decodeFloats('@')).to.eql([-0.00001]);
@@ -186,7 +186,7 @@ describe('ol.format.Polyline', function() {
describe('encodeSignedInteger', function() { describe('encodeSignedInteger', function() {
it('returns expected value', function() { it('returns expected value', function() {
var encodeSignedIntegers = _ol_format_Polyline_.encodeSignedIntegers; var encodeSignedIntegers = Polyline.encodeSignedIntegers;
expect(encodeSignedIntegers([0])).to.eql('?'); expect(encodeSignedIntegers([0])).to.eql('?');
expect(encodeSignedIntegers([-1])).to.eql('@'); expect(encodeSignedIntegers([-1])).to.eql('@');
@@ -204,7 +204,7 @@ describe('ol.format.Polyline', function() {
describe('decodeSignedInteger', function() { describe('decodeSignedInteger', function() {
it('returns expected value', 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([0]);
expect(decodeSignedIntegers('@')).to.eql([-1]); expect(decodeSignedIntegers('@')).to.eql([-1]);
@@ -223,7 +223,7 @@ describe('ol.format.Polyline', function() {
describe('encodeUnsignedInteger', function() { describe('encodeUnsignedInteger', function() {
it('returns expected value', function() { it('returns expected value', function() {
var encodeUnsignedInteger = _ol_format_Polyline_.encodeUnsignedInteger; var encodeUnsignedInteger = Polyline.encodeUnsignedInteger;
expect(encodeUnsignedInteger(0)).to.eql('?'); expect(encodeUnsignedInteger(0)).to.eql('?');
expect(encodeUnsignedInteger(1)).to.eql('@'); expect(encodeUnsignedInteger(1)).to.eql('@');
@@ -243,7 +243,7 @@ describe('ol.format.Polyline', function() {
describe('decodeUnsignedInteger', function() { describe('decodeUnsignedInteger', function() {
it('returns expected value', 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([0]);
expect(decodeUnsignedIntegers('@')).to.eql([1]); expect(decodeUnsignedIntegers('@')).to.eql([1]);
@@ -320,12 +320,12 @@ describe('ol.format.Polyline', function() {
}); });
it('parses XYZ linestring', function() { it('parses XYZ linestring', function() {
var xyz = _ol_format_Polyline_.encodeDeltas([ var xyz = Polyline.encodeDeltas([
38.500, -120.200, 100, 38.500, -120.200, 100,
40.700, -120.950, 200, 40.700, -120.950, 200,
43.252, -126.453, 20 43.252, -126.453, 20
], 3); ], 3);
var format = new _ol_format_Polyline_({ var format = new Polyline({
geometryLayout: 'XYZ' geometryLayout: 'XYZ'
}); });
+7 -7
View File
@@ -1,9 +1,9 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
import Polygon from '../../../../src/ol/geom/Polygon.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 {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 = { var aruba = {
type: 'Topology', type: 'Topology',
@@ -42,13 +42,13 @@ describe('ol.format.TopoJSON', function() {
var format; var format;
before(function() { before(function() {
format = new _ol_format_TopoJSON_(); format = new TopoJSON();
}); });
describe('constructor', function() { describe('constructor', function() {
it('creates a new format', function() { it('creates a new format', function() {
expect(format).to.be.a(_ol_format_Feature_); expect(format).to.be.a(FeatureFormat);
expect(format).to.be.a(_ol_format_TopoJSON_); 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) { it('sets the topology\'s child names as feature property', function(done) {
afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) { afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) {
var format = new _ol_format_TopoJSON_({ var format = new TopoJSON({
layerName: 'layer' layerName: 'layer'
}); });
var features = format.readFeatures(text); 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) { it('only parses features from specified topology\'s children', function(done) {
afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) { afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) {
var format = new _ol_format_TopoJSON_({ var format = new TopoJSON({
layers: ['land'] layers: ['land']
}); });
var features = format.readFeatures(text); var features = format.readFeatures(text);
+50 -50
View File
@@ -1,6 +1,6 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_format_GML2_ from '../../../../src/ol/format/GML2.js'; import GML2 from '../../../../src/ol/format/GML2.js';
import _ol_format_WFS_ from '../../../../src/ol/format/WFS.js'; import WFS from '../../../../src/ol/format/WFS.js';
import _ol_format_filter_ from '../../../../src/ol/format/filter.js'; import _ol_format_filter_ from '../../../../src/ol/format/filter.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
@@ -16,7 +16,7 @@ describe('ol.format.WFS', function() {
describe('featureType', function() { describe('featureType', function() {
it('#getFeatureType #setFeatureType', function() { it('#getFeatureType #setFeatureType', function() {
var format = new _ol_format_WFS_({ var format = new WFS({
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featureType: ['foo', 'bar'] featureType: ['foo', 'bar']
}); });
@@ -41,7 +41,7 @@ describe('ol.format.WFS', function() {
afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(data) { afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(data) {
try { try {
xml = data; xml = data;
features = new _ol_format_WFS_(config).readFeatures(xml); features = new WFS(config).readFeatures(xml);
} catch (e) { } catch (e) {
done(e); done(e);
} }
@@ -67,7 +67,7 @@ describe('ol.format.WFS', function() {
}); });
it('transforms and creates a polygon for Illinois', 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' featureProjection: 'EPSG:3857'
}); });
feature = features[0]; feature = features[0];
@@ -88,7 +88,7 @@ describe('ol.format.WFS', function() {
var config = { var config = {
'featureNS': 'http://mapserver.gis.umn.edu/mapserver', 'featureNS': 'http://mapserver.gis.umn.edu/mapserver',
'featureType': 'polygon', 'featureType': 'polygon',
'gmlFormat': new _ol_format_GML2_() 'gmlFormat': new GML2()
}; };
before(function(done) { before(function(done) {
@@ -97,7 +97,7 @@ describe('ol.format.WFS', function() {
afterLoadText('spec/ol/format/wfs/polygonv2.xml', function(data) { afterLoadText('spec/ol/format/wfs/polygonv2.xml', function(data) {
try { try {
xml = data; xml = data;
features = new _ol_format_WFS_(config).readFeatures(xml); features = new WFS(config).readFeatures(xml);
} catch (e) { } catch (e) {
done(e); done(e);
} }
@@ -138,7 +138,7 @@ describe('ol.format.WFS', function() {
}); });
}); });
it('returns an empty array of features when none exist', 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); expect(result).to.have.length(0);
}); });
}); });
@@ -149,7 +149,7 @@ describe('ol.format.WFS', function() {
afterLoadText('spec/ol/format/wfs/NumberOfFeatures.xml', afterLoadText('spec/ol/format/wfs/NumberOfFeatures.xml',
function(xml) { function(xml) {
try { try {
response = new _ol_format_WFS_().readFeatureCollectionMetadata(xml); response = new WFS().readFeatureCollectionMetadata(xml);
} catch (e) { } catch (e) {
done(e); done(e);
} }
@@ -172,7 +172,7 @@ describe('ol.format.WFS', function() {
afterLoadText('spec/ol/format/wfs/boundedBy.xml', afterLoadText('spec/ol/format/wfs/boundedBy.xml',
function(xml) { function(xml) {
try { try {
response = new _ol_format_WFS_().readFeatureCollectionMetadata(xml); response = new WFS().readFeatureCollectionMetadata(xml);
} catch (e) { } catch (e) {
done(e); done(e);
} }
@@ -191,7 +191,7 @@ describe('ol.format.WFS', function() {
afterLoadText('spec/ol/format/wfs/TransactionResponse.xml', afterLoadText('spec/ol/format/wfs/TransactionResponse.xml',
function(xml) { function(xml) {
try { try {
response = new _ol_format_WFS_().readTransactionResponse(xml); response = new WFS().readTransactionResponse(xml);
} catch (e) { } catch (e) {
done(e); done(e);
} }
@@ -226,7 +226,7 @@ describe('ol.format.WFS', function() {
' <wfs:PropertyName>STATE_ABBR</wfs:PropertyName>' + ' <wfs:PropertyName>STATE_ABBR</wfs:PropertyName>' +
' </wfs:Query>' + ' </wfs:Query>' +
'</wfs:GetFeature>'; '</wfs:GetFeature>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
resultType: 'hits', resultType: 'hits',
featureTypes: ['states'], featureTypes: ['states'],
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
@@ -251,7 +251,7 @@ describe('ol.format.WFS', function() {
' xmlns:topp="http://www.openplans.org/topp">' + ' xmlns:topp="http://www.openplans.org/topp">' +
' </wfs:Query>' + ' </wfs:Query>' +
'</wfs:GetFeature>'; '</wfs:GetFeature>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
count: 10, count: 10,
startIndex: 20, startIndex: 20,
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
@@ -278,7 +278,7 @@ describe('ol.format.WFS', function() {
' </ogc:BBOX>' + ' </ogc:BBOX>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp', featurePrefix: 'topp',
@@ -301,7 +301,7 @@ describe('ol.format.WFS', function() {
' </ogc:PropertyIsEqualTo>' + ' </ogc:PropertyIsEqualTo>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp', featurePrefix: 'topp',
@@ -329,7 +329,7 @@ describe('ol.format.WFS', function() {
' </ogc:Or>' + ' </ogc:Or>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp', featurePrefix: 'topp',
@@ -371,7 +371,7 @@ describe('ol.format.WFS', function() {
' </ogc:Or>' + ' </ogc:Or>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp', featurePrefix: 'topp',
@@ -403,7 +403,7 @@ describe('ol.format.WFS', function() {
' </ogc:PropertyIsBetween>' + ' </ogc:PropertyIsBetween>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp', featurePrefix: 'topp',
@@ -424,7 +424,7 @@ describe('ol.format.WFS', function() {
' </ogc:PropertyIsNull>' + ' </ogc:PropertyIsNull>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp', featurePrefix: 'topp',
@@ -446,7 +446,7 @@ describe('ol.format.WFS', function() {
' </ogc:PropertyIsLike>' + ' </ogc:PropertyIsLike>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp', featurePrefix: 'topp',
@@ -468,7 +468,7 @@ describe('ol.format.WFS', function() {
' </ogc:PropertyIsLike>' + ' </ogc:PropertyIsLike>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp', featurePrefix: 'topp',
@@ -492,7 +492,7 @@ describe('ol.format.WFS', function() {
' </ogc:Not>' + ' </ogc:Not>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp', featurePrefix: 'topp',
@@ -528,7 +528,7 @@ describe('ol.format.WFS', function() {
' </ogc:And>' + ' </ogc:And>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'urn:ogc:def:crs:EPSG::4326', srsName: 'urn:ogc:def:crs:EPSG::4326',
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featurePrefix: 'topp', featurePrefix: 'topp',
@@ -562,7 +562,7 @@ describe('ol.format.WFS', function() {
' </ogc:Contains>' + ' </ogc:Contains>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'EPSG:4326', srsName: 'EPSG:4326',
featureTypes: ['area'], featureTypes: ['area'],
filter: _ol_format_filter_.contains( filter: _ol_format_filter_.contains(
@@ -599,7 +599,7 @@ describe('ol.format.WFS', function() {
' </ogc:Intersects>' + ' </ogc:Intersects>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'EPSG:4326', srsName: 'EPSG:4326',
featureTypes: ['area'], featureTypes: ['area'],
filter: _ol_format_filter_.intersects( filter: _ol_format_filter_.intersects(
@@ -636,7 +636,7 @@ describe('ol.format.WFS', function() {
' </ogc:Within>' + ' </ogc:Within>' +
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'EPSG:4326', srsName: 'EPSG:4326',
featureTypes: ['area'], featureTypes: ['area'],
filter: _ol_format_filter_.within( filter: _ol_format_filter_.within(
@@ -676,7 +676,7 @@ describe('ol.format.WFS', function() {
' </ogc:Filter>' + ' </ogc:Filter>' +
'</wfs:Query>'; '</wfs:Query>';
var serialized = new _ol_format_WFS_().writeGetFeature({ var serialized = new WFS().writeGetFeature({
srsName: 'EPSG:4326', srsName: 'EPSG:4326',
featureTypes: ['states'], featureTypes: ['states'],
filter: _ol_format_filter_.during('date_prop', '2010-01-20T00:00:00Z', '2012-12-31T00:00:00Z') 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" ' + 'service="WFS" version="1.1.0" handle="handle_t" ' +
'xsi:schemaLocation="http://www.opengis.net/wfs ' + 'xsi:schemaLocation="http://www.opengis.net/wfs ' +
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>'; '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'}); {handle: 'handle_t'});
expect(serialized).to.xmleql(_ol_xml_.parse(text)); expect(serialized).to.xmleql(_ol_xml_.parse(text));
}); });
@@ -711,7 +711,7 @@ describe('ol.format.WFS', function() {
}); });
}); });
it('creates the correct srsName', function() { it('creates the correct srsName', function() {
var format = new _ol_format_WFS_(); var format = new WFS();
var insertFeature = new _ol_Feature_({ var insertFeature = new _ol_Feature_({
the_geom: new MultiLineString([[ the_geom: new MultiLineString([[
[-5178372.1885436, 1992365.7775042], [-5178372.1885436, 1992365.7775042],
@@ -742,7 +742,7 @@ describe('ol.format.WFS', function() {
}); });
it('creates the correct update', function() { it('creates the correct update', function() {
var format = new _ol_format_WFS_(); var format = new WFS();
var updateFeature = new _ol_Feature_(); var updateFeature = new _ol_Feature_();
updateFeature.setGeometryName('the_geom'); updateFeature.setGeometryName('the_geom');
updateFeature.setGeometry(new MultiLineString([[ updateFeature.setGeometry(new MultiLineString([[
@@ -763,7 +763,7 @@ describe('ol.format.WFS', function() {
}); });
it('creates the correct update if geometry name is alias', 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([[ var updateFeature = new _ol_Feature_(new MultiLineString([[
[-12279454, 6741885], [-12279454, 6741885],
[-12064207, 6732101], [-12064207, 6732101],
@@ -787,7 +787,7 @@ describe('ol.format.WFS', function() {
describe('when writing out a Transaction request', function() { describe('when writing out a Transaction request', function() {
it('creates the correct update with default featurePrefix', 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_(); var updateFeature = new _ol_Feature_();
updateFeature.setGeometryName('the_geom'); updateFeature.setGeometryName('the_geom');
updateFeature.setGeometry(new MultiLineString([[ updateFeature.setGeometry(new MultiLineString([[
@@ -810,7 +810,7 @@ describe('ol.format.WFS', function() {
describe('when writing out a Transaction request', function() { describe('when writing out a Transaction request', function() {
it('does not create an update if no fid', 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_(); var updateFeature = new _ol_Feature_();
updateFeature.setGeometryName('the_geom'); updateFeature.setGeometryName('the_geom');
updateFeature.setGeometry(new MultiLineString([[ updateFeature.setGeometry(new MultiLineString([[
@@ -843,7 +843,7 @@ describe('ol.format.WFS', function() {
}); });
it('handles multiple geometries', function() { it('handles multiple geometries', function() {
var format = new _ol_format_WFS_(); var format = new WFS();
var updateFeature = new _ol_Feature_(); var updateFeature = new _ol_Feature_();
updateFeature.setGeometryName('the_geom'); updateFeature.setGeometryName('the_geom');
updateFeature.setGeometry(new MultiLineString([[ updateFeature.setGeometry(new MultiLineString([[
@@ -878,7 +878,7 @@ describe('ol.format.WFS', function() {
}); });
it('creates the correct transaction body', function() { it('creates the correct transaction body', function() {
var format = new _ol_format_WFS_(); var format = new WFS();
var insertFeature = new _ol_Feature_({ var insertFeature = new _ol_Feature_({
the_geom: new MultiPoint([[1, 2]]), the_geom: new MultiPoint([[1, 2]]),
foo: 'bar', foo: 'bar',
@@ -921,7 +921,7 @@ describe('ol.format.WFS', function() {
}); });
it('handles writing out Native', function() { it('handles writing out Native', function() {
var format = new _ol_format_WFS_(); var format = new WFS();
var serialized = format.writeTransaction(null, null, null, { var serialized = format.writeTransaction(null, null, null, {
nativeElements: [{ nativeElements: [{
vendorId: 'ORACLE', vendorId: 'ORACLE',
@@ -948,7 +948,7 @@ describe('ol.format.WFS', function() {
}); });
it('handles the WFS version', function() { it('handles the WFS version', function() {
var format = new _ol_format_WFS_(); var format = new WFS();
var insertFeature = new _ol_Feature_({ var insertFeature = new _ol_Feature_({
the_geom: new LineString([[1.1, 2], [3, 4.2]]), the_geom: new LineString([[1.1, 2], [3, 4.2]]),
foo: 'bar', foo: 'bar',
@@ -992,7 +992,7 @@ describe('ol.format.WFS', function() {
}); });
it('do not add feature prefix twice', function() { it('do not add feature prefix twice', function() {
var format = new _ol_format_WFS_(); var format = new WFS();
var insertFeature = new _ol_Feature_({ var insertFeature = new _ol_Feature_({
the_geom: new MultiPoint([[1, 2]]), the_geom: new MultiPoint([[1, 2]]),
foo: 'bar', foo: 'bar',
@@ -1035,7 +1035,7 @@ describe('ol.format.WFS', function() {
}); });
it('handles 3D in WFS 1.0.0', 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_({ var insertFeature = new _ol_Feature_({
the_geom: new LineString([[1.1, 2, 4], [3, 4.2, 5]]), the_geom: new LineString([[1.1, 2, 4], [3, 4.2, 5]]),
foo: 'bar', foo: 'bar',
@@ -1077,7 +1077,7 @@ describe('ol.format.WFS', function() {
}); });
it('handles 3D in WFS 1.1.0', 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_({ var insertFeature = new _ol_Feature_({
the_geom: new MultiPoint([[1, 2, 3]]), the_geom: new MultiPoint([[1, 2, 3]]),
foo: 'bar', foo: 'bar',
@@ -1117,7 +1117,7 @@ describe('ol.format.WFS', function() {
}); });
it('handles writing multiple Query elements', function() { it('handles writing multiple Query elements', function() {
var format = new _ol_format_WFS_(); var format = new WFS();
var serialized = format.writeGetFeature({ var serialized = format.writeGetFeature({
featureNS: 'http://www.openplans.org/topp', featureNS: 'http://www.openplans.org/topp',
featureTypes: ['states', 'cities'], featureTypes: ['states', 'cities'],
@@ -1137,7 +1137,7 @@ describe('ol.format.WFS', function() {
'featureNS': 'http://mapserver.gis.umn.edu/mapserver', 'featureNS': 'http://mapserver.gis.umn.edu/mapserver',
'featureType': 'Historische_Messtischblaetter_WFS' 'featureType': 'Historische_Messtischblaetter_WFS'
}; };
features = new _ol_format_WFS_(config).readFeatures(xml); features = new WFS(config).readFeatures(xml);
} catch (e) { } catch (e) {
done(e); done(e);
} }
@@ -1165,7 +1165,7 @@ describe('ol.format.WFS', function() {
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
try { try {
features = new _ol_format_WFS_({ features = new WFS({
featureNS: 'http://localhost:8080/official', featureNS: 'http://localhost:8080/official',
featureType: ['planet_osm_polygon', 'planet_osm_line'] featureType: ['planet_osm_polygon', 'planet_osm_line']
}).readFeatures(xml); }).readFeatures(xml);
@@ -1188,11 +1188,11 @@ describe('ol.format.WFS', function() {
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
try { try {
lineFeatures = new _ol_format_WFS_({ lineFeatures = new WFS({
featureNS: 'http://localhost:8080/official', featureNS: 'http://localhost:8080/official',
featureType: ['planet_osm_line'] featureType: ['planet_osm_line']
}).readFeatures(xml); }).readFeatures(xml);
polygonFeatures = new _ol_format_WFS_({ polygonFeatures = new WFS({
featureNS: 'http://localhost:8080/official', featureNS: 'http://localhost:8080/official',
featureType: ['planet_osm_polygon'] featureType: ['planet_osm_polygon']
}).readFeatures(xml); }).readFeatures(xml);
@@ -1216,7 +1216,7 @@ describe('ol.format.WFS', function() {
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
try { try {
features = new _ol_format_WFS_().readFeatures(xml); features = new WFS().readFeatures(xml);
} catch (e) { } catch (e) {
done(e); done(e);
} }
@@ -1236,7 +1236,7 @@ describe('ol.format.WFS', function() {
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) { afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) {
try { try {
features = new _ol_format_WFS_().readFeatures(xml); features = new WFS().readFeatures(xml);
} catch (e) { } catch (e) {
done(e); done(e);
} }
@@ -1259,11 +1259,11 @@ describe('ol.format.WFS', function() {
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) { afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) {
try { try {
busFeatures = new _ol_format_WFS_({ busFeatures = new WFS({
featureNS: 'http://mapserver.gis.umn.edu/mapserver', featureNS: 'http://mapserver.gis.umn.edu/mapserver',
featureType: ['bus_stop'] featureType: ['bus_stop']
}).readFeatures(xml); }).readFeatures(xml);
infoFeatures = new _ol_format_WFS_({ infoFeatures = new WFS({
featureNS: 'http://mapserver.gis.umn.edu/mapserver', featureNS: 'http://mapserver.gis.umn.edu/mapserver',
featureType: ['information'] featureType: ['information']
}).readFeatures(xml); }).readFeatures(xml);
@@ -1296,7 +1296,7 @@ describe('ol.format.WFS', function() {
' </PropertyIsEqualTo>' + ' </PropertyIsEqualTo>' +
' </And>' + ' </And>' +
'</Filter>'; '</Filter>';
var serialized = _ol_format_WFS_.writeFilter( var serialized = WFS.writeFilter(
_ol_format_filter_.and( _ol_format_filter_.and(
_ol_format_filter_.like('name', 'Mississippi*'), _ol_format_filter_.like('name', 'Mississippi*'),
_ol_format_filter_.equalTo('waterway', 'riverbank') _ol_format_filter_.equalTo('waterway', 'riverbank')
+3 -3
View File
@@ -1,12 +1,12 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import Point from '../../../../src/ol/geom/Point.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'; import {transform} from '../../../../src/ol/proj.js';
describe('ol.format.WKT', function() { describe('ol.format.WKT', function() {
var format = new _ol_format_WKT_(); var format = new WKT();
describe('#readProjectionFromText', function() { describe('#readProjectionFromText', function() {
it('returns the default projection', function() { it('returns the default projection', function() {
@@ -779,7 +779,7 @@ describe('ol.format.WKT', function() {
}); });
it('GeometryCollection split / merged correctly', 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 wkt = 'GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))';
var features = format.readFeatures(wkt); var features = format.readFeatures(wkt);
expect(features.length).to.eql(2); expect(features.length).to.eql(2);
+2 -2
View File
@@ -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('ol.format.WMSCapabilities', function() {
describe('when parsing ogcsample.xml', function() { describe('when parsing ogcsample.xml', function() {
var parser = new _ol_format_WMSCapabilities_(); var parser = new WMSCapabilities();
var capabilities; var capabilities;
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/wms/ogcsample.xml', function(xml) { afterLoadText('spec/ol/format/wms/ogcsample.xml', function(xml) {
@@ -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 {addCommon, clearAllProjections} from '../../../../src/ol/proj.js';
import {register} from '../../../../src/ol/proj/proj4.js'; import {register} from '../../../../src/ol/proj/proj4.js';
@@ -8,12 +8,12 @@ describe('ol.format.WMSGetFeatureInfo', function() {
describe('#getLayers', function() { describe('#getLayers', function() {
it('returns null if layers is undefined', 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); expect(format.getLayers()).to.be(null);
}); });
it('returns the value provided in the layers option', function() { it('returns the value provided in the layers option', function() {
var format = new _ol_format_WMSGetFeatureInfo_({ var format = new WMSGetFeatureInfo({
layers: ['a', 'z'] layers: ['a', 'z']
}); });
expect(format.getLayers()).to.eql(['a', 'z']); expect(format.getLayers()).to.eql(['a', 'z']);
@@ -32,7 +32,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
register(proj4); register(proj4);
afterLoadText('spec/ol/format/wms/getfeatureinfo.xml', function(data) { afterLoadText('spec/ol/format/wms/getfeatureinfo.xml', function(data) {
try { try {
features = new _ol_format_WMSGetFeatureInfo_().readFeatures(data); features = new WMSGetFeatureInfo().readFeatures(data);
} catch (e) { } catch (e) {
done(e); done(e);
} }
@@ -73,7 +73,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
' <AAA64_layer>' + ' <AAA64_layer>' +
' </AAA64_layer>' + ' </AAA64_layer>' +
'</msGMLOutput>'; '</msGMLOutput>';
var features = new _ol_format_WMSGetFeatureInfo_().readFeatures(text); var features = new WMSGetFeatureInfo().readFeatures(text);
expect(features.length).to.be(0); expect(features.length).to.be(0);
}); });
@@ -98,7 +98,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
' </AAA64_feature>' + ' </AAA64_feature>' +
' </AAA64_layer>' + ' </AAA64_layer>' +
'</msGMLOutput>'; '</msGMLOutput>';
var features = new _ol_format_WMSGetFeatureInfo_().readFeatures(text); var features = new WMSGetFeatureInfo().readFeatures(text);
expect(features.length).to.be(1); expect(features.length).to.be(1);
expect(features[0].get('FOO')).to.be('bar'); expect(features[0].get('FOO')).to.be('bar');
// FIXME is that really wanted ? // FIXME is that really wanted ?
@@ -158,7 +158,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
' </AAA62_feature>' + ' </AAA62_feature>' +
' </AAA62_layer>' + ' </AAA62_layer>' +
'</msGMLOutput>'; '</msGMLOutput>';
var format = new _ol_format_WMSGetFeatureInfo_(); var format = new WMSGetFeatureInfo();
var features = format.readFeatures(text); var features = format.readFeatures(text);
expect(features.length).to.be(2); expect(features.length).to.be(2);
expect(features[0].get('OBJECTID')).to.be('287'); expect(features[0].get('OBJECTID')).to.be('287');
@@ -224,7 +224,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
' </opengeo:roads>' + ' </opengeo:roads>' +
' </gml:featureMember>' + ' </gml:featureMember>' +
'</wfs:FeatureCollection>'; '</wfs:FeatureCollection>';
var features = new _ol_format_WMSGetFeatureInfo_().readFeatures(text); var features = new WMSGetFeatureInfo().readFeatures(text);
expect(features.length).to.be(1); expect(features.length).to.be(1);
expect(features[0].get('cat')).to.be('3'); expect(features[0].get('cat')).to.be('3');
expect(features[0].getGeometry().getType()).to.be('MultiLineString'); expect(features[0].getGeometry().getType()).to.be('MultiLineString');
+2 -2
View File
@@ -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() { describe('ol.format.XSD', function() {
@@ -7,7 +7,7 @@ describe('ol.format.XSD', function() {
it('can handle non-Zulu time zones', function() { it('can handle non-Zulu time zones', function() {
var node = document.createElement('time'); var node = document.createElement('time');
node.textContent = '2016-07-12T15:00:00+03:00'; 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');
}); });
}); });
+5 -5
View File
@@ -2,7 +2,7 @@ import {inherits} from '../../../../src/ol/index.js';
import _ol_View_ from '../../../../src/ol/View.js'; import _ol_View_ from '../../../../src/ol/View.js';
import Event from '../../../../src/ol/events/Event.js'; import Event from '../../../../src/ol/events/Event.js';
import EventTarget from '../../../../src/ol/events/EventTarget.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 DragAndDrop from '../../../../src/ol/interaction/DragAndDrop.js';
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.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({ 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() { it('accepts a source option', function() {
var source = new _ol_source_Vector_(); var source = new _ol_source_Vector_();
var drop = new DragAndDrop({ var drop = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_], formatConstructors: [GeoJSON],
source: source source: source
}); });
expect(drop.source_).to.equal(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() { it('registers and unregisters listeners on a custom target', function() {
var customTarget = new EventTarget(); var customTarget = new EventTarget();
interaction = new DragAndDrop({ interaction = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_], formatConstructors: [GeoJSON],
target: customTarget target: customTarget
}); });
interaction.setMap(map); interaction.setMap(map);
@@ -138,7 +138,7 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
it('adds dropped features to a source', function(done) { it('adds dropped features to a source', function(done) {
var source = new _ol_source_Vector_(); var source = new _ol_source_Vector_();
var drop = new DragAndDrop({ var drop = new DragAndDrop({
formatConstructors: [_ol_format_GeoJSON_], formatConstructors: [GeoJSON],
source: source source: source
}); });
drop.setMap(map); drop.setMap(map);
@@ -7,7 +7,7 @@ import _ol_VectorImageTile_ from '../../../../../src/ol/VectorImageTile.js';
import _ol_VectorTile_ from '../../../../../src/ol/VectorTile.js'; import _ol_VectorTile_ from '../../../../../src/ol/VectorTile.js';
import _ol_View_ from '../../../../../src/ol/View.js'; import _ol_View_ from '../../../../../src/ol/View.js';
import * as _ol_extent_ from '../../../../../src/ol/extent.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 Point from '../../../../../src/ol/geom/Point.js';
import _ol_layer_VectorTile_ from '../../../../../src/ol/layer/VectorTile.js'; import _ol_layer_VectorTile_ from '../../../../../src/ol/layer/VectorTile.js';
import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.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_); inherits(TileClass, _ol_VectorTile_);
source = new _ol_source_VectorTile_({ source = new _ol_source_VectorTile_({
format: new _ol_format_MVT_(), format: new MVT(),
tileClass: TileClass, tileClass: TileClass,
tileGrid: _ol_tilegrid_.createXYZ() tileGrid: _ol_tilegrid_.createXYZ()
}); });
@@ -350,7 +350,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
document.body.appendChild(target); document.body.appendChild(target);
var extent = [1824704.739223726, 6141868.096770482, 1827150.7241288517, 6144314.081675608]; var extent = [1824704.739223726, 6141868.096770482, 1827150.7241288517, 6144314.081675608];
var source = new _ol_source_VectorTile_({ var source = new _ol_source_VectorTile_({
format: new _ol_format_MVT_(), format: new MVT(),
url: 'spec/ol/data/14-8938-5680.vector.pbf', url: 'spec/ol/data/14-8938-5680.vector.pbf',
minZoom: 14, minZoom: 14,
maxZoom: 14 maxZoom: 14
+2 -2
View File
@@ -2,7 +2,7 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_View_ from '../../../../src/ol/View.js'; import _ol_View_ from '../../../../src/ol/View.js';
import _ol_VectorImageTile_ from '../../../../src/ol/VectorImageTile.js'; import _ol_VectorImageTile_ from '../../../../src/ol/VectorImageTile.js';
import _ol_VectorTile_ from '../../../../src/ol/VectorTile.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 _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js';
import {get as getProjection} from '../../../../src/ol/proj.js'; import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.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() { describe('ol.source.VectorTile', function() {
var format = new _ol_format_MVT_(); var format = new MVT();
var source = new _ol_source_VectorTile_({ var source = new _ol_source_VectorTile_({
format: format, format: format,
tilePixelRatio: 8, tilePixelRatio: 8,
+3 -3
View File
@@ -3,7 +3,7 @@
import _ol_Sphere_ from '../../../src/ol/Sphere.js'; 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 GeometryCollection from '../../../src/ol/geom/GeometryCollection.js';
import LineString from '../../../src/ol/geom/LineString.js'; import LineString from '../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../src/ol/geom/MultiLineString.js';
@@ -95,7 +95,7 @@ describe('ol.Sphere', function() {
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/wkt/illinois.wkt', function(wkt) { afterLoadText('spec/ol/format/wkt/illinois.wkt', function(wkt) {
try { try {
var format = new _ol_format_WKT_(); var format = new WKT();
geometry = format.readGeometry(wkt); geometry = format.readGeometry(wkt);
} catch (e) { } catch (e) {
done(e); done(e);
@@ -187,7 +187,7 @@ describe('ol.Sphere.getArea()', function() {
before(function(done) { before(function(done) {
afterLoadText('spec/ol/format/wkt/illinois.wkt', function(wkt) { afterLoadText('spec/ol/format/wkt/illinois.wkt', function(wkt) {
try { try {
var format = new _ol_format_WKT_(); var format = new WKT();
geometry = format.readGeometry(wkt); geometry = format.readGeometry(wkt);
} catch (e) { } catch (e) {
done(e); done(e);
+8 -8
View File
@@ -2,7 +2,7 @@ import _ol_TileState_ from '../../../src/ol/TileState.js';
import _ol_VectorImageTile_ from '../../../src/ol/VectorImageTile.js'; import _ol_VectorImageTile_ from '../../../src/ol/VectorImageTile.js';
import _ol_VectorTile_ from '../../../src/ol/VectorTile.js'; import _ol_VectorTile_ from '../../../src/ol/VectorTile.js';
import _ol_events_ from '../../../src/ol/events.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 {get as getProjection} from '../../../src/ol/proj.js';
import _ol_tilegrid_ from '../../../src/ol/tilegrid.js'; import _ol_tilegrid_ from '../../../src/ol/tilegrid.js';
import _ol_tilegrid_TileGrid_ from '../../../src/ol/tilegrid/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() { describe('ol.VectorImageTile', function() {
it('configures loader that sets features on the source tile', function(done) { 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 url = 'spec/ol/data/point.json';
var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format, var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format,
_ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() { _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) { 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 url = 'spec/ol/data/unavailable.json';
var sourceTile; var sourceTile;
var tile = new _ol_VectorImageTile_([0, 0, 0] /* one world away */, 0, url, format, 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) { 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 url = 'spec/ol/data/unavailable.json';
var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format, var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format,
_ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() { _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) { 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 url = '';
var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format, var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format,
_ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() {}, _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() { 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 url = 'spec/ol/data/point.json';
var tileGrid = new _ol_tilegrid_TileGrid_({ var tileGrid = new _ol_tilegrid_TileGrid_({
resolutions: [0.02197265625, 0.010986328125, 0.0054931640625], resolutions: [0.02197265625, 0.010986328125, 0.0054931640625],
@@ -112,7 +112,7 @@ describe('ol.VectorImageTile', function() {
}); });
it('#dispose() while loading', function() { it('#dispose() while loading', function() {
var format = new _ol_format_GeoJSON_(); var format = new GeoJSON();
var url = 'spec/ol/data/point.json'; var url = 'spec/ol/data/point.json';
var tile = new _ol_VectorImageTile_([0, 0, 0] /* one world away */, 0, url, format, var tile = new _ol_VectorImageTile_([0, 0, 0] /* one world away */, 0, url, format,
_ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() { _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() {
@@ -132,7 +132,7 @@ describe('ol.VectorImageTile', function() {
}); });
it('#dispose() when loaded', function(done) { it('#dispose() when loaded', function(done) {
var format = new _ol_format_GeoJSON_(); var format = new GeoJSON();
var url = 'spec/ol/data/point.json'; var url = 'spec/ol/data/point.json';
var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format, var tile = new _ol_VectorImageTile_([0, 0, -1], 0, url, format,
_ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() { _ol_VectorImageTile_.defaultLoadFunction, [0, 0, -1], function() {
+2 -2
View File
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../../../src/ol/Feature.js';
import _ol_VectorImageTile_ from '../../../src/ol/VectorImageTile.js'; import _ol_VectorImageTile_ from '../../../src/ol/VectorImageTile.js';
import _ol_VectorTile_ from '../../../src/ol/VectorTile.js'; import _ol_VectorTile_ from '../../../src/ol/VectorTile.js';
import _ol_events_ from '../../../src/ol/events.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 {get as getProjection} from '../../../src/ol/proj.js';
import _ol_proj_Projection_ from '../../../src/ol/proj/Projection.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) { it('loader sets features on the tile and updates proj units', function(done) {
// mock format that return a tile-pixels feature // mock format that return a tile-pixels feature
var format = new _ol_format_TextFeature_(); var format = new TextFeature();
format.readProjection = function(source) { format.readProjection = function(source) {
return new _ol_proj_Projection_({ return new _ol_proj_Projection_({
code: '', code: '',