|  | @@ -8,7 +8,7 @@ import android.view.View
 | 
	
		
			
				|  |  |  import android.view.ViewGroup
 | 
	
		
			
				|  |  |  import com.cr.common.CrUnitManager
 | 
	
		
			
				|  |  |  import com.cr.common.DataManager
 | 
	
		
			
				|  |  | -import com.cr.common.FileManager
 | 
	
		
			
				|  |  | +import com.cr.common.CrFileManager
 | 
	
		
			
				|  |  |  import com.cr.cruav.CrApplication
 | 
	
		
			
				|  |  |  import com.cr.cruav.R
 | 
	
		
			
				|  |  |  import com.cr.data.CrUtil
 | 
	
	
		
			
				|  | @@ -341,8 +341,8 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // todo: 2023/6/14 删除案件点
 | 
	
		
			
				|  |  | -        override fun onRemoveWaypoint(location: Point) {
 | 
	
		
			
				|  |  | -            caseRemoveCaseWaypoing(location)
 | 
	
		
			
				|  |  | +        override fun onRemoveWaypoint(screenPoint: android.graphics.Point) {
 | 
	
		
			
				|  |  | +            caseRemoveCaseWaypoing(screenPoint)
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // todo: 2023/6/14 选择移动的案件点
 | 
	
	
		
			
				|  | @@ -413,7 +413,7 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |       * 添加基础矢量地图集合
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      private fun addBaseGeoDatabaseToMap() {
 | 
	
		
			
				|  |  | -        if (!FileManager.isExists(CrUtil.MAP_PATH_BASE)) return
 | 
	
		
			
				|  |  | +        if (!CrFileManager.isExists(CrUtil.MAP_PATH_BASE)) return
 | 
	
		
			
				|  |  |          var geoDatabase = Geodatabase(CrUtil.MAP_PATH_BASE)
 | 
	
		
			
				|  |  |          // todo: 2023/4/13 加载完成监听
 | 
	
		
			
				|  |  |          geoDatabase.addDoneLoadingListener(Runnable {
 | 
	
	
		
			
				|  | @@ -444,7 +444,7 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |       * 加载可编辑数据
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      private fun addEditGeoDatabaseToMap() {
 | 
	
		
			
				|  |  | -        if (!FileManager.isExists(CrUtil.MAP_PATH_EDIT)) return
 | 
	
		
			
				|  |  | +        if (!CrFileManager.isExists(CrUtil.MAP_PATH_EDIT)) return
 | 
	
		
			
				|  |  |          var geoDatabase = Geodatabase(CrUtil.MAP_PATH_EDIT)
 | 
	
		
			
				|  |  |          // todo: 2023/4/14 数据加载完监听
 | 
	
		
			
				|  |  |          geoDatabase.addDoneLoadingListener(Runnable {
 | 
	
	
		
			
				|  | @@ -1285,25 +1285,17 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 删除案件点
 | 
	
		
			
				|  |  | -     * @param queryPoint Point 查询产靠位置
 | 
	
		
			
				|  |  | +     * @param screenPoint android.graphics.Point 查询产靠位置
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    private fun caseRemoveCaseWaypoing(queryPoint: Point) {
 | 
	
		
			
				|  |  | -        // todo: 2023/6/14 创建缓冲区
 | 
	
		
			
				|  |  | -        var queryGeometry = GeometryEngine.buffer(queryPoint, 10.0)
 | 
	
		
			
				|  |  | -        // todo: 2023/6/14 设置查询参数
 | 
	
		
			
				|  |  | -        var queryParameters = QueryParameters()
 | 
	
		
			
				|  |  | -        queryParameters.spatialRelationship = QueryParameters.SpatialRelationship.CONTAINS
 | 
	
		
			
				|  |  | -        queryParameters.geometry = queryGeometry
 | 
	
		
			
				|  |  | -        queryParameters.whereClause = "1=1"
 | 
	
		
			
				|  |  | +    private fun caseRemoveCaseWaypoing(screenPoint: android.graphics.Point) {
 | 
	
		
			
				|  |  |          // todo: 2023/6/14 开始查询
 | 
	
		
			
				|  |  | -        var identifyAsync = fTableMedia?.queryFeaturesAsync(queryParameters)
 | 
	
		
			
				|  |  | +        var identifyAsync = map_mapView?.identifyLayerAsync(fLayerMedia,screenPoint,6.0,false)
 | 
	
		
			
				|  |  |          identifyAsync?.addDoneListener(Runnable {
 | 
	
		
			
				|  |  |              try {
 | 
	
		
			
				|  |  |                  if (identifyAsync.isDone) {
 | 
	
		
			
				|  |  | -                    var queryFeatures = identifyAsync.get()
 | 
	
		
			
				|  |  |                      var features = mutableListOf<Feature>()
 | 
	
		
			
				|  |  | -                    for (fea in queryFeatures) {
 | 
	
		
			
				|  |  | -                        features.add(fea)
 | 
	
		
			
				|  |  | +                    for (element in identifyAsync.get().elements) {
 | 
	
		
			
				|  |  | +                        features.add(element as Feature)
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      if (features.size > 0) {
 | 
	
		
			
				|  |  |                          var dig = DialogNormal(context!!)
 | 
	
	
		
			
				|  | @@ -1313,14 +1305,13 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |                          dig.setListener(object : DialogNormal.DialogNormalListener {
 | 
	
		
			
				|  |  |                              // todo: 2023/6/14 确认删除
 | 
	
		
			
				|  |  |                              override fun completion() {
 | 
	
		
			
				|  |  | -                                var deleteAsync = fTableMedia?.deleteFeaturesAsync(features)
 | 
	
		
			
				|  |  | -                                deleteAsync?.addDoneListener(Runnable {
 | 
	
		
			
				|  |  | -                                    try {
 | 
	
		
			
				|  |  | -                                        if (deleteAsync.isDone) {
 | 
	
		
			
				|  |  | -                                            showInformation("案件点删除成功!")
 | 
	
		
			
				|  |  | +                                caseRemoveWaypointAndUpdateCasePolygon(features,object:iCompletion{
 | 
	
		
			
				|  |  | +                                    override fun onCompletion(result: ResultModel) {
 | 
	
		
			
				|  |  | +                                        if(result.isSuccess == true){
 | 
	
		
			
				|  |  | +                                            CrUtil.showMessage("删除成功!")
 | 
	
		
			
				|  |  | +                                        }else{
 | 
	
		
			
				|  |  | +                                            showError(result.message!!)
 | 
	
		
			
				|  |  |                                          }
 | 
	
		
			
				|  |  | -                                    } catch (ex: java.lang.IllegalArgumentException) {
 | 
	
		
			
				|  |  | -                                        showError("案件点删除失败!")
 | 
	
		
			
				|  |  |                                      }
 | 
	
		
			
				|  |  |                                  })
 | 
	
		
			
				|  |  |                              }
 | 
	
	
		
			
				|  | @@ -1342,6 +1333,75 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | +     * 删除案件点并更新与之相对应的案件面
 | 
	
		
			
				|  |  | +     * @param features List<Feature> 案件点集合
 | 
	
		
			
				|  |  | +     * @param callback iCompletion 完成回调
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun caseRemoveWaypointAndUpdateCasePolygon(features:List<Feature>,callback: iCompletion){
 | 
	
		
			
				|  |  | +        var deleteAsync = fTableMedia?.deleteFeaturesAsync(features)
 | 
	
		
			
				|  |  | +        deleteAsync?.addDoneListener(Runnable {
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                if (deleteAsync.isDone) {
 | 
	
		
			
				|  |  | +                    // todo: 2023/6/16 更新
 | 
	
		
			
				|  |  | +                    var wheres = mutableListOf<String>()
 | 
	
		
			
				|  |  | +                    for(fea in features){
 | 
	
		
			
				|  |  | +                        wheres.add(fea.attributes[FIELD_CASE_NAME].toString())
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    caseUpdateCasePolygonByWhere(wheres,callback)
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } catch (ex: java.lang.IllegalArgumentException) {
 | 
	
		
			
				|  |  | +                if (callback != null) callback.onCompletion(ResultModel(false,"案件点删除失败!"))
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 根据更新条件更新案件点关联的案件面为 未关联案件点状态
 | 
	
		
			
				|  |  | +     * @param wheres List<String> 案件Id的集合
 | 
	
		
			
				|  |  | +     * @param callback iCompletion 完成回调
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private fun caseUpdateCasePolygonByWhere(wheres:List<String>,callback:iCompletion){
 | 
	
		
			
				|  |  | +        var updateWhere = ""
 | 
	
		
			
				|  |  | +        // todo: 2023/6/16 组合条件
 | 
	
		
			
				|  |  | +        for(where in wheres){
 | 
	
		
			
				|  |  | +            updateWhere += if(updateWhere == ""){
 | 
	
		
			
				|  |  | +                String.format("'%s'",where)
 | 
	
		
			
				|  |  | +            }else{
 | 
	
		
			
				|  |  | +                String.format(",'%s'",where)
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        // todo: 2023/6/16 开始查询
 | 
	
		
			
				|  |  | +        var queryParameters = QueryParameters()
 | 
	
		
			
				|  |  | +        queryParameters.whereClause = updateWhere
 | 
	
		
			
				|  |  | +        var asyncQuery = fTableCasePolygon?.queryFeaturesAsync(queryParameters)
 | 
	
		
			
				|  |  | +        asyncQuery?.addDoneListener(Runnable{
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                if(asyncQuery.isDone){
 | 
	
		
			
				|  |  | +                    var features = mutableListOf<Feature>()
 | 
	
		
			
				|  |  | +                    for(fea in asyncQuery.get()){
 | 
	
		
			
				|  |  | +                        fea.attributes[FIELD_CASE_POLYGON_ANJID] = ""
 | 
	
		
			
				|  |  | +                        fea.attributes[FIELD_CASE_POLYGON_BZ] = FIELD_CASE_POLYGON_BZ_VALUE_NO
 | 
	
		
			
				|  |  | +                        features.add(fea)
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    // todo: 2023/6/16 开始更新
 | 
	
		
			
				|  |  | +                    var asyncUpdate = fTableCasePolygon?.updateFeaturesAsync(features)
 | 
	
		
			
				|  |  | +                    asyncUpdate?.addDoneListener(Runnable {
 | 
	
		
			
				|  |  | +                        try {
 | 
	
		
			
				|  |  | +                            if(asyncUpdate.isDone){
 | 
	
		
			
				|  |  | +                                if(callback != null) callback.onCompletion(ResultModel(true,""))
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }catch (ex:java.lang.IllegalArgumentException){
 | 
	
		
			
				|  |  | +                            if(callback != null) callback.onCompletion(ResultModel(false,"关联案件更新失败!"))
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    })
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }catch(ex:java.lang.IllegalArgumentException) {
 | 
	
		
			
				|  |  | +                if(callback != null) callback.onCompletion(ResultModel(false,"关联案件查询失败!"))
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  |       * 移动案件点
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      private fun caseMoveWaypoint() {
 | 
	
	
		
			
				|  | @@ -1460,29 +1520,6 @@ class FragmentMap : CrAnimationFragment() {
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 显示警告信息
 | 
	
		
			
				|  |  | -     * @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()
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 订阅地图事件执行动作
 |