Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Overlay descendants without Context-dependecy that can be created in AsyncTask (again)#373

Merged
spyhunter99 merged 4 commits intoosmdroid:masterfrom
k3b:master
Aug 17, 2016
Merged

Overlay descendants without Context-dependecy that can be created in AsyncTask (again)#373
spyhunter99 merged 4 commits intoosmdroid:masterfrom
k3b:master

Conversation

@k3b
Copy link
Copy Markdown
Contributor

@k3b k3b commented Aug 15, 2016

I have a database with 18000 geo-positions (jpg-photos with exif-geo-info) that are displayed as clusters in a map.
Every time visible map area or the zoom level changes, the visible clusters are recalculted from the database:
An AsyncTask creates Clusterpoints (inherited from Overlay) and put them into a FolderOverlay.
When all visible Clusterpoints are calculated in the background, the FolderOverlay is added to the map.

Overlay and descendants can only be created in background task if they donot acces Android-Context.

Up to osmdroid-5.1 I used ResourceProxy for creating Overlays in AsyncTask.

Since Osmdroid-5.2 has removed ResourceProxy this merge request also removes Android-Context dependency from some Overlay descendants
so that these can be created in AsyncTask again.

These Overlay descendants are now Android-Context-free so they can be created in AsyncTask (outside main gui thread):

  • Overlay,
  • OverlayWithIW,
  • ItemizedOverlay
  • Polyline,
  • Polygon,
  • PathOverlay,
  • NonAcceleratedOverlay,
  • MapEventsOverlay,

I deprecated the original constructors and created a new one without Context.
Old Osmdroid programs will get a deprecated compiler warning but should continue working.

This osmdroid issue relates to k3b/APhotoManager#59

k3b added 4 commits August 15, 2016 16:14
….	Polyline, Polygon, PathOverlay, OverlayWithIW, Overlay, NonAcceleratedOverlay, MapEventsOverlay, ItemizedOverlay
Made some basic overlays Context independant so they can be created in AsyncTask.	Polyline, Polygon, PathOverlay, OverlayWithIW, Overlay, NonAcceleratedOverlay, MapEventsOverlay, ItemizedOverlay
@k3b k3b changed the title Overlay descendants without Context that be created in AsyncTask Overlay descendants without Context-dependecy that can be created in AsyncTask (again) Aug 15, 2016
@spyhunter99
Copy link
Copy Markdown
Collaborator

wow a lot of work. i had initially considered this approach with the 5.1 to 5.2 refactor. The scale bar was the only thing that uses the one field. I have no issues with the PR other than the scary commit message that says don't merge.

@MKergall does this cause any issues from OBP?

@MKergall
Copy link
Copy Markdown
Collaborator

I don't see particular issues from OBP.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants