#10037 closed enhancement (fixed)
[Patch] Double click selection mode
Reported by: | simon04 | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 14.05 |
Component: | Core | Version: | |
Keywords: | Cc: | akks, Don-vip, Balaitous |
Description (last modified by )
Based on the very nice new feature of utilsplugin2 ([o30419]), I would like to propose to add this feature to the core. One could easily support adding/removing objects from the selection based on whether [alt]
/[ctrl]
is pressed.
What do you think (of the attached patch which is based on [o30419])?
Attachments (4)
Change History (23)
by , 11 years ago
Attachment: | dblclkselect.patch added |
---|
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Description: | modified (diff) |
---|
Sorry, I forgot that. A double-click selects inside selects a surrounding (multi)polygon.
comment:5 by , 11 years ago
It would be nice to see it in core :) It is nice that ctrl-and shift click works too.
I had some integration problems when adding this to plugin, here are the ideas:
1) Some actions in SelectionMode are triggered with single mouse press. Will it work correctly in SelectionManager?
2) There was incorrect behavior of Geometry.isNodeInsideMultiPolygon for some cases. I'll check it once more and post an example if it still exists.
3) This action can be really CPU and time-consuming for big dataset. Maybe some parameters should be added (maxWays and maxRelations, for example) to avoid possible several seconds delay in dbl-click?
comment:6 by , 11 years ago
After testing:
1) All actions seems to work perfectly, there are no event problems.
3) Action is rather fast, maybe it can work without tuning parameters.
2) There are still some cases when Geometry.isNodeInsideMultiPolygon works incorrectly (not related to the patch, however), so I had to keep separate version in Utilsplugin2.
Example: download relation r398514
via ctrl-shift-o and try to select the boundary relation with double click.
Utilsplugin2 version does, Geometry.isNodeInsideMultiPolygon does not :)
My opinion - the patch itself is clean and ready for inclusion (with slightly expanded JavaDoc).
comment:7 by , 11 years ago
Here is the simplified example for bad Geometry.isNodeInsideMultiPolygon behavior (try selecting it from left and right internal point).
by , 11 years ago
Attachment: | insideMultipolygon.osm added |
---|
comment:8 by , 11 years ago
After checking: the algorithm of isPolygonInsideMultiPolygon
is not completely correct - multipolygon with multiple outer parts is not a sum of its outers (some validator tests should also work incorrectly). This is better to be fixed...
I can not fix it myself without replacing or duplicating a lot of existing code (utilsplugin2 may have correct but completely different checking).
by , 11 years ago
Attachment: | bankInsideBank.osm added |
---|
validator not detecting bank inside bank (move one of the nodes upper and the warning arise)
by , 11 years ago
Attachment: | 2014-05-19 18_09_59-_ Редактор OpenStreetMap на Java.png added |
---|
illustration
comment:9 by , 11 years ago
Cc: | added |
---|
comment:10 by , 11 years ago
Cc: | added |
---|
Yes, I'm not absolutely confident in the correctness of this method.
@Balaitous: interested in checking this point? ;)
If anyone thinks it's too complicated for this release, feel free to postpone to next milestone, we should release the next stable release this week-end.
comment:11 by , 11 years ago
This patch is easy and harmless enough and can be included now (there will be enough time to detect possible event bugs) :)
However, then some users can notice nodeInsidePolygon problem (currently it is used mostly in mapcss).
We can temporarily use the code of isPointInsideMultipolygon
from Utilsplugin2 for isNodeInsideMultiPolygon
only (it needs isPointInsidePolygon
, buildPointList
, getWayPoints
, getRayIntersectionsCount
as the private functions). Then the existing behavior will not change but some hidden duplicate functionality will exist in Geometry.java.
comment:12 by , 11 years ago
(How) does isPointInsideMultipolygon
from Utilsplugin2 handle inner
roles of multipolygon relations?
static boolean isPointInsideMultipolygon(EastNorth p, Relation rel) { Set<Way> usedWays = OsmPrimitive.getFilteredSet(rel.getMemberPrimitives(), Way.class); return isPointInsidePolygon(p, buildPointList(usedWays)); }
comment:16 by , 11 years ago
I've removed the implementation from utilsplugin2 in [o30459], [o30461].
comment:17 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The feature is implemented, the bug demonstrated in attachment:insideMultipolygon.osm has been fixed. A big thanks to all people involved!
comment:18 by , 11 years ago
Wow! That was really impressing.
Have tested the code on ~80 administrative boundaries collection - it is working and fast enough, suitable for tested version.
Reconstructing the rings for all the dataset multipolygons for each double click is a rather big task. If later we encounter the performance issues, we can do something about caching the MultipolygonCreate.joinWays results.
The algorithm from Utilsplugin2 does not handle the roles or try to orient the ways. It just counts the intersections of OX-parallel ray and all multipolygon parts (inner and outer fragments). If the number is 2k, the ray starting point is outside the multipolygon. This can potentially work faster, detects points on edges or vertices but does not support polygonIntersection (no Java2d area can be used).
Could you explain what this is about?