Arunkarthicknallasami / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

The Projection class needs clean-up and should match Google API v1 #499

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Our Projection class has gotten a bit out of hand. We should:

1. Trim the projection down to the basics:
   a. fromPixels (Google API - already implemented)
   b. toPixels (Google API - right now we call this toMapPixels)
   c. metersToEquatorPixels - (Google API - already implemented albeit slightly incorrectly since it uses latitude 0.0 instead of on-screen latitude)
   d. fromPixelsProjected
   e. toPixelsProjected
   f. toPixelsFromMotionEvent (new method - used to correctly go from MotionEvent to on-screen pixels)
   g. getZoomLevel, getBoundingBox, getScreenRect (not intrinsic), getMapOrientation()

2. Move the projection into its own file. See issue 414.

3. We can move all the "extra" methods into a subclass of the Projection class 
(ProjectionExtended perhaps?).

Original issue reported on code.google.com by kurtzm...@gmail.com on 10 Dec 2013 at 9:38

GoogleCodeExporter commented 9 years ago

Original comment by kurtzm...@gmail.com on 10 Dec 2013 at 9:42

GoogleCodeExporter commented 9 years ago

Original comment by kurtzm...@gmail.com on 10 Dec 2013 at 9:42

GoogleCodeExporter commented 9 years ago

Original comment by kurtzm...@gmail.com on 10 Dec 2013 at 9:44

GoogleCodeExporter commented 9 years ago

Original comment by kurtzm...@gmail.com on 10 Dec 2013 at 9:45

GoogleCodeExporter commented 9 years ago
Sorry "d" should be "toPixelsTranslated"

Original comment by kurtzm...@gmail.com on 10 Dec 2013 at 10:18

GoogleCodeExporter commented 9 years ago
I have a patch which I will post once we get our attachment limit increased, 
but I think I may have to scale this back a bit.

Neil - are the getNorthEast() and getSouthWest() methods necessary in the 
Projection?

Original comment by kurtzm...@gmail.com on 11 Dec 2013 at 3:04

GoogleCodeExporter commented 9 years ago
The reason Projection is an inner class is because it calls methods from the 
outer class, specifically methods from View such as getHeight().

getNorthEast() and getSouthWest() are used for the v2 projection - see issue 
478.

Original comment by neilboyd on 12 Dec 2013 at 9:18

GoogleCodeExporter commented 9 years ago
Okay - I'll leave in getNE and getSW. We can pass in a MapView instance for the 
projection to pull what it needs and then we can get the projection out of the 
MapView class and into its own file. Its just that the MapView is so huge now 
and I think this will clean it up a bit and maybe make it easier to subclass.

Original comment by kurtzm...@gmail.com on 13 Dec 2013 at 3:37

GoogleCodeExporter commented 9 years ago
Fixed in Github.

Original comment by kurtzm...@gmail.com on 16 Apr 2014 at 10:28