From d0c0eb97ba73c367981de22e39ebb91f10b624df Mon Sep 17 00:00:00 2001
From: xiaoyan <xiaoyan159@163.com>
Date: Tue, 23 May 2023 15:37:12 +0800
Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0git=E5=BF=BD?=
 =?UTF-8?q?=E7=95=A5=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 8ccc4f86..4e2ca589 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,4 @@
 .externalNativeBuild
 .cxx
 local.properties
+./vtm/
\ No newline at end of file

From f4ddc2768d31d9abf6ec0db53ed1e386873f5915 Mon Sep 17 00:00:00 2001
From: xiaoyan <xiaoyan159@163.com>
Date: Tue, 23 May 2023 15:39:11 +0800
Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0git=E5=BF=BD?=
 =?UTF-8?q?=E7=95=A5=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitignore | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 4e2ca589..3e0cedc7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,4 +14,4 @@
 .externalNativeBuild
 .cxx
 local.properties
-./vtm/
\ No newline at end of file
+/vtm/
\ No newline at end of file

From 7f6ae65e62bac16b71fe788f8a2ee281a7cb726d Mon Sep 17 00:00:00 2001
From: xiaoyan <xiaoyan159@163.com>
Date: Tue, 23 May 2023 15:41:36 +0800
Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0geometry=E5=8F=B3?=
 =?UTF-8?q?=E7=A7=BB=E5=87=BD=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/navinfo/omqs/db/ImportPreProcess.kt   | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)

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 ba4a91d7..dfdf88ea 100644
--- a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt
+++ b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt
@@ -1,6 +1,11 @@
 package com.navinfo.omqs.db
 
 import com.navinfo.collect.library.data.entity.RenderEntity
+import com.navinfo.collect.library.utils.GeometryTools
+import org.locationtech.jts.algorithm.Angle
+import org.locationtech.jts.geom.Coordinate
+import org.locationtech.jts.geom.Geometry
+
 
 class ImportPreProcess {
     /**
@@ -11,4 +16,38 @@ class ImportPreProcess {
         renderEntity.properties["foo"] = "bar"
         return renderEntity
     }
+
+    /**
+     * 计算指定数据指定方向的坐标
+     * */
+    fun translateRight(renderEntity: RenderEntity): RenderEntity {
+        // 获取当前renderEntity的geometry
+        val geometry = renderEntity.wkt
+        var angle = 0.0 // geometry的角度,如果是点,获取angle,如果是线,获取最后两个点的方向
+        var point = Coordinate(geometry?.coordinate)
+        if (Geometry.TYPENAME_POINT == geometry?.geometryType) {
+            angle = if(renderEntity?.properties?.get("angle") == null) 0.0 else renderEntity?.properties?.get("angle")?.toDouble()!!
+        } else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
+            val p1: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 2)
+            val p2: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 1)
+            // 计算线段的方向
+            angle = Angle.angle(p1, p2)
+            point = p2
+        }
+
+        // 将角度转换为弧度
+        val radian = Math.toRadians(angle)
+
+        // 计算偏移距离
+        val dx: Double = GeometryTools.convertDistanceToDegree(5.0, geometry?.coordinate?.y!!) * Math.cos(radian)
+        val dy: Double = GeometryTools.convertDistanceToDegree(5.0, geometry?.coordinate?.y!!) * Math.sin(radian)
+
+        // 计算偏移后的点
+        val coord =
+            Coordinate(point.getX() + dy, point.getY() - dx)
+
+        // 将这个点记录在数据中
+        renderEntity.properties["geometry"] = GeometryTools.createGeometry(doubleArrayOf(coord.x, coord.y)).toString()
+        return renderEntity
+    }
 }
\ No newline at end of file