Modify

Opened 3 years ago

Last modified 11 days ago

#13538 new defect

[Patch] Missing "Cannot add node outside of the world" message

Reported by: GerdP Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: template_report Cc: Bjoeni

Description

What steps will reproduce the problem?

  1. Create new Layer (Ctrl+N)
  2. Zoom out so the the planet bounding box is shown
  3. Try to add a note above or below the box: The message "Cannot add node outside of the world" pops up
  4. Try the same on left or right side

What is the expected result?

Same message box

What happens instead?

You can add nodes and draw lines

Please provide any additional information below. Attach a screenshot if possible.

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2016-09-06 00:16:07 +0200 (Tue, 06 Sep 2016)
Build-Date:2016-09-05 22:21:00
Revision:10966
Relative:URL: ^/trunk

Identification: JOSM/1.5 (10966 en) Windows 10 64-Bit
Memory Usage: 715 MB / 1803 MB (224 MB allocated, but free)
Java version: 1.8.0_102-b14, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Screen: \Display0 1920x1080
Maximum Screen Size: 1920x1080
Dataset consistency test: No problems found

Plugins:
+ FastDraw (32773)
+ apache-commons (32699)
+ buildings_tools (32796)
+ ejml (32680)
+ geotools (32813)
+ jts (32699)
+ o5m (32857)
+ opendata (32898)
+ pbf (32865)
+ poly (32699)
+ reverter (32796)
+ utilsplugin2 (32815)

Map paint styles:
+ https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1

Last errors/warnings:
- W: Update plugins - org.openstreetmap.josm.plugins.PluginHandler$UpdatePluginsMessagePanel[,0,0,0x0,invalid,layout=java.awt.GridBagLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]

Attachments (4)

13538.patch (1.2 KB) - added by GerdP 3 weeks ago.
no_move_right_sample.osm (82.9 KB) - added by GerdP 3 weeks ago.
13538-v2.patch (8.3 KB) - added by GerdP 3 weeks ago.
13538-deprecate.patch (2.2 KB) - added by GerdP 11 days ago.

Download all attachments as: .zip

Change History (10)

Changed 3 weeks ago by GerdP

Attachment: 13538.patch added

comment:1 Changed 3 weeks ago by GerdP

Summary: Missing "Cannot add node outside of the world" message[Patch] Missing "Cannot add node outside of the world" message

I stumbled again over this problem. When you create such a node and use "zoom to data" you'll not get to the place where the node was created. The attached patch uses this knowledge to produce the missing warning for the add node action.

If someone knows a more elegant solution for this please let me know, else I'll add a similar code to other actions like MoveAction.

Changed 3 weeks ago by GerdP

Attachment: no_move_right_sample.osm added

Changed 3 weeks ago by GerdP

Attachment: 13538-v2.patch added

comment:2 Changed 3 weeks ago by GerdP

Priority: minornormal

There are quite a lot of places where LatLon.isOutSideWorld() is used and most of them simply don't work near the 180° longitude.
I wonder if those tests were added before the code for the projection classes was changed to normalize the LatLon to be in the -180..180 interval?
Without the patch you can move a way which ends close to the 180 longitude west and thus destroy the geometry. You can also use the Create Circle Action
The attached patch fixes the places in core.
Important:
I've not only changed the test, in some cases I've also changed the reaction. I think when the "Cannot move objects outside of the world." popup appears the corresponding action should be undone, not stopped.

There is still more to do, for example I can enter 180 for longitude in the "Move Node" dialog and this results in a node displayed at
180 but the stored value is -179.99999. Quite confusing...

comment:3 Changed 3 weeks ago by GerdP

In 14960/josm:

see #13538:

  • Add new method isOutSideWorld() to class Node and use the method where LatLon.isOutSideWorld() was used before
  • Add a check in MoveNodeAction to make sure that rounding errors near 180 longitude don't move the node from east to west or vice versa

(I've removed the changes to reactions implemented in 13538-v2.patch, they would be too confusing.)

TODO: Plugins should use the new method in Node

comment:4 Changed 2 weeks ago by Don-vip

In 14964/josm:

see #13538 - avoid creation of intermediate Node objects

Changed 11 days ago by GerdP

Attachment: 13538-deprecate.patch added

comment:5 Changed 11 days ago by GerdP

@Vincent: Do you agree that I should deprecate LatLon.isOutSideWorld()?
The attached patch would do that.
I'm also not sure if that should be done now or after milestone 19.4?

comment:6 Changed 11 days ago by Bjoeni

Cc: Bjoeni added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to GerdP
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.