[josm-dev] License Change Plugin slows down drawing
Paul Hartmann
phaaurlt at googlemail.com
Wed Jan 11 13:14:29 GMT 2012
On 01/10/2012 11:23 PM, Frederik Ramm wrote:
> Hi,
>
> whenver a license change layer is active and you have lots of objects
> loaded, JOSM becomes noticeably slower.
>
> I could use a little help here. Since many of you have tweaked JOSM's
> drawing performance in the past, maybe you only need to take a quick
> look at this drawing code
>
> http://trac.openstreetmap.org/browser/applications/editors/josm/plugins/licensechange/src/org/openstreetmap/josm/plugins/licensechange/LicenseProblem.java
>
>
> and you have an idea how it could be improved?
You can use QuadBuckets for the 'highlighted' collection. This helps a
lot if the user zooms in and has only few primitives in the current
viewport.
(In this case, you probably need to replace "QuadBuckets<T extends
OsmPrimitive>" by "QuadBuckets<T extends HasBbox>" and add a new
interface HasBbox.)
> The "sliding window" of four consecutive nodes in the visit function is
> there to determine whether linecaps need to be drawn or not.
>
> Is it the trigonometry in drawSegment? (This is more or less copied from
> similar code in the validation layer.)
You can draw a parallel line of fixed distance without trigonometry (see
the code in MapPainter [1]), but I'm not sure this will make a big
difference. Usually, most time is not spend in JOSM code, but in the
Java libs that actually do the painting.
> Would it perhaps make sense to
> cache the buffered outline instead of computing it each time?
Shouldn't be necessary, as far as I can tell.
[1]
<http://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPainter.java#L271>
Paul
More information about the josm-dev
mailing list