2019.9.8课程设计报告

一、当天完成的任务

   页面和代码的删减改动完成,再传gitlab;准备开始报告撰写

   更改地图标记为例:

//设置地图标记
    public void addMapMark(int position){
        MarkerOptions markerOption = new MarkerOptions();
        markerOption.position(listData.getLatLng());
        markerOption.title(listData.getName());
        markerOption.draggable(false);
        Bitmap bt = BitmapFactory.decodeFile(listData.getFilePath());
        if(bt != null){
            markerOption.icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory
                    .decodeFile(listData.getFilePath())));
        }else {
            Log.e(TAG, "没有获取到头像,使用默认头像");
            markerOption.icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory
                    .decodeResource(getResources(),R.mipmap.default_avatar1)));
        }

        aMap.addMarker(markerOption);
    }
根据坐标获得地址:
首先要在class里接口:

public class MainActivity extends BaseActivity implements GeocodeSearch.OnGeocodeSearchListener
然后传入坐标值

    /**
     * 得到地图地址信息
     * @param latLng 坐标值
     */
    public void getAddress(LatLng latLng){
        geocodeSearch = new GeocodeSearch(this);
        geocodeSearch.setOnGeocodeSearchListener(this);
        Log.e(TAG, "getAddress 坐标值:"+"latitude:" +latLng.latitude+"longitude:"+latLng.longitude);
        LatLonPoint latLonPoint = new LatLonPoint(latLng.latitude,latLng.longitude);
        RegeocodeQuery regeocodeQuery = new RegeocodeQuery(latLonPoint,200,GeocodeSearch.AMAP);//发生送坐标、范围、坐标系
        geocodeSearch.getFromLocationAsyn(regeocodeQuery);
    }
获得坐标的地图地址文本回调

@Override  //根据坐标返回文本地址的回调接口
    public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
        //1000 是高德官方指定的成功的回返码
        if( i == 1000){
            Log.e(TAG, "onRegeocodeSearched回调码i: "+i );
            RegeocodeAddress regeocodeAddress = regeocodeResult.getRegeocodeAddress();
            address = regeocodeAddress.getFormatAddress();
            Log.e(TAG, "onRegeocodeSearched地址: "+mAddress);
            mAddress.setText(address);
        }else {
            Log.e(TAG, "onRegeocodeSearched回调码i: "+i );
        }

    }

    @Override
    public void onGeocodeSearched(GeocodeResult geocodeResult, int i) {
        //根据地址返回坐标的回调,不用到
    }

二、第二天的计划

   开始报告撰写,大概两天完成。

三、每日小结

   ①自己做的项目,代码冗余太多,项目太大

   ②测试的时候创建的分支太多了,搞得后面删减的时候不知道什么该删,什么不该删。同时自己从不对Activity重命名,让我不知道每个Activity的作用

   ③有空把小程序开发也看看hhh

猜你喜欢

转载自www.cnblogs.com/RecKono/p/11488237.html
今日推荐