#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

View File

@@ -46,7 +46,7 @@ OpenLayers.Feature.Vector.prototype =
initialize: function(geometry, data, style) {
OpenLayers.Feature.prototype.initialize.apply(this, [null, null, data]);
this.lonlat = null;
this.setGeometry(geometry);
this.geometry = geometry;
this.state = null;
if (data) {
OpenLayers.Util.extend(this.attributes, data);
@@ -125,56 +125,6 @@ OpenLayers.Feature.Vector.prototype =
return null;
},
/**
* Set a feature id to the feature
*
* @param {String} feature id to set
*/
setFid: function(fid) {
this.fid = fid;
},
/**
* Set a geometry to the feature
*
* @param {OpenLayers.Geometry} geometry to set
* @param {Boolean} recurse Recursively set feature (for components)
*/
setGeometry: function(geometry, recurse) {
if(geometry) {
this.geometry = geometry;
this.geometry.feature = this;
if (recurse != false) {
this._setGeometryFeatureReference(this.geometry, this);
}
}
},
/**
* Sets recursively the reference to the feature in the geometry
*
* @param {OpenLayers.Geometry}
* @param {OpenLayers.Feature}
*/
_setGeometryFeatureReference: function(geometry, feature) {
geometry.feature = feature;
if (geometry.components) {
for (var i = 0; i < geometry.components.length; i++) {
this._setGeometryFeatureReference(geometry.components[i], feature);
}
}
},
/**
* Adds attributes an attributes object to the feature.
* (should not be in geometry but in feature class)
*
* @param {Attributes} attributes
*/
setAttributes: function(attributes) {
this.attributes=attributes;
},
/**
* @param {OpenLayers.LonLat} lonlat
* @param {float} toleranceLon Optional tolerance in Geometric Coords