#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
+20 -19
View File
@@ -16,7 +16,7 @@ OpenLayers.Handler.Point.prototype =
OpenLayers.Class.inherit(OpenLayers.Handler, {
/**
* @type OpenLayers.Geometry.Point
* @type OpenLayers.Feature.Vector
* @private
*/
point: null,
@@ -87,10 +87,11 @@ OpenLayers.Handler.Point.prototype =
},
/**
* Add temporary geometries
* Add temporary features
*/
createGeometry: function() {
this.point = new OpenLayers.Geometry.Point();
createFeature: function() {
this.point = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point());
},
/**
@@ -112,7 +113,7 @@ OpenLayers.Handler.Point.prototype =
/**
* Destroy the temporary geometries
*/
destroyGeometry: function() {
destroyFeature: function() {
this.point.destroy();
},
@@ -122,7 +123,7 @@ OpenLayers.Handler.Point.prototype =
finalize: function() {
this.layer.renderer.clear();
this.callback("done", [this.geometryClone()]);
this.destroyGeometry();
this.destroyFeature();
this.drawing = false;
this.mouseDown = false;
this.lastDown = null;
@@ -135,7 +136,7 @@ OpenLayers.Handler.Point.prototype =
cancel: function() {
this.layer.renderer.clear();
this.callback("cancel", [this.geometryClone()]);
this.destroyGeometry();
this.destroyFeature();
this.drawing = false;
this.mouseDown = false;
this.lastDown = null;
@@ -151,10 +152,10 @@ OpenLayers.Handler.Point.prototype =
},
/**
* Render geometries on the temporary layer.
* Render features on the temporary layer.
*/
drawGeometry: function() {
this.layer.renderer.drawGeometry(this.point, this.style);
drawFeature: function() {
this.layer.drawFeature(this.point, this.style);
},
/**
@@ -163,7 +164,7 @@ OpenLayers.Handler.Point.prototype =
* @type OpenLayers.Geometry.Point
*/
geometryClone: function() {
return this.point.clone();
return this.point.geometry.clone();
},
/**
@@ -183,14 +184,14 @@ OpenLayers.Handler.Point.prototype =
return true;
}
if(this.lastDown == null) {
this.createGeometry();
this.createFeature();
}
this.lastDown = evt.xy;
this.drawing = true;
var lonlat = this.map.getLonLatFromPixel(evt.xy);
this.point.x = lonlat.lon;
this.point.y = lonlat.lat;
this.drawGeometry();
this.point.geometry.x = lonlat.lon;
this.point.geometry.y = lonlat.lat;
this.drawFeature();
return false;
},
@@ -204,9 +205,9 @@ OpenLayers.Handler.Point.prototype =
mousemove: function (evt) {
if(this.drawing) {
var lonlat = this.map.getLonLatFromPixel(evt.xy);
this.point.x = lonlat.lon;
this.point.y = lonlat.lat;
this.drawGeometry();
this.point.geometry.x = lonlat.lon;
this.point.geometry.y = lonlat.lat;
this.drawFeature();
}
return true;
},
@@ -220,7 +221,7 @@ OpenLayers.Handler.Point.prototype =
*/
mouseup: function (evt) {
if(this.drawing) {
this.finalize(this.point);
this.finalize();
return false;
} else {
return true;