Remove dimension option from KML parser
Geometry constructors now accept coordinates in any dimension
This commit is contained in:
@@ -32,7 +32,7 @@ var style = new ol.style.Style({
|
||||
|
||||
var vector = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
parser: new ol.parser.KML({dimension: 2}),
|
||||
parser: new ol.parser.KML(),
|
||||
url: 'data/kml/2012_Earthquakes_Mag5.kml'
|
||||
}),
|
||||
style: style
|
||||
|
||||
@@ -54,7 +54,7 @@ var style = new ol.style.Style({
|
||||
|
||||
var vector = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
parser: new ol.parser.KML({dimension: 2}),
|
||||
parser: new ol.parser.KML(),
|
||||
url: 'data/kml/timezones.kml'
|
||||
}),
|
||||
style: style
|
||||
|
||||
@@ -22,7 +22,7 @@ var raster = new ol.layer.Tile({
|
||||
var vector = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
parser: new ol.parser.KML({
|
||||
maxDepth: 1, dimension: 2, extractStyles: true, extractAttributes: true
|
||||
maxDepth: 1, extractStyles: true, extractAttributes: true
|
||||
}),
|
||||
url: 'data/kml/lines.kml'
|
||||
})
|
||||
|
||||
@@ -412,8 +412,6 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.parser.KMLOptions
|
||||
* @property {number|undefined} dimension Create geometries with `dimension`
|
||||
* dimensions. Default is 3.
|
||||
* @property {boolean|undefined} extractAttributes Should we extract attributes
|
||||
* from the KML? Default is `true´.
|
||||
* @property {boolean|undefined} extractStyles Should we extract styles from the
|
||||
|
||||
@@ -52,8 +52,6 @@ ol.parser.KML = function(opt_options) {
|
||||
options.extractStyles : false;
|
||||
this.schemaLocation = 'http://www.opengis.net/kml/2.2 ' +
|
||||
'http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd';
|
||||
// TODO re-evaluate once shared structures support 3D
|
||||
this.dimension = goog.isDef(options.dimension) ? options.dimension : 3;
|
||||
this.maxDepth = goog.isDef(options.maxDepth) ? options.maxDepth : 0;
|
||||
this.trackAttributes = goog.isDef(options.trackAttributes) ?
|
||||
options.trackAttributes : null;
|
||||
@@ -263,8 +261,7 @@ ol.parser.KML = function(opt_options) {
|
||||
for (var i = 0, ii = coords.length; i < ii; i++) {
|
||||
var array = coords[i].replace(reg.removeSpace, '').split(',');
|
||||
var pair = [];
|
||||
var jj = Math.min(array.length, this.dimension);
|
||||
for (var j = 0; j < jj; j++) {
|
||||
for (var j = 0, jj = array.length; j < jj; j++) {
|
||||
pair.push(parseFloat(array[j]));
|
||||
}
|
||||
coordArray.push(pair);
|
||||
@@ -544,7 +541,7 @@ ol.parser.KML = function(opt_options) {
|
||||
'coord': function(node, container) {
|
||||
var str = this.getChildValue(node);
|
||||
var coords = str.replace(this.regExes.trimSpace, '').split(/\s+/);
|
||||
for (var i = 0, ii = this.dimension; i < ii; ++i) {
|
||||
for (var i = 0, ii = coords.length; i < ii; ++i) {
|
||||
coords[i] = parseFloat(coords[i]);
|
||||
}
|
||||
var point = {
|
||||
|
||||
Reference in New Issue
Block a user