ALKMaps.Format

Base class for format reading/writing a variety of formats.  Subclasses of ALKMaps.Format are expected to have read and write methods.

Summary
ALKMaps.FormatBase class for format reading/writing a variety of formats.
Properties
options{Object} A reference to options passed to the constructor.
externalProjection{ALKMaps.Projection} When passed a externalProjection and internalProjection, the format will reproject the geometries it reads or writes.
internalProjection{ALKMaps.Projection} When passed a externalProjection and internalProjection, the format will reproject the geometries it reads or writes.
data{Object} When keepData is true, this is the parsed string sent to read.
keepData{Object} Maintain a reference (data) to the most recently read data.
Constructor
ALKMaps.FormatInstances of this class are not useful.
Functions
destroyClean up.
readRead data from a string, and return an object whose type depends on the subclass.
writeAccept an object, and return a string.

Properties

options

{Object} A reference to options passed to the constructor.

externalProjection

{ALKMaps.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 {ALKMaps.Projection.addTransform} for more information on custom transformations.

internalProjection

{ALKMaps.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 {ALKMaps.Projection.addTransform} for more information on custom transformations.

data

{Object} When keepData is true, this is the parsed string sent to read.

keepData

{Object} Maintain a reference (data) to the most recently read data.  Default is false.

Constructor

ALKMaps.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

Valid options

keepData{Boolean} If true, upon read, the data property will be set to the parsed object (e.g. the json or xml object).

Returns

An instance of ALKMaps.Format

Functions

destroy

destroy: function()

Clean up.

read

read: function(data)

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

write

write: function(object)

Accept an object, and return a string.

Parameters

object{Object} Object to be serialized

Returns

{String} A string representation of the object.

Methods for coordinate transforms between coordinate systems.
{Object} Maintain a reference (data) to the most recently read data.
read: function(data)
Read data from a string, and return an object whose type depends on the subclass.
{Object} When keepData is true, this is the parsed string sent to read.
destroy: function()
Clean up.
write: function(object)
Accept an object, and return a string.
ALKMaps.Projection.addTransform = function(from,
to,
method)
Set a custom transform method between two projections.
Close