美文网首页ArcGIS runtime for Android
Arcgis runtime for Android 100.5

Arcgis runtime for Android 100.5

作者: _执_念__ | 来源:发表于2020-07-16 11:13 被阅读0次

    (三) 加载基础地图

    地图上的监听事件

    1. 地图加载完成监听

    mapView.addDrawStatusChangedListener {
                Log.e("test", it.drawStatus.name) // COMPLETED 地图加载完成
            }
    

    2. 地图缩放基本监听

    mapView.addMapScaleChangedListener {
                //自定义比例尺,在这里跟随地图变化
    
            }
    

    3. 地图旋转监听

    mapView.addMapRotationChangedListener {
               //自定义指南针,可以在这里设置,跟随地图旋转
    
            }
    

    4. 图层状态变化监听

     mapView.addLayerViewStateChangedListener { 
                //图层超出或进入可见范围,或者控制可见不可见时调用
    
            }
    

    5. 点击事件监听

    mapView.onTouchListener = object : DefaultMapViewOnTouchListener(this, mapView) {
       override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
          //单击事件
      
         return super.onSingleTapConfirmed(e)
        }
    }
    

    地图的一些操作

    1. 移动到某点为中心

    (中心点坐标,比例)
     mapView.setViewpointCenterAsync(Point(1.2957313863797672E7, 4852689.604022887), 50000.0)
    

    2. 移动到某个范围

     val envelope = Envelope(
                    1.2948833926058898E7,
                    4349896.492981933,
                    1.3109843192109745E7,
                    4447340.642539789,
                    mapView.spatialReference
                )
    mapView.setViewpointGeometryAsync(envelope)
    

    3. 设置旋转角度

    mapView.setViewpointRotationAsync(0.0)
    

    4. 设置缩放比例

    //设置比例
    mapView.setViewpointScaleAsync(10000)
    //缩小
     mapView.setViewpointScaleAsync(mapView.mapScale * 2)
    //放大
    mapView.setViewpointScaleAsync(mapView.mapScale * 0.5)
    

    (五) 绘制点、线、面、文字、图片

    相关文章

      网友评论

        本文标题:Arcgis runtime for Android 100.5

        本文链接:https://www.haomeiwen.com/subject/qafphktx.html