[Webflysuesk-commits] r51 - in webflysuesk/branches/openlayers-integration: . webflys/src/main/webapp/pages
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Apr 8 15:59:47 CEST 2009
Author: iweinzierl
Date: 2009-04-08 15:59:47 +0200 (Wed, 08 Apr 2009)
New Revision: 51
Modified:
webflysuesk/branches/openlayers-integration/ChangeLog.txt
webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/DrawMarker.js
webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/InteractiveRangeSelection.js
Log:
Bugfix: markers are only drawn when the tool is activated.
Modified: webflysuesk/branches/openlayers-integration/ChangeLog.txt
===================================================================
--- webflysuesk/branches/openlayers-integration/ChangeLog.txt 2009-04-08 10:59:21 UTC (rev 50)
+++ webflysuesk/branches/openlayers-integration/ChangeLog.txt 2009-04-08 13:59:47 UTC (rev 51)
@@ -1,5 +1,12 @@
2009-04-08 Ingo Weinzierl <ingo.weinzierl at intevation.de>
+
+ * webflys/src/main/webapp/pages/DrawMarker.js,
+ webflys/src/main/webapp/pages/InteractiveRangeSelection.js: Bugfix:
+ markers will be drawn only after the user has activated the tool in the
+ toolbar.
+2009-04-08 Ingo Weinzierl <ingo.weinzierl at intevation.de>
+
* webflys/src/main/webapp/pages/main.jsp: JavaScript lib included.
From and To textfields have now an styleId attribute which is rendered to
an id tag in html.
Modified: webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/DrawMarker.js
===================================================================
--- webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/DrawMarker.js 2009-04-08 10:59:21 UTC (rev 50)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/DrawMarker.js 2009-04-08 13:59:47 UTC (rev 51)
@@ -24,6 +24,12 @@
layer: null,
/**
+ * Property: callbacks
+ * {Object} The function that are sent to the handler for callback
+ */
+ callbacks: null,
+
+ /**
* Property: size
* {Double}
*/
@@ -48,6 +54,12 @@
icon: null,
/**
+ * Property: maxCount
+ * {Number}
+ */
+ maxCount: 100,
+
+ /**
* Constant: EVENT_TYPES
*
* Supported event types:
@@ -77,6 +89,8 @@
this.icon = new OpenLayers.Icon(this.url, this.size, this.offset);
this.maxCount = options.maxCount;
+ OpenLayers.Util.extend(this, options);
+
// events
this.EVENT_TYPES = DrawMarker.prototype.EVENT_TYPES.concat(
OpenLayers.Control.prototype.EVENT_TYPES);
@@ -85,9 +99,18 @@
this.callbacks = OpenLayers.Util.extend({
done: this.addMarker,
});
-
- // add an event listener when clicking on the map
- this.layer.map.events.register('click', this, this.onClick);
+
+ this.handler = new OpenLayers.Handler.Click(
+ this,
+ { 'click': this.onClick },
+ {
+ 'single': true,
+ 'double': false,
+ 'pixelTolerance': 0,
+ 'stopSingle': false,
+ 'stopDouble': true
+ }
+ );
},
@@ -115,18 +138,18 @@
// call markerAdded function now
this.markerAdded(marker);
+ this.events.triggerEvent("markeradded", {marker: marker});
},
+
/**
- * Method onClick
+ * Method: onClick
*
* Parameters:
- * e - Event
+ * evt - {Event}
*/
- onClick: function(e) {
- // TODO Check if this tool is activated
- var lonlat = map.getLonLatFromPixel(e.xy);
- this.addMarker(lonlat);
+ onClick: function(evt) {
+ this.addMarker(this.map.getLonLatFromPixel(evt.xy));
},
CLASS_NAME: "DrawMarker"
Modified: webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/InteractiveRangeSelection.js
===================================================================
--- webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/InteractiveRangeSelection.js 2009-04-08 10:59:21 UTC (rev 50)
+++ webflysuesk/branches/openlayers-integration/webflys/src/main/webapp/pages/InteractiveRangeSelection.js 2009-04-08 13:59:47 UTC (rev 51)
@@ -24,14 +24,16 @@
var options = {
title: "Interaktive Streckenauswahl",
- handlerOptions: { freehand: false, multi: false },
maxCount: 2
//displayClass: 'olControlDrawMarker'
};
- tool = new DrawMarker(markerLayer, options);
+ tool = new DrawMarker(
+ markerLayer,
+ options
+ );
tool.markerAdded = changeMarkerPosition;
-
+
// add the new tool to the toolpanel
panel.addControls([tool]);
}
More information about the Webflysuesk-commits
mailing list