diff --git a/examples/kml.js b/examples/kml.js
index 78d2ca3d46..8662b0a508 100644
--- a/examples/kml.js
+++ b/examples/kml.js
@@ -4,7 +4,7 @@ goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Vector');
-goog.require('ol.parser.ogc.KML');
+goog.require('ol.parser.KML');
goog.require('ol.projection');
goog.require('ol.source.TiledWMS');
goog.require('ol.source.Vector');
@@ -40,7 +40,7 @@ var map = new ol.Map({
})
});
-var kml = new ol.parser.ogc.KML({
+var kml = new ol.parser.KML({
maxDepth: 1, dimension: 2, extractStyles: true, extractAttributes: true});
$.ajax({
diff --git a/src/ol/parser/kml.exports b/src/ol/parser/kml.exports
new file mode 100644
index 0000000000..d389b1ad42
--- /dev/null
+++ b/src/ol/parser/kml.exports
@@ -0,0 +1,3 @@
+@exportSymbol ol.parser.KML
+@exportProperty ol.parser.KML.prototype.read
+@exportProperty ol.parser.KML.prototype.write
diff --git a/src/ol/parser/ogc/kml.js b/src/ol/parser/kml.js
similarity index 97%
rename from src/ol/parser/ogc/kml.js
rename to src/ol/parser/kml.js
index 588b05b67b..703b51c0fd 100644
--- a/src/ol/parser/ogc/kml.js
+++ b/src/ol/parser/kml.js
@@ -1,4 +1,4 @@
-goog.provide('ol.parser.ogc.KML');
+goog.provide('ol.parser.KML');
goog.require('goog.array');
goog.require('goog.async.Deferred');
goog.require('goog.async.DeferredList');
@@ -38,7 +38,7 @@ goog.require('ol.style.PolygonLiteral');
* dimension: (number|undefined),
* maxDepth: (number|undefined)}}
*/
-ol.parser.ogc.KMLOptions;
+ol.parser.KMLOptions;
@@ -47,10 +47,10 @@ ol.parser.ogc.KMLOptions;
* @implements {ol.parser.DomFeatureParser}
* @implements {ol.parser.StringFeatureParser}
* @implements {ol.parser.AsyncObjectFeatureParser}
- * @param {ol.parser.ogc.KMLOptions=} opt_options Optional configuration object.
+ * @param {ol.parser.KMLOptions=} opt_options Optional configuration object.
* @extends {ol.parser.XML}
*/
-ol.parser.ogc.KML = function(opt_options) {
+ol.parser.KML = function(opt_options) {
if (goog.isDef(opt_options)) {
goog.object.extend(this, opt_options);
}
@@ -802,7 +802,7 @@ ol.parser.ogc.KML = function(opt_options) {
straightBracket: (/\$\[(.*?)\]/g)
});
};
-goog.inherits(ol.parser.ogc.KML, ol.parser.XML);
+goog.inherits(ol.parser.KML, ol.parser.XML);
/**
@@ -811,7 +811,7 @@ goog.inherits(ol.parser.ogc.KML, ol.parser.XML);
* after parsing.
* @param {ol.parser.ReadFeaturesOptions=} opt_options Feature reading options.
*/
-ol.parser.ogc.KML.prototype.readFeaturesFromObjectAsync =
+ol.parser.KML.prototype.readFeaturesFromObjectAsync =
function(obj, callback, opt_options) {
this.readFeaturesOptions_ = opt_options;
this.read(obj, callback);
@@ -824,7 +824,7 @@ ol.parser.ogc.KML.prototype.readFeaturesFromObjectAsync =
* @param {ol.parser.ReadFeaturesOptions=} opt_options Reader options.
* @return {Array.
} Array of features.
*/
-ol.parser.ogc.KML.prototype.readFeaturesFromString =
+ol.parser.KML.prototype.readFeaturesFromString =
function(str, opt_options) {
this.readFeaturesOptions_ = opt_options;
return this.read(str).features;
@@ -837,7 +837,7 @@ ol.parser.ogc.KML.prototype.readFeaturesFromString =
* @param {ol.parser.ReadFeaturesOptions=} opt_options Feature reading options.
* @return {Array.} Array of features.
*/
-ol.parser.ogc.KML.prototype.readFeaturesFromNode =
+ol.parser.KML.prototype.readFeaturesFromNode =
function(node, opt_options) {
this.readFeaturesOptions_ = opt_options;
return this.read(node).features;
@@ -849,7 +849,7 @@ ol.parser.ogc.KML.prototype.readFeaturesFromNode =
* @param {ol.parser.ReadFeaturesOptions=} opt_options Feature reading options.
* @return {Array.} Array of features.
*/
-ol.parser.ogc.KML.prototype.readFeaturesFromObject =
+ol.parser.KML.prototype.readFeaturesFromObject =
function(obj, opt_options) {
this.readFeaturesOptions_ = opt_options;
return this.read(obj).features;
@@ -861,7 +861,7 @@ ol.parser.ogc.KML.prototype.readFeaturesFromObject =
* @param {Object} obj The returned object from the parser.
* @param {Function} done A callback for when all links have been retrieved.
*/
-ol.parser.ogc.KML.prototype.parseLinks = function(deferreds, obj, done) {
+ol.parser.KML.prototype.parseLinks = function(deferreds, obj, done) {
var unvisited;
if (this.depth_ < this.maxDepth) {
this.depth_++;
@@ -875,6 +875,7 @@ ol.parser.ogc.KML.prototype.parseLinks = function(deferreds, obj, done) {
goog.events.listen(xhr, goog.net.EventType.COMPLETE, function(e) {
if (e.target.isSuccess()) {
var data = e.target.getResponseXml();
+ e.target.dispose();
if (data && data.nodeType == 9) {
data = data.documentElement;
}
@@ -901,7 +902,7 @@ ol.parser.ogc.KML.prototype.parseLinks = function(deferreds, obj, done) {
* is done.
* @return {Object} An object representing the document.
*/
-ol.parser.ogc.KML.prototype.read = function(data, opt_callback) {
+ol.parser.KML.prototype.read = function(data, opt_callback) {
if (typeof data == 'string') {
data = goog.dom.xml.loadXml(data);
}
@@ -940,7 +941,7 @@ ol.parser.ogc.KML.prototype.read = function(data, opt_callback) {
* @param {Array} styles The style list to search in.
* @param {Array=} opt_symbolizers Optional symbolizers.
*/
-ol.parser.ogc.KML.prototype.applyStyle_ = function(feature, styles,
+ol.parser.KML.prototype.applyStyle_ = function(feature, styles,
opt_symbolizers) {
var symbolizers = opt_symbolizers;
var i, ii;
@@ -978,7 +979,7 @@ ol.parser.ogc.KML.prototype.applyStyle_ = function(feature, styles,
* @param {ol.geom.SharedVertices=} opt_vertices Shared vertices.
* @return {ol.geom.Geometry} The geometry created.
*/
-ol.parser.ogc.KML.prototype.createGeometry_ = function(container,
+ol.parser.KML.prototype.createGeometry_ = function(container,
opt_vertices) {
var geometry = null, coordinates, i, ii;
switch (container.geometry.type) {
@@ -1035,7 +1036,7 @@ ol.parser.ogc.KML.prototype.createGeometry_ = function(container,
* @param {Object} obj Object structure to write out as XML.
* @return {string} An string representing the XML document.
*/
-ol.parser.ogc.KML.prototype.write = function(obj) {
+ol.parser.KML.prototype.write = function(obj) {
var root = this.writeNode('kml', obj);
return goog.dom.xml.serialize(root);
};
diff --git a/src/ol/parser/ogc/kml.exports b/src/ol/parser/ogc/kml.exports
deleted file mode 100644
index de5b20774b..0000000000
--- a/src/ol/parser/ogc/kml.exports
+++ /dev/null
@@ -1,3 +0,0 @@
-@exportSymbol ol.parser.ogc.KML
-@exportProperty ol.parser.ogc.KML.prototype.read
-@exportProperty ol.parser.ogc.KML.prototype.write
diff --git a/src/ol/parser/xml.js b/src/ol/parser/xml.js
index 5c40d9d636..01ed4bd6e1 100644
--- a/src/ol/parser/xml.js
+++ b/src/ol/parser/xml.js
@@ -9,7 +9,7 @@ goog.require('ol.parser.Parser');
* @extends {ol.parser.Parser}
*/
ol.parser.XML = function() {
- if (window.ActiveXObject) {
+ if (goog.global.ActiveXObject) {
this.xmldom = new ActiveXObject('Microsoft.XMLDOM');
}
this.regExes = {
diff --git a/test/spec/ol/parser/ogc/kml.test.js b/test/spec/ol/parser/kml.test.js
similarity index 91%
rename from test/spec/ol/parser/ogc/kml.test.js
rename to test/spec/ol/parser/kml.test.js
index 5a88a6fc77..0345927206 100644
--- a/test/spec/ol/parser/ogc/kml.test.js
+++ b/test/spec/ol/parser/kml.test.js
@@ -1,12 +1,12 @@
-goog.provide('ol.test.parser.ogc.kml');
+goog.provide('ol.test.parser.kml');
describe('ol.parser.kml', function() {
- var parser = new ol.parser.ogc.KML();
+ var parser = new ol.parser.KML();
describe('Test KML parser', function() {
it('Polygon read correctly', function() {
- var url = 'spec/ol/parser/ogc/xml/kml_polygon.kml';
+ var url = 'spec/ol/parser/kml/polygon.kml';
afterLoadXml(url, function(xml) {
var obj = parser.read(xml);
var output = parser.write(obj);
@@ -33,7 +33,7 @@ describe('ol.parser.kml', function() {
});
});
it('Linestring read correctly', function() {
- var url = 'spec/ol/parser/ogc/xml/kml_linestring.kml';
+ var url = 'spec/ol/parser/kml/linestring.kml';
afterLoadXml(url, function(xml) {
var obj = parser.read(xml);
var output = parser.write(obj);
@@ -54,7 +54,7 @@ describe('ol.parser.kml', function() {
});
});
it('Point read correctly', function() {
- var url = 'spec/ol/parser/ogc/xml/kml_point.kml';
+ var url = 'spec/ol/parser/kml/point.kml';
afterLoadXml(url, function(xml) {
var obj = parser.read(xml);
var output = parser.write(obj);
@@ -72,9 +72,9 @@ describe('ol.parser.kml', function() {
});
});
it('NetworkLink read correctly', function(done) {
- var url = 'spec/ol/parser/ogc/xml/kml_networklink.kml';
+ var url = 'spec/ol/parser/kml/networklink.kml';
afterLoadXml(url, function(xml) {
- var p = new ol.parser.ogc.KML({maxDepth: 1});
+ var p = new ol.parser.KML({maxDepth: 1});
// we need to supply a callback to get visited NetworkLinks
var obj = p.read(xml, function(features) {
expect(features.length).to.eql(3);
@@ -83,9 +83,9 @@ describe('ol.parser.kml', function() {
});
});
it('NetworkLink read correctly [recursively]', function(done) {
- var url = 'spec/ol/parser/ogc/xml/kml_networklink_depth.kml';
+ var url = 'spec/ol/parser/kml/networklink_depth.kml';
afterLoadXml(url, function(xml) {
- var p = new ol.parser.ogc.KML({maxDepth: 2});
+ var p = new ol.parser.KML({maxDepth: 2});
// we need to supply a callback to get visited NetworkLinks
var obj = p.read(xml, function(features) {
expect(features.length).to.eql(2);
@@ -94,9 +94,9 @@ describe('ol.parser.kml', function() {
});
});
it('NetworkLink maxDepth', function(done) {
- var url = 'spec/ol/parser/ogc/xml/kml_networklink_depth.kml';
+ var url = 'spec/ol/parser/kml/networklink_depth.kml';
afterLoadXml(url, function(xml) {
- var p = new ol.parser.ogc.KML({maxDepth: 1});
+ var p = new ol.parser.KML({maxDepth: 1});
// we need to supply a callback to get visited NetworkLinks
var obj = p.read(xml, function(features) {
// since maxDepth is 1, we will not get to the second feature
@@ -106,7 +106,7 @@ describe('ol.parser.kml', function() {
});
});
it('Extended data read correctly', function() {
- var url = 'spec/ol/parser/ogc/xml/kml_extended_data.kml';
+ var url = 'spec/ol/parser/kml/extended_data.kml';
afterLoadXml(url, function(xml) {
var obj = parser.read(xml);
expect(obj.features[0].get('name')).to.eql('Extended data placemark');
@@ -117,7 +117,7 @@ describe('ol.parser.kml', function() {
});
});
it('Extended data read correctly [2]', function() {
- var url = 'spec/ol/parser/ogc/xml/kml_extended_data2.kml';
+ var url = 'spec/ol/parser/kml/extended_data2.kml';
afterLoadXml(url, function(xml) {
var obj = parser.read(xml);
var feature = obj.features[0];
@@ -127,7 +127,7 @@ describe('ol.parser.kml', function() {
});
});
it('Multi geometry read correctly', function() {
- var url = 'spec/ol/parser/ogc/xml/kml_multigeometry.kml';
+ var url = 'spec/ol/parser/kml/multigeometry.kml';
afterLoadXml(url, function(xml) {
var obj = parser.read(xml);
var geom = obj.features[0].getGeometry();
@@ -146,7 +146,7 @@ describe('ol.parser.kml', function() {
});
});
it('Discrete multi geometry read correctly', function() {
- var url = 'spec/ol/parser/ogc/xml/kml_multigeometry_discrete.kml';
+ var url = 'spec/ol/parser/kml/multigeometry_discrete.kml';
afterLoadXml(url, function(xml) {
var obj = parser.read(xml);
var geom = obj.features[0].getGeometry();
@@ -157,9 +157,9 @@ describe('ol.parser.kml', function() {
});
});
it('Test extract tracks', function() {
- var url = 'spec/ol/parser/ogc/xml/kml_macnoise.kml';
+ var url = 'spec/ol/parser/kml/macnoise.kml';
afterLoadXml(url, function(xml) {
- var p = new ol.parser.ogc.KML({extractStyles: true,
+ var p = new ol.parser.KML({extractStyles: true,
trackAttributes: ['speed', 'num']});
var obj = p.read(xml);
expect(obj.features.length).to.eql(170);
@@ -198,7 +198,7 @@ describe('ol.parser.kml', function() {
'10 ' +
' -112,36 -113,37 ' +
'';
- var p = new ol.parser.ogc.KML({extractStyles: true});
+ var p = new ol.parser.KML({extractStyles: true});
var obj = p.read(test_style);
var output = p.write(obj);
var expected = '' +
@@ -229,7 +229,7 @@ describe('ol.parser.kml', function() {
'49.630662409673505 8.397385910100951,48.45172350357396 ' +
'5.001370157823406,49.26855713824488' +
'';
- var p = new ol.parser.ogc.KML({extractStyles: true});
+ var p = new ol.parser.KML({extractStyles: true});
var obj = p.read(test_style_fill);
var output = p.write(obj);
var expected = '' +
@@ -253,9 +253,9 @@ describe('ol.parser.kml', function() {
expect(symbolizer2.opacity).to.eql(0);
});
it('Test iconStyle', function() {
- var url = 'spec/ol/parser/ogc/xml/kml_iconstyle.kml';
+ var url = 'spec/ol/parser/kml/iconstyle.kml';
afterLoadXml(url, function(xml) {
- var p = new ol.parser.ogc.KML({extractStyles: true});
+ var p = new ol.parser.KML({extractStyles: true});
var obj = p.read(xml);
var output = p.write(obj);
var expected = '' +
@@ -285,5 +285,5 @@ goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
-goog.require('ol.parser.ogc.KML');
+goog.require('ol.parser.KML');
goog.require('ol.style.LineLiteral');
diff --git a/test/spec/ol/parser/ogc/xml/kml_depth.kml b/test/spec/ol/parser/kml/depth.kml
similarity index 55%
rename from test/spec/ol/parser/ogc/xml/kml_depth.kml
rename to test/spec/ol/parser/kml/depth.kml
index 09c48be4bf..f1b30ad95c 100644
--- a/test/spec/ol/parser/ogc/xml/kml_depth.kml
+++ b/test/spec/ol/parser/kml/depth.kml
@@ -1,6 +1,6 @@
- spec/ol/parser/ogc/xml/kml_polygon.kml
+ spec/ol/parser/kml/polygon.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_extended_data.kml b/test/spec/ol/parser/kml/extended_data.kml
similarity index 100%
rename from test/spec/ol/parser/ogc/xml/kml_extended_data.kml
rename to test/spec/ol/parser/kml/extended_data.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_extended_data2.kml b/test/spec/ol/parser/kml/extended_data2.kml
similarity index 100%
rename from test/spec/ol/parser/ogc/xml/kml_extended_data2.kml
rename to test/spec/ol/parser/kml/extended_data2.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_iconstyle.kml b/test/spec/ol/parser/kml/iconstyle.kml
similarity index 100%
rename from test/spec/ol/parser/ogc/xml/kml_iconstyle.kml
rename to test/spec/ol/parser/kml/iconstyle.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_linestring.kml b/test/spec/ol/parser/kml/linestring.kml
similarity index 100%
rename from test/spec/ol/parser/ogc/xml/kml_linestring.kml
rename to test/spec/ol/parser/kml/linestring.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_macnoise.kml b/test/spec/ol/parser/kml/macnoise.kml
similarity index 100%
rename from test/spec/ol/parser/ogc/xml/kml_macnoise.kml
rename to test/spec/ol/parser/kml/macnoise.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_multigeometry.kml b/test/spec/ol/parser/kml/multigeometry.kml
similarity index 100%
rename from test/spec/ol/parser/ogc/xml/kml_multigeometry.kml
rename to test/spec/ol/parser/kml/multigeometry.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_multigeometry_discrete.kml b/test/spec/ol/parser/kml/multigeometry_discrete.kml
similarity index 100%
rename from test/spec/ol/parser/ogc/xml/kml_multigeometry_discrete.kml
rename to test/spec/ol/parser/kml/multigeometry_discrete.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_networklink.kml b/test/spec/ol/parser/kml/networklink.kml
similarity index 70%
rename from test/spec/ol/parser/ogc/xml/kml_networklink.kml
rename to test/spec/ol/parser/kml/networklink.kml
index ca99d17ee8..54ffa50a12 100644
--- a/test/spec/ol/parser/ogc/xml/kml_networklink.kml
+++ b/test/spec/ol/parser/kml/networklink.kml
@@ -9,7 +9,7 @@
-122.0822035425683,37.42228990140251,0
- spec/ol/parser/ogc/xml/kml_polygon.kml
- spec/ol/parser/ogc/xml/kml_point.kml
+ spec/ol/parser/kml/polygon.kml
+ spec/ol/parser/kml/point.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_networklink_depth.kml b/test/spec/ol/parser/kml/networklink_depth.kml
similarity index 82%
rename from test/spec/ol/parser/ogc/xml/kml_networklink_depth.kml
rename to test/spec/ol/parser/kml/networklink_depth.kml
index d54d778797..2bf62c81fd 100644
--- a/test/spec/ol/parser/ogc/xml/kml_networklink_depth.kml
+++ b/test/spec/ol/parser/kml/networklink_depth.kml
@@ -9,6 +9,6 @@
-122.0822035425683,37.42228990140251,0
- spec/ol/parser/ogc/xml/kml_depth.kml
+ spec/ol/parser/kml/depth.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_point.kml b/test/spec/ol/parser/kml/point.kml
similarity index 100%
rename from test/spec/ol/parser/ogc/xml/kml_point.kml
rename to test/spec/ol/parser/kml/point.kml
diff --git a/test/spec/ol/parser/ogc/xml/kml_polygon.kml b/test/spec/ol/parser/kml/polygon.kml
similarity index 100%
rename from test/spec/ol/parser/ogc/xml/kml_polygon.kml
rename to test/spec/ol/parser/kml/polygon.kml