Git Product home page Git Product logo

navi's Introduction

一键导航和拖拽选址

综合使用搜索和导航实现导航到周边餐馆功能示例

前述

扫一扫安装##

Screenshot

使用方法##

###1:配置搭建AndroidSDK工程###

结果展示##

  • 搜索周边餐饮服务

Screenshot

  • 导航到选定目的地

Screenshot

核心类/接口

接口 说明 版本
PoiSearch.Query Query(String query,String ctgr) Query构造函数 V2.1.0
PoiSearch.SearchBound SearchBound(LatLonPoint center,int radiusInMeters) 根据给定的参数来构造PoiSearch.SearchBound 新对象 V2.1.0
PoiSearch searchPOIAsyn() 查询POI异步接口 V2.1.0
AMapNavi startNavi(int naviType) 开始导航。实时导航GPS未开启时,会自动打开GPS定位功能。模拟导航则不需要使用定位功能

核心难点

    /**
     * 自定义marker点击弹窗内容
     *
     * @param marker
     * @return
     */
    @Override
    public View getInfoWindow(final Marker marker) {
        View view = getLayoutInflater().inflate(R.layout.poikeywordsearch_uri,
                null);
        TextView title = (TextView) view.findViewById(R.id.title);
        title.setText(marker.getTitle());

        TextView snippet = (TextView) view.findViewById(R.id.snippet);
        int index = mPoiOverlay.getPoiIndex(marker);
        float distance = mPoiOverlay.getDistance(index);
        String showDistance = Utils.getFriendlyDistance((int) distance);
        snippet.setText("距当前位置" + showDistance);
        ImageButton button = (ImageButton) view
                .findViewById(R.id.start_amap_app);
        // 调起导航
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startAMapNavi(marker);
            }
        });
        return view;
    }
    
     /**
     * 驾车路径规划计算,计算单条路径
     */
    private void calculateDriveRoute(NaviLatLng start, NaviLatLng end) {
        int strategyFlag = 0;
        List<NaviLatLng> startList = new ArrayList<NaviLatLng>();
        /**
         * 途径点坐标集合
         */
        List<NaviLatLng> wayList = new ArrayList<NaviLatLng>();
        /**
         * 终点坐标集合[建议就一个终点]
         */
        List<NaviLatLng> endList = new ArrayList<NaviLatLng>();
        try {
            strategyFlag = mAMapNavi.strategyConvert(true, false, false, true, false);
        } catch (Exception e) {
            e.printStackTrace();
        }
        startList.add(start);
        endList.add(end);
        mAMapNavi.calculateDriveRoute(startList, endList, wayList, strategyFlag);
    }

=======

Navi

基于高德地图 一键导航和 拖拽选址(仿摩拜单车大头针拖拽选址)

10e844d20a7d66394a3f36f4ffe659a91546d6cd

navi's People

Contributors

marren06 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.