[OpenLayers-Commits] r2036 - sandbox/vector/lib/OpenLayers
commits at openlayers.org
commits at openlayers.org
Mon Dec 11 19:03:06 EST 2006
Author: camerons
Date: 2006-12-11 19:03:06 -0500 (Mon, 11 Dec 2006)
New Revision: 2036
Modified:
sandbox/vector/lib/OpenLayers/Style.js
Log:
Inserted some commented out code which should convert pixel dimensions to percentages. For some reason, it is not working for me - might be a problem in my harness that is calling the code. To be debugged later.
Modified: sandbox/vector/lib/OpenLayers/Style.js
===================================================================
--- sandbox/vector/lib/OpenLayers/Style.js 2006-12-11 22:54:12 UTC (rev 2035)
+++ sandbox/vector/lib/OpenLayers/Style.js 2006-12-12 00:03:06 UTC (rev 2036)
@@ -2,13 +2,13 @@
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
* for the full text of the license. */
-/*
- * OpenLayers.Style is a prototype.js HashTable with defaults style properties.
+/**
+ * Store Style parameters for rendering vector layers.
*/
OpenLayers.Style = OpenLayers.Class.create();
/**
- * constructor. Sub-classes need to set up this.eventHandler (see above)
+ * Default Style parameters.
*/
OpenLayers.Style.prototype = {
@@ -29,13 +29,35 @@
hoverPointRadius: 1,
hoverPointUnit: "%",
pointerEvents: "visiblePainted",
+
+ /** Pointer to the map object, used to calculate point width, height. */
+ map: null,
+ /**
+ * @constructor
+ * @param {Object} object Optional parameters to pass into the object.
+ * Parameters include: fillColor, fillOpacity, strokeColor, strokeOpacity,
+ * strokeWidth, pointRadius. Also {OpenLayers.Map} map, which is a pointer
+ * to the Map object - required to determine point width/height.
+ */
initialize: function(object) {
- //var defaultStyleCopy = eval(OpenLayers.Style.Defaults.toSource());
- //var hash = OpenLayers.Util.extend(this, object || {});
OpenLayers.Util.extend(this, object);
+// TBD: For some reason, the following code is not working for me.
+// Needs further debugging.
+// // Convert pixels to percent otherwise the points will increase
+// // in size as you zoom in.
+// if(this.map){
+// if(this.strokeUnit!="%"){
+// this.strokeWidth=this.strokeWidth/this.map.getSize().w*100;
+// this.strokeUnit="%";
+// }
+// if(this.pointUnit!="%"){
+// this.pointRadius=this.pointRadius/this.map.getSize().w*100;
+// this.pointUnit="%";
+// }
+// }
},
-
+
/** @final @type String */
CLASS_NAME: "OpenLayers.Style"
}
More information about the Commits
mailing list