Merge pull request #1781 from twpayne/format-feature

Rename ol.format.Format to ol.format.Feature
This commit is contained in:
Tom Payne
2014-02-28 14:47:19 +01:00
19 changed files with 277 additions and 274 deletions

View File

@@ -320,7 +320,7 @@
/**
* @typedef {Object} olx.interaction.DragAndDropOptions
* @property {Array.<function(new: ol.format.Format)>|undefined} formatConstructors
* @property {Array.<function(new: ol.format.Feature)>|undefined} formatConstructors
* Format constructors.
* @property {ol.proj.ProjectionLike} reprojectTo Target projection. By
* default, the map's view's projection is used.
@@ -853,7 +853,7 @@
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
* @property {Document|undefined} doc Document.
* @property {ol.Extent|undefined} extent Extent.
* @property {ol.format.Format} format Format.
* @property {ol.format.Feature} format Format.
* @property {string|undefined} logo Logo.
* @property {Node|undefined} node Node.
* @property {Object|undefined} object Object.

View File

@@ -0,0 +1,111 @@
goog.provide('ol.format.BinaryFeature');
goog.require('goog.asserts');
goog.require('ol.BrowserFeature');
goog.require('ol.binary.Buffer');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
goog.require('ol.proj');
/**
* @constructor
* @extends {ol.format.Feature}
*/
ol.format.BinaryFeature = function() {
goog.base(this);
};
goog.inherits(ol.format.BinaryFeature, ol.format.Feature);
/**
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @private
* @return {ol.binary.Buffer} Buffer.
*/
ol.format.BinaryFeature.getBuffer_ = function(source) {
if (ol.BrowserFeature.HAS_ARRAY_BUFFER && source instanceof ArrayBuffer) {
return new ol.binary.Buffer(source);
} else if (goog.isString(source)) {
return new ol.binary.Buffer(source);
} else {
goog.asserts.fail();
return null;
}
};
/**
* @inheritDoc
*/
ol.format.BinaryFeature.prototype.getType = function() {
return ol.format.FormatType.BINARY;
};
/**
* @inheritDoc
*/
ol.format.BinaryFeature.prototype.readFeature = function(source) {
return this.readFeatureFromBuffer(ol.format.BinaryFeature.getBuffer_(source));
};
/**
* @inheritDoc
*/
ol.format.BinaryFeature.prototype.readFeatures = function(source) {
return this.readFeaturesFromBuffer(
ol.format.BinaryFeature.getBuffer_(source));
};
/**
* @param {ol.binary.Buffer} buffer Buffer.
* @protected
* @return {ol.Feature} Feature.
*/
ol.format.BinaryFeature.prototype.readFeatureFromBuffer = goog.abstractMethod;
/**
* @param {ol.binary.Buffer} buffer Buffer.
* @protected
* @return {Array.<ol.Feature>} Feature.
*/
ol.format.BinaryFeature.prototype.readFeaturesFromBuffer = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.BinaryFeature.prototype.readGeometry = function(source) {
return this.readGeometryFromBuffer(
ol.format.BinaryFeature.getBuffer_(source));
};
/**
* @param {ol.binary.Buffer} buffer Buffer.
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.BinaryFeature.prototype.readGeometryFromBuffer = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.BinaryFeature.prototype.readProjection = function(source) {
return this.readProjectionFromBuffer(
ol.format.BinaryFeature.getBuffer_(source));
};
/**
* @param {ol.binary.Buffer} buffer Buffer.
* @return {ol.proj.Projection} Projection.
*/
ol.format.BinaryFeature.prototype.readProjectionFromBuffer =
goog.abstractMethod;

View File

@@ -1,107 +0,0 @@
goog.provide('ol.format.Binary');
goog.require('goog.asserts');
goog.require('ol.BrowserFeature');
goog.require('ol.binary.Buffer');
goog.require('ol.format.Format');
goog.require('ol.format.FormatType');
goog.require('ol.proj');
/**
* @constructor
* @extends {ol.format.Format}
*/
ol.format.Binary = function() {
goog.base(this);
};
goog.inherits(ol.format.Binary, ol.format.Format);
/**
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @private
* @return {ol.binary.Buffer} Buffer.
*/
ol.format.Binary.getBuffer_ = function(source) {
if (ol.BrowserFeature.HAS_ARRAY_BUFFER && source instanceof ArrayBuffer) {
return new ol.binary.Buffer(source);
} else if (goog.isString(source)) {
return new ol.binary.Buffer(source);
} else {
goog.asserts.fail();
return null;
}
};
/**
* @inheritDoc
*/
ol.format.Binary.prototype.getType = function() {
return ol.format.FormatType.BINARY;
};
/**
* @inheritDoc
*/
ol.format.Binary.prototype.readFeature = function(source) {
return this.readFeatureFromBuffer(ol.format.Binary.getBuffer_(source));
};
/**
* @inheritDoc
*/
ol.format.Binary.prototype.readFeatures = function(source) {
return this.readFeaturesFromBuffer(ol.format.Binary.getBuffer_(source));
};
/**
* @param {ol.binary.Buffer} buffer Buffer.
* @protected
* @return {ol.Feature} Feature.
*/
ol.format.Binary.prototype.readFeatureFromBuffer = goog.abstractMethod;
/**
* @param {ol.binary.Buffer} buffer Buffer.
* @protected
* @return {Array.<ol.Feature>} Feature.
*/
ol.format.Binary.prototype.readFeaturesFromBuffer = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.Binary.prototype.readGeometry = function(source) {
return this.readGeometryFromBuffer(ol.format.Binary.getBuffer_(source));
};
/**
* @param {ol.binary.Buffer} buffer Buffer.
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.Binary.prototype.readGeometryFromBuffer = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.Binary.prototype.readProjection = function(source) {
return this.readProjectionFromBuffer(ol.format.Binary.getBuffer_(source));
};
/**
* @param {ol.binary.Buffer} buffer Buffer.
* @return {ol.proj.Projection} Projection.
*/
ol.format.Binary.prototype.readProjectionFromBuffer = goog.abstractMethod;

View File

@@ -0,0 +1,72 @@
goog.provide('ol.format.Feature');
goog.require('goog.functions');
/**
* @constructor
*/
ol.format.Feature = function() {
};
/**
* @return {Array.<string>} Extensions.
*/
ol.format.Feature.prototype.getExtensions = goog.abstractMethod;
/**
* @return {ol.format.FormatType} Format.
*/
ol.format.Feature.prototype.getType = goog.abstractMethod;
/**
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.Feature} Feature.
*/
ol.format.Feature.prototype.readFeature = goog.abstractMethod;
/**
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {Array.<ol.Feature>} Features.
*/
ol.format.Feature.prototype.readFeatures = goog.abstractMethod;
/**
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.Feature.prototype.readGeometry = goog.abstractMethod;
/**
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection.
*/
ol.format.Feature.prototype.readProjection = goog.abstractMethod;
/**
* @param {ol.Feature} feature Feature.
* @return {ArrayBuffer|Node|Object|string} Result.
*/
ol.format.Feature.prototype.writeFeature = goog.abstractMethod;
/**
* @param {Array.<ol.Feature>} features Features.
* @return {ArrayBuffer|Node|Object|string} Result.
*/
ol.format.Feature.prototype.writeFeatures = goog.abstractMethod;
/**
* @param {ol.geom.Geometry} geometry Geometry.
* @return {ArrayBuffer|Node|Object|string} Node.
*/
ol.format.Feature.prototype.writeGeometry = goog.abstractMethod;

View File

@@ -1 +0,0 @@
@exportProperty ol.format.Format.prototype.readProjection

View File

@@ -1,8 +1,5 @@
goog.provide('ol.format.Format');
goog.provide('ol.format.FormatType');
goog.require('goog.functions');
/**
* @enum {string}
@@ -13,72 +10,3 @@ ol.format.FormatType = {
TEXT: 'text',
XML: 'xml'
};
/**
* @constructor
*/
ol.format.Format = function() {
};
/**
* @return {Array.<string>} Extensions.
*/
ol.format.Format.prototype.getExtensions = goog.abstractMethod;
/**
* @return {ol.format.FormatType} Format.
*/
ol.format.Format.prototype.getType = goog.abstractMethod;
/**
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.Feature} Feature.
*/
ol.format.Format.prototype.readFeature = goog.abstractMethod;
/**
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {Array.<ol.Feature>} Features.
*/
ol.format.Format.prototype.readFeatures = goog.abstractMethod;
/**
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.Format.prototype.readGeometry = goog.abstractMethod;
/**
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection.
*/
ol.format.Format.prototype.readProjection = goog.abstractMethod;
/**
* @param {ol.Feature} feature Feature.
* @return {ArrayBuffer|Node|Object|string} Result.
*/
ol.format.Format.prototype.writeFeature = goog.abstractMethod;
/**
* @param {Array.<ol.Feature>} features Features.
* @return {ArrayBuffer|Node|Object|string} Result.
*/
ol.format.Format.prototype.writeFeatures = goog.abstractMethod;
/**
* @param {ol.geom.Geometry} geometry Geometry.
* @return {ArrayBuffer|Node|Object|string} Node.
*/
ol.format.Format.prototype.writeGeometry = goog.abstractMethod;

View File

@@ -7,7 +7,7 @@ goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.object');
goog.require('ol.Feature');
goog.require('ol.format.JSON');
goog.require('ol.format.JSONFeature');
goog.require('ol.geom.GeometryCollection');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LineString');
@@ -22,7 +22,7 @@ goog.require('ol.proj');
/**
* @constructor
* @extends {ol.format.JSON}
* @extends {ol.format.JSONFeature}
* @param {olx.format.GeoJSONOptions=} opt_options Options.
* @todo stability experimental
*/
@@ -40,7 +40,7 @@ ol.format.GeoJSON = function(opt_options) {
options.defaultProjection : 'EPSG:4326');
};
goog.inherits(ol.format.GeoJSON, ol.format.JSON);
goog.inherits(ol.format.GeoJSON, ol.format.JSONFeature);
/**

View File

@@ -8,7 +8,7 @@ goog.require('goog.object');
goog.require('goog.string');
goog.require('ol.Feature');
goog.require('ol.extent');
goog.require('ol.format.XML');
goog.require('ol.format.XMLFeature');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
@@ -24,7 +24,7 @@ goog.require('ol.xml');
* @constructor
* @param {olx.format.GMLOptions=} opt_options
* Optional configuration object.
* @extends {ol.format.XML}
* @extends {ol.format.XMLFeature}
* @todo stability experimental
*/
ol.format.GML = function(opt_options) {
@@ -45,7 +45,7 @@ ol.format.GML = function(opt_options) {
goog.base(this);
};
goog.inherits(ol.format.GML, ol.format.XML);
goog.inherits(ol.format.GML, ol.format.XMLFeature);
/**

View File

@@ -6,7 +6,7 @@ goog.require('goog.asserts');
goog.require('goog.dom.NodeType');
goog.require('goog.object');
goog.require('ol.Feature');
goog.require('ol.format.XML');
goog.require('ol.format.XMLFeature');
goog.require('ol.format.XSD');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
@@ -18,13 +18,13 @@ goog.require('ol.xml');
/**
* @constructor
* @extends {ol.format.XML}
* @extends {ol.format.XMLFeature}
* @todo stability experimental
*/
ol.format.GPX = function() {
goog.base(this);
};
goog.inherits(ol.format.GPX, ol.format.XML);
goog.inherits(ol.format.GPX, ol.format.XMLFeature);
/**

View File

@@ -5,7 +5,7 @@ goog.require('goog.asserts');
goog.require('goog.string');
goog.require('goog.string.newlines');
goog.require('ol.Feature');
goog.require('ol.format.Text');
goog.require('ol.format.TextFeature');
goog.require('ol.geom.LineString');
goog.require('ol.proj');
@@ -23,7 +23,7 @@ ol.format.IGCZ = {
/**
* @constructor
* @extends {ol.format.Text}
* @extends {ol.format.TextFeature}
* @param {olx.format.IGCOptions=} opt_options Options.
* @todo stability experimental
*/
@@ -41,7 +41,7 @@ ol.format.IGC = function(opt_options) {
options.altitudeMode : ol.format.IGCZ.NONE;
};
goog.inherits(ol.format.IGC, ol.format.Text);
goog.inherits(ol.format.IGC, ol.format.TextFeature);
/**

View File

@@ -1,20 +1,20 @@
goog.provide('ol.format.JSON');
goog.provide('ol.format.JSONFeature');
goog.require('goog.asserts');
goog.require('goog.json');
goog.require('ol.format.Format');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
/**
* @constructor
* @extends {ol.format.Format}
* @extends {ol.format.Feature}
*/
ol.format.JSON = function() {
ol.format.JSONFeature = function() {
goog.base(this);
};
goog.inherits(ol.format.JSON, ol.format.Format);
goog.inherits(ol.format.JSONFeature, ol.format.Feature);
/**
@@ -22,7 +22,7 @@ goog.inherits(ol.format.JSON, ol.format.Format);
* @private
* @return {Object} Object.
*/
ol.format.JSON.prototype.getObject_ = function(source) {
ol.format.JSONFeature.prototype.getObject_ = function(source) {
if (goog.isObject(source)) {
return source;
} else if (goog.isString(source)) {
@@ -38,7 +38,7 @@ ol.format.JSON.prototype.getObject_ = function(source) {
/**
* @inheritDoc
*/
ol.format.JSON.prototype.getType = function() {
ol.format.JSONFeature.prototype.getType = function() {
return ol.format.FormatType.JSON;
};
@@ -46,7 +46,7 @@ ol.format.JSON.prototype.getType = function() {
/**
* @inheritDoc
*/
ol.format.JSON.prototype.readFeature = function(source) {
ol.format.JSONFeature.prototype.readFeature = function(source) {
return this.readFeatureFromObject(this.getObject_(source));
};
@@ -54,7 +54,7 @@ ol.format.JSON.prototype.readFeature = function(source) {
/**
* @inheritDoc
*/
ol.format.JSON.prototype.readFeatures = function(source) {
ol.format.JSONFeature.prototype.readFeatures = function(source) {
return this.readFeaturesFromObject(this.getObject_(source));
};
@@ -64,7 +64,7 @@ ol.format.JSON.prototype.readFeatures = function(source) {
* @protected
* @return {ol.Feature} Feature.
*/
ol.format.JSON.prototype.readFeatureFromObject = goog.abstractMethod;
ol.format.JSONFeature.prototype.readFeatureFromObject = goog.abstractMethod;
/**
@@ -72,13 +72,13 @@ ol.format.JSON.prototype.readFeatureFromObject = goog.abstractMethod;
* @protected
* @return {Array.<ol.Feature>} Features.
*/
ol.format.JSON.prototype.readFeaturesFromObject = goog.abstractMethod;
ol.format.JSONFeature.prototype.readFeaturesFromObject = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.JSON.prototype.readGeometry = function(source) {
ol.format.JSONFeature.prototype.readGeometry = function(source) {
return this.readGeometryFromObject(this.getObject_(source));
};
@@ -88,13 +88,13 @@ ol.format.JSON.prototype.readGeometry = function(source) {
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.JSON.prototype.readGeometryFromObject = goog.abstractMethod;
ol.format.JSONFeature.prototype.readGeometryFromObject = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.JSON.prototype.readProjection = function(source) {
ol.format.JSONFeature.prototype.readProjection = function(source) {
return this.readProjectionFromObject(this.getObject_(source));
};
@@ -104,13 +104,13 @@ ol.format.JSON.prototype.readProjection = function(source) {
* @protected
* @return {ol.proj.Projection} Projection.
*/
ol.format.JSON.prototype.readProjectionFromObject = goog.abstractMethod;
ol.format.JSONFeature.prototype.readProjectionFromObject = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.JSON.prototype.writeFeature = function(feature) {
ol.format.JSONFeature.prototype.writeFeature = function(feature) {
return this.writeFeatureObject(feature);
};
@@ -120,13 +120,13 @@ ol.format.JSON.prototype.writeFeature = function(feature) {
* @protected
* @return {Object} Object.
*/
ol.format.JSON.prototype.writeFeatureObject = goog.abstractMethod;
ol.format.JSONFeature.prototype.writeFeatureObject = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.JSON.prototype.writeFeatures = function(features) {
ol.format.JSONFeature.prototype.writeFeatures = function(features) {
return this.writeFeaturesObject(features);
};
@@ -136,13 +136,13 @@ ol.format.JSON.prototype.writeFeatures = function(features) {
* @protected
* @return {Object} Object.
*/
ol.format.JSON.prototype.writeFeaturesObject = goog.abstractMethod;
ol.format.JSONFeature.prototype.writeFeaturesObject = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.JSON.prototype.writeGeometry = function(geometry) {
ol.format.JSONFeature.prototype.writeGeometry = function(geometry) {
return this.writeGeometryObject(geometry);
};
@@ -152,4 +152,4 @@ ol.format.JSON.prototype.writeGeometry = function(geometry) {
* @protected
* @return {Object} Object.
*/
ol.format.JSON.prototype.writeGeometryObject = goog.abstractMethod;
ol.format.JSONFeature.prototype.writeGeometryObject = goog.abstractMethod;

View File

@@ -16,7 +16,7 @@ goog.require('goog.object');
goog.require('goog.string');
goog.require('ol.Feature');
goog.require('ol.feature');
goog.require('ol.format.XML');
goog.require('ol.format.XMLFeature');
goog.require('ol.format.XSD');
goog.require('ol.geom.GeometryCollection');
goog.require('ol.geom.GeometryType');
@@ -60,7 +60,7 @@ ol.format.KMLGxTrackObject_;
/**
* @constructor
* @extends {ol.format.XML}
* @extends {ol.format.XMLFeature}
* @param {olx.format.KMLOptions=} opt_options Options.
* @todo stability experimental
*/
@@ -130,7 +130,7 @@ ol.format.KML = function(opt_options) {
};
};
goog.inherits(ol.format.KML, ol.format.XML);
goog.inherits(ol.format.KML, ol.format.XMLFeature);
/**

View File

@@ -2,7 +2,7 @@ goog.provide('ol.format.Polyline');
goog.require('goog.asserts');
goog.require('ol.Feature');
goog.require('ol.format.Text');
goog.require('ol.format.TextFeature');
goog.require('ol.geom.LineString');
goog.require('ol.geom.flat');
goog.require('ol.proj');
@@ -11,12 +11,12 @@ goog.require('ol.proj');
/**
* @constructor
* @extends {ol.format.Text}
* @extends {ol.format.TextFeature}
*/
ol.format.Polyline = function() {
goog.base(this);
};
goog.inherits(ol.format.Polyline, ol.format.Text);
goog.inherits(ol.format.Polyline, ol.format.TextFeature);
/**

View File

@@ -1,19 +1,19 @@
goog.provide('ol.format.Text');
goog.provide('ol.format.TextFeature');
goog.require('goog.asserts');
goog.require('ol.format.Format');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
/**
* @constructor
* @extends {ol.format.Format}
* @extends {ol.format.Feature}
*/
ol.format.Text = function() {
ol.format.TextFeature = function() {
goog.base(this);
};
goog.inherits(ol.format.Text, ol.format.Format);
goog.inherits(ol.format.TextFeature, ol.format.Feature);
/**
@@ -21,7 +21,7 @@ goog.inherits(ol.format.Text, ol.format.Format);
* @private
* @return {string} Text.
*/
ol.format.Text.prototype.getText_ = function(source) {
ol.format.TextFeature.prototype.getText_ = function(source) {
if (goog.isString(source)) {
return source;
} else {
@@ -34,7 +34,7 @@ ol.format.Text.prototype.getText_ = function(source) {
/**
* @inheritDoc
*/
ol.format.Text.prototype.getType = function() {
ol.format.TextFeature.prototype.getType = function() {
return ol.format.FormatType.TEXT;
};
@@ -42,7 +42,7 @@ ol.format.Text.prototype.getType = function() {
/**
* @inheritDoc
*/
ol.format.Text.prototype.readFeature = function(source) {
ol.format.TextFeature.prototype.readFeature = function(source) {
return this.readFeatureFromText(this.getText_(source));
};
@@ -52,13 +52,13 @@ ol.format.Text.prototype.readFeature = function(source) {
* @protected
* @return {ol.Feature} Feature.
*/
ol.format.Text.prototype.readFeatureFromText = goog.abstractMethod;
ol.format.TextFeature.prototype.readFeatureFromText = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.Text.prototype.readFeatures = function(source) {
ol.format.TextFeature.prototype.readFeatures = function(source) {
return this.readFeaturesFromText(this.getText_(source));
};
@@ -68,13 +68,13 @@ ol.format.Text.prototype.readFeatures = function(source) {
* @protected
* @return {Array.<ol.Feature>} Features.
*/
ol.format.Text.prototype.readFeaturesFromText = goog.abstractMethod;
ol.format.TextFeature.prototype.readFeaturesFromText = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.Text.prototype.readGeometry = function(source) {
ol.format.TextFeature.prototype.readGeometry = function(source) {
return this.readGeometryFromText(this.getText_(source));
};
@@ -84,13 +84,13 @@ ol.format.Text.prototype.readGeometry = function(source) {
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.Text.prototype.readGeometryFromText = goog.abstractMethod;
ol.format.TextFeature.prototype.readGeometryFromText = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.Text.prototype.readProjection = function(source) {
ol.format.TextFeature.prototype.readProjection = function(source) {
return this.readProjectionFromText(this.getText_(source));
};
@@ -100,13 +100,13 @@ ol.format.Text.prototype.readProjection = function(source) {
* @protected
* @return {ol.proj.Projection} Projection.
*/
ol.format.Text.prototype.readProjectionFromText = goog.abstractMethod;
ol.format.TextFeature.prototype.readProjectionFromText = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.Text.prototype.writeFeature = function(feature) {
ol.format.TextFeature.prototype.writeFeature = function(feature) {
return this.writeFeatureText(feature);
};
@@ -116,13 +116,13 @@ ol.format.Text.prototype.writeFeature = function(feature) {
* @protected
* @return {string} Text.
*/
ol.format.Text.prototype.writeFeatureText = goog.abstractMethod;
ol.format.TextFeature.prototype.writeFeatureText = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.Text.prototype.writeFeatures = function(features) {
ol.format.TextFeature.prototype.writeFeatures = function(features) {
return this.writeFeaturesText(features);
};
@@ -132,13 +132,13 @@ ol.format.Text.prototype.writeFeatures = function(features) {
* @protected
* @return {string} Text.
*/
ol.format.Text.prototype.writeFeaturesText = goog.abstractMethod;
ol.format.TextFeature.prototype.writeFeaturesText = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.Text.prototype.writeGeometry = function(geometry) {
ol.format.TextFeature.prototype.writeGeometry = function(geometry) {
return this.writeGeometryText(geometry);
};
@@ -148,4 +148,4 @@ ol.format.Text.prototype.writeGeometry = function(geometry) {
* @protected
* @return {string} Text.
*/
ol.format.Text.prototype.writeGeometryText = goog.abstractMethod;
ol.format.TextFeature.prototype.writeGeometryText = goog.abstractMethod;

View File

@@ -4,7 +4,7 @@ goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.object');
goog.require('ol.Feature');
goog.require('ol.format.JSON');
goog.require('ol.format.JSONFeature');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
@@ -17,7 +17,7 @@ goog.require('ol.proj');
/**
* @constructor
* @extends {ol.format.JSON}
* @extends {ol.format.JSONFeature}
* @param {olx.format.TopoJSONOptions=} opt_options Options.
* @todo stability experimental
*/
@@ -35,7 +35,7 @@ ol.format.TopoJSON = function(opt_options) {
ol.proj.get(options.defaultProjection || 'EPSG:4326');
};
goog.inherits(ol.format.TopoJSON, ol.format.JSON);
goog.inherits(ol.format.TopoJSON, ol.format.JSONFeature);
/**

View File

@@ -1,9 +1,9 @@
goog.provide('ol.format.XML');
goog.provide('ol.format.XMLFeature');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.dom.NodeType');
goog.require('ol.format.Format');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
goog.require('ol.xml');
@@ -11,18 +11,18 @@ goog.require('ol.xml');
/**
* @constructor
* @extends {ol.format.Format}
* @extends {ol.format.Feature}
*/
ol.format.XML = function() {
ol.format.XMLFeature = function() {
goog.base(this);
};
goog.inherits(ol.format.XML, ol.format.Format);
goog.inherits(ol.format.XMLFeature, ol.format.Feature);
/**
* @inheritDoc
*/
ol.format.XML.prototype.getType = function() {
ol.format.XMLFeature.prototype.getType = function() {
return ol.format.FormatType.XML;
};
@@ -30,7 +30,7 @@ ol.format.XML.prototype.getType = function() {
/**
* @inheritDoc
*/
ol.format.XML.prototype.readFeature = function(source) {
ol.format.XMLFeature.prototype.readFeature = function(source) {
if (ol.xml.isDocument(source)) {
return this.readFeatureFromDocument(/** @type {Document} */ (source));
} else if (ol.xml.isNode(source)) {
@@ -49,7 +49,7 @@ ol.format.XML.prototype.readFeature = function(source) {
* @param {Document} doc Document.
* @return {ol.Feature} Feature.
*/
ol.format.XML.prototype.readFeatureFromDocument = function(doc) {
ol.format.XMLFeature.prototype.readFeatureFromDocument = function(doc) {
var features = this.readFeaturesFromDocument(doc);
if (features.length > 0) {
return features[0];
@@ -63,13 +63,13 @@ ol.format.XML.prototype.readFeatureFromDocument = function(doc) {
* @param {Node} node Node.
* @return {ol.Feature} Feature.
*/
ol.format.XML.prototype.readFeatureFromNode = goog.abstractMethod;
ol.format.XMLFeature.prototype.readFeatureFromNode = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.XML.prototype.readFeatures = function(source) {
ol.format.XMLFeature.prototype.readFeatures = function(source) {
if (ol.xml.isDocument(source)) {
return this.readFeaturesFromDocument(/** @type {Document} */ (source));
} else if (ol.xml.isNode(source)) {
@@ -89,7 +89,7 @@ ol.format.XML.prototype.readFeatures = function(source) {
* @protected
* @return {Array.<ol.Feature>} Features.
*/
ol.format.XML.prototype.readFeaturesFromDocument = function(doc) {
ol.format.XMLFeature.prototype.readFeaturesFromDocument = function(doc) {
/** @type {Array.<ol.Feature>} */
var features = [];
var n;
@@ -107,13 +107,13 @@ ol.format.XML.prototype.readFeaturesFromDocument = function(doc) {
* @protected
* @return {Array.<ol.Feature>} Features.
*/
ol.format.XML.prototype.readFeaturesFromNode = goog.abstractMethod;
ol.format.XMLFeature.prototype.readFeaturesFromNode = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.XML.prototype.readGeometry = function(source) {
ol.format.XMLFeature.prototype.readGeometry = function(source) {
if (ol.xml.isDocument(source)) {
return this.readGeometryFromDocument(/** @type {Document} */ (source));
} else if (ol.xml.isNode(source)) {
@@ -133,7 +133,7 @@ ol.format.XML.prototype.readGeometry = function(source) {
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.XML.prototype.readGeometryFromDocument = goog.abstractMethod;
ol.format.XMLFeature.prototype.readGeometryFromDocument = goog.abstractMethod;
/**
@@ -141,13 +141,13 @@ ol.format.XML.prototype.readGeometryFromDocument = goog.abstractMethod;
* @protected
* @return {ol.geom.Geometry} Geometry.
*/
ol.format.XML.prototype.readGeometryFromNode = goog.abstractMethod;
ol.format.XMLFeature.prototype.readGeometryFromNode = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.XML.prototype.readProjection = function(source) {
ol.format.XMLFeature.prototype.readProjection = function(source) {
if (ol.xml.isDocument(source)) {
return this.readProjectionFromDocument(/** @type {Document} */ (source));
} else if (ol.xml.isNode(source)) {
@@ -167,7 +167,7 @@ ol.format.XML.prototype.readProjection = function(source) {
* @protected
* @return {ol.proj.Projection} Projection.
*/
ol.format.XML.prototype.readProjectionFromDocument = goog.abstractMethod;
ol.format.XMLFeature.prototype.readProjectionFromDocument = goog.abstractMethod;
/**
@@ -175,13 +175,13 @@ ol.format.XML.prototype.readProjectionFromDocument = goog.abstractMethod;
* @protected
* @return {ol.proj.Projection} Projection.
*/
ol.format.XML.prototype.readProjectionFromNode = goog.abstractMethod;
ol.format.XMLFeature.prototype.readProjectionFromNode = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.XML.prototype.writeFeature = function(feature) {
ol.format.XMLFeature.prototype.writeFeature = function(feature) {
return this.writeFeatureNode(feature);
};
@@ -191,13 +191,13 @@ ol.format.XML.prototype.writeFeature = function(feature) {
* @protected
* @return {Node} Node.
*/
ol.format.XML.prototype.writeFeatureNode = goog.abstractMethod;
ol.format.XMLFeature.prototype.writeFeatureNode = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.XML.prototype.writeFeatures = function(features) {
ol.format.XMLFeature.prototype.writeFeatures = function(features) {
return this.writeFeaturesNode(features);
};
@@ -207,13 +207,13 @@ ol.format.XML.prototype.writeFeatures = function(features) {
* @protected
* @return {Node} Node.
*/
ol.format.XML.prototype.writeFeaturesNode = goog.abstractMethod;
ol.format.XMLFeature.prototype.writeFeaturesNode = goog.abstractMethod;
/**
* @inheritDoc
*/
ol.format.XML.prototype.writeGeometry = function(geometry) {
ol.format.XMLFeature.prototype.writeGeometry = function(geometry) {
return this.writeGeometryNode(geometry);
};
@@ -223,4 +223,4 @@ ol.format.XML.prototype.writeGeometry = function(geometry) {
* @protected
* @return {Node} Node.
*/
ol.format.XML.prototype.writeGeometryNode = goog.abstractMethod;
ol.format.XMLFeature.prototype.writeGeometryNode = goog.abstractMethod;

View File

@@ -29,7 +29,7 @@ ol.interaction.DragAndDrop = function(opt_options) {
/**
* @private
* @type {Array.<function(new: ol.format.Format)>}
* @type {Array.<function(new: ol.format.Feature)>}
*/
this.formatConstructors_ = goog.isDef(options.formatConstructors) ?
options.formatConstructors : [];
@@ -157,7 +157,7 @@ ol.interaction.DragAndDrop.prototype.setMap = function(map) {
/**
* @param {ol.format.Format} format Format.
* @param {ol.format.Feature} format Format.
* @param {string} text Text.
* @private
* @return {Array.<ol.Feature>} Features.

View File

@@ -37,7 +37,7 @@ ol.source.VectorFile = function(opt_options) {
});
/**
* @type {ol.format.Format}
* @type {ol.format.Feature}
* @protected
*/
this.format = options.format;