📄 class.js
字号:
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license. * See http://svn.openlayers.org/trunk/openlayers/release-license.txt * for the full text of the license. *//** * 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); * */OpenLayers.Class = function() { var Class = function() { /** * This following condition can be removed at 3.0 - this is only for * backwards compatibility while the Class.inherit method is still * in use. So at 3.0, the following three lines would be replaced with * simply: * this.initialize.apply(this, arguments); */ if (arguments && arguments[0] != OpenLayers.Class.isPrototype) { this.initialize.apply(this, arguments); } } var extended = {}; var parent; for(var i=0; i<arguments.length; ++i) { if(typeof arguments[i] == "function") { // get the prototype of the superclass parent = arguments[i].prototype; } else { // in this case we're extending with the prototype parent = arguments[i]; } OpenLayers.Util.extend(extended, parent); } Class.prototype = extended; return Class;}/** * Property: isPrototype * *Deprecated*. This is no longer needed and will be removed at 3.0. */OpenLayers.Class.isPrototype = function () {};/** * APIFunction: OpenLayers.create * *Deprecated*. Old method to create an OpenLayers style class. Use the * <OpenLayers.Class> constructor instead. * * Returns: * An OpenLayers class */OpenLayers.Class.create = function() { return function() { if (arguments && arguments[0] != OpenLayers.Class.isPrototype) this.initialize.apply(this, arguments); }}/** * APIFunction: inherit * *Deprecated*. Old method to inherit from one or more OpenLayers style * classes. Use the <OpenLayers.Class> constructor instead. * * Parameters: * class - One or more classes can be provided as arguments * * Returns: * An object prototype */OpenLayers.Class.inherit = function () { var superClass = arguments[0]; var proto = new superClass(OpenLayers.Class.isPrototype); for (var i = 1; i < arguments.length; i++) { if (typeof arguments[i] == "function") { var mixin = arguments[i]; arguments[i] = new mixin(OpenLayers.Class.isPrototype); } OpenLayers.Util.extend(proto, arguments[i]); } return proto;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -