Modify

Opened 3 years ago

Closed 3 years ago

#13222 closed enhancement (fixed)

[Patch] Use visitor pattern for painting tiles

Reported by: michael2402 Owned by: team
Priority: normal Milestone: 16.08
Component: Core imagery Version:
Keywords: gsoc-core Cc: Don-vip, bastiK, stoecker

Description

Migrate towards a visitor pattern.

Only the default zoom level is painted this way, the missed tiles are still painted using the old function.

Using streams and by adding a simple parallelStream() I was able to execute the image processors in parallel. This speeds up drawing a lot.

Attachments (2)

patch-mapview-imagery-tile-source-paint-iteration.patch (10.6 KB) - added by michael2402 3 years ago.
patch-fix-13222.patch (10.6 KB) - added by michael2402 3 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 3 years ago by michael2402

Milestone: 16.07

comment:2 Changed 3 years ago by Don-vip

AbstractTileSourceLayer grows bigger than 2000 lines, it causes a checkstyle violation, is there a way to refactor it?

comment:3 Changed 3 years ago by michael2402

I know. I also added some sonar warnings ;-)

I am currently attempting to separate the TileSet (coordinate conversion, range, ...) stuff and separate it from the tile loading so that that class can be refactored to a static class and then extracted. I want to move the painter to a new class as well. After that, AbstractTileSourceLayer won't contain any paint code and thus be small again ;-).

Last edited 3 years ago by michael2402 (previous) (diff)

comment:4 Changed 3 years ago by wiktorn

I like this change. I'm thinking about taking this a bit further, and create a structure that would map:
screen area -> tile(x,y,z), tile area to paint

This would allow us to parallelize whole paintTiles/missedTiles algorithm and then - just paint all the tiles in computed places.

comment:5 Changed 3 years ago by michael2402

Yes, this is the next step I am planing.

I don't like the current structure of the missed tiles algorithm. It makes parallelization and extension (like limiting the number of tiles to paint) difficult.

I am currently planing to do a new collection algorithm that computes all tiles that need painting and then remove the old paint class. I am currently making the screen area more universal and respect the bounds of the projection - this will finally fix the problem that JOSM paints the wrong side of the world close to 180° ;-)

comment:6 Changed 3 years ago by Don-vip

Milestone: 16.0716.08

comment:7 Changed 3 years ago by michael2402

This should be able to be applied as soon as 16.7 is out.

Changed 3 years ago by michael2402

Attachment: patch-fix-13222.patch added

comment:8 Changed 3 years ago by michael2402

I updated this one to the current version, too.

Can you give priority to this one, since I want to work on the tile source more. You don't need to fix Somar warnings (e.g. p -> getTile(p)). After this patch I will work on a patch that moves lots of code around and will then allow to use the same layer for multiple MapViews.

comment:9 Changed 3 years ago by Don-vip

Resolution: fixed
Status: newclosed

In 10820/josm:

fix #13222 - Use visitor pattern for painting tiles (patch by michael2402) - gsoc-core

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.