[OpenLayers-Dev] switch 1 layer on and at the same time, switch another layer off

Boer, dr. W.M. de (Thijs) W.M.dBoer at minlnv.nl
Wed May 11 03:41:24 EDT 2011


Hello list,

In an OL application I would like to switch 1 layer on and at the same time, switch another layer off (in the layerswitcher panel).
Both layers are overlays. So the on/off of these two layers are connected as it were. Is this possible and if so, has anyone a bit of code for it ?

Kind regards

Thijs de Boer
........................................................................
GIS Competence Center
Dienst Landelijk Gebied
Ministerie van Economische Zaken, Landbouw & Innovatie
Postbus 20021 | 3502 LA | Utrecht


-----Oorspronkelijk bericht-----
Van: openlayers-dev-bounces at lists.osgeo.org [mailto:openlayers-dev-bounces at lists.osgeo.org] Namens openlayers-dev-request at lists.osgeo.org
Verzonden: dinsdag 10 mei 2011 16:01
Aan: openlayers-dev at lists.osgeo.org
Onderwerp: Dev Digest, Vol 56, Issue 8

Send Dev mailing list submissions to
        openlayers-dev at lists.osgeo.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.osgeo.org/mailman/listinfo/openlayers-dev
or, via email, send a message with subject or body 'help' to
        openlayers-dev-request at lists.osgeo.org

You can reach the person managing the list at
        openlayers-dev-owner at lists.osgeo.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of Dev digest..."


Today's Topics:

   1. OpenLayers and GeoCouch (Dipl. Inf. Carsten Eider)
   2. SelectFeature and last/prevHighlighter (Slawomir Messner)
   3. Re: OpenLayers & Sencha Touch Ext.Panel (lapinos03)
   4. Re: SelectFeature and last/prevHighlighter (Eric Lemoine)
   5. Re: OpenLayers & Sencha Touch Ext.Panel (Eric Lemoine)
   6. Re: OpenLayers & Sencha Touch Ext.Panel (Eric Lemoine)
   7. Re: OpenLayers & Sencha Touch Ext.Panel (Eric Lemoine)
   8. Re: SelectFeature and last/prevHighlighter (Slawomir Messner)


----------------------------------------------------------------------

Message: 1
Date: Mon, 09 May 2011 11:36:17 +0200
From: "Dipl. Inf. Carsten Eider" <eider at fh-bingen.de>
Subject: [OpenLayers-Dev] OpenLayers and GeoCouch
To: "openlayers-dev at lists.osgeo.org" <openlayers-dev at lists.osgeo.org>
Message-ID: <4DC7B591.9050008 at fh-bingen.de>
Content-Type: text/plain; charset="iso-8859-15"

Hi folks,

has anyone ever heard of geocouch(https://github.com/couchbase/geocouch)
or even developed an application with openlayers based on it?

TIA Carsten

--
Mit freundlichen Gr??en / Yours faithfully Carsten Eider

Dipl. Inf. (FH)

Kompetenzzentrum f?r Innovative Informationssysteme

c/o Fachhochschule Bingen / University of applied sciences Bingen

Berlinstra?e 109
55411 Bingen

Tel: +49 (0) 6721 / 409-179
Fax: +49 (0) 6721 / 994-251
email: eider at fh-bingen.de
Internet: iis.fh-bingen.de

Diese E-Mail, inklusive anh?ngender Dateien, kann vertrauliche und/oder rechtlich gesch?tzte Inhalte enthalten.
Wenn Sie nicht der richtige Adressat sind und diese E-Mail irrt?mlich erhalten haben, benachrichtigen Sie bitte sofort den Absender und vernichten Sie sodann die Originalnachricht.
Die unbefugte Kopie, Weiterleitung oder sonstige Verbreitung dieser Nachricht ist nicht gestattet.

This e-mail, including attachments, may contain confidential and/or privileged information.
If you are not the intended recipient, please notify the sender immediately then delete the original message.
Any copying forwarding and/or distribution without permission of the sender is forbidden.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: eider.vcf
Type: text/x-vcard
Size: 1142 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110509/e85ace19/eider-0001.vcf

------------------------------

Message: 2
Date: Mon, 09 May 2011 14:52:10 +0200
From: Slawomir Messner <slawomir.messner at staff.uni-marburg.de>
Subject: [OpenLayers-Dev] SelectFeature and last/prevHighlighter
Cc: "openlayers-dev at lists.osgeo.org" <openlayers-dev at lists.osgeo.org>
Message-ID: <4DC7E37A.2050807 at staff.uni-marburg.de>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed

Hi,
I have a question. In the unhighlight function if another SelectFeature was the prevHighlighter it is set to the lastHighlighter but then the feature is simply redraw with it's own style/layer style or default renderIntent. Shouldn't this be only in the first to cases of the if-stmt? in the third like in outFeature that the highlight of the "new"
lastHighlighter is used?
Here the code I'm talking about(Without the comments in it):

     unhighlight: function(feature) {
         var layer = feature.layer;
         if(feature._prevHighlighter == undefined) {
             delete feature._lastHighlighter;
         } else if(feature._prevHighlighter == this.id) {
             delete feature._prevHighlighter;
         } else {
             feature._lastHighlighter = feature._prevHighlighter;
             delete feature._prevHighlighter;
         }
          layer.drawFeature(feature, feature.style || feature.layer.style ||
                 "default");
         this.events.triggerEvent("featureunhighlighted", {feature :
feature});
     },

Now how I think it should be:

unhighlight: function(feature) {
         var layer = feature.layer;
     var newHighlighter = null;
         if(feature._prevHighlighter == undefined) {
             delete feature._lastHighlighter;
         } else if(feature._prevHighlighter == this.id) {
             delete feature._prevHighlighter;
         } else {
             feature._lastHighlighter = feature._prevHighlighter;
             delete feature._prevHighlighter;
             newHighlighter = this.map.getControl(feature._lastHighlighter);
         }
         if(newHighlighter != null) {
             newHighlighter.highlight(feature);
         } else {
             layer.drawFeature(feature, feature.style || feature.layer.style ||
                 "default");
             this.events.triggerEvent("featureunhighlighted", {feature :
feature});
         }
},
When I look at the code of highlight the "featureunhighlighted" should always thrown to a symmetric behavior of un-/highlight or the "featurehighlighted" event should only be triggered in the highlight when there was no _lastHighlighter.
Regards
Slawomir


------------------------------

Message: 3
Date: Mon, 9 May 2011 07:03:10 -0700 (PDT)
From: lapinos03 <lapinos03 at free.fr>
Subject: [OpenLayers-Dev] Re: OpenLayers & Sencha Touch Ext.Panel
To: dev at openlayers.org
Message-ID: <1304949790286-6344332.post at n2.nabble.com>
Content-Type: text/plain; charset=UTF-8

Hi there !

This is not a Sencha conflict because I experience the same problem with my website (desktop version) shown on the iPad 1 and I don't use Sencha at all (only jquery). At very rare occasion, I had this phenomenum on Firefox 3.6 as well and on somebody else's website. We both used OL 2.10. I'm glad that it happens with the official Sencha example because I thought first I may have done some wrong programming with OL.

I have already spent a lot of time trying to fix this. Unsuccessfully so far. For me it's a critical bug. I'd like to develop a webapp instead of a native app, using OL and reuse almost all what i've done for the desktop version. Also I'd like to use the Sencha framework.

This bug is reproductible on the iOS Simulator (choose iOS 3.2 in the settings of Dashcode to simulate the iPad).

What happens exactly?
First click on the layer button, bottom right of the screen (or the Search box, bottom-left button). A panel pops up, with a black translucent background. At that time, you can notice that the map is redrawing. After that (and only after that), during a dragging process, every time a new tile is loaded and displayed, the map seems to jump back for a quick time to the starting point of the dragging. I have also noticed that sometimes, tiles on the right border are stretched as if the first column of pixels is repeated along the horizontal axis. Moreover, since version 2.11 (from the trunk), the map shakes around the current position while being dragged. Also noticed on iOS Simulator (choose iOS 4.3 in Dashcode - simulates iPhone 4), the map flickers after all tiles seem to be loaded (not always, rather after a zoom-in).

I ported the mobile-sencha.html example to Dashcode in order debug step by step in the iOS environment. I put a lot of breakpoints in Layer.js, Grid.js, Image.js, etc??? So far, nothing found. When you put a transparent <div> on top of the map, does the map receive an event? Which one? Which handler?

Digging into OL and trying to understand how the whole stuff works is quite difficult to me. So if somebody is willing to help and guide me through the debugging process, I am ready to spend more time.

Kind Regards,
/Pascal

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/OpenLayers-Sencha-Touch-Ext-Panel-tp6228284p6344332.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.


------------------------------

Message: 4
Date: Mon, 9 May 2011 18:03:29 +0200
From: Eric Lemoine <eric.lemoine at camptocamp.com>
Subject: Re: [OpenLayers-Dev] SelectFeature and last/prevHighlighter
To: Slawomir Messner <slawomir.messner at staff.uni-marburg.de>
Cc: "openlayers-dev at lists.osgeo.org" <openlayers-dev at lists.osgeo.org>
Message-ID: <BANLkTinDtVNYzJgA5eq7q0zmWL48rWpC0Q at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Monday, May 9, 2011, Slawomir Messner <slawomir.messner at staff.uni-marburg.de> wrote:
> Hi,
> I have a question. In the unhighlight function if another SelectFeature was the prevHighlighter it is set to the lastHighlighter but then the feature is simply redraw with it's own style/layer style or default renderIntent. Shouldn't this be only in the first to cases of the if-stmt? in the third like in outFeature that the highlight of the "new" lastHighlighter is used?
> Here the code I'm talking about(Without the comments in it):
>
>  ? ?unhighlight: function(feature) {
>  ? ? ? ?var layer = feature.layer;
>  ? ? ? ?if(feature._prevHighlighter == undefined) {  ? ? ? ? ? ?delete
> feature._lastHighlighter;  ? ? ? ?} else if(feature._prevHighlighter
> == this.id) {  ? ? ? ? ? ?delete feature._prevHighlighter;  ? ? ? ?}
> else {  ? ? ? ? ? ?feature._lastHighlighter =
> feature._prevHighlighter;  ? ? ? ? ? ?delete feature._prevHighlighter;
> ? ? ? ?}  ? ? ? ? layer.drawFeature(feature, feature.style ||
> feature.layer.style ||  ? ? ? ? ? ? ? ?"default");  ? ? ?
> ?this.events.triggerEvent("featureunhighlighted", {feature :
> feature});  ? ?},
>
> Now how I think it should be:
>
> unhighlight: function(feature) {
>  ? ? ? ?var layer = feature.layer;
>  ? ?var newHighlighter = null;
>  ? ? ? ?if(feature._prevHighlighter == undefined) {  ? ? ? ? ? ?delete
> feature._lastHighlighter;  ? ? ? ?} else if(feature._prevHighlighter
> == this.id) {  ? ? ? ? ? ?delete feature._prevHighlighter;  ? ? ? ?}
> else {  ? ? ? ? ? ?feature._lastHighlighter =
> feature._prevHighlighter;  ? ? ? ? ? ?delete feature._prevHighlighter;
> ? ? ? ? ? ?newHighlighter =
> this.map.getControl(feature._lastHighlighter);
>  ? ? ? ?}
>  ? ? ? ?if(newHighlighter != null) {
>  ? ? ? ? ? ?newHighlighter.highlight(feature);
>  ? ? ? ?} else {
>  ? ? ? ? ? ?layer.drawFeature(feature, feature.style ||
> feature.layer.style ||  ? ? ? ? ? ? ? ?"default");  ? ? ? ? ?
> ?this.events.triggerEvent("featureunhighlighted", {feature :
> feature});  ? ? ? ?} }, When I look at the code of highlight the
> "featureunhighlighted" should always thrown to a symmetric behavior of un-/highlight or the "featurehighlighted" event should only be triggered in the highlight when there was no _lastHighlighter.


Hi

I'd like to know your exact use-case (control1 does this, control2 does that, etc.). With that we should be able to write a test-case demonstrating that the current code doesn't behave as expected.

Thanks for your effort on that. It's not trivial code.

--
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


------------------------------

Message: 5
Date: Mon, 9 May 2011 18:09:22 +0200
From: Eric Lemoine <eric.lemoine at camptocamp.com>
Subject: Re: [OpenLayers-Dev] OpenLayers & Sencha Touch Ext.Panel
To: lapinos03 <lapinos03 at free.fr>
Cc: "dev at openlayers.org" <dev at openlayers.org>
Message-ID: <BANLkTik0sQw3x4x9RD61qMcXcYRhi_iF4Q at mail.gmail.com>
Content-Type: text/plain; charset=windows-1252

On Monday, May 9, 2011, lapinos03 <lapinos03 at free.fr> wrote:
> Hi there !
>
> This is not a Sencha conflict because I experience the same problem
> with my website (desktop version) shown on the iPad 1 and I don't use
> Sencha at all (only jquery). At very rare occasion, I had this
> phenomenum on Firefox 3.6 as well and on somebody else's website. We
> both used OL 2.10. I'm glad that it happens with the official Sencha
> example because I thought first I may have done some wrong programming with OL.
>
> I have already spent a lot of time trying to fix this. Unsuccessfully
> so far. For me it's a critical bug. I'd like to develop a webapp
> instead of a native app, using OL and reuse almost all what i've done
> for the desktop version. Also I'd like to use the Sencha framework.
>
> This bug is reproductible on the iOS Simulator (choose iOS 3.2 in the
> settings of Dashcode to simulate the iPad).
>
> What happens exactly?
> First click on the layer button, bottom right of the screen (or the
> Search box, bottom-left button). A panel pops up, with a black
> translucent background. At that time, you can notice that the map is
> redrawing. After that (and only after that), during a dragging
> process, every time a new tile is loaded and displayed, the map seems
> to jump back for a quick time to the starting point of the dragging. I
> have also noticed that sometimes, tiles on the right border are
> stretched as if the first column of pixels is repeated along the
> horizontal axis. Moreover, since version 2.11 (from the trunk), the
> map shakes around the current position while being dragged. Also
> noticed on iOS Simulator (choose iOS 4.3 in Dashcode - simulates
> iPhone 4), the map flickers after all tiles seem to be loaded (not always, rather after a zoom-in).
>
> I ported the mobile-sencha.html example to Dashcode in order debug
> step by step in the iOS environment. I put a lot of breakpoints in
> Layer.js, Grid.js, Image.js, etc? So far, nothing found. When you put
> a transparent <div> on top of the map, does the map receive an event?
> Which one? Which handler?
>
> Digging into OL and trying to understand how the whole stuff works is
> quite difficult to me. So if somebody is willing to help and guide me
> through the debugging process, I am ready to spend more time.

Creating a minimal example without Sencha Touch involved would help a lot.

--
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


------------------------------

Message: 6
Date: Mon, 9 May 2011 18:20:27 +0200
From: Eric Lemoine <eric.lemoine at camptocamp.com>
Subject: Re: [OpenLayers-Dev] OpenLayers & Sencha Touch Ext.Panel
To: C?dric MOULLET <cedric.moullet at gmail.com>
Cc: "<dev at openlayers.org>" <dev at openlayers.org>
Message-ID: <BANLkTimtqijJgduvp04W=rrXbDi-Kyt_1g at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Thursday, March 31, 2011, C?dric MOULLET <cedric.moullet at gmail.com> wrote:
> Hi Devs,
> The example http://openlayers.org/dev/examples/mobile-sencha.html is using a SelectFeature control launching an Ext,Panel.
> On iPad, for example, the map navigation seems to be disturbed after the launch of an Ext.Panel (so after the selection of one feature). Navigation is still working, but pan or pinch makes some kind of jump and is not fluent anymore.
> Do you see any reason for that ? Which OpenLayers behaviour could be influenced by Sencha Touch ? I would really appreciate any kinds of hints in order to be able to investigate further.

I think I'm observing the same in iPhone. At this point I don't what's going on. Does the example destroy on the popup after "touchout"
(sorry I don't the example code handy).

--
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


------------------------------

Message: 7
Date: Mon, 9 May 2011 18:24:32 +0200
From: Eric Lemoine <eric.lemoine at camptocamp.com>
Subject: Re: [OpenLayers-Dev] OpenLayers & Sencha Touch Ext.Panel
To: C?dric MOULLET <cedric.moullet at gmail.com>
Cc: "<dev at openlayers.org>" <dev at openlayers.org>
Message-ID: <BANLkTik2qos0+PYuBA8XGCR8=0VJNHRxbw at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Monday, May 9, 2011, Eric Lemoine <eric.lemoine at camptocamp.com> wrote:
> On Thursday, March 31, 2011, C?dric MOULLET <cedric.moullet at gmail.com> wrote:
>> Hi Devs,
>> The example http://openlayers.org/dev/examples/mobile-sencha.html is using a SelectFeature control launching an Ext,Panel.
>> On iPad, for example, the map navigation seems to be disturbed after the launch of an Ext.Panel (so after the selection of one feature). Navigation is still working, but pan or pinch makes some kind of jump and is not fluent anymore.
>> Do you see any reason for that ? Which OpenLayers behaviour could be influenced by Sencha Touch ? I would really appreciate any kinds of hints in order to be able to investigate further.
>
> I think I'm observing the same in iPhone. At this point I don't what's
> going on. Does the example destroy on the popup after "touchout"
> (sorry I don't the example code handy).


Let me rephrase that (end of the day!):

I think I'm observing the same in my iPhone. At this point I don't know what's going on. Does the example destroy the popup after touching te map to unselect the feature? (sorry I don't have the example code handy).



--
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


------------------------------

Message: 8
Date: Tue, 10 May 2011 07:20:22 +0200
From: Slawomir Messner <slawomir.messner at staff.uni-marburg.de>
Subject: Re: [OpenLayers-Dev] SelectFeature and last/prevHighlighter
Cc: "openlayers-dev at lists.osgeo.org" <openlayers-dev at lists.osgeo.org>
Message-ID: <4DC8CB16.6000304 at staff.uni-marburg.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi,
the use-case is that we have two SelectFeature controls. One for selecting features to know to which feature add attributes the other one for highlighting features that already have certain attributes. So if you select some features and then highlight some features to see which one has an attribute then you unhighlight them to un-/select or assign some attributes the selection disappears. Selecting happens by clicking or a box, un-/highlight by hover over a row of a table ("legend").
And, if I remember correct, the selected features are still in selectedFeatures attribute of the layer. This leads, in best case, to a is confused user when some of the former selected features are not selected again and then attributes are assigned.
We have to thank you for the effort you all put into the project.
Regards
Slawomir

Am 09.05.2011 18:03, schrieb Eric Lemoine:
> On Monday, May 9, 2011, Slawomir Messner
> <slawomir.messner at staff.uni-marburg.de>  wrote:
>> Hi,
>> I have a question. In the unhighlight function if another SelectFeature was the prevHighlighter it is set to the lastHighlighter but then the feature is simply redraw with it's own style/layer style or default renderIntent. Shouldn't this be only in the first to cases of the if-stmt? in the third like in outFeature that the highlight of the "new" lastHighlighter is used?
>> Here the code I'm talking about(Without the comments in it):
>>
>>      unhighlight: function(feature) {
>>          var layer = feature.layer;
>>          if(feature._prevHighlighter == undefined) {
>>              delete feature._lastHighlighter;
>>          } else if(feature._prevHighlighter == this.id) {
>>              delete feature._prevHighlighter;
>>          } else {
>>              feature._lastHighlighter = feature._prevHighlighter;
>>              delete feature._prevHighlighter;
>>          }
>>           layer.drawFeature(feature, feature.style || feature.layer.style ||
>>                  "default");
>>          this.events.triggerEvent("featureunhighlighted", {feature : feature});
>>      },
>>
>> Now how I think it should be:
>>
>> unhighlight: function(feature) {
>>          var layer = feature.layer;
>>      var newHighlighter = null;
>>          if(feature._prevHighlighter == undefined) {
>>              delete feature._lastHighlighter;
>>          } else if(feature._prevHighlighter == this.id) {
>>              delete feature._prevHighlighter;
>>          } else {
>>              feature._lastHighlighter = feature._prevHighlighter;
>>              delete feature._prevHighlighter;
>>              newHighlighter = this.map.getControl(feature._lastHighlighter);
>>          }
>>          if(newHighlighter != null) {
>>              newHighlighter.highlight(feature);
>>          } else {
>>              layer.drawFeature(feature, feature.style || feature.layer.style ||
>>                  "default");
>>              this.events.triggerEvent("featureunhighlighted", {feature : feature});
>>          }
>> },
>> When I look at the code of highlight the "featureunhighlighted" should always thrown to a symmetric behavior of un-/highlight or the "featurehighlighted" event should only be triggered in the highlight when there was no _lastHighlighter.
>
> Hi
>
> I'd like to know your exact use-case (control1 does this, control2
> does that, etc.). With that we should be able to write a test-case
> demonstrating that the current code doesn't behave as expected.
>
> Thanks for your effort on that. It's not trivial code.
>






------------------------------

_______________________________________________
Dev mailing list
Dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev


End of Dev Digest, Vol 56, Issue 8
**********************************

Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u
niet de geadresseerde bent of dit bericht abusievelijk aan u is gezonden,
wordt u verzocht dat aan de afzender te melden en het bericht te 
verwijderen. 
De Staat aanvaardt geen aansprakelijkheid voor schade, van welke aard 
ook, die verband houdt met risico's verbonden aan het elektronisch 
verzenden van berichten.

This message may contain information that is not intended for you. If you
are not the addressee or if this message was sent to you by mistake, you
are requested to inform the sender and delete the message.
The State accepts no liability for damage of any kind resulting from the
risks inherent in the electronic transmission of messages.




More information about the Dev mailing list