diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..690c5f4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..690c5f4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..70d3756
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..690c5f4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..70d3756
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..d6bfba4
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..690c5f4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..70d3756
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..d6bfba4
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..b007d28
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..690c5f4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..70d3756
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..d6bfba4
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..b007d28
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..4515aa3
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..690c5f4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..70d3756
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..d6bfba4
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..b007d28
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..4515aa3
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..690c5f4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..70d3756
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..d6bfba4
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..b007d28
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..4515aa3
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 806ba8a..484d635 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5030
- versionName "5.0.3"
+ versionCode 5040
+ versionName "5.0.4"
ndk {
moduleName "serial_port"
diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..690c5f4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..70d3756
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..d6bfba4
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..b007d28
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..4515aa3
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 806ba8a..484d635 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5030
- versionName "5.0.3"
+ versionCode 5040
+ versionName "5.0.4"
ndk {
moduleName "serial_port"
diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt
index 3bccc59..d02785e 100644
--- a/app/src/main/java/com/casic/detector/view/MainActivity.kt
+++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt
@@ -435,9 +435,9 @@
}
}).build().show()
} else {
- searchDialog.show()
+// searchDialog.show()
//TODO 新探测界面
-// searchNewDialog.show()
+ searchNewDialog.show()
}
}
@@ -1742,62 +1742,44 @@
}
}
- //开始定位,先定位一次
- val tempPoints = ArrayList()
- locationHub.getCurrentLocation(true, object : OnGetLocationListener {
- override fun onAMapLocationGet(location: AMapLocation?) {
- if (location != null) {
- DataBaseManager.get.loadTaskLabels().forEach {
- val distance = AMapUtils.calculateLineDistance(
- LatLng(location.latitude, location.longitude),
- LatLng(it.lat.toDouble(), it.lng.toDouble())
- )
-
- //TODO 筛选出距离小于3米的点进行渲染
- if (distance < 150) {
- tempPoints.add(it)
- }
- }
- } else {
- "当前位置信号差,无法精确计算标识器位置".show(context)
- }
- }
- })
-
//点位渲染,每次定位都计算当前位置与符合条件的点距离
locationHub.getCurrentLocation(false, object : OnGetLocationListener {
override fun onAMapLocationGet(location: AMapLocation?) {
location?.apply {
val dataPoints = ArrayList()
- tempPoints.forEach {
+ DataBaseManager.get.loadTaskLabels().forEach {
val angle = calculateAngle(
LatLng(it.lat.toDouble(), it.lng.toDouble())
)
+ //单位:米
val distance = AMapUtils.calculateLineDistance(
LatLng(latitude, longitude),
LatLng(it.lat.toDouble(), it.lng.toDouble())
)
- dataPoints.add(RadarScanView.DataPoint(angle, distance.toInt()))
- }
- binding.radarScanView.renderPointData(dataPoints)
-
- //获取MarkerId对应的标识器
- DataBaseManager.get.queryLabelById(markerId).forEach {
- //设置距离进度条,距离最大3米,需要转换
- val distance = AMapUtils.calculateLineDistance(
- LatLng(latitude, longitude),
- LatLng(it.lat.toDouble(), it.lng.toDouble())
- )
-
- val progress = if (distance > 3) {
- 100
- } else {
- (distance / 3) * 100
+ if (distance <= 5.5) {
+ dataPoints.add(RadarScanView.DataPoint(angle, distance.toInt()))
}
- binding.distancePgBar.progress = progress.toInt()
}
+ binding.radarScanView.renderPointData(dataPoints,
+ object : RadarScanView.OnGetNearestPointCallback {
+ override fun getNearestPoint(point: RadarScanView.DataPoint?) {
+ if (point == null) {
+ binding.distanceValueView.text = "大于5500cm"
+ binding.distancePgBar.progress = 100
+ } else {
+ binding.distanceValueView.text = "${point.distance * 100}cm"
+ val progress = if (point.distance > 5.5f) {
+ 100
+ } else {
+ (point.distance / 5.5f) * 100
+ }
+
+ binding.distancePgBar.progress = progress.toInt()
+ }
+ }
+ })
}
}
})
diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..690c5f4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..70d3756
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..d6bfba4
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..b007d28
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..4515aa3
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 806ba8a..484d635 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5030
- versionName "5.0.3"
+ versionCode 5040
+ versionName "5.0.4"
ndk {
moduleName "serial_port"
diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt
index 3bccc59..d02785e 100644
--- a/app/src/main/java/com/casic/detector/view/MainActivity.kt
+++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt
@@ -435,9 +435,9 @@
}
}).build().show()
} else {
- searchDialog.show()
+// searchDialog.show()
//TODO 新探测界面
-// searchNewDialog.show()
+ searchNewDialog.show()
}
}
@@ -1742,62 +1742,44 @@
}
}
- //开始定位,先定位一次
- val tempPoints = ArrayList()
- locationHub.getCurrentLocation(true, object : OnGetLocationListener {
- override fun onAMapLocationGet(location: AMapLocation?) {
- if (location != null) {
- DataBaseManager.get.loadTaskLabels().forEach {
- val distance = AMapUtils.calculateLineDistance(
- LatLng(location.latitude, location.longitude),
- LatLng(it.lat.toDouble(), it.lng.toDouble())
- )
-
- //TODO 筛选出距离小于3米的点进行渲染
- if (distance < 150) {
- tempPoints.add(it)
- }
- }
- } else {
- "当前位置信号差,无法精确计算标识器位置".show(context)
- }
- }
- })
-
//点位渲染,每次定位都计算当前位置与符合条件的点距离
locationHub.getCurrentLocation(false, object : OnGetLocationListener {
override fun onAMapLocationGet(location: AMapLocation?) {
location?.apply {
val dataPoints = ArrayList()
- tempPoints.forEach {
+ DataBaseManager.get.loadTaskLabels().forEach {
val angle = calculateAngle(
LatLng(it.lat.toDouble(), it.lng.toDouble())
)
+ //单位:米
val distance = AMapUtils.calculateLineDistance(
LatLng(latitude, longitude),
LatLng(it.lat.toDouble(), it.lng.toDouble())
)
- dataPoints.add(RadarScanView.DataPoint(angle, distance.toInt()))
- }
- binding.radarScanView.renderPointData(dataPoints)
-
- //获取MarkerId对应的标识器
- DataBaseManager.get.queryLabelById(markerId).forEach {
- //设置距离进度条,距离最大3米,需要转换
- val distance = AMapUtils.calculateLineDistance(
- LatLng(latitude, longitude),
- LatLng(it.lat.toDouble(), it.lng.toDouble())
- )
-
- val progress = if (distance > 3) {
- 100
- } else {
- (distance / 3) * 100
+ if (distance <= 5.5) {
+ dataPoints.add(RadarScanView.DataPoint(angle, distance.toInt()))
}
- binding.distancePgBar.progress = progress.toInt()
}
+ binding.radarScanView.renderPointData(dataPoints,
+ object : RadarScanView.OnGetNearestPointCallback {
+ override fun getNearestPoint(point: RadarScanView.DataPoint?) {
+ if (point == null) {
+ binding.distanceValueView.text = "大于5500cm"
+ binding.distancePgBar.progress = 100
+ } else {
+ binding.distanceValueView.text = "${point.distance * 100}cm"
+ val progress = if (point.distance > 5.5f) {
+ 100
+ } else {
+ (point.distance / 5.5f) * 100
+ }
+
+ binding.distancePgBar.progress = progress.toInt()
+ }
+ }
+ })
}
}
})
diff --git a/app/src/main/java/com/casic/detector/widgets/RadarScanView.kt b/app/src/main/java/com/casic/detector/widgets/RadarScanView.kt
index abbacd9..6bc23d7 100644
--- a/app/src/main/java/com/casic/detector/widgets/RadarScanView.kt
+++ b/app/src/main/java/com/casic/detector/widgets/RadarScanView.kt
@@ -358,23 +358,35 @@
/**
* 数据点
* @param dataPoints 数据点集合
+ * @param callback 最小值的点
* */
- fun renderPointData(dataPoints: ArrayList) {
- points = ArrayList()
- dataPoints.forEach {
- points?.add(it.convertPointF())
+ fun renderPointData(dataPoints: ArrayList, callback: OnGetNearestPointCallback) {
+ if (dataPoints.isNotEmpty()) {
+ points = ArrayList()
+ dataPoints.forEach {
+ points?.add(it.convertPointF())
+ }
+
+ //计算出附近最近的点
+ dataPoints.sortBy(DataPoint::distance)
+
+ val nearestPoint = dataPoints.first()
+ //减少排序计算次数,回调最近的点到主界面
+ callback.getNearestPoint(nearestPoint)
+
+ //在最近的点外侧绘制同心圆
+ targetPoint = nearestPoint.convertPointF()
+ } else {
+ callback.getNearestPoint(null)
}
-
- //计算出附近最近的点
- dataPoints.sortBy(DataPoint::distance)
-
- //在最近的点外侧绘制同心圆
- targetPoint = dataPoints.first().convertPointF()
-
- //实时刷新点位数据
+ //不管有无数据点,都要刷新点位数据,不然从有数据到无数据这个过程,界面不会及时刷新
invalidate()
}
+ interface OnGetNearestPointCallback {
+ fun getNearestPoint(point: DataPoint?)
+ }
+
/**
* dataPoint转为PointF
* */
@@ -393,5 +405,5 @@
* @param angle 数据点和圆心的方位角
* @param distance 数据点和圆心的相对距离
* */
- data class DataPoint(val angle: Int, val distance: Int)
+ data class DataPoint(var angle: Int, var distance: Int)
}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 0363905..1c1a7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/local.properties
/.idea/caches
/.idea/libraries
+/.idea/misc.xml
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
@@ -15,5 +16,4 @@
cmake-build-debug
local.properties
-/.idea
/app/build
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..690c5f4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..70d3756
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..d6bfba4
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..b007d28
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..4515aa3
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 806ba8a..484d635 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,8 +20,8 @@
applicationId "com.casic.detector"
minSdkVersion 22
targetSdkVersion 33
- versionCode 5030
- versionName "5.0.3"
+ versionCode 5040
+ versionName "5.0.4"
ndk {
moduleName "serial_port"
diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt
index 3bccc59..d02785e 100644
--- a/app/src/main/java/com/casic/detector/view/MainActivity.kt
+++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt
@@ -435,9 +435,9 @@
}
}).build().show()
} else {
- searchDialog.show()
+// searchDialog.show()
//TODO 新探测界面
-// searchNewDialog.show()
+ searchNewDialog.show()
}
}
@@ -1742,62 +1742,44 @@
}
}
- //开始定位,先定位一次
- val tempPoints = ArrayList()
- locationHub.getCurrentLocation(true, object : OnGetLocationListener {
- override fun onAMapLocationGet(location: AMapLocation?) {
- if (location != null) {
- DataBaseManager.get.loadTaskLabels().forEach {
- val distance = AMapUtils.calculateLineDistance(
- LatLng(location.latitude, location.longitude),
- LatLng(it.lat.toDouble(), it.lng.toDouble())
- )
-
- //TODO 筛选出距离小于3米的点进行渲染
- if (distance < 150) {
- tempPoints.add(it)
- }
- }
- } else {
- "当前位置信号差,无法精确计算标识器位置".show(context)
- }
- }
- })
-
//点位渲染,每次定位都计算当前位置与符合条件的点距离
locationHub.getCurrentLocation(false, object : OnGetLocationListener {
override fun onAMapLocationGet(location: AMapLocation?) {
location?.apply {
val dataPoints = ArrayList()
- tempPoints.forEach {
+ DataBaseManager.get.loadTaskLabels().forEach {
val angle = calculateAngle(
LatLng(it.lat.toDouble(), it.lng.toDouble())
)
+ //单位:米
val distance = AMapUtils.calculateLineDistance(
LatLng(latitude, longitude),
LatLng(it.lat.toDouble(), it.lng.toDouble())
)
- dataPoints.add(RadarScanView.DataPoint(angle, distance.toInt()))
- }
- binding.radarScanView.renderPointData(dataPoints)
-
- //获取MarkerId对应的标识器
- DataBaseManager.get.queryLabelById(markerId).forEach {
- //设置距离进度条,距离最大3米,需要转换
- val distance = AMapUtils.calculateLineDistance(
- LatLng(latitude, longitude),
- LatLng(it.lat.toDouble(), it.lng.toDouble())
- )
-
- val progress = if (distance > 3) {
- 100
- } else {
- (distance / 3) * 100
+ if (distance <= 5.5) {
+ dataPoints.add(RadarScanView.DataPoint(angle, distance.toInt()))
}
- binding.distancePgBar.progress = progress.toInt()
}
+ binding.radarScanView.renderPointData(dataPoints,
+ object : RadarScanView.OnGetNearestPointCallback {
+ override fun getNearestPoint(point: RadarScanView.DataPoint?) {
+ if (point == null) {
+ binding.distanceValueView.text = "大于5500cm"
+ binding.distancePgBar.progress = 100
+ } else {
+ binding.distanceValueView.text = "${point.distance * 100}cm"
+ val progress = if (point.distance > 5.5f) {
+ 100
+ } else {
+ (point.distance / 5.5f) * 100
+ }
+
+ binding.distancePgBar.progress = progress.toInt()
+ }
+ }
+ })
}
}
})
diff --git a/app/src/main/java/com/casic/detector/widgets/RadarScanView.kt b/app/src/main/java/com/casic/detector/widgets/RadarScanView.kt
index abbacd9..6bc23d7 100644
--- a/app/src/main/java/com/casic/detector/widgets/RadarScanView.kt
+++ b/app/src/main/java/com/casic/detector/widgets/RadarScanView.kt
@@ -358,23 +358,35 @@
/**
* 数据点
* @param dataPoints 数据点集合
+ * @param callback 最小值的点
* */
- fun renderPointData(dataPoints: ArrayList) {
- points = ArrayList()
- dataPoints.forEach {
- points?.add(it.convertPointF())
+ fun renderPointData(dataPoints: ArrayList, callback: OnGetNearestPointCallback) {
+ if (dataPoints.isNotEmpty()) {
+ points = ArrayList()
+ dataPoints.forEach {
+ points?.add(it.convertPointF())
+ }
+
+ //计算出附近最近的点
+ dataPoints.sortBy(DataPoint::distance)
+
+ val nearestPoint = dataPoints.first()
+ //减少排序计算次数,回调最近的点到主界面
+ callback.getNearestPoint(nearestPoint)
+
+ //在最近的点外侧绘制同心圆
+ targetPoint = nearestPoint.convertPointF()
+ } else {
+ callback.getNearestPoint(null)
}
-
- //计算出附近最近的点
- dataPoints.sortBy(DataPoint::distance)
-
- //在最近的点外侧绘制同心圆
- targetPoint = dataPoints.first().convertPointF()
-
- //实时刷新点位数据
+ //不管有无数据点,都要刷新点位数据,不然从有数据到无数据这个过程,界面不会及时刷新
invalidate()
}
+ interface OnGetNearestPointCallback {
+ fun getNearestPoint(point: DataPoint?)
+ }
+
/**
* dataPoint转为PointF
* */
@@ -393,5 +405,5 @@
* @param angle 数据点和圆心的方位角
* @param distance 数据点和圆心的相对距离
* */
- data class DataPoint(val angle: Int, val distance: Int)
+ data class DataPoint(var angle: Int, var distance: Int)
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_search_marker_new.xml b/app/src/main/res/layout/dialog_search_marker_new.xml
index 5068f74..ca6feaa 100644
--- a/app/src/main/res/layout/dialog_search_marker_new.xml
+++ b/app/src/main/res/layout/dialog_search_marker_new.xml
@@ -96,12 +96,28 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_20" />
-
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+
+
+
+