1
/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
2
* license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
3
* full text of the license. */
6
* @requires OpenLayers/Util.js
10
* Class: OpenLayers.Format
11
* Base class for format reading/writing a variety of formats. Subclasses
12
* of OpenLayers.Format are expected to have read and write methods.
14
OpenLayers.Format = OpenLayers.Class({
18
* {Object} A reference to options passed to the constructor.
23
* APIProperty: externalProjection
24
* {<OpenLayers.Projection>} When passed a externalProjection and
25
* internalProjection, the format will reproject the geometries it
26
* reads or writes. The externalProjection is the projection used by
27
* the content which is passed into read or which comes out of write.
28
* In order to reproject, a projection transformation function for the
29
* specified projections must be available. This support may be
30
* provided via proj4js or via a custom transformation function. See
31
* {<OpenLayers.Projection.addTransform>} for more information on
32
* custom transformations.
34
externalProjection: null,
37
* APIProperty: internalProjection
38
* {<OpenLayers.Projection>} When passed a externalProjection and
39
* internalProjection, the format will reproject the geometries it
40
* reads or writes. The internalProjection is the projection used by
41
* the geometries which are returned by read or which are passed into
42
* write. In order to reproject, a projection transformation function
43
* for the specified projections must be available. This support may be
44
* provided via proj4js or via a custom transformation function. See
45
* {<OpenLayers.Projection.addTransform>} for more information on
46
* custom transformations.
48
internalProjection: null,
51
* Constructor: OpenLayers.Format
52
* Instances of this class are not useful. See one of the subclasses.
55
* options - {Object} An optional object with properties to set on the
59
* An instance of OpenLayers.Format
61
initialize: function(options) {
62
OpenLayers.Util.extend(this, options);
63
this.options = options;
75
* Read data from a string, and return an object whose type depends on the
79
* data - {string} Data to read/parse.
82
* Depends on the subclass
84
read: function(data) {
85
OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"));
90
* Accept an object, and return a string.
93
* object - {Object} Object to be serialized
96
* {String} A string representation of the object.
98
write: function(object) {
99
OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"));
102
CLASS_NAME: "OpenLayers.Format"