From: Alexandre A. S. <aas...@gm...> - 2011-05-12 14:50:49
|
Hi Lukas, Thank you very much for your help. It works great for me using var layers= new $wnd.Array(); though you're right and it works properly in Chrome but no in FF4. I'was making some tests and no way... As it's a problem that I also have to face if I found any workaround I'll write you and please if you find it, let me know. Cheers, Alex. ________________________________________ De: Lukas Johansson [luk...@de...] Enviado el: jueves, 12 de mayo de 2011 13:16 Para: Alexandre Ascasibar Sequeiros; gwt...@li... Asunto: SV: Select feature in multiple layer I've been banging my head against the same problem for quite some time. I think that the problem is related to var selectControl = new $wnd.OpenLayers.Control.SelectFeature( [vectors1, vectors2], .... Where you create an array with just []. I think that Alexander Solovets might be able to explain this better but it has to do with the context where the array is created. For it to exist in the webbpages' window (as in a plain javascriptapplication) you need to do: Array = new $wnd.Array() and the populate this array. I am not sure if $wnd.[] would work but I doubt it. That said I have tracked my own problems (arrays not working properly in firefox 4) to the same line of code where you are (creating the SelectFeature) and I haven't yet got it to work. /Lukas -----Ursprungligt meddelande----- Från: Alexandre Ascasibar Sequeiros [mailto:aas...@gm...] Skickat: den 12 maj 2011 12:42 Till: gwt...@li... Ämne: Re: [Gwt-openlayers-users] Select feature in multiple layer Hi again, I'm trying to solve the multilayer issue using JSNI calling the function above: public static native void selectableAllLayers(JSObject map) /*-{ var vectors1 = new $wnd.OpenLayers.Layer.Vector("Vector Layer 1", { styleMap: new $wnd.OpenLayers.StyleMap({ "default": new $wnd.OpenLayers.Style($wnd.OpenLayers.Util.applyDefaults({ graphicOpacity: 1, rotation: -45, pointRadius: 10 }, $wnd.OpenLayers.Feature.Vector.style["default"])), "select": new $wnd.OpenLayers.Style({ }) }) }); var vectors2 = new $wnd.OpenLayers.Layer.Vector("Vector Layer 2", { styleMap: new $wnd.OpenLayers.StyleMap({ "default": new $wnd.OpenLayers.Style($wnd.OpenLayers.Util.applyDefaults({ fillColor: "red", strokeColor: "gray", graphicName: "square", rotation: 45, pointRadius: 15 }, $wnd.OpenLayers.Feature.Vector.style["default"])), "select": new $wnd.OpenLayers.Style($wnd.OpenLayers.Util.applyDefaults({ graphicName: "square", rotation: 45, pointRadius: 15 }, $wnd.OpenLayers.Feature.Vector.style["select"])) }) }); map.addLayers([vectors1, vectors2]); var selectControl = new $wnd.OpenLayers.Control.SelectFeature( [vectors1, vectors2], { clickout: true, toggle: false, multiple: false, hover: false, toggleKey: "ctrlKey", // ctrl key removes from selection multipleKey: "shiftKey" // shift key adds to selection } ); map.addControl(selectControl); selectControl.activate(); }-*/; But I received the next error: "(TypeError): Object [object Object],[object Object] has no method 'getZIndex' stack: TypeError: Object [object Object],[object Object] has no method 'getZIndex' at Object.moveLayerToTop (http://myurl) at Object.activate (http://myurl) at Object.activate (myurl) at ..." The thing is if I change the code and write SelectFeature for just one layer, it works: var selectControl = new $wnd.OpenLayers.Control.SelectFeature(vectors1, {.... but using an array doesn't work, Please, does anyone know what's the problem? Thanks in advance, Alex. ________________________________________ De: Alexandre Ascasibar Sequeiros [aas...@gm...] Enviado el: martes, 10 de mayo de 2011 13:46 Para: gwt...@li... Asunto: [Gwt-openlayers-users] Select feature in multiple layer Hi all, I'm trying to enable Select feature in multiple layers at the same time. I tried to extend SelectFeatureImpl adding the method: public static native JSObject create(JSObject layer1, JSObject layer2, JSObject options)/*-{ return new $wnd.OpenLayers.Control.SelectFeature([layer1, layer2], options); }-*/; but it doesn't work. Any one know how to handle this? Thank in advance, Alex. ______________________ This message including any attachments may contain confidential information, according to our Information Security Management System, and intended solely for a specific individual to whom they are addressed. Any unauthorised copy, disclosure or distribution of this message is strictly forbidden. If you have received this transmission in error, please notify the sender immediately and delete it. ______________________ Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener informacion clasificada por su emisor como confidencial en el marco de su Sistema de Gestion de Seguridad de la Informacion siendo para uso exclusivo del destinatario, quedando prohibida su divulgacion copia o distribucion a terceros sin la autorizacion expresa del remitente. Si Vd. ha recibido este mensaje erroneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboracion. ______________________ ------------------------------------------------------------------------------ Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Gwt-openlayers-users mailing list Gwt...@li... https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users ______________________ This message including any attachments may contain confidential information, according to our Information Security Management System, and intended solely for a specific individual to whom they are addressed. Any unauthorised copy, disclosure or distribution of this message is strictly forbidden. If you have received this transmission in error, please notify the sender immediately and delete it. ______________________ Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener informacion clasificada por su emisor como confidencial en el marco de su Sistema de Gestion de Seguridad de la Informacion siendo para uso exclusivo del destinatario, quedando prohibida su divulgacion copia o distribucion a terceros sin la autorizacion expresa del remitente. Si Vd. ha recibido este mensaje erroneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboracion. ______________________ ------------------------------------------------------------------------------ Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Gwt-openlayers-users mailing list Gwt...@li... https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users ______________________ This message including any attachments may contain confidential information, according to our Information Security Management System, and intended solely for a specific individual to whom they are addressed. Any unauthorised copy, disclosure or distribution of this message is strictly forbidden. If you have received this transmission in error, please notify the sender immediately and delete it. ______________________ Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener informacion clasificada por su emisor como confidencial en el marco de su Sistema de Gestion de Seguridad de la Informacion siendo para uso exclusivo del destinatario, quedando prohibida su divulgacion copia o distribucion a terceros sin la autorizacion expresa del remitente. Si Vd. ha recibido este mensaje erroneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboracion. ______________________ |