Thanks Robert, unfortunately that does not help. I am interested in capturing the event so I know when the user has modified a feature and I can then use the GML.
I am caught in a spiral of problems. I should really be using the afterfeaturemodified event on the layer but this does not work probably because I am using styles on my layer. I get a CLASS_NAME error that I cannot debug. I posted a message on the list but no reply and I see nothing about it in the forum. I seem to be navigating in unmapped territory... Thanks for the effort! -- George Follow me: http://twitter.com/geo_twit On Wed, 27 May 2009 Robert Sanson <[email protected]> wrote: > Hi George > > Here is how I specify the controls: > > //Select, Draw and Modify controls - these are specific to the layer > controls = { > select: new OpenLayers.Control.SelectFeature(crops, > {callbacks: {'over':feature_info}}), > dpolygon: new > OpenLayers.Control.DrawFeature(crops,OpenLayers.Handler.Polygon), > modify: new OpenLayers.Control.ModifyFeature(crops), > delf: new OpenLayers.Control.SelectFeature(crops, > {onSelect: function(feature) {crops.destroyFeatures([feature])}}) > //delf: new OpenLayers.Control.SelectFeature(crops, > {onSelect: function(feature) > {feature.geometry.destroy();crops.eraseFeatures([feature])}}) > }; > for(var key in controls) { > map.addControl(controls[key]); > } > > Then I have a function that responds to radio buttons in a div > outside the map that sets the mode and activates or deactivates the > controls: > > function toggleControl(element) { > mode = element.value; > OpenLayers.Util.getElement('comments').innerHTML = > "Mode:" + mode; > if ((mode == "select") || (mode == "modify")){ > crop_style.strokeColor = "#0000ff"; > } > else { > crop_style.strokeColor = "#ff0000"; > } > for(key in controls) { > var control = controls[key]; > if(element.value == key && element.checked) { > control.activate(); > } else { > control.deactivate(); > } > } > crops.onFeatureInsert = function(feature) { > feature.attributes.prop0 = 'new'; //This should be > modified to get actual ID > alert("New crop area inserted"); > } > } > > Hope that helps. > > Robert S >>>> Geo-rge <[email protected]> 28/05/2009 8:41 a.m. >>> > > Dear List, > > I am having trouble trying to capture events when the ModifyFeature control > is activated and deactivated. > > I define my control as such: > > modify = new > OpenLayers.Control.ModifyFeature(lyrPlanning,{'displayClass': > 'olControlModifyFeature', > 'mode': OpenLayers.Control.ModifyFeature.RESHAPE | > OpenLayers.Control.ModifyFeature.DRAG | > OpenLayers.Control.ModifyFeature.ROTATE}); > > I try to register the event like this: > modify.events.register('deactivate',modify,modify_deactivated); > > this last line causes a syntax error! > > I had already defined > function modify_deactivated() {alert('!');}" > > I have that feeling that I am doing something so silly I will never get it. > Appreciate any help > > George Mu'ammar > -- > View this message in context: > http://n2.nabble.com/Control-activate-and-deactivate-events-tp2983592p2983592.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users > > ------------------------------------------------------------------ > The contents of this email are confidential to AsureQuality. If you > have received this communication in error please notify the sender > immediately and delete the message and any attachments. The opinions > expressed in this email are not necessarily those of AsureQuality. > This message has been scanned for known viruses before delivery. > AsureQuality supports the Unsolicited Electronic Messages Act 2007. > If you do not wish to receive similar communications in future, > please notify the sender of this message. > ------------------------------------------------------------------ > > > This message has been scanned for malware by SurfControl plc. > www.surfcontrol.com > _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
