#628 - a feature has a geometry - a geometry doesn't have a feature - features are rendered, selected, moved, modified, etc - down in the renderer, expando properties on nodes are limited to _featureId, _style, and _options - this removes expandos that created circular references back through the map and to other dom elements - when the renderer is involved in selecting features, it returns a featureId (instead of a geometry or feature) and the layer is responsible for fetching the appropriate feature

git-svn-id: http://svn.openlayers.org/trunk/openlayers@3043 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2007-04-10 16:07:56 +00:00
parent 8af1822d94
commit 645bff1286
21 changed files with 335 additions and 336 deletions
+21 -18
View File
@@ -16,7 +16,7 @@ OpenLayers.Handler.Polygon.prototype =
OpenLayers.Class.inherit(OpenLayers.Handler.Path, {
/**
* @type OpenLayers.Geometry.Polygon
* @type OpenLayers.Feature.Vector
* @private
*/
polygon: null,
@@ -44,17 +44,20 @@ OpenLayers.Handler.Polygon.prototype =
/**
* Add temporary geometries
*/
createGeometry: function() {
this.polygon = new OpenLayers.Geometry.Polygon();
this.line = new OpenLayers.Geometry.LinearRing();
this.polygon.addComponent(this.line);
this.point = new OpenLayers.Geometry.Point();
createFeature: function() {
this.polygon = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Polygon());
this.line = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LinearRing());
this.polygon.geometry.addComponent(this.line.geometry);
this.point = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point());
},
/**
* Destroy temporary geometries
*/
destroyGeometry: function() {
destroyFeature: function() {
this.polygon.destroy();
this.point.destroy();
},
@@ -63,18 +66,18 @@ OpenLayers.Handler.Polygon.prototype =
* Modify the existing geometry given the new point
*
*/
modifyGeometry: function() {
var index = this.line.components.length - 2;
this.line.components[index].x = this.point.x;
this.line.components[index].y = this.point.y;
modifyFeature: function() {
var index = this.line.geometry.components.length - 2;
this.line.geometry.components[index].x = this.point.geometry.x;
this.line.geometry.components[index].y = this.point.geometry.y;
},
/**
* Render geometries on the temporary layer.
*/
drawGeometry: function() {
this.layer.renderer.drawGeometry(this.polygon, this.style);
this.layer.renderer.drawGeometry(this.point, this.style);
drawFeature: function() {
this.layer.drawFeature(this.polygon, this.style);
this.layer.drawFeature(this.point, this.style);
},
/**
@@ -83,7 +86,7 @@ OpenLayers.Handler.Polygon.prototype =
* @type OpenLayers.Geometry.Polygon
*/
geometryClone: function() {
return this.polygon.clone();
return this.polygon.geometry.clone();
},
/**
@@ -95,9 +98,9 @@ OpenLayers.Handler.Polygon.prototype =
dblclick: function(evt) {
if(!this.freehandMode(evt)) {
// remove the penultimate point
var index = this.line.components.length - 2;
this.line.removeComponent(this.line.components[index]);
this.finalize(this.line);
var index = this.line.geometry.components.length - 2;
this.line.geometry.removeComponent(this.line.geometry.components[index]);
this.finalize();
}
return false;
},