Osmdroid simple source code resources and research

1. First, look at the OSM

        OpenStreetMap (referred to as OSM) is a collaborative online map plan, the goal is to create a free and allows anyone to edit the content of the world map. See Baidu Encyclopedia , Wikipedia .

2. OSM's articles

  1. Reference http://blog.csdn.net/scy411082514/article/details/7471499 This article describes in more detail.
  2. www.OpenStreetMap.org map URL
  3. OSM Application android end http://wiki.openstreetmap.org/wiki/Android#OpenStreetMap.org
  4. osmdroid compile the source code: http://blog.csdn.net/qq_30124547/article/details/53114743
  5. Basic usage osmdroid (blog written when version a bit old, and the current 5.5, but basically did not how they change): http://blog.csdn.net/youngkingyj/article/details/44200057
  6. osmdroid latest source:
  7. osmdroid latest demo:

3. osm source brief

         

         1. openStreetMapViewer --------- is a demo osmdroid whole, various operations for polygons, etc. drawn dotted line operation

         2. osmdroid-android ------------- osmdroid source is used jar package, or the source can be used, which better scalability

         3. osmdroid-third-party ---------- osmdroid provide support for other maps, examples are provided bing and google (over the wall required) (There will be a special presentation of an article)

         4. Other research is not temporary.


4. Map tile tile Introduction

        You can refer to blog: http: //blog.csdn.net/happyduoduo1/article/details/51781024

        Wikipedia: http: //www.baike.com/wiki/ tile map

4. Support offline cache can also browse the map, a custom cache size

         osmdroid map is supported by default cached map, that map is loaded logic is to start sdcard directory to load the corresponding map, and if not, get from the network.

         org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants This class contains static constants, many of the settings on the cache also in this class, we pick up a few of view.

         Cached map location osmdroid file in the root of the sdcard folder, browse the directory also download it

       

    private static File OSMDROID_PATH = new File(Environment.getExternalStorageDirectory(),"osmdroid");
    //缓存路径的set、get方法,可以自己设置缓存目录,也可以自行下载地图放入对应的文件夹。
    public static File getBasePath(){
          return OSMDROID_PATH;
     }
    public static void setOfflineMapsPath(String path){
          OSMDROID_PATH = new File(path);
     }

    //从注释也可以看出来,定义了缓存的有效期和默认瓦片缓存的大小,都有对应的set方法
    /** 30 days */
    public static final long TILE_EXPIRY_TIME_MILLISECONDS = 1000L * 60 * 60 * 24 * 30;

    /** default is 600 Mb */
    public static long TILE_MAX_CACHE_SIZE_BYTES = 600L * 1024 * 1024;

    /** default is 500 Mb */
    public static long TILE_TRIM_CACHE_SIZE_BYTES = 500L * 1024 * 1024;
    

       

 5.  osmdroid-android 

          

        1. TileSystem: single package, is the role this class of item processing using Mercator projection osmdroid tiles.

               

           This class is the main keyword conversion! Conversion between coordinates.

           2.osmdroid core package considered.

              api package which defines the main interface point, mapview, controller, projection, etc.

              event package which defines a number of events, such as the sliding events, listen for events map, zoom, events, etc.

              Package details are as follows:

             

               tileprovider包是主要是瓦片提供、包括缓存也在这个包下,可以通过拓展图源的方式显示其他地图,继承OnlineTileSourceBase实现对应方法(将有一篇文章介绍到)

              util主要一些‘工具类’,包括瓦片处理,bitmappool等

              views是关于显示层的一些包括最常用的mapview和controller,何有overlay、polyline和polygon等(只列举了常用的)

              剩下的两个LocationListenerProxy和SensorEventListenerProxy一个是定位相关的代理类,一个是传感器事件的代理类。

Guess you like

Origin blog.csdn.net/qq_30124547/article/details/53266136