diff --git a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt index 4c5ad593..cd90dfad 100644 --- a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt +++ b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt @@ -544,6 +544,19 @@ class ImportPreProcess { } } } + /** + * 生成默认路口数据的参考数据 + * */ + fun generateIntersectionDynamic(renderEntity: RenderEntity) { + // 路口数据的其他点位,是保存在nodeList对应的数组下 + if (renderEntity.properties.containsKey("type")) { + if (renderEntity.properties["type"] == "0") { + renderEntity.properties["typesrc"] = "assets:symbols/dot_blue_dark.svg" + } else { + renderEntity.properties["typesrc"] = "assets:symbols/volcano.svg" + } + } + } /** * 处理杆状物的高程数据 diff --git a/app/src/main/java/com/navinfo/omqs/http/taskdownload/TaskDownloadScope.kt b/app/src/main/java/com/navinfo/omqs/http/taskdownload/TaskDownloadScope.kt index 428c0653..11131659 100644 --- a/app/src/main/java/com/navinfo/omqs/http/taskdownload/TaskDownloadScope.kt +++ b/app/src/main/java/com/navinfo/omqs/http/taskdownload/TaskDownloadScope.kt @@ -107,7 +107,7 @@ class TaskDownloadScope( if (status != FileDownloadStatus.LOADING && status != FileDownloadStatus.IMPORTING) { val realm = Realm.getDefaultInstance() realm.executeTransaction { - it.copyToRealmOrUpdate(taskBean) + it.insertOrUpdate(taskBean) } } } diff --git a/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt b/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt index 2e2eb852..a5859a3d 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterFragment.kt @@ -123,7 +123,8 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit? //116.25017070328308 40.061730653134696 // 定位到指定位置 niMapController.mMapView.vtmMap.animator() - .animateTo(GeoPoint( 40.055878135289966, 116.3011588289057 )) +// .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 )) + .animateTo(GeoPoint( 39.91975038055932,116.35447089476969 )) } // R.id.personal_center_menu_task_list -> { // findNavController().navigate(R.id.TaskManagerFragment) diff --git a/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterViewModel.kt b/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterViewModel.kt index d20db0cf..40ce76a4 100644 --- a/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterViewModel.kt +++ b/app/src/main/java/com/navinfo/omqs/ui/fragment/personalcenter/PersonalCenterViewModel.kt @@ -169,6 +169,12 @@ class PersonalCenterViewModel @Inject constructor( importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, task).collect { Log.d("importOMDBData", it) } + } else { + val newTask = TaskBean() + newTask.id = 9999 + importOMDBHelper.importOmdbZipFile(importOMDBHelper.omdbFile, newTask).collect { + Log.d("importOMDBData", it) + } } Log.d("OMQSApplication", "导入数据完成") } diff --git a/app/src/test/java/com/navinfo/omqs/ParallelRectangleAlgorithm.java b/app/src/test/java/com/navinfo/omqs/ParallelRectangleAlgorithm.java new file mode 100644 index 00000000..c7d2eab0 --- /dev/null +++ b/app/src/test/java/com/navinfo/omqs/ParallelRectangleAlgorithm.java @@ -0,0 +1,97 @@ +package com.navinfo.omqs; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +public class ParallelRectangleAlgorithm { + public static List getParallelRectanglePoints(List polygon) { + // Step 1: Get the first two points of the polygon to form a line + List line = new ArrayList<>(); + line.add(polygon.get(0)); + line.add(polygon.get(1)); + // Step 2: Find the points on the opposite side or farther away from the line + List farPoints = new ArrayList<>(); + for (int i = 2; i < polygon.size(); i++) { + Point point = polygon.get(i); + int side = getSide(line.get(0), line.get(1), point); + double distance = getDistance(line.get(0), line.get(1), point); + if (side != 0 && side != Math.signum(distance)) { + farPoints.add(point); + } + } + // Step 3: Find the perpendicular lines to the first line passing through the farthest points + List perpendicularLines = new ArrayList<>(); + for (Point farPoint : farPoints) { + double dx = line.get(1).getY() - line.get(0).getY(); + double dy = line.get(0).getX() - line.get(1).getX(); + double magnitude = Math.sqrt(dx * dx + dy * dy); + dx /= magnitude; + dy /= magnitude; + double distance = Math.abs((farPoint.getX() - line.get(0).getX()) * dx + (farPoint.getY() - line.get(0).getY()) * dy); + Point perpendicularLine = new Point(farPoint.getX() + distance * dx, farPoint.getY() + distance * dy); + perpendicularLines.add(perpendicularLine); + } + // Step 4: Find the intersection points of the perpendicular lines + List intersectionPoints = new ArrayList<>(); + for (int i = 0; i < perpendicularLines.size(); i++) { + for (int j = i + 1; j < perpendicularLines.size(); j++) { + Point intersectionPoint = getIntersectionPoint(line.get(0), perpendicularLines.get(i), line.get(1), perpendicularLines.get(j)); + intersectionPoints.add(intersectionPoint); + } + } + return intersectionPoints; + } + private static int getSide(Point p1, Point p2, Point point) { + return Integer.signum((int) Math.signum((p2.getX() - p1.getX()) * (point.getY() - p1.getY()) - (p2.getY() - p1.getY()) * (point.getX() - p1.getX()))); + } + private static double getDistance(Point p1, Point p2, Point point) { + return ((p2.getX() - p1.getX()) * (point.getY() - p1.getY()) - (p2.getY() - p1.getY()) * (point.getX() - p1.getX())) / Math.sqrt((p2.getX() - p1.getX()) * (p2.getX() - p1.getX()) + (p2.getY() - p1.getY()) * (p2.getY() - p1.getY())); + } + private static Point getIntersectionPoint(Point p1, Point p2, Point p3, Point p4) { + double x1 = p1.getX(); + double y1 = p1.getY(); + double x2 = p2.getX(); + double y2 = p2.getY(); + double x3 = p3.getX(); + double y3 = p3.getY(); + double x4 = p4.getX(); + double y4 = p4.getY(); + double x = ((x2 - x1) * (x3 * y4 - x4 * y3) - (x4 - x3) * (x1 * y2 - x2 * y1)) / ((x2 - x1) * (y3 - y4) - (x4 - x3) * (y1 - y2)); + double y = ((y3 - y4) * (x1 * y2 - x2 * y1) - (y1 - y2) * (x3 * y4 - x4 * y3)) / ((x2 - x1) * (y3 - y4) - (x4 - x3) * (y1 - y2)); + return new Point(x, y); + } + + @Test + public void test() { + List polygon = new ArrayList<>(); + polygon.add(new Point(0, 0)); + polygon.add(new Point(2, 0)); + polygon.add(new Point(2, 1)); + polygon.add(new Point(1, 1)); + polygon.add(new Point(1, 2)); + polygon.add(new Point(0, 2)); + List result = getParallelRectanglePoints(polygon); + for (Point point : result) { + System.out.println(point); + } + } +} +class Point { + private double x; + private double y; + public Point(double x, double y) { + this.x = x; + this.y = y; + } + public double getX() { + return x; + } + public double getY() { + return y; + } + @Override + public String toString() { + return "(" + x + ", " + y + ")"; + } +} \ No newline at end of file diff --git a/collect-library/src/main/assets/editormarker.xml b/collect-library/src/main/assets/editormarker.xml index 92a69964..6d14d464 100644 --- a/collect-library/src/main/assets/editormarker.xml +++ b/collect-library/src/main/assets/editormarker.xml @@ -1482,10 +1482,10 @@ - - + + + + @@ -1951,15 +1951,19 @@ - + + - - - - - + + + + + + + + diff --git a/collect-library/src/main/assets/omdb/diversion_zone.jpg b/collect-library/src/main/assets/omdb/diversion_zone.jpg new file mode 100644 index 00000000..204baaa2 Binary files /dev/null and b/collect-library/src/main/assets/omdb/diversion_zone.jpg differ diff --git a/collect-library/src/main/assets/omdb/veer_side_walk.jpg b/collect-library/src/main/assets/omdb/veer_side_walk.jpg new file mode 100644 index 00000000..5bcf84f4 Binary files /dev/null and b/collect-library/src/main/assets/omdb/veer_side_walk.jpg differ diff --git a/vtm b/vtm index 8717b07e..58f23103 160000 --- a/vtm +++ b/vtm @@ -1 +1 @@ -Subproject commit 8717b07ebff4dd61226abb19474be6567a736ad8 +Subproject commit 58f231037c44ccc1c82d00818c402a2894ca4e09