Class.js

Summary
Class.js
Constructor
OpenLayers.ClassBase class used to construct all other classes.
Properties
isPrototypeDeprecated.
Functions
OpenLayers.createDeprecated.
inheritDeprecated.
OpenLayers.inherit
extendCopy all properties of a source object to a destination object.

Constructor

OpenLayers.Class

Base class used to construct all other classes.  Includes support for multiple inheritance.

This constructor is new in OpenLayers 2.5.  At OpenLayers 3.0, the old syntax for creating classes and dealing with inheritance will be removed.

To create a new OpenLayers-style class, use the following syntax

var MyClass = OpenLayers.Class(prototype);

To create a new OpenLayers-style class with multiple inheritance, use the following syntax:

var MyClass = OpenLayers.Class(Class1, Class2, prototype);

Note that instanceof reflection will only reveal Class1 as superclass.

Properties

isPrototype

Deprecated.  This is no longer needed and will be removed at 3.0.

Functions

OpenLayers.create

Deprecated.  Old method to create an OpenLayers style class.  Use the OpenLayers.Class constructor instead.

Returns

An OpenLayers class

inherit

OpenLayers.Class.inherit = function (P)

Deprecated.  Old method to inherit from one or more OpenLayers style classes.  Use the OpenLayers.Class constructor instead.

Parameters

classOne or more classes can be provided as arguments

Returns

An object prototype

OpenLayers.inherit

OpenLayers.inherit = function(C,
P)

Parameters

C{Object} the class that inherits
P{Object} the superclass to inherit from

In addition to the mandatory C and P parameters, an arbitrary number of objects can be passed, which will extend C.

extend

Copy all properties of a source object to a destination object.  Modifies the passed in destination object.  Any properties on the source object that are set to undefined will not be (re)set on the destination object.

Parameters

destination{Object} The object that will be modified
source{Object} The object with properties to be set on the destination

Returns

{Object} The destination object.

OpenLayers.Class.inherit = function (P)
Deprecated.
OpenLayers.inherit = function(C,
P)
Base class used to construct all other classes.
Close