externalProjection properties. These allow for the reprojection of data -- OpenLayers users with SphericalMercator get this built in for EPSG:900913, and other users can use the external proj4js library available from MapBuilder SVN to add support for any number of projections. This means that featres can be, for example, transformed from a KML doc in 4326 to Spherical Mercator before being added to a layer, making using SphericalMercator slightly more enticing. r=elemoine (Closes #1039) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5516 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
88 lines
2.9 KiB
JavaScript
88 lines
2.9 KiB
JavaScript
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the Clear BSD
|
|
* license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
|
|
* full text of the license. */
|
|
|
|
/**
|
|
* @requires OpenLayers/Util.js
|
|
*
|
|
* Class: OpenLayers.Format
|
|
* Base class for format reading/writing a variety of formats. Subclasses
|
|
* of OpenLayers.Format are expected to have read and write methods.
|
|
*/
|
|
OpenLayers.Format = OpenLayers.Class({
|
|
|
|
/**
|
|
* APIProperty: externalProjection
|
|
* {<OpenLayers.Projection>} When passed a externalProjection and
|
|
* internalProjection, the format will reproject the geometries it
|
|
* reads or writes. The externalProjection is the projection used by
|
|
* the content which is passed into read or which comes out of write.
|
|
* In order to reproject, a projection transformation function for the
|
|
* specified projections must be available. This support may be
|
|
* provided via proj4js or via a custom transformation function. See
|
|
* {<OpenLayers.Projection.addTransform>} for more information on
|
|
* custom transformations.
|
|
*/
|
|
externalProjection: null,
|
|
|
|
/**
|
|
* APIProperty: internalProjection
|
|
* {<OpenLayers.Projection>} When passed a externalProjection and
|
|
* internalProjection, the format will reproject the geometries it
|
|
* reads or writes. The internalProjection is the projection used by
|
|
* the geometries which are returned by read or which are passed into
|
|
* write. In order to reproject, a projection transformation function
|
|
* for the specified projections must be available. This support may be
|
|
* provided via proj4js or via a custom transformation function. See
|
|
* {<OpenLayers.Projection.addTransform>} for more information on
|
|
* custom transformations.
|
|
*/
|
|
internalProjection: null,
|
|
|
|
/**
|
|
* Constructor: OpenLayers.Format
|
|
* Instances of this class are not useful. See one of the subclasses.
|
|
*
|
|
* Parameters:
|
|
* options - {Object} An optional object with properties to set on the
|
|
* format
|
|
*
|
|
* Returns:
|
|
* An instance of OpenLayers.Format
|
|
*/
|
|
initialize: function(options) {
|
|
OpenLayers.Util.extend(this, options);
|
|
},
|
|
|
|
/**
|
|
* Method: read
|
|
* Read data from a string, and return an object whose type depends on the
|
|
* subclass.
|
|
*
|
|
* Parameters:
|
|
* data - {string} Data to read/parse.
|
|
*
|
|
* Returns:
|
|
* Depends on the subclass
|
|
*/
|
|
read: function(data) {
|
|
alert("Read not implemented.");
|
|
},
|
|
|
|
/**
|
|
* Method: write
|
|
* Accept an object, and return a string.
|
|
*
|
|
* Parameters:
|
|
* object - {Object} Object to be serialized
|
|
*
|
|
* Returns:
|
|
* {String} A string representation of the object.
|
|
*/
|
|
write: function(object) {
|
|
alert("Write not implemented.");
|
|
},
|
|
|
|
CLASS_NAME: "OpenLayers.Format"
|
|
});
|