diff --git a/src/ol/format/format.exports b/src/ol/format/format.exports new file mode 100644 index 0000000000..0d0fdfb024 --- /dev/null +++ b/src/ol/format/format.exports @@ -0,0 +1,2 @@ +@exportProperty ol.format.Format.prototype.readProjection +@exportProperty ol.format.Format.prototype.readStyleFunction diff --git a/src/ol/format/format.js b/src/ol/format/format.js new file mode 100644 index 0000000000..18d924554d --- /dev/null +++ b/src/ol/format/format.js @@ -0,0 +1,101 @@ +goog.provide('ol.format.Format'); +goog.provide('ol.format.FormatType'); + +goog.require('goog.functions'); +goog.require('ol.proj'); + + +/** + * @enum {string} + */ +ol.format.FormatType = { + BINARY: 'binary', + JSON: 'json', + TEXT: 'text', + XML: 'xml' +}; + + + +/** + * @constructor + */ +ol.format.Format = function() { +}; + + +/** + * @return {ol.format.FormatType} Format. + */ +ol.format.Format.prototype.getType = goog.abstractMethod; + + +/** + * @param {Document|Node|Object|string} source Source. + * @return {ol.Feature} Feature. + */ +ol.format.Format.prototype.readFeature = goog.abstractMethod; + + +/** + * @param {Document|Node|Object|string} source Source. + * @return {Array.} Features. + */ +ol.format.Format.prototype.readFeatures = goog.abstractMethod; + + +/** + * @param {Document|Node|Object|string} source Source. + * @param {function(this: S, ol.Feature, (Document|Node|Object|undefined)): T} + * callback Callback. + * @param {S=} opt_obj Scope. + * @template S,T + */ +ol.format.Format.prototype.readFeaturesAsync = goog.abstractMethod; + + +/** + * @param {Document|Node|Object|string} source Source. + * @return {ol.geom.Geometry} Geometry. + */ +ol.format.Format.prototype.readGeometry = goog.abstractMethod; + + +/** + * @param {Document|Node|Object|string} source Source. + * @return {ol.proj.Projection} Projection. + */ +ol.format.Format.prototype.readProjection = function(source) { + return ol.proj.get('EPSG:4326'); +}; + + +/** + * @param {Document|Node|Object|string} source Source. + * @return {function(ol.Feature, number): Array.} Style + * function. + */ +ol.format.Format.prototype.readStyleFunction = function(source) { + return goog.functions.NULL; +}; + + +/** + * @param {ol.Feature} feature Feature. + * @return {Node|Object|string} Result. + */ +ol.format.Format.prototype.writeFeature = goog.abstractMethod; + + +/** + * @param {Array.} features Features. + * @return {Node|Object|string} Result. + */ +ol.format.Format.prototype.writeFeatures = goog.abstractMethod; + + +/** + * @param {ol.geom.Geometry} geometry Geometry. + * @return {Node|Object|string} Node. + */ +ol.format.Format.prototype.writeGeometry = goog.abstractMethod;