|
@@ -7,9 +7,8 @@ import android.os.Bundle
|
|
import android.view.LayoutInflater
|
|
import android.view.LayoutInflater
|
|
import android.view.View
|
|
import android.view.View
|
|
import android.view.ViewGroup
|
|
import android.view.ViewGroup
|
|
-import com.cr.common.CrFileManager
|
|
|
|
-import com.cr.common.CrUnitManager
|
|
|
|
-import com.cr.common.DataManager
|
|
|
|
|
|
+import androidx.fragment.app.activityViewModels
|
|
|
|
+import com.cr.common.*
|
|
import com.cr.cruav.CrApplication
|
|
import com.cr.cruav.CrApplication
|
|
import com.cr.cruav.R
|
|
import com.cr.cruav.R
|
|
import com.cr.data.CrUtil
|
|
import com.cr.data.CrUtil
|
|
@@ -19,6 +18,7 @@ import com.cr.event.EventMapCapture
|
|
import com.cr.map.*
|
|
import com.cr.map.*
|
|
import com.cr.models.CompletionModel
|
|
import com.cr.models.CompletionModel
|
|
import com.cr.models.ICompletion
|
|
import com.cr.models.ICompletion
|
|
|
|
+import com.cr.viewmodel.CrFlightControlVM
|
|
import com.esri.arcgisruntime.arcgisservices.LabelDefinition
|
|
import com.esri.arcgisruntime.arcgisservices.LabelDefinition
|
|
import com.esri.arcgisruntime.data.*
|
|
import com.esri.arcgisruntime.data.*
|
|
import com.esri.arcgisruntime.geometry.*
|
|
import com.esri.arcgisruntime.geometry.*
|
|
@@ -49,6 +49,8 @@ import kotlin.math.abs
|
|
* 描述:地图界面
|
|
* 描述:地图界面
|
|
*/
|
|
*/
|
|
class FragmentMap : CrAnimationFragment() {
|
|
class FragmentMap : CrAnimationFragment() {
|
|
|
|
+ // todo: 2023/8/17 飞行器模型
|
|
|
|
+ private val flightControlVm:CrFlightControlVM by activityViewModels()
|
|
/**
|
|
/**
|
|
* 事件监听接口
|
|
* 事件监听接口
|
|
*/
|
|
*/
|
|
@@ -87,40 +89,40 @@ class FragmentMap : CrAnimationFragment() {
|
|
val LAYER_NAME_AIR_HOME = "返航点"
|
|
val LAYER_NAME_AIR_HOME = "返航点"
|
|
|
|
|
|
// todo: 2023/4/14 符号相关常量
|
|
// todo: 2023/4/14 符号相关常量
|
|
- val SYMBOL_WIDTH = 25.0f; // define: 2023/4/13 图片符号的宽度
|
|
|
|
- val SYMBOL_HEIGHT = 25.0f; // define: 2023/4/13 图片符号的高度
|
|
|
|
- val R_LABEL_WJ_NO = "wj_no"; // define: 2023/4/13 未上传违建标识
|
|
|
|
- val R_LABEL_WJ_YES = "wj_yes"; // define: 2023/4/13 已上传违建标识
|
|
|
|
- val R_LABEL_REPEAT_NO = "repeat_no"; // define: 2023/4/13 为上传复飞点标识
|
|
|
|
- val R_LABEL_REPEAT_YES = "repeat_yes"; // define: 2023/4/13 已上传复飞点标识
|
|
|
|
|
|
+ val SYMBOL_WIDTH = 25.0f // define: 2023/4/13 图片符号的宽度
|
|
|
|
+ val SYMBOL_HEIGHT = 25.0f // define: 2023/4/13 图片符号的高度
|
|
|
|
+ val R_LABEL_WJ_NO = "wj_no" // define: 2023/4/13 未上传违建标识
|
|
|
|
+ val R_LABEL_WJ_YES = "wj_yes" // define: 2023/4/13 已上传违建标识
|
|
|
|
+ val R_LABEL_REPEAT_NO = "repeat_no" // define: 2023/4/13 为上传复飞点标识
|
|
|
|
+ val R_LABEL_REPEAT_YES = "repeat_yes" // define: 2023/4/13 已上传复飞点标识
|
|
|
|
|
|
// todo: 2023/4/14 媒体点相关常量
|
|
// todo: 2023/4/14 媒体点相关常量
|
|
- val MEDIA_TYPE_WJ_NO = "0"; // define: 2023/4/13 未上传的违建点
|
|
|
|
- val MEDIA_TYPE_WJ_YES = "1"; // define: 2023/4/13 已上传的违建点
|
|
|
|
- val MEDIA_TYPE_REPEAT_NO = "4"; // define: 2023/4/13 未上传的复飞案件
|
|
|
|
- val MEDIA_TYPE_REPEAT_YES = "5"; // define: 2023/4/13 已上传的复飞案件
|
|
|
|
|
|
+ val MEDIA_TYPE_WJ_NO = "0" // define: 2023/4/13 未上传的违建点
|
|
|
|
+ val MEDIA_TYPE_WJ_YES = "1" // define: 2023/4/13 已上传的违建点
|
|
|
|
+ val MEDIA_TYPE_REPEAT_NO = "4" // define: 2023/4/13 未上传的复飞案件
|
|
|
|
+ val MEDIA_TYPE_REPEAT_YES = "5" // define: 2023/4/13 已上传的复飞案件
|
|
|
|
|
|
// todo: 2023/4/14 字段相关常量
|
|
// todo: 2023/4/14 字段相关常量
|
|
companion object {
|
|
companion object {
|
|
- val FIELD_NET_CASE_POLYGON_AJH = "AJH"; // define: 2023/4/13 网络案件的案件编号
|
|
|
|
- val FIELD_CASE_POLYGON_ANJID = "ANJID"; // define: 2023/4/13 案件ID
|
|
|
|
- val FIELD_CASE_POLYGON_MJ = "MJ"; // define: 2023/4/13 面积
|
|
|
|
- val FIELD_CASE_POLYGON_BZ = "BZ"; // define: 2023/4/13 违建面的类型 0--代表未匹配 1--代表已匹配
|
|
|
|
- val FIELD_CASE_POLYGON_BZ_VALUE_NO = "0"; // define: 2023/4/13 未匹配
|
|
|
|
- val FIELD_CASE_POLYGON_BZ_VALUE_YES = "1"; // define: 2023/4/13 已匹配
|
|
|
|
- val FIELD_CASE_NAME = "NAME"; // define: 2023/4/13 名称字段
|
|
|
|
- val FIELD_CASE_IMAGES = "IMAGES"; // define: 2023/4/13 图片集合字段
|
|
|
|
- val FIELD_CASE_RQ = "RQ"; // define: 2023/4/13 日期字段
|
|
|
|
- val FIELD_CASE_LAT = "LAT"; // define: 2023/4/13 纬度字段
|
|
|
|
- val FIELD_CASE_LNG = "LNG"; // define: 2023/4/13 经度字段
|
|
|
|
- val FIELD_CASE_ISUP = "ISUP"; // define: 2023/4/13 是否上传
|
|
|
|
- val FIELD_CASE_ALT = "ALT"; // define: 2023/4/13 高度字段
|
|
|
|
- val FIELD_CASE_ANG = "ANG"; // define: 2023/4/13 角度字段
|
|
|
|
- val FIELD_CASE_TYPE = "TYPE"; // define: 2023/4/13 类型字段
|
|
|
|
- val FIELD_CASE_ISDOWN = "ISDOWN"; // define: 2023/4/13 是否下载
|
|
|
|
|
|
+ val FIELD_NET_CASE_POLYGON_AJH = "AJH" // define: 2023/4/13 网络案件的案件编号
|
|
|
|
+ val FIELD_CASE_POLYGON_ANJID = "ANJID" // define: 2023/4/13 案件ID
|
|
|
|
+ val FIELD_CASE_POLYGON_MJ = "MJ" // define: 2023/4/13 面积
|
|
|
|
+ val FIELD_CASE_POLYGON_BZ = "BZ" // define: 2023/4/13 违建面的类型 0--代表未匹配 1--代表已匹配
|
|
|
|
+ val FIELD_CASE_POLYGON_BZ_VALUE_NO = "0" // define: 2023/4/13 未匹配
|
|
|
|
+ val FIELD_CASE_POLYGON_BZ_VALUE_YES = "1" // define: 2023/4/13 已匹配
|
|
|
|
+ val FIELD_CASE_NAME = "NAME" // define: 2023/4/13 名称字段
|
|
|
|
+ val FIELD_CASE_IMAGES = "IMAGES" // define: 2023/4/13 图片集合字段
|
|
|
|
+ val FIELD_CASE_RQ = "RQ" // define: 2023/4/13 日期字段
|
|
|
|
+ val FIELD_CASE_LAT = "LAT" // define: 2023/4/13 纬度字段
|
|
|
|
+ val FIELD_CASE_LNG = "LNG" // define: 2023/4/13 经度字段
|
|
|
|
+ val FIELD_CASE_ISUP = "ISUP" // define: 2023/4/13 是否上传
|
|
|
|
+ val FIELD_CASE_ALT = "ALT" // define: 2023/4/13 高度字段
|
|
|
|
+ val FIELD_CASE_ANG = "ANG" // define: 2023/4/13 角度字段
|
|
|
|
+ val FIELD_CASE_TYPE = "TYPE" // define: 2023/4/13 类型字段
|
|
|
|
+ val FIELD_CASE_ISDOWN = "ISDOWN" // define: 2023/4/13 是否下载
|
|
|
|
|
|
val MEDIA_TYPE_WJ_NO = "0" // define: 2023/6/12 未上传的案件点
|
|
val MEDIA_TYPE_WJ_NO = "0" // define: 2023/6/12 未上传的案件点
|
|
- val MEDIA_TYPE_WJ_YES = "1"; // define: 2023/6/12 已上传的案件点
|
|
|
|
|
|
+ val MEDIA_TYPE_WJ_YES = "1" // define: 2023/6/12 已上传的案件点
|
|
val MEDIA_TYPE_REPEAT_NO = "4" // define: 2023/6/12 未上传的复飞点
|
|
val MEDIA_TYPE_REPEAT_NO = "4" // define: 2023/6/12 未上传的复飞点
|
|
val MEDIA_TYPE_REPEAT_YES = "5" // define: 2023/6/12 已上传的复飞点
|
|
val MEDIA_TYPE_REPEAT_YES = "5" // define: 2023/6/12 已上传的复飞点
|
|
}
|
|
}
|
|
@@ -130,7 +132,6 @@ class FragmentMap : CrAnimationFragment() {
|
|
|
|
|
|
// todo: 2023/4/14 绘制图层
|
|
// todo: 2023/4/14 绘制图层
|
|
private var gLayerIco: GraphicsOverlay? = null // define: 2023/4/13 标志图层
|
|
private var gLayerIco: GraphicsOverlay? = null // define: 2023/4/13 标志图层
|
|
- private var gLayerDoodle: GraphicsOverlay? = null // define: 2023/4/13 涂鸦图层
|
|
|
|
private var gLayerAirplaneLocation: GraphicsOverlay? = null // define: 2023/4/13 飞行器位置图层
|
|
private var gLayerAirplaneLocation: GraphicsOverlay? = null // define: 2023/4/13 飞行器位置图层
|
|
private var gLayerAirplaneHomeLocation: GraphicsOverlay? = null // define: 2023/4/13 飞行器返航点位置图层
|
|
private var gLayerAirplaneHomeLocation: GraphicsOverlay? = null // define: 2023/4/13 飞行器返航点位置图层
|
|
private var gLayerAirplaneLine: GraphicsOverlay? = null // define: 2023/4/13 飞行航线图层
|
|
private var gLayerAirplaneLine: GraphicsOverlay? = null // define: 2023/4/13 飞行航线图层
|
|
@@ -178,6 +179,10 @@ class FragmentMap : CrAnimationFragment() {
|
|
private var mapStateList = mutableListOf<MapStateModel>() // define: 2023/8/14 地图状态
|
|
private var mapStateList = mutableListOf<MapStateModel>() // define: 2023/8/14 地图状态
|
|
private var captureNames = mutableListOf<String>() // define: 2023/8/14 截屏图片名称
|
|
private var captureNames = mutableListOf<String>() // define: 2023/8/14 截屏图片名称
|
|
|
|
|
|
|
|
+ // todo: 2023/8/17 投影
|
|
|
|
+ private val spatialReferenceWGS84 = SpatialReference.create(4326)
|
|
|
|
+ private val spatialReferenceWebMTK = SpatialReference.create(3857)
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 重写创建View方法
|
|
* 重写创建View方法
|
|
@@ -227,7 +232,7 @@ class FragmentMap : CrAnimationFragment() {
|
|
setSketchEditor()
|
|
setSketchEditor()
|
|
itView.sketchEditor = sketchEditor
|
|
itView.sketchEditor = sketchEditor
|
|
// todo: 2023/4/18 Touch事件初始化
|
|
// todo: 2023/4/18 Touch事件初始化
|
|
- mapTouch = MapTouch(context!!, itView)
|
|
|
|
|
|
+ mapTouch = MapTouch(CrApplication.getContext(), itView)
|
|
mapTouch?.setListener(touchListener)
|
|
mapTouch?.setListener(touchListener)
|
|
itView.onTouchListener = mapTouch
|
|
itView.onTouchListener = mapTouch
|
|
}
|
|
}
|
|
@@ -378,7 +383,8 @@ class FragmentMap : CrAnimationFragment() {
|
|
addEditGeoDatabaseToMap()
|
|
addEditGeoDatabaseToMap()
|
|
// todo: 2023/4/19 添加动态图层
|
|
// todo: 2023/4/19 添加动态图层
|
|
addGraphicOverlayToMap()
|
|
addGraphicOverlayToMap()
|
|
-
|
|
|
|
|
|
+ // todo: 2023/8/17 添加飞行相关图层
|
|
|
|
+ addAirplaneLayerToMap()
|
|
// todo: 2023/4/13 定位地图中心点
|
|
// todo: 2023/4/13 定位地图中心点
|
|
setMapCenter(118.709, 35.219, 5000.0);
|
|
setMapCenter(118.709, 35.219, 5000.0);
|
|
}
|
|
}
|
|
@@ -532,7 +538,82 @@ class FragmentMap : CrAnimationFragment() {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 编辑图层符号话
|
|
|
|
|
|
+ * 添加飞行相关图层到地图
|
|
|
|
+ */
|
|
|
|
+ private fun addAirplaneLayerToMap() {
|
|
|
|
+ // todo: 2023/8/16 初始化航线图层
|
|
|
|
+ gLayerAirplaneLine = GraphicsOverlay()
|
|
|
|
+ gLayerAirplaneLine?.let {
|
|
|
|
+ overlaysAddToMap(it,LAYER_NAME_AIR_LINE,LayerManager.LayerGroup.LAYER_NAME_AIR)
|
|
|
|
+ }
|
|
|
|
+ // todo: 2023/8/16 初始化历史航线图层
|
|
|
|
+ gLayerHistoryAirplaneLine = GraphicsOverlay()
|
|
|
|
+ gLayerHistoryAirplaneLine?.let {
|
|
|
|
+ overlaysAddToMap(it,LAYER_NAME_AIR_HISTORY_LINE,LayerManager.LayerGroup.LAYER_NAME_AIR)
|
|
|
|
+ }
|
|
|
|
+ // todo: 2023/8/17 初始化返航点图层
|
|
|
|
+ gLayerAirplaneHomeLocation = GraphicsOverlay()
|
|
|
|
+ gLayerAirplaneHomeLocation?.let {
|
|
|
|
+ overlaysAddToMap(it,LAYER_NAME_AIR_HOME,LayerManager.LayerGroup.LAYER_NAME_AIR)
|
|
|
|
+ }
|
|
|
|
+ // todo: 2023/8/17 初始化飞行器图层
|
|
|
|
+ gLayerAirplaneLocation = GraphicsOverlay()
|
|
|
|
+ gLayerAirplaneLocation?.let {
|
|
|
|
+ overlaysAddToMap(it,LAYER_NAME_AIR_LOCATION,LayerManager.LayerGroup.LAYER_NAME_AIR)
|
|
|
|
+ }
|
|
|
|
+ // todo: 2023/8/17 符号化
|
|
|
|
+ initAirplaneSymbolInfo()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 飞行相关符号化
|
|
|
|
+ */
|
|
|
|
+ private fun initAirplaneSymbolInfo(){
|
|
|
|
+ // todo: 2023/8/17 符号化航线
|
|
|
|
+ symbolAirplaneLine = SimpleLineSymbol(SimpleLineSymbol.Style.SOLID,Color.WHITE,2.0f)
|
|
|
|
+ symbolAirplaneLink = SimpleLineSymbol(SimpleLineSymbol.Style.SOLID,Color.GREEN,2.0f)
|
|
|
|
+ builderAirplaneLine = PolylineBuilder(spatialReferenceWGS84)
|
|
|
|
+ builderAirplaneLink = PolylineBuilder(spatialReferenceWGS84)
|
|
|
|
+ graAirplaneLine = Graphic(builderAirplaneLine!!.toGeometry(),symbolAirplaneLine)
|
|
|
|
+ graAirplaneLink = Graphic(builderAirplaneLink!!.toGeometry(),symbolAirplaneLink)
|
|
|
|
+ gLayerAirplaneLine?.graphics?.add(graAirplaneLine)
|
|
|
|
+ gLayerAirplaneLine?.graphics?.add(graAirplaneLink)
|
|
|
|
+ // todo: 2023/8/17 飞行器符号化
|
|
|
|
+ builderAirplaneLocation = PointBuilder(spatialReferenceWGS84)
|
|
|
|
+ symbolAirplaneLocation = createPictureMarkerSymbol(R.drawable.ico_air,25f,40f)
|
|
|
|
+ graAirplaneLocation = Graphic(builderAirplaneLocation!!.toGeometry(),symbolAirplaneLocation)
|
|
|
|
+ gLayerAirplaneLocation?.graphics?.add(graAirplaneLocation)
|
|
|
|
+ // todo: 2023/8/17 返航位置初始化
|
|
|
|
+ builderAirplaneHomeLocation = PointBuilder(spatialReferenceWGS84)
|
|
|
|
+ var symbolAirplaneHomeLocation = createPictureMarkerSymbol(R.drawable.ico_home,30f,30f)
|
|
|
|
+ graAirplaneHomeLocation = Graphic(builderAirplaneHomeLocation!!.toGeometry(),symbolAirplaneHomeLocation)
|
|
|
|
+ gLayerAirplaneHomeLocation?.graphics?.add(graAirplaneHomeLocation)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加绘制图层到地图中
|
|
|
|
+ * @param layer GraphicsOverlay 绘制图层
|
|
|
|
+ * @param layerName String 图层名称
|
|
|
|
+ * @param group LayerGroup 分组
|
|
|
|
+ */
|
|
|
|
+ private fun overlaysAddToMap(layer:GraphicsOverlay,layerName:String,group:LayerManager.LayerGroup){
|
|
|
|
+ // todo: 2023/8/17 设置可见
|
|
|
|
+ layer.isVisible = true
|
|
|
|
+ // todo: 2023/8/17 加入到地图中
|
|
|
|
+ mapView?.graphicsOverlays!!.add(layer)
|
|
|
|
+ // todo: 2023/8/17 加入到图层控制中
|
|
|
|
+ LayerManager.getInstance().addLayer(
|
|
|
|
+ LayerModel(
|
|
|
|
+ layerName,
|
|
|
|
+ layer.isVisible,
|
|
|
|
+ LayerType.LAYER_TYPE_GRAPHIC,
|
|
|
|
+ layer
|
|
|
|
+ ), group
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 编辑图层符号化
|
|
*/
|
|
*/
|
|
private fun editLayerRenderer() {
|
|
private fun editLayerRenderer() {
|
|
// todo: 2023/4/14 永久涂鸦图层符号化
|
|
// todo: 2023/4/14 永久涂鸦图层符号化
|
|
@@ -678,7 +759,7 @@ class FragmentMap : CrAnimationFragment() {
|
|
width: Float,
|
|
width: Float,
|
|
height: Float
|
|
height: Float
|
|
): PictureMarkerSymbol {
|
|
): PictureMarkerSymbol {
|
|
- val tDrawable = context!!.resources.getDrawable(drawable) as BitmapDrawable
|
|
|
|
|
|
+ val tDrawable = CrApplication.getContext().resources.getDrawable(drawable) as BitmapDrawable
|
|
val symbol = PictureMarkerSymbol(tDrawable)
|
|
val symbol = PictureMarkerSymbol(tDrawable)
|
|
if (width > 0) symbol.width = width else symbol.width =
|
|
if (width > 0) symbol.width = width else symbol.width =
|
|
CrUnitManager.px2dp(tDrawable.bitmap.width).toFloat()
|
|
CrUnitManager.px2dp(tDrawable.bitmap.width).toFloat()
|
|
@@ -791,15 +872,15 @@ class FragmentMap : CrAnimationFragment() {
|
|
try {
|
|
try {
|
|
addAsync.get()
|
|
addAsync.get()
|
|
if (addAsync.isDone) {
|
|
if (addAsync.isDone) {
|
|
- DialogNormal(context!!, "提示", "涂鸦保存成功!").show()
|
|
|
|
|
|
+ showInformation("涂鸦保存成功!")
|
|
sketchEditor?.stop()
|
|
sketchEditor?.stop()
|
|
CrApplication.getEventBus()
|
|
CrApplication.getEventBus()
|
|
.post(FragmentDoodle.EventDoodleAction(FragmentDoodle.EventDoodleAction.CLOSE_DRAW))
|
|
.post(FragmentDoodle.EventDoodleAction(FragmentDoodle.EventDoodleAction.CLOSE_DRAW))
|
|
}
|
|
}
|
|
} catch (e: InterruptedException) {
|
|
} catch (e: InterruptedException) {
|
|
- DialogNormal(context!!, "警告", e.message!!).show()
|
|
|
|
|
|
+ showWarning(e.message!!)
|
|
} catch (e: ExecutionException) {
|
|
} catch (e: ExecutionException) {
|
|
- DialogNormal(context!!, "警告", e.message!!).show()
|
|
|
|
|
|
+ showWarning(e.message!!)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -810,7 +891,7 @@ class FragmentMap : CrAnimationFragment() {
|
|
* @param delTable FeatureTable 数据表
|
|
* @param delTable FeatureTable 数据表
|
|
*/
|
|
*/
|
|
private fun removeAllFeatureByTable(delTable: FeatureTable) {
|
|
private fun removeAllFeatureByTable(delTable: FeatureTable) {
|
|
- var dialog = DialogNormal(context!!, "警告", "删除后无法恢复,是否删除?")
|
|
|
|
|
|
+ var dialog = DialogNormal(CrApplication.getContext(), "警告", "删除后无法恢复,是否删除?")
|
|
dialog.setButtonsText("是", "否")
|
|
dialog.setButtonsText("是", "否")
|
|
dialog.setListener(object : DialogNormal.DialogNormalListener {
|
|
dialog.setListener(object : DialogNormal.DialogNormalListener {
|
|
// todo: 2023/4/17 删除
|
|
// todo: 2023/4/17 删除
|
|
@@ -853,7 +934,7 @@ class FragmentMap : CrAnimationFragment() {
|
|
* @param layer FeatureLayer 图层
|
|
* @param layer FeatureLayer 图层
|
|
*/
|
|
*/
|
|
private fun doodleSelectFeature(layer: FeatureLayer) {
|
|
private fun doodleSelectFeature(layer: FeatureLayer) {
|
|
- var dialog = DialogNormal(context!!, "警告", "删除后无法恢复,是否删除?")
|
|
|
|
|
|
+ var dialog = DialogNormal(requireContext(), "警告", "删除后无法恢复,是否删除?")
|
|
dialog.setButtonsText("是", "否")
|
|
dialog.setButtonsText("是", "否")
|
|
dialog.setListener(object : DialogNormal.DialogNormalListener {
|
|
dialog.setListener(object : DialogNormal.DialogNormalListener {
|
|
override fun completion() {
|
|
override fun completion() {
|
|
@@ -865,10 +946,10 @@ class FragmentMap : CrAnimationFragment() {
|
|
dAsync.addDoneListener(Runnable {
|
|
dAsync.addDoneListener(Runnable {
|
|
try {
|
|
try {
|
|
if (dAsync.isDone) {
|
|
if (dAsync.isDone) {
|
|
- DialogNormal(context!!, "提示", "删除成功!").show()
|
|
|
|
|
|
+ showInformation("删除成功!")
|
|
}
|
|
}
|
|
} catch (e: java.lang.IllegalArgumentException) {
|
|
} catch (e: java.lang.IllegalArgumentException) {
|
|
- DialogNormal(context!!, "错误", "删除错误!").show()
|
|
|
|
|
|
+ showError("删除错误!")
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -1310,7 +1391,7 @@ class FragmentMap : CrAnimationFragment() {
|
|
features.add(element as Feature)
|
|
features.add(element as Feature)
|
|
}
|
|
}
|
|
if (features.size > 0) {
|
|
if (features.size > 0) {
|
|
- var dig = DialogNormal(context!!)
|
|
|
|
|
|
+ var dig = DialogNormal(CrApplication.getContext())
|
|
dig.setTitle("提示")
|
|
dig.setTitle("提示")
|
|
dig.setMessage("删除后将无法恢复,确定删除吗?")
|
|
dig.setMessage("删除后将无法恢复,确定删除吗?")
|
|
dig.setButtonsText("删除", "取消")
|
|
dig.setButtonsText("删除", "取消")
|
|
@@ -1552,7 +1633,7 @@ class FragmentMap : CrAnimationFragment() {
|
|
* 保存截图
|
|
* 保存截图
|
|
* @param joinCaseName String 关联的案件名称
|
|
* @param joinCaseName String 关联的案件名称
|
|
*/
|
|
*/
|
|
- private fun captures(joinCaseName:String) {
|
|
|
|
|
|
+ private fun captures(joinCaseName: String) {
|
|
// todo: 2023/8/14 显示等待框
|
|
// todo: 2023/8/14 显示等待框
|
|
showLoading("初始化...")
|
|
showLoading("初始化...")
|
|
// todo: 2023/8/14 初始化图片信息
|
|
// todo: 2023/8/14 初始化图片信息
|
|
@@ -1582,7 +1663,7 @@ class FragmentMap : CrAnimationFragment() {
|
|
ovLayerList.add(ovLayersXZ)
|
|
ovLayerList.add(ovLayersXZ)
|
|
// todo: 2023/8/14 截图-规划图
|
|
// todo: 2023/8/14 截图-规划图
|
|
var opNamesGH = mutableListOf<String>(
|
|
var opNamesGH = mutableListOf<String>(
|
|
- LAYER_NAME_GH,LAYER_NAME_CONFIG_VILLAGE,LAYER_NAME_CONFIG_TOWNS,LAYER_NAME_CASE
|
|
|
|
|
|
+ LAYER_NAME_GH, LAYER_NAME_CONFIG_VILLAGE, LAYER_NAME_CONFIG_TOWNS, LAYER_NAME_CASE
|
|
)
|
|
)
|
|
var ovLayersGH = mutableListOf<GraphicsOverlay>(gLayerIco!!)
|
|
var ovLayersGH = mutableListOf<GraphicsOverlay>(gLayerIco!!)
|
|
opNameList.add(opNamesGH)
|
|
opNameList.add(opNamesGH)
|
|
@@ -1593,15 +1674,21 @@ class FragmentMap : CrAnimationFragment() {
|
|
updateLoading("保存地图状态...")
|
|
updateLoading("保存地图状态...")
|
|
saveMapLayerState()
|
|
saveMapLayerState()
|
|
updateLoading("截取影像图...")
|
|
updateLoading("截取影像图...")
|
|
- capturesByName(opNameList[0],ovLayerList[0],captureNames[0])
|
|
|
|
|
|
+ capturesByName(opNameList[0], ovLayerList[0], captureNames[0])
|
|
updateLoading("截取现状图...")
|
|
updateLoading("截取现状图...")
|
|
- capturesByName(opNameList[1],ovLayerList[1],captureNames[1])
|
|
|
|
|
|
+ capturesByName(opNameList[1], ovLayerList[1], captureNames[1])
|
|
updateLoading("截取规划图...")
|
|
updateLoading("截取规划图...")
|
|
- capturesByName(opNameList[2],ovLayerList[2],captureNames[2])
|
|
|
|
|
|
+ capturesByName(opNameList[2], ovLayerList[2], captureNames[2])
|
|
updateLoading("恢复地图状态...")
|
|
updateLoading("恢复地图状态...")
|
|
restoreMapLayerState()
|
|
restoreMapLayerState()
|
|
// todo: 2023/8/14 发送截图完成事件
|
|
// todo: 2023/8/14 发送截图完成事件
|
|
- CrApplication.getEventBus().post(EventMapCapture(EventMapCapture.CaptureAction.CAPTURE_ACTION_COMPLETE,null,captureNames))
|
|
|
|
|
|
+ CrApplication.getEventBus().post(
|
|
|
|
+ EventMapCapture(
|
|
|
|
+ EventMapCapture.CaptureAction.CAPTURE_ACTION_COMPLETE,
|
|
|
|
+ null,
|
|
|
|
+ captureNames
|
|
|
|
+ )
|
|
|
|
+ )
|
|
// todo: 2023/8/14 关闭等待框
|
|
// todo: 2023/8/14 关闭等待框
|
|
closeLoading()
|
|
closeLoading()
|
|
}
|
|
}
|
|
@@ -1706,6 +1793,87 @@ class FragmentMap : CrAnimationFragment() {
|
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream)
|
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 飞行器位置超边界剧中
|
|
|
|
+ * @param longitude Double 经度
|
|
|
|
+ * @param latitude Double 纬度
|
|
|
|
+ */
|
|
|
|
+ private fun aircraftCenter(longitude:Double,latitude:Double){
|
|
|
|
+ var visiblePolygon = mapView?.visibleArea
|
|
|
|
+ var airPoint = Point(longitude,latitude,spatialReferenceWGS84)
|
|
|
|
+ var targetPoint = GeometryEngine.project(airPoint,mapView?.spatialReference) as Point
|
|
|
|
+ if(!GeometryEngine.within(targetPoint,visiblePolygon)){
|
|
|
|
+ setMapCenter(longitude,latitude,0.0)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 初始化订阅
|
|
|
|
+ */
|
|
|
|
+ private fun initObserver(){
|
|
|
|
+ flightControlVm.flightControlInfo.observe(requireActivity()){
|
|
|
|
+ it?.let {
|
|
|
|
+ if(it.longitude > 10 && it.latitude > 10){
|
|
|
|
+ // todo: 2023/8/17 更新位置
|
|
|
|
+ updateAirplaneLocation(it)
|
|
|
|
+ // todo: 2023/8/17 更新返航点
|
|
|
|
+ updateAirplaneHomeLocation(it)
|
|
|
|
+ // todo: 2023/8/17 更新连接线
|
|
|
|
+ updateAirplaneLinkLine(it)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 更新飞行器位置
|
|
|
|
+ * @param obj CrFlightControlInfo 飞行器信息
|
|
|
|
+ */
|
|
|
|
+ private fun updateAirplaneLocation(obj:CrFlightControlInfo){
|
|
|
|
+ // todo: 2023/8/17 更新飞行器位置
|
|
|
|
+ builderAirplaneLocation?.setXY(obj.longitude,obj.latitude)
|
|
|
|
+ graAirplaneLocation?.geometry = builderAirplaneLocation!!.toGeometry()
|
|
|
|
+ // todo: 2023/8/17 更新角度
|
|
|
|
+ symbolAirplaneLocation?.angle = obj.yaw.toFloat()
|
|
|
|
+ // todo: 2023/8/17 超边界更新
|
|
|
|
+ aircraftCenter(obj.longitude,obj.latitude)
|
|
|
|
+ // todo: 2023/8/17 更新航线
|
|
|
|
+ builderAirplaneLine?.addPoint(Point(obj.longitude,obj.latitude))
|
|
|
|
+ graAirplaneLine?.geometry = builderAirplaneLine!!.toGeometry()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 更新返航位置
|
|
|
|
+ * @param obj CrFlightControlInfo 飞行器信息
|
|
|
|
+ */
|
|
|
|
+ private fun updateAirplaneHomeLocation(obj:CrFlightControlInfo){
|
|
|
|
+ if(obj.isUpdateHomeLocation){
|
|
|
|
+ CrUtil.print("返航点已刷新,请留意返航位置!")
|
|
|
|
+ CrAudioUtil.getInstance().play("返航点已刷新,请留意返航位置!")
|
|
|
|
+ builderAirplaneHomeLocation?.setXY(obj.homeLongitude,obj.homeLatitude)
|
|
|
|
+ graAirplaneHomeLocation?.geometry = builderAirplaneHomeLocation!!.toGeometry()
|
|
|
|
+ // todo: 2023/8/17 如果返航点已刷新 则认为是更换了起飞位置 则重新初始化航线
|
|
|
|
+ builderAirplaneLine = PolylineBuilder(spatialReferenceWGS84)
|
|
|
|
+ builderAirplaneLine?.addPoint(Point(obj.homeLongitude,obj.homeLatitude))
|
|
|
|
+ graAirplaneLine?.geometry = builderAirplaneLine!!.toGeometry()
|
|
|
|
+ // todo: 2023/8/17 设置更新标志 否则一直更新
|
|
|
|
+ obj.isUpdateHomeLocation = false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 更新连接线
|
|
|
|
+ * @param obj CrFlightControlInfo 飞行器信息
|
|
|
|
+ */
|
|
|
|
+ private fun updateAirplaneLinkLine(obj:CrFlightControlInfo){
|
|
|
|
+ if(obj.isHomeLocationValid && obj.isLocationValid){
|
|
|
|
+ builderAirplaneLink = PolylineBuilder(spatialReferenceWGS84)
|
|
|
|
+ builderAirplaneLink?.addPoint(Point(obj.longitude,obj.latitude))
|
|
|
|
+ builderAirplaneLink?.addPoint(Point(obj.homeLongitude,obj.homeLatitude))
|
|
|
|
+ graAirplaneLink?.geometry = builderAirplaneLink!!.toGeometry()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 订阅地图事件执行动作
|
|
* 订阅地图事件执行动作
|
|
@@ -1806,7 +1974,7 @@ class FragmentMap : CrAnimationFragment() {
|
|
}
|
|
}
|
|
// todo: 2023/6/7 输入坐标定位
|
|
// todo: 2023/6/7 输入坐标定位
|
|
MapAction.EventInputLocationToMap -> {
|
|
MapAction.EventInputLocationToMap -> {
|
|
- var dialogInput: DialogInput = DialogInput(context!!, "输入位置信息")
|
|
|
|
|
|
+ var dialogInput: DialogInput = DialogInput(requireContext(), "输入位置信息")
|
|
dialogInput.setButtonsText("确定", "关闭")
|
|
dialogInput.setButtonsText("确定", "关闭")
|
|
dialogInput.setHints("输入经度,例118.70687", "输入纬度,例35.218991")
|
|
dialogInput.setHints("输入经度,例118.70687", "输入纬度,例35.218991")
|
|
dialogInput.setFonts(
|
|
dialogInput.setFonts(
|
|
@@ -1862,9 +2030,9 @@ class FragmentMap : CrAnimationFragment() {
|
|
* 订阅截屏事件
|
|
* 订阅截屏事件
|
|
*/
|
|
*/
|
|
@Subscribe
|
|
@Subscribe
|
|
- fun onCapture(event:EventMapCapture){
|
|
|
|
|
|
+ fun onCapture(event: EventMapCapture) {
|
|
event?.let {
|
|
event?.let {
|
|
- if(it.action == EventMapCapture.CaptureAction.CAPTURE_ACTION_START){
|
|
|
|
|
|
+ if (it.action == EventMapCapture.CaptureAction.CAPTURE_ACTION_START) {
|
|
captures(it.joinCaseName!!)
|
|
captures(it.joinCaseName!!)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1885,5 +2053,15 @@ class FragmentMap : CrAnimationFragment() {
|
|
super.onDestroy()
|
|
super.onDestroy()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 生命周期
|
|
|
|
+ * 后台转前台
|
|
|
|
+ */
|
|
|
|
+ override fun onResume() {
|
|
|
|
+ super.onResume()
|
|
|
|
+ // todo: 2023/8/17 初始化订阅
|
|
|
|
+ initObserver()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|