Modify

Ticket #720 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

about draw.rawgps.max-line-length cost of computation

Reported by: anonymous Owned by: framm
Priority: minor Component: Core
Version: latest Keywords:
Cc:

Description

At the moment you (re-)compute the distance fairly oftern, if I understand it correctly. However, if the assumption "if a org.openstreetmap.josm.data.gpx.WayPoint has a previous org.openstreetmap.josm.data.gpx.WayPoint, that will never change" is true, you could cache the result of the computation in org.openstreetmap.josm.data.gpx.WayPoint. e.g.

org.openstreetmap.josm.data.gpx.WayPoint: 19 public int cachedDistance = -1;

org.openstreetmap.josm.gui.layer.GpxLayer: 323 if (maxLineLength > -1) { 324 if (trkPnt.cachedDistance <= -1) 325 trkPnt.cachedDistance = trkPnt.latlon.distance(oldWp.latlon); 326 if (trkPnt.cachedDistance > maxLineLength) continue; 327 }

Attachments

patch.diff Download (9.0 KB) - added by Henry Loenwind 4 years ago.
patch.2.diff Download (9.0 KB) - added by Henry Loenwind 4 years ago.
Patch v2

Change History

comment:1 Changed 4 years ago by framm

I think that the assumption may be broken by loading new GPX data (which might just be sorted in between the existing data, I'm not sure) but in that case one could clear the cache on loading.

comment:2 Changed 4 years ago by ramack

I don't think that data will be sorted in between atm. But updating the distance cache should be easy on inserting new data.

comment:3 Changed 4 years ago by Henry Loenwind

  • Owner changed from framm to Henry Loenwind

I thought on storing a flag about the validity of the data in the layer instead in the points. So it can easily be cleared when loading data or merging layers. I think, I'll separate the compute-loop from the draw-loop, too. That may save some ifs in the draw loop.

Changed 4 years ago by Henry Loenwind

comment:4 Changed 4 years ago by Henry Loenwind

  • Owner changed from Henry Loenwind to framm

ok, here's the patch.

I added 2 new configuration values (einstein mode only for now):

draw.rawgps.alternatedirection Set to "true" to have arrows drawn with less math. They will be off by up to 22.5°, but MAY be rendered faster. On my machine the effect was not really noticeable.

draw.rawgps.trianglelines Set to "true" to have lines rendered as 2 lines, like the arrow lines, but over the whole length of the line. Does not look really nice, but on my machine this renders more than 10 times faster than straight lines!

Changed 4 years ago by Henry Loenwind

Patch v2

comment:5 Changed 4 years ago by Henry Loenwind

a minor update for the patch, no need to paint the arrows if the line was ommited because it would have had 0-length

comment:6 Changed 4 years ago by ramack

  • Status changed from new to closed
  • Resolution set to fixed

patch from #966 applied in [721]

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.