EcoGIS / CAPS-Scenario-Builder

The CAPS Scenario Builder will allow government officials, conservation groups and others to submit "scenarios" for proposed changes to land cover and infrastructure so that these changes can be assessed for their impact on ecological integrity.
http://www.umass.edu/landeco/research/caps/caps.html
3 stars 0 forks source link

Select features button active when layers aren't displayed #17

Closed ScottJackson closed 12 years ago

ScottJackson commented 12 years ago

When I select edit_scenario(points) the program loads two layers. One (edit_scenario(points) is displayed by default. The other (base_culverts_bridges) is not. The Select Features button is active even though there is nothing to select. The same appears to be true for other point edit features (dams, tidal restrictions, terrestrial crossing structures).

ghost commented 12 years ago

If I understand this correctly, this happens because the layer doesn’t need to be displayed for you to select it—you can select a crossing just fine, even though you can’t see it until you turn crossings on.

ScottJackson commented 12 years ago

I think it would be better if the select features button is only active if the layer is displayed. It is true that you can select a feature even if you can't see it (I tried it). The problem is that you can't tell that you selected anything unless you notice that the unselect and delete selected features buttons are now active. I think there might be a risk that a user might select a feature, perhaps several features, that are not displayed and then lose track of it (them). If they subsequently click the delete selected features button they might make a change that they never intended.

bobenglish commented 12 years ago

In general, I've copied the behavior of QGIS on this and other things. QGIS does not require a layer to be visible for the "Select Features" tool to be enabled. It is enabled whenever a vector layer is the active layer, as it is in our app. You'll notice that select features is only enabled when a scenario is being edited. Also, the sub actions (i.e. deselect features, modify features and delete features) are only active when a feature is actually selected. Select features also behaves quite well when you have selected features (even on multiple layers) and switch between layers. When select features is "enabled" you still have to click the button and click on the map to select features. Would a user really click the select features button and then start clicking on a white map canvas for some reason,and then click on the delete button if he happened to hit a feature and turn the delete button on? I don't think any GIS program deals with that level of user error.

The behavior of the select features tool is very complicated and involves at least dozens of possibilities and hundreds of lines of code. I have spent a huge amount of time getting it to work as well as it does. To try to add requiring the layer to be active AND visible for the select tool to be active would probably double the number of possibilities the code would have to deal with, and would be very difficult at this point. I think QGIS probably doesn't do it because the overhead in code complexity is probably not worth the benefit.

bobenglish commented 12 years ago

I incorrectly described the select tool behavior above. The sub actions become active when you toggle on the select button. You don't need to have selected a feature for them to be active.

ScottJackson commented 12 years ago

This issue is not a big one. The potential for trouble has to do with the potential to select features when a particular layer isn't even the active window. It wouldn't necessarily involve someone clicking on a blank screen. I made this mistake myself by clicking an intersection of a road and stream with only the USGS displayed. I couldn't figure out why it wouldn't show up as a yellow dot.

bobenglish commented 12 years ago

You can't select features on a vlayer that isn't active. You can only select features on the active vlayer, and you can select them even if the active vlayer is not visible. However, if you then click "delete" you will be prompted if you want to delete however many features you have unknowingly selected and you can cancel. The same is true for modifying features, you would get an add attributes dialog with the opportunity to cancel. So, I think this lays that problem to rest.

If you have another vlayer visible and you click on a feature and it doesn't turn yellow, then you know you are trying to select features on a layer that is not active, so you are in effect warned to activate the layer you want to select features on.

Now, let's say we made it so that the layer had to be active and visible for the select button to be enabled. In that case if you had a layer that was not visible (i.e. not checked) as the active layer, but you were looking at a layer that was checked and visible, you would be wondering why the select tool wasn't active so you could select features. In either case you would be confused. We would be no better off in terms of confusion.

I'll be happy to make the app behave any way you choose, but think it through first. I'm sure a lot of thought and experience went into the QGIS behavior, so I would hesitate to change it. You could check ArcGis. I'm not sure how that behaves, but I don't have a copy of it.

ScottJackson commented 12 years ago

OK. I'm satisfied.

bobenglish commented 12 years ago

OK. Closed due to consensus that we probably can't make this work better than it does.