[OpenLayers-Dev] SelectFeature control setLayer

2009-11-04 Thread Bart van den Eijnden (OSGIS)
Hi list,

currently there is no way to tie a layer dynamically to the 
SelectFeature Control. Is this by design? Or are patches welcome?

Best regards,
Bart

-- 
Bart van den Eijnden
OSGIS, Open Source GIS
bart...@osgis.nl
http://www.osgis.nl

___
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev


Re: [OpenLayers-Dev] SelectFeature control setLayer

2009-11-04 Thread Andreas Hocevar
Bart van den Eijnden (OSGIS) wrote:
 Hi list,

 currently there is no way to tie a layer dynamically to the 
 SelectFeature Control. Is this by design? Or are patches welcome?
   

I'd say patches are welcome.

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

___
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev


Re: [OpenLayers-Dev] SelectFeature control

2009-03-16 Thread Alexandre Dube
Thanks Eric,

  I'll have to try that in the following days.  I'll let you know if I 
have comments.

Regards,

Alexandre

Eric Lemoine wrote:
 On Fri, Mar 13, 2009 at 4:28 PM, Eric Lemoine eric@gmail.com wrote:
   
 I like it. See the attached eric-to-alexandre patch ;-)
 

 Alexandre, I attached a more complete patch to
 http://trac.openlayers.org/ticket/1596.

 Cheers,
 --
 Eric
   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com

___
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev


Re: [OpenLayers-Dev] SelectFeature control

2009-03-16 Thread Alexandre Dube
Hi Eric,

  This is sweet.  It accomplish everything we need to have two or more 
SelectFeatures controls at the same time, on the same layer.  And the 
new highlight events make it possible to have temporary things 
happening at the same time, like displaying a popup on hover.

Great work Eric.  You're going to make a lot of people happy with this fix.

Alexandre

Eric Lemoine wrote:

 Alexandre, I attached a more complete patch to
 http://trac.openlayers.org/ticket/1596.

 Cheers,
 --
 Eric
   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com

___
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev


Re: [OpenLayers-Dev] SelectFeature control

2009-03-15 Thread Eric Lemoine
On Fri, Mar 13, 2009 at 4:28 PM, Eric Lemoine eric@gmail.com wrote:
 I like it. See the attached eric-to-alexandre patch ;-)

Alexandre, I attached a more complete patch to
http://trac.openlayers.org/ticket/1596.

Cheers,
--
Eric
___
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev


Re: [OpenLayers-Dev] SelectFeature control

2009-03-06 Thread Alexandre Dube
Hi Eric,

  This looks flawless but the easiest way to know would be to test it.  
I would be glad to test this.

  One thing to though is that a SelectFeature control can draw features 
depending on its renderIntent value OR selectStyle value.  So, instead 
of storing the previous renderIntent, it could be the previous drawer ( 
i.e. control ) and call feature._previousdrawer.drawFeature(feature) and 
the previous control itself would draw the feature depending if it has a 
selectStyle or renderIntent.

  Your solution looks simple and great.  It has this concept :

  this == current drawer
  feature._previousdrawer ( or previousrenderintent ) == the previous drawer

  With our 2 controls example that is enough.  Plus, as long as we keep 
the selectedFeature array in the layer objet, there's no need to know 
more than current and previous.  If we have let's say ( silly ) 6 
select features at the same time, having all their own colors, a feature 
is selected/highlighted and unselected/unhighlighted one at a time so 
curent and previous drawer is enough.  With that in mind, no need 
for a stack of renderIntent or a stack of _previousDrawer.

  What do you think ?

Alexandre

Eric Lemoine wrote:
 On Thu, Mar 5, 2009 at 5:09 PM, Alexandre Dube ad...@mapgears.com wrote:
   
 Sorry, I should have written :

 Control #1, select on click, color: blue
 Control #2, highlight on hover, color: yellow, highlightOnly


 The problem is that control #2 :

 highlight a feature even if it's selected
 doesn't unhighlight a feature that is selected

 so, a blue-selected-feature becomes yellow, and then moving out it remains
 yellow.  Do you see what I mean ?
 

 You are so right!

 How about that: unhighlight only if I'm the last drawer of the
 feature, and unhighlight to the previous render intent. The
 implementation would look like this:

 (1) the select feature control places a reference to itself in the
 feature it is about to highlight (whether highlightOnly is set or not)

 feature._drawer = this;
 this.layer.drawFeature(feature, selectStyle);

 (2) before highlighting a feature store in the feature it current renderIntent

 feature._previousRenderIntent = feature.renderIntent;

 (3) unhighlight only if I'm the last drawer of the feature

 if(feature._drawer == this) {
 this.layer.drawFeature(feature, feature._previousRenderIntent);
 }


 It looks better to me, tell me if this is flawed again.

 Thanks for the collaboration on this Alexandre.

 --
 Eric
   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com

___
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev


Re: [OpenLayers-Dev] SelectFeature control

2009-03-05 Thread Eric Lemoine
The highlightOnly control does not do feature unselection either, it
just highlights and unhighlights features (unhighlighting them only if
they're not selected).

Eric

2009/3/5, Alexandre Dube ad...@mapgears.com:
 Hi Eric,

   That's a nice and great approach without hurting the core a all.
 There's just a small issue with this solution ( see below ).

   Keep up the excellent work,

 Alexandre

 Eric Lemoine wrote:
 On Tue, Mar 3, 2009 at 7:05 PM, Eric Lemoine eric@gmail.com wrote:

 Alexandre

 I fully support the idea of being able to have two highlight feature
 controls working at the same time, one on hover and one on click.
 However i don't like the renderIntent array in the feature class, it
 brings extra complexity that I think is undesirable. I have to say
 though that i cannot think of a better solution at this point. Still
 thinking...

 Thanks for bringing this back up.



 Alexandre,

 What about this: add an highlightOnly boolean option to the select
 feature control, if highlightOnly is true then do not select features,
 just highlight them. Also, if highlightOnly is set to true, when
 clicking or moving out of an highlighted feature do not unhighlight
 the feature if it is in the selected features array, i.e. if it was
 previously selected (by another select feature control).


 Control #1, select on click, color: blue
 Control #2, select on hover, color: yellow, highlightOnly

 Mouse over a feature, it's not selected but color changed to yellow. ( OK )
 Click on this feature, it's selected and color changed to blue. ( OK )
 Move moves over the feature, it remains blue ( OK )
 Move out of the feature, it remains blue ( OK )
 Move back over the feature, it's not selected but changes from blue to
 yellow ( OK )
 Move out, it remains yellow ( not OK : it should be drawn back to blue )

 Selecting a bunch of features on click with control #1 renders them to
 blue, but hovering them makes control #2 renders them to yellow instead.

 It's a small price to pay if we consider that your changes don't hurt
 the core at all, which is a good thing in my opinion.

 BUT ( sorry to bring that up again ^_^ ), a renderIntent stack would
 resolve this small issue.  We would just need to call
 this.layer.drawFeature(feature) instead of not calling
 this.drawFeature(feature) to draw the feature back to its previous
 renderIntent.

 What do you ( and others ) think ?

 See the attached patch. Note that patch isn't complete - the select
 feature control should trigger featurehighlighted and
 featureunhighlighted events to complete the picture.

 What do you think?

 --
 Eric



 --
 Alexandre Dubé
 Mapgears
 www.mapgears.com



-- 
Envoyé avec mon mobile
___
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev


Re: [OpenLayers-Dev] SelectFeature control

2009-03-04 Thread Eric Lemoine
On Tue, Mar 3, 2009 at 7:05 PM, Eric Lemoine eric@gmail.com wrote:
 Alexandre

 I fully support the idea of being able to have two highlight feature
 controls working at the same time, one on hover and one on click.
 However i don't like the renderIntent array in the feature class, it
 brings extra complexity that I think is undesirable. I have to say
 though that i cannot think of a better solution at this point. Still
 thinking...

 Thanks for bringing this back up.


Alexandre,

What about this: add an highlightOnly boolean option to the select
feature control, if highlightOnly is true then do not select features,
just highlight them. Also, if highlightOnly is set to true, when
clicking or moving out of an highlighted feature do not unhighlight
the feature if it is in the selected features array, i.e. if it was
previously selected (by another select feature control).

See the attached patch. Note that patch isn't complete - the select
feature control should trigger featurehighlighted and
featureunhighlighted events to complete the picture.

What do you think?

--
Eric
Index: lib/OpenLayers/Control/SelectFeature.js
===
--- lib/OpenLayers/Control/SelectFeature.js	(revision 8869)
+++ lib/OpenLayers/Control/SelectFeature.js	(working copy)
@@ -58,6 +58,15 @@
  * ignores clicks and only listens to mouse moves.
  */
 hover: false,
+
+/**
+ * APIProperty: highlightOnly
+ * {Boolean} If true do not actually select features, i.e. place them in the
+ * layer's selected features array, just highlight them (calling drawFeature
+ * on the layer), when clicking or moving out of an highlighted feature, it
+ * isn't unhighlighted if it's in selected features arra. Defaults to false.
+ */
+highlightOnly: false,
 
 /**
  * APIProperty: box
@@ -233,19 +242,23 @@
  */
 clickFeature: function(feature) {
 if(!this.hover) {
-var selected = (OpenLayers.Util.indexOf(this.layer.selectedFeatures,
-feature)  -1);
-if(selected) {
-if(this.toggleSelect()) {
-this.unselect(feature);
-} else if(!this.multipleSelect()) {
-this.unselectAll({except: feature});
-}
+if(this.highlightOnly) {
+this.drawFeature(feature);
 } else {
-if(!this.multipleSelect()) {
-this.unselectAll({except: feature});
+var selected = OpenLayers.Util.indexOf(
+this.layer.selectedFeatures, feature)  -1;
+if(selected) {
+if(this.toggleSelect()) {
+this.unselect(feature);
+} else if(!this.multipleSelect()) {
+this.unselectAll({except: feature});
+}
+} else {
+if(!this.multipleSelect()) {
+this.unselectAll({except: feature});
+}
+this.select(feature);
 }
-this.select(feature);
 }
 }
 },
@@ -284,7 +297,16 @@
  */
 clickoutFeature: function(feature) {
 if(!this.hover  this.clickout) {
-this.unselectAll();
+if(this.highlightOnly) {
+// unhighlight the feature only of it's not in the
+// array of selected features
+if(OpenLayers.Util.indexOf(this.layer.selectedFeatures,
+   feature) == -1) {
+this.drawFeature(feature, default);
+}
+} else {
+this.unselectAll();
+}
 }
 },
 
@@ -297,9 +319,13 @@
  * feature - {OpenLayers.Feature.Vector} 
  */
 overFeature: function(feature) {
-if(this.hover 
-   (OpenLayers.Util.indexOf(this.layer.selectedFeatures, feature) == -1)) {
-this.select(feature);
+if(this.hover) {
+if(this.highlightOnly) {
+this.drawFeature(feature);
+} else if(OpenLayers.Util.indexOf(
+this.layer.selectedFeatures, feature) == -1) {
+this.select(feature);
+}
 }
 },
 
@@ -313,9 +339,32 @@
  */
 outFeature: function(feature) {
 if(this.hover) {
-this.unselect(feature);
+if(this.highlightOnly) {
+// unhighlight the feature only of it's not in the
+// array of selected features
+if(OpenLayers.Util.indexOf(this.layer.selectedFeatures,
+   feature) == -1) {
+this.drawFeature(feature, default);
+}
+} else {
+this.unselect(feature);
+}
 

[OpenLayers-Dev] SelectFeature control

2009-03-03 Thread Alexandre Dube
Hi devs,

  I brought several weeks ago some possible modification ideas that the 
SelectFeature control could have, including :

  - having its own selectedFeatures array with the corresponding events 
that are currently in the layer
  - the feature renderIntent could be a stack of strings ( an array ) 
instead of a string only, selecting a feature would add select to the 
array, unselecting would remove it.

  That would enable the possibility to have multiple SelectFeature 
controls at the same time.  For example, one onHover the other onClick, 
both having their own customized style.  So far, I had no positive 
comments about theses ideas but I'd like to talk about it more to know 
exactly why they're not good ideas, please.

  Kind regards,

-- 
Alexandre Dubé
Mapgears
www.mapgears.com

___
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev


[OpenLayers-Dev] SelectFeature Control Ticket #1666 (new feature)

2009-01-21 Thread Andre Pereira de Matos
Hi devs and users,

Does anyone know if this ticket about select feature control firing events on 
multiple layers (not just in the topmost layer) will be released soon?

Can I use the patch now? What can I do to have this feature?

Regards,
André Matos
http://maps.sapo.pt

___
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev


Re: [OpenLayers-Dev] SelectFeature Control Ticket #1666 (new feature)

2009-01-21 Thread Christopher Schmidt
On Wed, Jan 21, 2009 at 02:40:45PM +, Andre Pereira de Matos wrote:
 Can I use the patch now? What can I do to have this feature?

This code is still in development. As with all code still in
development, it is subject to change. The code is open source: you *can*
do anything you want with it.

(That said, I'm pretty sure that the sigleroot atch that andreas has
been working on will be 'the solution' that I am most in favor of for
multiple layer eature selection.)

Regards,
-- 
Christopher Schmidt
MetaCarta
___
Dev mailing list
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev


Re: [OpenLayers-Dev] SelectFeature Control Ticket #1666 (new feature)

2009-01-21 Thread Andreas Hocevar
2009/1/21 Andre Pereira de Matos andre.ma...@co.sapo.pt:
 Does anyone know if this ticket about select feature control firing events
 on multiple layers (not just in the topmost layer) will be released soon?

It fires events *only* on the layer that the selected feature belongs
to. Not in the topmost layer that the control creates, but in one of
the layers the control is configured with.

But, as Chris pointed out, the code is subject to change.

 Can I use the patch now? What can I do to have this feature?

Apply the patch to a current trunk version of OpenLayers (see [1] for
instructions). Have a look at the example [2] to see how to use.

Regards,
Andreas.

[1] http://trac.openlayers.org/wiki/ApplyingPatches for instructions
[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
Dev@openlayers.org
http://openlayers.org/mailman/listinfo/dev