Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#18248 closed defect (fixed)

[Patch] raise maximum simplify-way.max-error

Reported by: Klumbumbus Owned by: Don-vip
Priority: normal Milestone: 19.10
Component: Core Version: latest
Keywords: Cc:

Description (last modified by Don-vip)

r15419 added a maximum value for simplify-way.max-error which is 100.
I suggest to raise it to 10000, because e.g. to simplify the shapes for wiki:/Maps/Croatia?action=diff&version=15 (where one had 3338! nodes) I needed a simplify-way.max-error of 2000. I did it this way:

  • SimplifyWayAction.java

     
    133133        JPanel q = new JPanel(new GridBagLayout());
    134134        q.add(new JLabel(tr("Maximum error (meters): ")));
    135135        JSpinner n = new JSpinner(new SpinnerNumberModel(
    136                 s.getDouble(keyError, 3.0), 0.01, 100, 0.5));
     136                s.getDouble(keyError, 3.0), 0.01, 10000, 0.5));
    137137        q.add(n);
    138138        q.setBorder(BorderFactory.createEmptyBorder(14, 0, 10, 0));
    139139        p.add(q, GBC.eol());

and noticed no problems. Was there a reason for the 100 limit?
One open point with this change is when you type values >10000 it corrects them to 100 instead to 10000, I don't know where to fix that.

Another thing is if you add a larger simplify-way.max-error value directly in the preferences you get an exception. Not sure if that should be catched.

Attachments (0)

Change History (7)

comment:1 by Don-vip, 4 years ago

Cc: Bjoeni removed
Description: modified (diff)
Milestone: 19.10
Owner: changed from team to Bjoeni
Type: enhancementdefect

@Bjoeni can you please provide a patch for the different issues described here?

comment:2 by Bjoeni, 4 years ago

I'll have a look, I don't remember why I did that half a year ago. But agreed it makes no sense at all.

comment:3 by Bjoeni, 4 years ago

  • src/org/openstreetmap/josm/actions/SimplifyWayAction.java

     
    133133        JPanel q = new JPanel(new GridBagLayout());
    134134        q.add(new JLabel(tr("Maximum error (meters): ")));
    135135        JSpinner n = new JSpinner(new SpinnerNumberModel(
    136                 s.getDouble(keyError, 3.0), 0.01, 100, 0.5));
     136                s.getDouble(keyError, 3.0), 0.01, null, 0.5));
     137        ((JSpinner.DefaultEditor) n.getEditor()).getTextField().setColumns(4);
    137138        q.add(n);
    138139        q.setBorder(BorderFactory.createEmptyBorder(14, 0, 10, 0));
    139140        p.add(q, GBC.eol());

Let's just give the user the freedom he deserves ;)

I believe the reason it jumped back to 100 for you was that it just goes back to the last valid value entered.

Last edited 4 years ago by Bjoeni (previous) (diff)

comment:4 by Bjoeni, 4 years ago

Owner: Bjoeni removed
Summary: raise maximum simplify-way.max-error[Patch] raise maximum simplify-way.max-error
Version: latest

So yeah the reason I did that was probably because the width of the JSpinner is usually determined by its max value, so I just put 100, wanted to change it later and forgot about it.

comment:5 by Bjoeni, 4 years ago

Updated the "patch" above, because I just noticed that SpinnerNumberModel takes null as an argument, so no need at all for Integer.MAX_VALUE.

comment:6 by Don-vip, 4 years ago

Owner: set to Don-vip
Resolution: fixed
Status: newclosed

In 15471/josm:

fix #18248 - raise maximum simplify-way.max-error (patch by Bjoeni)

comment:7 by Don-vip, 4 years ago

Thanks!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Don-vip.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.