Hi, I didn't have a patch. The only thing I have is a new handler and a new control.
I can send you that code, if you want and you can include and test it. Thanks, André Matos http://maps.sapo.pt -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Joel Tremblet Sent: sábado, 24 de Janeiro de 2009 21:00 To: [email protected] Subject: Re: [OpenLayers-Dev] New DragFeature Control and SelectFeatureControl cross layers. Want to share I'm interested to test your code to select a layer.GML witch contain markers. I have 2 layers of markers but only one layer can be selected by [CODE] selectControl = new OpenLayers.Control.SelectFeature(map.layers[1], {onSelect: onFeatureSelect, onUnselect: onFeatureUnselect}); {/CODE] In which folder I must to download your patch Thanks Andre Pereira de Matos wrote: > > Forgot the code, sorry. > > Best Regards, > André Matos > http://maps.sapo.pt > > > -----Original Message----- > From: Andre Pereira de Matos > Sent: sexta-feira, 16 de Janeiro de 2009 11:02 > To: 'Andreas Hocevar' > Cc: [email protected]; [email protected] > Subject: RE: [OpenLayers-Dev] New DragFeature Control and > SelectFeatureControl cross layers. Want to share > > Hi, > > I sent the code and a short explanation to OpenLayers dev and users... > > I didn't see your code yet... But I promise that I will. > Thanks for sharing ;) > > Here is the mail, that I sent: > > I have done controls and handlers to handle events in features that are in > different layers (with OpenLayers controls you only can handle events in a > single layer, and that layer must be on the top), and as I received on > mail requests to share my code, I decided to send it for the list. With an > explanation how it works. > > > > Actually I made two controls, FeatureEventHandlerControl and > DragFeatureControl and an handler (FeatureHandler) to help the > FeatureEventHandlerControl. > > This two controls works pretty like the SelectFeature and DragFeature > OpenLayers controls, but they work cross layers. They don't care about the > layers. When you want to get an event from a feature, you must register > that feature on the control, and when that event occurres you will be > notified. > > For example: > > ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// > > Var dragControl = new Sapo.Control.DragFeatureControl([], { > > 'dragstart': { callback: function(feacture, pixel){/*do something*/} > context: this} > 'drag': { > callback: function(feacture, pixel){/*do something*/} context: this} > 'dragend': { callback: function(feacture, pixel){/*do something*/} > context: this} > } > ); > Var featureEvtHandler = new Sapo.Control.FeatureEventHandlers([], { > > 'click': { callback: function(feacture, pixel){/*do something*/} context: > this} > > 'mouseover': { callback: function(feacture, pixel){/*do something*/} > context: this} > > 'mouseout': { callback: function(feacture, pixel){/*do something*/} > context: this} > } > ); > > Map.addControl(dragControl); > Map.addControl(featureEvtHandler); > > dragControl.activate(); > featureEvtHandler.activate(); > > Var layer1 = new OpenLayers.Layer.Vector("Markers", > { > projection: new > OpenLayers.Projection("EPSG:4326"), > styleMap: new > OpenLayers.StyleMap({ > > externalGraphic: "http://openlayers.org/dev/img/marker-gold.png", > > backgroundGraphic: "http://openlayers.org/dev/examples/marker_shadow.png", > graphicYOffset: > -20, > > backgroundXOffset: 0, > > backgroundYOffset: -17, > pointRadius: 10 > }) > > } > ); > > Var layer2 = new OpenLayers.Layer.Vector("Markers 2", > { > projection: new > OpenLayers.Projection("EPSG:4326"), > styleMap: new > OpenLayers.StyleMap({ > > externalGraphic: "http://openlayers.org/dev/img/marker-gold.png", > > backgroundGraphic: "http://openlayers.org/dev/examples/marker_shadow.png", > graphicYOffset: > -20, > > backgroundXOffset: 0, > > backgroundYOffset: -17, > pointRadius: 10 > }) > > } > ); > > Map.addLayer(layer1); > Map.addLayer(layer2); > > Var feature1 = new OpenLayers.Feature.Vector(new > OpenLayers.Geometry.Point(-1904105.3415234375, 4392319.753066596)); Var > feature2 = new OpenLayers.Feature.Vector(new > OpenLayers.Geometry.Point(-1504105.3415234375, 4392319.753066596)); > > Layer1.addFeatures([feature1]); > Layer2.addFeatures([feature2]); > > dragControl.addFeature(feature1); > featureEvtHandler.addFeature(feature2); > > ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// > > When occurs an event(dragstart, drag, dragend, click, mouseover, mouseout) > in any of this features, in different layers, the callbacks will be > notified. > > If you have any questions just ask us (André or João)! > > Regards, > André Matos > http://maps.sapo.pt > > > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On > Behalf Of Andreas Hocevar > Sent: quinta-feira, 15 de Janeiro de 2009 15:11 > To: Andre Pereira de Matos > Cc: [email protected]; [email protected] > Subject: Re: [OpenLayers-Dev] New DragFeature Control and > SelectFeatureControl cross layers. Want to share > > Hi Andre, > > 2009/1/13 Andre Pereira de Matos <[email protected]>: >> I have made a Project with openlayers, and at some point I had to make a >> new >> handler and a new control to provide draggable feature and handle events >> like, click, mouseover, mouseout in features that was in different >> layers. >> >> The Openlayers control (DragFeature, SelectFeature) and handlers (Drag, >> Feature) only works if the features are all in the same layer and the >> layer >> is on the top. > > I have no experience with the DragFeature control, but I have created > a solution for feature selection that works with multiple layers > recently [1]. An example is also avaialable [2]. > > You may want to check this out, and I'd be interested to see your > approach. Also, it would be cool to see if my approach also works with > the DragFeature control. > > Regards, > Andreas. > > [1] http://trac.openlayers.org/ticket/1666 > [2] > http://dev.openlayers.org/sandbox/ahocevar/singleroot/openlayers/examples/select-feature-multilayer.html > > -- > Andreas Hocevar > OpenGeo - http://opengeo.org/ > Expert service straight from the developers. > > > _______________________________________________ > Dev mailing list > [email protected] > http://openlayers.org/mailman/listinfo/dev > > -- View this message in context: http://n2.nabble.com/New-DragFeature-Control-and-SelectFeatureControl-cross-layers.-Want-to-share-tp2152758p2210540.html Sent from the OpenLayers Dev mailing list archive at Nabble.com. _______________________________________________ Dev mailing list [email protected] http://openlayers.org/mailman/listinfo/dev
Controls.rar
Description: Controls.rar
_______________________________________________ Dev mailing list [email protected] http://openlayers.org/mailman/listinfo/dev
