- initialize: function(noteLayer, options) {
- this.noteLayer = noteLayer;
-
- this.title = i18n("javascripts.note.create");
-
- OpenLayers.Control.prototype.initialize.apply(this, [ options ]);
-
- this.events.register("activate", this, function() {
- if(!this.noteLayer.getVisibility())
- this.noteLayer.setVisibility(true);
- });
-
- this.noteLayer.events.register("visibilitychanged", this, function() {
- if(this.active && !this.noteLayer.getVisibility())
- this.noteLayer.setVisibility(true);
- });
- },
-
- destroy: function() {
- if (this.handler)
- this.handler.destroy();
- this.handler = null;
-
- OpenLayers.Control.prototype.destroy.apply(this, arguments);
- },
-
- draw: function() {
- this.handler = new OpenLayers.Handler.Click(this, {'click': this.click}, { 'single': true, 'double': false, 'pixelTolerance': 0, 'stopSingle': false, 'stopDouble': false });
- },
-
- /**
- * Map clicking event handler. Adds a temporary marker with a
- * popup to the map, the popup contains the form to add a note.
- */
- click: function(e) {
- var lonlat = this.map.getLonLatFromViewPortPx(e.xy);
- this.addTemporaryMarker(lonlat);
- },
-
- addTemporaryMarker: function(lonlat) {
- if(!this.map) return true;
-
- var control = this;
- var map = control.map;
- var lonlatApi = lonlat.clone().transform(map.getProjectionObject(), this.noteLayer.apiProjection);
- var feature = new OpenLayers.Feature(this.noteLayer, lonlat, { icon: this.icon.clone(), autoSize: true });
+ addNote: function(lonlat) {
+ var layer = this;
+ var map = this.map;
+ var lonlatApi = lonlat.clone().transform(map.getProjectionObject(), this.apiProjection);
+ var feature = new OpenLayers.Feature(this, lonlat, { icon: this.iconNew.clone(), autoSize: true });