|  | @@ -14,22 +14,18 @@ import com.cr.cruav.R
 | 
	
		
			
				|  |  |  import com.cr.data.CrUtil
 | 
	
		
			
				|  |  |  import com.cr.dialog.DialogNormal
 | 
	
		
			
				|  |  |  import com.cr.map.*
 | 
	
		
			
				|  |  | -import com.esri.arcgisruntime.ArcGISRuntimeEnvironment
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.arcgisservices.LabelDefinition
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.data.Feature
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.data.FeatureTable
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.data.Geodatabase
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.data.QueryParameters
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.data.ServiceFeatureTable
 | 
	
		
			
				|  |  | -import com.esri.arcgisruntime.geometry.Geometry
 | 
	
		
			
				|  |  | -import com.esri.arcgisruntime.geometry.Point
 | 
	
		
			
				|  |  | -import com.esri.arcgisruntime.geometry.PointBuilder
 | 
	
		
			
				|  |  | -import com.esri.arcgisruntime.geometry.PolylineBuilder
 | 
	
		
			
				|  |  | +import com.esri.arcgisruntime.geometry.*
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.layers.ArcGISMapImageLayer
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.layers.ArcGISTiledLayer
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.layers.FeatureLayer
 | 
	
		
			
				|  |  | +import com.esri.arcgisruntime.layers.Layer
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.mapping.ArcGISMap
 | 
	
		
			
				|  |  | -import com.esri.arcgisruntime.mapping.GeoElement
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.mapping.view.*
 | 
	
		
			
				|  |  |  import com.esri.arcgisruntime.symbology.*
 | 
	
		
			
				|  |  |  import com.google.gson.JsonObject
 | 
	
	
		
			
				|  | @@ -110,9 +106,6 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |      // todo: 2023/4/13 标志相关
 | 
	
		
			
				|  |  |      private var markChange: EventMarkChange? = null
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // todo: 2023/4/13 动作相关
 | 
	
		
			
				|  |  | -    private var mapAction: MapAction? = null
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      // todo: 2023/4/14 绘制图层
 | 
	
		
			
				|  |  |      private var gLayerIco: GraphicsOverlay? = null // define: 2023/4/13 标志图层
 | 
	
		
			
				|  |  |      private var gLayerDoodle: GraphicsOverlay? = null // define: 2023/4/13 涂鸦图层
 | 
	
	
		
			
				|  | @@ -141,8 +134,8 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |      private var feaSelectCase: Feature? = null // define: 2023/4/13 选中的案件点
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // todo: 2023/4/14 编辑图层
 | 
	
		
			
				|  |  | -    private var fTableICO: FeatureTable? = null // define: 2023/4/14 永久标志表
 | 
	
		
			
				|  |  | -    private var fLayerICO: FeatureLayer? = null // define: 2023/4/14 永久标志图层
 | 
	
		
			
				|  |  | +    private var fTableMark: FeatureTable? = null // define: 2023/4/14 永久标志表
 | 
	
		
			
				|  |  | +    private var fLayerMark: FeatureLayer? = null // define: 2023/4/14 永久标志图层
 | 
	
		
			
				|  |  |      private var fTableMedia: FeatureTable? = null // define: 2023/4/14 媒体表
 | 
	
		
			
				|  |  |      private var fLayerMedia: FeatureLayer? = null // define: 2023/4/14 媒体图层
 | 
	
		
			
				|  |  |      private var fTableDoodle: FeatureTable? = null // define: 2023/4/14 永久涂鸦表
 | 
	
	
		
			
				|  | @@ -201,9 +194,7 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |              itView.backgroundGrid.gridLineColor = Color.argb(0, 255, 255, 255)
 | 
	
		
			
				|  |  |              // todo: 2023/4/17 设置草图编辑
 | 
	
		
			
				|  |  |              sketchEditor = SketchEditor()
 | 
	
		
			
				|  |  | -            sketchEditor?.sketchEditConfiguration?.let {
 | 
	
		
			
				|  |  | -                it.isAllowPartSelection = false
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +            setSketchEditor()
 | 
	
		
			
				|  |  |              itView.sketchEditor = sketchEditor
 | 
	
		
			
				|  |  |              // todo: 2023/4/18 Touch事件初始化
 | 
	
		
			
				|  |  |              mapTouch = MapTouch(context!!, itView)
 | 
	
	
		
			
				|  | @@ -215,18 +206,65 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | +     * 草图编辑工具监听
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private var sketchGeometryChangeListener =
 | 
	
		
			
				|  |  | +        SketchGeometryChangedListener { p0 -> // todo: 2023/4/21 计算测试
 | 
	
		
			
				|  |  | +            if(p0!!.geometry.geometryType == GeometryType.POLYLINE){
 | 
	
		
			
				|  |  | +                var polyline = p0.geometry as Polyline
 | 
	
		
			
				|  |  | +                var pointCollection = PointCollection(SpatialReference.create(3857))
 | 
	
		
			
				|  |  | +                for(point in polyline.parts[0].points){
 | 
	
		
			
				|  |  | +                    pointCollection.add(point)
 | 
	
		
			
				|  |  | +                    if(pointCollection.size >=2){
 | 
	
		
			
				|  |  | +                        var polyline = Polyline(pointCollection)
 | 
	
		
			
				|  |  | +                        var lineLength = GeometryEngine.length(polyline)
 | 
	
		
			
				|  |  | +                        CrUtil.print("长度$lineLength")
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private var sketchSelectedVertexChangedListener = SelectedVertexChangedListener { CrUtil.print("选择节点变化") }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 设置草图编辑器
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun setSketchEditor(){
 | 
	
		
			
				|  |  | +        // todo: 2023/4/21 获取样式
 | 
	
		
			
				|  |  | +        var sketchStyle:SketchStyle = sketchEditor!!.sketchStyle
 | 
	
		
			
				|  |  | +        // todo: 2023/4/21 设置点符号样式
 | 
	
		
			
				|  |  | +        var markerSymbol = SimpleMarkerSymbol()
 | 
	
		
			
				|  |  | +        markerSymbol.size = 10f
 | 
	
		
			
				|  |  | +        markerSymbol.color = Color.RED
 | 
	
		
			
				|  |  | +        markerSymbol.style = SimpleMarkerSymbol.Style.CIRCLE
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // todo: 2023/4/21 设置样式
 | 
	
		
			
				|  |  | +        sketchStyle.vertexSymbol = markerSymbol
 | 
	
		
			
				|  |  | +        // todo: 2023/4/21 启用
 | 
	
		
			
				|  |  | +        sketchEditor?.sketchStyle = sketchStyle
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  |       * Touch监听
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      private var touchListener = object : MapTouch.TouchListener {
 | 
	
		
			
				|  |  | -        // todo: 2023/4/18 涂鸦选择回调
 | 
	
		
			
				|  |  | -        override fun onDoodleSelect(feature: Feature?) {
 | 
	
		
			
				|  |  | -            if (feature != null) {
 | 
	
		
			
				|  |  | -                // todo: 2023/4/18 高亮显示
 | 
	
		
			
				|  |  | -                focusFeature(fLayerDoodle!!, feature)
 | 
	
		
			
				|  |  | -            } else {
 | 
	
		
			
				|  |  | -                unfocusFeature(fLayerDoodle!!)
 | 
	
		
			
				|  |  | +        // todo: 2023/4/21 选择
 | 
	
		
			
				|  |  | +        override fun onSelect(feature: Feature?, layer: Layer) {
 | 
	
		
			
				|  |  | +            if (layer is FeatureLayer) {
 | 
	
		
			
				|  |  | +                if (feature != null) {
 | 
	
		
			
				|  |  | +                    // todo: 2023/4/18 高亮显示
 | 
	
		
			
				|  |  | +                    focusFeature(layer!!, feature)
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    unfocusFeature(layer!!)
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // todo: 2023/4/19 标志添加回调
 | 
	
		
			
				|  |  | +        override fun onMarkAppend(mapPoint: Point) {
 | 
	
		
			
				|  |  | +            markAppend(mapPoint)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
	
		
			
				|  | @@ -241,6 +279,8 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |          addBaseGeoDatabaseToMap()
 | 
	
		
			
				|  |  |          // todo: 2023/4/14 添加可编辑矢量数据
 | 
	
		
			
				|  |  |          addEditGeoDatabaseToMap()
 | 
	
		
			
				|  |  | +        // todo: 2023/4/19 添加动态图层
 | 
	
		
			
				|  |  | +        addGraphicOverlayToMap()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // todo: 2023/4/13 定位地图中心点
 | 
	
		
			
				|  |  |          setMapCenter(118.709, 35.219, 5000.0);
 | 
	
	
		
			
				|  | @@ -319,15 +359,15 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |          // todo: 2023/4/14 数据加载完监听
 | 
	
		
			
				|  |  |          geoDatabase.addDoneLoadingListener(Runnable {
 | 
	
		
			
				|  |  |              // todo: 2023/4/14 初始化标志图层
 | 
	
		
			
				|  |  | -            fTableICO = geoDatabase.getGeodatabaseFeatureTable("ico84")
 | 
	
		
			
				|  |  | -            fLayerICO = FeatureLayer(fTableICO)
 | 
	
		
			
				|  |  | -            fLayerICO!!.name = LAYER_NAME_ICO
 | 
	
		
			
				|  |  | -            fLayerICO!!.isVisible = true
 | 
	
		
			
				|  |  | -            mMap!!.operationalLayers.add(fLayerICO)
 | 
	
		
			
				|  |  | +            fTableMark = geoDatabase.getGeodatabaseFeatureTable("ico84")
 | 
	
		
			
				|  |  | +            fLayerMark = FeatureLayer(fTableMark)
 | 
	
		
			
				|  |  | +            fLayerMark!!.name = LAYER_NAME_ICO
 | 
	
		
			
				|  |  | +            fLayerMark!!.isVisible = true
 | 
	
		
			
				|  |  | +            mMap!!.operationalLayers.add(fLayerMark)
 | 
	
		
			
				|  |  |              LayerManager.getInstance().addLayer(
 | 
	
		
			
				|  |  |                  LayerModel(
 | 
	
		
			
				|  |  | -                    fLayerICO!!.name,
 | 
	
		
			
				|  |  | -                    fLayerICO!!.isVisible, LayerType.LAYER_TYPE_FEATURE_EDIT, fLayerICO!!
 | 
	
		
			
				|  |  | +                    fLayerMark!!.name,
 | 
	
		
			
				|  |  | +                    fLayerMark!!.isVisible, LayerType.LAYER_TYPE_FEATURE_EDIT, fLayerMark!!
 | 
	
		
			
				|  |  |                  ), LayerManager.LayerGroup.LAYER_NAME_DAILY
 | 
	
		
			
				|  |  |              )
 | 
	
		
			
				|  |  |              // todo: 2023/4/14  初始化涂鸦图层
 | 
	
	
		
			
				|  | @@ -381,6 +421,15 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | +     * 添加动态图层到地图
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun addGraphicOverlayToMap() {
 | 
	
		
			
				|  |  | +        // todo: 2023/4/19 初始化动态标志图层
 | 
	
		
			
				|  |  | +        gLayerIco = GraphicsOverlay()
 | 
	
		
			
				|  |  | +        appendGraphicOverlay(gLayerIco!!, LAYER_NAME_TEMP_ICO)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  |       * 编辑图层符号话
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      private fun editLayerRenderer() {
 | 
	
	
		
			
				|  | @@ -392,7 +441,7 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |          val icoSymbol: PictureMarkerSymbol =
 | 
	
		
			
				|  |  |              createPictureMarkerSymbol(R.drawable.ico_ty1, 30f, 30f)
 | 
	
		
			
				|  |  |          val icoRenderer = SimpleRenderer(icoSymbol)
 | 
	
		
			
				|  |  | -        fLayerICO?.renderer = icoRenderer
 | 
	
		
			
				|  |  | +        fLayerMark?.renderer = icoRenderer
 | 
	
		
			
				|  |  |          // todo: 2023/4/14  违建符号化
 | 
	
		
			
				|  |  |          val mediaRenderer = UniqueValueRenderer()
 | 
	
		
			
				|  |  |          val mediaSymbolYes: PictureMarkerSymbol = createPictureMarkerSymbol(
 | 
	
	
		
			
				|  | @@ -495,6 +544,28 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | +     * 向地图中添加动态绘制图层
 | 
	
		
			
				|  |  | +     * @param layer GraphicsOverlay 动态绘制图层
 | 
	
		
			
				|  |  | +     * @param layerName String 图层名称
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun appendGraphicOverlay(layer: GraphicsOverlay, layerName: String) {
 | 
	
		
			
				|  |  | +        // todo: 2023/4/19 设置该图层显示
 | 
	
		
			
				|  |  | +        layer.isVisible = true
 | 
	
		
			
				|  |  | +        mapView?.graphicsOverlays?.let {
 | 
	
		
			
				|  |  | +            it.add(layer)
 | 
	
		
			
				|  |  | +            LayerManager.getInstance().addLayer(
 | 
	
		
			
				|  |  | +                LayerModel(
 | 
	
		
			
				|  |  | +                    layerName,
 | 
	
		
			
				|  |  | +                    layer.isVisible,
 | 
	
		
			
				|  |  | +                    LayerType.LAYER_TYPE_GRAPHIC,
 | 
	
		
			
				|  |  | +                    layer
 | 
	
		
			
				|  |  | +                ), LayerManager.LayerGroup.LAYER_NAME_DRAW
 | 
	
		
			
				|  |  | +            )
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  |       * 创建图片符号
 | 
	
		
			
				|  |  |       * @param drawable Int 图片资源Id
 | 
	
		
			
				|  |  |       * @param width Float 宽度
 | 
	
	
		
			
				|  | @@ -580,14 +651,14 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 清除全部选择
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    private fun unfocusAllFeature(){
 | 
	
		
			
				|  |  | -        for(layer in mMap!!.operationalLayers){
 | 
	
		
			
				|  |  | -            if(layer is FeatureLayer){
 | 
	
		
			
				|  |  | +    private fun unfocusAllFeature() {
 | 
	
		
			
				|  |  | +        for (layer in mMap!!.operationalLayers) {
 | 
	
		
			
				|  |  | +            if (layer is FeatureLayer) {
 | 
	
		
			
				|  |  |                  layer.clearSelection()
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        for(overLayer in mapView!!.graphicsOverlays){
 | 
	
		
			
				|  |  | +        for (overLayer in mapView!!.graphicsOverlays) {
 | 
	
		
			
				|  |  |              overLayer.clearSelection()
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -622,7 +693,7 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |                          DialogNormal(context!!, "提示", "涂鸦保存成功!").show()
 | 
	
		
			
				|  |  |                          sketchEditor?.stop()
 | 
	
		
			
				|  |  |                          CrApplication.getEventBus()
 | 
	
		
			
				|  |  | -                            .post(FragmentDoodle.EventAction(FragmentDoodle.EventAction.CLOSE_DRAW))
 | 
	
		
			
				|  |  | +                            .post(FragmentDoodle.EventDoodleAction(FragmentDoodle.EventDoodleAction.CLOSE_DRAW))
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  } catch (e: InterruptedException) {
 | 
	
		
			
				|  |  |                      DialogNormal(context!!, "警告", e.message!!).show()
 | 
	
	
		
			
				|  | @@ -634,9 +705,10 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | -     * 删除全部涂鸦
 | 
	
		
			
				|  |  | +     * 删除数据表中的全部数据
 | 
	
		
			
				|  |  | +     * @param delTable FeatureTable 数据表
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    private fun doodleRemove() {
 | 
	
		
			
				|  |  | +    private fun removeAllFeatureByTable(delTable: FeatureTable) {
 | 
	
		
			
				|  |  |          var dialog = DialogNormal(context!!, "警告", "删除后无法恢复,是否删除?")
 | 
	
		
			
				|  |  |          dialog.setButtonsText("是", "否")
 | 
	
		
			
				|  |  |          dialog.setListener(object : DialogNormal.DialogNormalListener {
 | 
	
	
		
			
				|  | @@ -644,24 +716,24 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |              override fun completion() {
 | 
	
		
			
				|  |  |                  var params = QueryParameters()
 | 
	
		
			
				|  |  |                  params.whereClause = "1=1"
 | 
	
		
			
				|  |  | -                var queryAsync = fTableDoodle?.queryFeaturesAsync(params)
 | 
	
		
			
				|  |  | +                var queryAsync = delTable?.queryFeaturesAsync(params)
 | 
	
		
			
				|  |  |                  queryAsync?.addDoneListener(Runnable {
 | 
	
		
			
				|  |  |                      try {
 | 
	
		
			
				|  |  |                          if (queryAsync.isDone) {
 | 
	
		
			
				|  |  | -                            var deleteAsync = fTableDoodle?.deleteFeaturesAsync(queryAsync.get())
 | 
	
		
			
				|  |  | +                            var deleteAsync = delTable?.deleteFeaturesAsync(queryAsync.get())
 | 
	
		
			
				|  |  |                              deleteAsync?.addDoneListener(Runnable {
 | 
	
		
			
				|  |  |                                  try {
 | 
	
		
			
				|  |  |                                      if (deleteAsync.isDone) {
 | 
	
		
			
				|  |  | -                                        DialogNormal(context!!, "提示", "删除成功!").show()
 | 
	
		
			
				|  |  | +                                        showInformation("删除成功!")
 | 
	
		
			
				|  |  |                                      }
 | 
	
		
			
				|  |  |                                  } catch (e: java.lang.IllegalArgumentException) {
 | 
	
		
			
				|  |  | -                                    DialogNormal(context!!, "错误", "删除错误!").show()
 | 
	
		
			
				|  |  | +                                    showError("删除错误!")
 | 
	
		
			
				|  |  |                                  }
 | 
	
		
			
				|  |  |                              })
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      } catch (e: java.lang.IllegalArgumentException) {
 | 
	
		
			
				|  |  | -                        DialogNormal(context!!, "错误", "查询错误!").show()
 | 
	
		
			
				|  |  | +                        showError("删除错误!")
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  })
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -676,24 +748,25 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | -     * 删除选择涂鸦
 | 
	
		
			
				|  |  | +     * 删除图层中选中的要素
 | 
	
		
			
				|  |  | +     * @param layer FeatureLayer 图层
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    private fun doodleDelete() {
 | 
	
		
			
				|  |  | +    private fun doodleSelectFeature(layer: FeatureLayer) {
 | 
	
		
			
				|  |  |          var dialog = DialogNormal(context!!, "警告", "删除后无法恢复,是否删除?")
 | 
	
		
			
				|  |  |          dialog.setButtonsText("是", "否")
 | 
	
		
			
				|  |  |          dialog.setListener(object : DialogNormal.DialogNormalListener {
 | 
	
		
			
				|  |  |              override fun completion() {
 | 
	
		
			
				|  |  | -                var sAsync = fLayerDoodle!!.selectedFeaturesAsync
 | 
	
		
			
				|  |  | +                var sAsync = layer!!.selectedFeaturesAsync
 | 
	
		
			
				|  |  |                  sAsync.addDoneListener(Runnable {
 | 
	
		
			
				|  |  | -                    if (sAsync.isDone){
 | 
	
		
			
				|  |  | +                    if (sAsync.isDone) {
 | 
	
		
			
				|  |  |                          var result = sAsync.get()
 | 
	
		
			
				|  |  | -                        var dAsync = fTableDoodle!!.deleteFeaturesAsync(result)
 | 
	
		
			
				|  |  | -                        dAsync.addDoneListener(Runnable{
 | 
	
		
			
				|  |  | +                        var dAsync = layer.featureTable.deleteFeaturesAsync(result)
 | 
	
		
			
				|  |  | +                        dAsync.addDoneListener(Runnable {
 | 
	
		
			
				|  |  |                              try {
 | 
	
		
			
				|  |  | -                                if(dAsync.isDone){
 | 
	
		
			
				|  |  | +                                if (dAsync.isDone) {
 | 
	
		
			
				|  |  |                                      DialogNormal(context!!, "提示", "删除成功!").show()
 | 
	
		
			
				|  |  |                                  }
 | 
	
		
			
				|  |  | -                            }catch (e:java.lang.IllegalArgumentException){
 | 
	
		
			
				|  |  | +                            } catch (e: java.lang.IllegalArgumentException) {
 | 
	
		
			
				|  |  |                                  DialogNormal(context!!, "错误", "删除错误!").show()
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  |                          })
 | 
	
	
		
			
				|  | @@ -708,6 +781,91 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | +     * 添加标志
 | 
	
		
			
				|  |  | +     * @param mapPoint Point 地图点
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun markAppend(mapPoint: Point) {
 | 
	
		
			
				|  |  | +        if (markChange == null) return
 | 
	
		
			
				|  |  | +        var markSymbol = createPictureMarkerSymbol(markChange!!.markDrawable, 0f, 0f)
 | 
	
		
			
				|  |  | +        // todo: 2023/4/19 设置偏移
 | 
	
		
			
				|  |  | +        markSymbol.offsetX = -1 * markSymbol.width / 2
 | 
	
		
			
				|  |  | +        markSymbol.angle = markChange!!.markAngle.toFloat()
 | 
	
		
			
				|  |  | +        // todo: 2023/4/19 创建要素
 | 
	
		
			
				|  |  | +        var markGraphic = Graphic(mapPoint, markSymbol)
 | 
	
		
			
				|  |  | +        gLayerIco?.graphics?.add(markGraphic)
 | 
	
		
			
				|  |  | +        CrUtil.showMessage("标志添加成功!")
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 保存标志
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun markSave() {
 | 
	
		
			
				|  |  | +        gLayerIco?.let {
 | 
	
		
			
				|  |  | +            var features: MutableList<Feature> = mutableListOf()
 | 
	
		
			
				|  |  | +            for (graphic in it.graphics) {
 | 
	
		
			
				|  |  | +                var feature = fTableMark?.createFeature()
 | 
	
		
			
				|  |  | +                feature?.geometry = graphic.geometry
 | 
	
		
			
				|  |  | +                features.add(feature!!)
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            var addAsync = fTableMark?.addFeaturesAsync(features)
 | 
	
		
			
				|  |  | +            addAsync?.addDoneListener(Runnable {
 | 
	
		
			
				|  |  | +                try {
 | 
	
		
			
				|  |  | +                    if (addAsync.isDone) {
 | 
	
		
			
				|  |  | +                        showInformation("保存成功!")
 | 
	
		
			
				|  |  | +                        gLayerIco?.graphics?.clear()
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                } catch (e: java.lang.IllegalArgumentException) {
 | 
	
		
			
				|  |  | +                    showError("保存错误!")
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 测量长度
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun measureLength(){
 | 
	
		
			
				|  |  | +        CrUtil.showMessage("地图上点击开始测量!")
 | 
	
		
			
				|  |  | +        sketchEditor?.let {
 | 
	
		
			
				|  |  | +            it.stop()
 | 
	
		
			
				|  |  | +            // todo: 2023/4/21 设置编辑模式
 | 
	
		
			
				|  |  | +            var model = SketchEditConfiguration()
 | 
	
		
			
				|  |  | +            model.isAllowPartSelection = false
 | 
	
		
			
				|  |  | +            model.isContextMenuEnabled = false
 | 
	
		
			
				|  |  | +            model.isRequireSelectionBeforeDrag = true
 | 
	
		
			
				|  |  | +            it.start(SketchCreationMode.POLYLINE,model)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            it.opacity = 1.0f
 | 
	
		
			
				|  |  | +            // todo: 2023/4/21 设置监听
 | 
	
		
			
				|  |  | +            it.addGeometryChangedListener(sketchGeometryChangeListener)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 显示警告信息
 | 
	
		
			
				|  |  | +     * @param warning String 警告消息
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun showWarning(warning: String) {
 | 
	
		
			
				|  |  | +        DialogNormal(context!!, "警告", warning).show()
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 显示错误信息
 | 
	
		
			
				|  |  | +     * @param error String 错误消息
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun showError(error: String) {
 | 
	
		
			
				|  |  | +        DialogNormal(context!!, "错误", error).show()
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 显示提示信息
 | 
	
		
			
				|  |  | +     * @param information String 提示消息
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun showInformation(information: String) {
 | 
	
		
			
				|  |  | +        DialogNormal(context!!, "提示", information).show()
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  |       * 订阅地图事件执行动作
 | 
	
		
			
				|  |  |       * @param event EventMap 事件
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -733,11 +891,11 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              // todo: 2023/4/17 全部删除保存的涂鸦
 | 
	
		
			
				|  |  |              MapAction.EventDoodleRemove -> {
 | 
	
		
			
				|  |  | -                doodleRemove()
 | 
	
		
			
				|  |  | +                removeAllFeatureByTable(fTableDoodle!!)
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              // todo: 2023/4/18 删除选择涂鸦
 | 
	
		
			
				|  |  |              MapAction.EventDoodleDelete -> {
 | 
	
		
			
				|  |  | -                doodleDelete()
 | 
	
		
			
				|  |  | +                doodleSelectFeature(fLayerDoodle!!)
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              // todo: 2023/4/18 选择涂鸦
 | 
	
		
			
				|  |  |              MapAction.MapTapSelectDoodle -> {
 | 
	
	
		
			
				|  | @@ -745,10 +903,46 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |                  mapTouch?.setQueryLayer(fLayerDoodle!!, MapAction.MapTapSelectDoodle)
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              // todo: 2023/4/18 停止Touch
 | 
	
		
			
				|  |  | -            MapAction.EventStopTouch->{
 | 
	
		
			
				|  |  | -                mapTouch?.setQueryLayer(null,null)
 | 
	
		
			
				|  |  | +            MapAction.EventStopTouch -> {
 | 
	
		
			
				|  |  | +                mapTouch?.setQueryLayer(null, null)
 | 
	
		
			
				|  |  |                  unfocusAllFeature()
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            // todo: 2023/4/19 绘制标志
 | 
	
		
			
				|  |  | +            MapAction.MapTapAppendMark -> {
 | 
	
		
			
				|  |  | +                CrUtil.showMessage("地图上单击创建标志!")
 | 
	
		
			
				|  |  | +                if (event.owner is FragmentMark) {
 | 
	
		
			
				|  |  | +                    markChange = (event.owner as FragmentMark).getMark()
 | 
	
		
			
				|  |  | +                    mapTouch?.setAction(MapAction.MapTapAppendMark)
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            // todo: 2023/4/19 清除标志
 | 
	
		
			
				|  |  | +            MapAction.EventMarkClear -> {
 | 
	
		
			
				|  |  | +                gLayerIco?.let {
 | 
	
		
			
				|  |  | +                    it.graphics?.clear()
 | 
	
		
			
				|  |  | +                    CrUtil.showMessage("标志清除完成!")
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            // todo: 2023/4/19 标志保存
 | 
	
		
			
				|  |  | +            MapAction.EventMarkSave -> {
 | 
	
		
			
				|  |  | +                markSave()
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            // todo: 2023/4/19 删除保存的全部标志
 | 
	
		
			
				|  |  | +            MapAction.EventMarkRemove -> {
 | 
	
		
			
				|  |  | +                removeAllFeatureByTable(fTableMark!!)
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            // todo: 2023/4/21 选择标志
 | 
	
		
			
				|  |  | +            MapAction.MapTapSelectMark -> {
 | 
	
		
			
				|  |  | +                CrUtil.showMessage("地图上点击需要选择的标志")
 | 
	
		
			
				|  |  | +                mapTouch?.setQueryLayer(fLayerMark!!, MapAction.MapTapSelectMark)
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            // todo: 2023/4/21 删除选择的标志
 | 
	
		
			
				|  |  | +            MapAction.EventMarkDelete->{
 | 
	
		
			
				|  |  | +                doodleSelectFeature(fLayerMark!!)
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            // todo: 2023/4/21 开始测量
 | 
	
		
			
				|  |  | +            MapAction.EventSurveyLength->{
 | 
	
		
			
				|  |  | +                measureLength()
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |