[OpenLayers-Commits] r2351 - in sandbox/vector-2.4/lib/OpenLayers: Feature Layer
commits at openlayers.org
commits at openlayers.org
Mon Mar 5 17:32:16 EST 2007
Author: crschmidt
Date: 2007-03-05 17:32:10 -0500 (Mon, 05 Mar 2007)
New Revision: 2351
Modified:
sandbox/vector-2.4/lib/OpenLayers/Feature/Vector.js
sandbox/vector-2.4/lib/OpenLayers/Layer/Vector.js
Log:
Move style from the geometry to the Feature. This is under the operating
assumption that "You can't render a geometry" -- style information should
be stored at the feature level.
Modified: sandbox/vector-2.4/lib/OpenLayers/Feature/Vector.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Feature/Vector.js 2007-03-05 22:23:19 UTC (rev 2350)
+++ sandbox/vector-2.4/lib/OpenLayers/Feature/Vector.js 2007-03-05 22:32:10 UTC (rev 2351)
@@ -39,11 +39,12 @@
* @param {OpenLayers.Geometry} geometry
* @param {Object} data
*/
- initialize: function(layer, geometry, data) {
+ initialize: function(layer, geometry, data, style) {
OpenLayers.Feature.prototype.initialize.apply(this, [layer, null, data]);
this.lonlat = null;
this.setGeometry(geometry);
this.state = null;
+ this.style = style ? style : OpenLayers.Feature.Vector.defaultStyle;
},
@@ -247,3 +248,23 @@
CLASS_NAME: "OpenLayers.Feature.Vector"
});
+
+
+// defaultStyle is used for the style of
+// features by default.
+OpenLayers.Feature.Vector.defaultStyle = {
+ fillColor: "orange",
+ fillOpacity: 0.4,
+ hoverFillColor: "white",
+ hoverFillOpacity: 0.8,
+ strokeColor: "red",
+ strokeOpacity: 1,
+ strokeWidth: 1,
+ hoverStrokeColor: "red",
+ hoverStrokeOpacity: 1,
+ hoverStrokeWidth: 0.2,
+ pointRadius: 6,
+ hoverPointRadius: 1,
+ hoverPointUnit: "%",
+ pointerEvents: "visiblePainted"
+};
Modified: sandbox/vector-2.4/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Layer/Vector.js 2007-03-05 22:23:19 UTC (rev 2350)
+++ sandbox/vector-2.4/lib/OpenLayers/Layer/Vector.js 2007-03-05 22:32:10 UTC (rev 2351)
@@ -114,7 +114,7 @@
throw "addFeatures : component should be an " + this.geometryType.prototype.CLASS_NAME;
}
- var style = features[i].geometry.style;
+ var style = features[i].style;
if (this.drawn) {
var feature = this.renderer.drawGeometry(features[i].geometry, style);
More information about the Commits
mailing list