• 大小: 2.85MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-08
  • 语言: Java
  • 标签: osmdroid  

资源简介

android 开源库osmdroid绘制点线面(比例尺,缩小放大,导航图标等)。常用的基本用法都有,以及之前写加载离线地图也在这个项目。 我的博客地址:http://blog.csdn.net/qq_16064871。

资源截图

代码片段和文件信息

package com.osmdroid.sample;

import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.Toast;

import org.osmdroid.api.IGeoPoint;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.ScaleBarOverlay;
import org.osmdroid.views.overlay.compass.CompassOverlay;
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider;
import org.osmdroid.views.overlay.gestures.RotationGestureOverlay;
import org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider;
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay;
import org.osmdroid.views.overlay.simplefastpoint.LabelledGeoPoint;
import org.osmdroid.views.overlay.simplefastpoint.SimpleFastPointOverlay;
import org.osmdroid.views.overlay.simplefastpoint.SimpleFastPointOverlayOptions;
import org.osmdroid.views.overlay.simplefastpoint.SimplePointTheme;

import java.util.ArrayList;
import java.util.List;

public class BasicMapTestActivity extends AppCompatActivity implements View.onclickListener {

    private MapView mapView;
    //地图旋转
    private RotationGestureOverlay mRotationGestureOverlay;
    //比例尺
    private ScaleBarOverlay mScaleBarOverlay;
    //指南针方向
    private CompassOverlay mCompassOverlay = null;
    //设置导航图标的位置
    private MyLocationNewOverlay mLocationOverlay;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_basic_test);

        initView();
    }

    private void initView() {

        findViewById(R.id.button1).setonclickListener(this);
        findViewById(R.id.button2).setonclickListener(this);
        findViewById(R.id.button3).setonclickListener(this);
        findViewById(R.id.button4).setonclickListener(this);

        mapView = (MapView) findViewById(R.id.mymapview);
        mapView.setDrawingCacheEnabled(true);
        mapView.setMaxZoomLevel(20);
        mapView.setMinZoomLevel(6);
        mapView.getController().setZoom(12);
        mapView.setTileSource(TileSourceFactory.MAPNIK);
        mapView.setUseDataConnection(true);
        mapView.setMultiTouchControls(true);// 触控放大缩小
        //是否显示地图数据源
        mapView.getOverlayManager().getTilesOverlay().setEnabled(true);


        //地图自由旋转
        mRotationGestureOverlay = new RotationGestureOverlay(mapView);
        mRotationGestureOverlay.setEnabled(true);
        mapView.getOverlays().add(this.mRotationGestureOverlay);

        //比例尺配置
        final DisplayMetrics dm = getResources().getDisplayMetrics();
        mScaleBarOverlay = new ScaleBarOverlay(mapView);
        mScaleBarOverlay.setCentred(true);
        mScaleBarOverlay.setAlignBottom(true); /

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        105  2017-02-13 11:15  Osmdroid-Sample\.gitignore

     文件         31  2017-02-13 11:18  Osmdroid-Sample\.gradle\2.14.1\taskArtifacts\cache.properties

     文件         17  2017-04-20 19:07  Osmdroid-Sample\.gradle\2.14.1\taskArtifacts\cache.properties.lock

     文件     580575  2017-04-20 19:07  Osmdroid-Sample\.gradle\2.14.1\taskArtifacts\fileHashes.bin

     文件   13426504  2017-04-20 19:07  Osmdroid-Sample\.gradle\2.14.1\taskArtifacts\fileSnapshots.bin

     文件     105052  2017-04-20 19:07  Osmdroid-Sample\.gradle\2.14.1\taskArtifacts\fileSnapshotsToTreeSnapshotsIndex.bin

     文件     354963  2017-04-20 19:07  Osmdroid-Sample\.gradle\2.14.1\taskArtifacts\taskArtifacts.bin

     文件      85626  2017-02-20 20:02  Osmdroid-Sample\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.bin

     文件         17  2017-02-20 20:02  Osmdroid-Sample\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.lock

     文件      30989  2017-02-20 20:02  Osmdroid-Sample\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.bin

     文件         17  2017-02-20 20:02  Osmdroid-Sample\.gradle\2.14.1\tasks\_app_compileDebugJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.lock

     文件      27347  2017-02-15 11:08  Osmdroid-Sample\.gradle\2.14.1\tasks\_app_compileReleaseJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.bin

     文件         17  2017-02-15 11:08  Osmdroid-Sample\.gradle\2.14.1\tasks\_app_compileReleaseJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.lock

     文件      20565  2017-02-15 11:08  Osmdroid-Sample\.gradle\2.14.1\tasks\_app_compileReleaseJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.bin

     文件         17  2017-02-15 11:08  Osmdroid-Sample\.gradle\2.14.1\tasks\_app_compileReleaseJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.lock

     文件      28337  2017-04-19 16:11  Osmdroid-Sample\.gradle\2.14.1\tasks\_asynctasksample_compileDebugJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.bin

     文件         17  2017-04-19 16:11  Osmdroid-Sample\.gradle\2.14.1\tasks\_asynctasksample_compileDebugJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.lock

     文件      19517  2017-04-19 16:11  Osmdroid-Sample\.gradle\2.14.1\tasks\_asynctasksample_compileDebugJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.bin

     文件         17  2017-04-19 16:11  Osmdroid-Sample\.gradle\2.14.1\tasks\_asynctasksample_compileDebugJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.lock

     文件      73935  2017-03-29 14:12  Osmdroid-Sample\.gradle\2.14.1\tasks\_OsmdroidSample_compileDebugJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.bin

     文件         17  2017-03-29 14:12  Osmdroid-Sample\.gradle\2.14.1\tasks\_OsmdroidSample_compileDebugJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.lock

     文件      20232  2017-03-29 14:12  Osmdroid-Sample\.gradle\2.14.1\tasks\_OsmdroidSample_compileDebugJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.bin

     文件         17  2017-03-29 14:12  Osmdroid-Sample\.gradle\2.14.1\tasks\_OsmdroidSample_compileDebugJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.lock

     文件     524040  2017-03-22 15:52  Osmdroid-Sample\.gradle\2.14.1\tasks\_same_compileDebugJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.bin

     文件         17  2017-03-22 15:52  Osmdroid-Sample\.gradle\2.14.1\tasks\_same_compileDebugJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.lock

     文件      23195  2017-03-22 15:52  Osmdroid-Sample\.gradle\2.14.1\tasks\_same_compileDebugJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.bin

     文件         17  2017-03-22 15:52  Osmdroid-Sample\.gradle\2.14.1\tasks\_same_compileDebugJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.lock

     文件      34324  2017-02-23 11:19  Osmdroid-Sample\.gradle\2.14.1\tasks\_same_compileReleaseJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.bin

     文件         17  2017-02-23 11:19  Osmdroid-Sample\.gradle\2.14.1\tasks\_same_compileReleaseJavaWithJavac\localClassSetAnalysis\localClassSetAnalysis.lock

     文件      19990  2017-02-23 11:19  Osmdroid-Sample\.gradle\2.14.1\tasks\_same_compileReleaseJavaWithJavac\localJarClasspathSnapshot\localJarClasspathSnapshot.bin

............此处省略154个文件信息

评论

共有 条评论