Merge all changes from the naturaldocs sandbox. This brings all the work that

has been done in the NaturalDocs branch back to trunk. Thanks to everyone who
helped out in making this happen. (I could list people, but the list would
be long, and I'm already mentally on vacation.)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-06-29 15:59:20 +00:00
parent f1c61fd0d6
commit 3948913bfc
107 changed files with 8658 additions and 4011 deletions
+158 -60
View File
@@ -3,8 +3,9 @@
* for the full text of the license. */
/**
* @class
* @requires OpenLayers/Renderer.js
*
* Class: OpenLayers.Renderer.Elements
* This is another virtual class in that it should never be instantiated by
* itself as a Renderer. It exists because there is *tons* of shared
* functionality between different vector libraries which use nodes/elements
@@ -15,25 +16,36 @@
* element-based renderer. The details of creating each node and drawing the
* paths are of course different, but the machinery is the same.
*
* @requires OpenLayers/Renderer.js
* Inherits:
* - <OpenLayers.Renderer>
*/
OpenLayers.Renderer.Elements = OpenLayers.Class.create();
OpenLayers.Renderer.Elements.prototype =
OpenLayers.Class.inherit(OpenLayers.Renderer, {
/** @type DOMElement */
/**
* Property: rendererRoot
* {DOMElement}
*/
rendererRoot: null,
/** @type DOMElement */
/**
* Property: root
* {DOMElement}
*/
root: null,
/** @type String */
/**
* Property: xmlns
* {String}
*/
xmlns: null,
/**
* @constructor
* Constructor: OpenLayers.Renderer.Elements
*
* @param {String} containerID
* Parameters:
* containerID - {String}
*/
initialize: function(containerID) {
OpenLayers.Renderer.prototype.initialize.apply(this, arguments);
@@ -46,7 +58,7 @@ OpenLayers.Renderer.Elements.prototype =
},
/**
*
* Method: destroy
*/
destroy: function() {
@@ -60,8 +72,8 @@ OpenLayers.Renderer.Elements.prototype =
},
/**
* Method: clear
* Remove all the elements from the root
* @private
*/
clear: function() {
if (this.root) {
@@ -71,30 +83,33 @@ OpenLayers.Renderer.Elements.prototype =
}
},
/** This function is in charge of asking the specific renderer which type
* of node to create for the given geometry. All geometries in an
* Elements-based renderer consist of one node and some attributes. We
* have the nodeFactory() function which creates a node for us, but it
* takes a 'type' as input, and that is precisely what this function
* tells us.
/**
* Method: getNodeType
* This function is in charge of asking the specific renderer which type
* of node to create for the given geometry. All geometries in an
* Elements-based renderer consist of one node and some attributes. We
* have the nodeFactory() function which creates a node for us, but it
* takes a 'type' as input, and that is precisely what this function
* tells us.
*
* Parameters:
* geometry - {<OpenLayers.Geometry>}
*
* @param geometry {OpenLayers.Geometry}
*
* @returns The corresponding node type for the specified geometry
* @type String
* @private
* Return:
* {String} The corresponding node type for the specified geometry
*/
getNodeType: function(geometry) { },
/**
* Method: drawGeometry
* Draw the geometry, creating new nodes, setting paths, setting style,
* setting featureId on the node. This method should only be called
* by the renderer itself.
* setting featureId on the node. This method should only be called
* by the renderer itself.
*
* @param {OpenLayers.Geometry} geometry
* @param {Object} style
* @param {String} featureId
* @private
* Parameters:
* geometry - {<OpenLayers.Geometry>}
* style - {Object}
* featureId - {String}
*/
drawGeometry: function(geometry, style, featureId) {
@@ -119,15 +134,16 @@ OpenLayers.Renderer.Elements.prototype =
this.drawGeometryNode(node, geometry);
},
/**
/**
* Method: drawGeometryNode
* Given a node, draw a geometry on the specified layer.
* node and geometry are required arguments, style is optional.
* This method is only called by the render itself.
* node and geometry are required arguments, style is optional.
* This method is only called by the render itself.
*
* @param {DOMElement} node
* @param {OpenLayers.Geometry} geometry
* @param {Object} style
* @private
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
* style - {Object}
*/
drawGeometryNode: function(node, geometry, style) {
style = style || node._style;
@@ -168,43 +184,126 @@ OpenLayers.Renderer.Elements.prototype =
this.setStyle(node, style, options, geometry);
},
/**
* virtual functions for drawing different Geometries.
* These should all be implemented by subclasses.
* These methods are only called by the render itself.
*
* @param {DOMElement} node
* @param {OpenLayers.Geometry} geometry
* @private
*/
/**
* Method: drawPoint
* Virtual function for drawing Point Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawPoint: function(node, geometry) {},
/**
* Method: drawLineString
* Virtual function for drawing LineString Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawLineString: function(node, geometry) {},
/**
* Method: drawLinearRing
* Virtual function for drawing LinearRing Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawLinearRing: function(node, geometry) {},
/**
* Method: drawPolygon
* Virtual function for drawing Polygon Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawPolygon: function(node, geometry) {},
/**
* Method: drawRectangle
* Virtual function for drawing Rectangle Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawRectangle: function(node, geometry) {},
/**
* Method: drawCircle
* Virtual function for drawing Circle Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawCircle: function(node, geometry) {},
/**
* Method: drawCurve
* Virtual function for drawing Curve Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawCurve: function(node, geometry) {},
/**
* Method: drawSurface
* Virtual function for drawing Surface Geometry.
* Should be implemented by subclasses.
* This method is only called by the renderer itself.
*
* Parameters:
* node - {DOMElement}
* geometry - {<OpenLayers.Geometry>}
*/
drawSurface: function(node, geometry) {},
/**
* @param evt {Object} an OpenLayers.Event object
* Method: getFeatureIdFromEvent
*
* Parameters:
* evt - {Object} An <OpenLayers.Event> object
*
* @returns A geometry from an event that happened on a layer
* @type OpenLayers.Geometry
* @private
* Return:
* {<OpenLayers.Geometry>} A geometry from an event that
* happened on a layer
*/
getFeatureIdFromEvent: function(evt) {
var node = evt.target || evt.srcElement;
return node._featureId;
},
/** Erase a geometry from the renderer. In the case of a multi-geometry,
* we cycle through and recurse on ourselves. Otherwise, we look for a
* node with the geometry.id, destroy its geometry, and remove it from
* the DOM.
/**
* Method: eraseGeometry
* Erase a geometry from the renderer. In the case of a multi-geometry,
* we cycle through and recurse on ourselves. Otherwise, we look for a
* node with the geometry.id, destroy its geometry, and remove it from
* the DOM.
*
* @param {OpenLayers.Geometry} geometry
* @private
* Parameters:
* geometry - {<OpenLayers.Geometry>}
*/
eraseGeometry: function(geometry) {
if ((geometry.CLASS_NAME == "OpenLayers.Geometry.MultiPoint") ||
@@ -226,20 +325,19 @@ OpenLayers.Renderer.Elements.prototype =
},
/**
* @private
*
* Method: nodeFactory
* Create new node of the specified type, with the (optional) specified id.
*
* If node already exists with same ID and type, we remove it and then
* call ourselves again to recreate it.
*
* @param {String} id
* @param {String} type Kind of node to draw
* @param {OpenLayers.Geometry} geometry
* Parameters:
* id - {String}
* type - {String} type Kind of node to draw
* geometry - {<OpenLayers.Geometry>}
*
* @returns A new node of the given type and id
* @type DOMElement
* @private
* Return:
* {DOMElement} A new node of the given type and id
*/
nodeFactory: function(id, type, geometry) {
var node = $(id);