Browse Source

解决自定义函数使用问题。改为代码中写表名

yucheng 3 years ago
parent
commit
d060e2261c

+ 3 - 1
build.gradle

@@ -3,6 +3,7 @@ version '2.0.10'
 
 buildscript {
     repositories {
+        maven{url "http://47.93.132.139:8081/nexus/content/repositories/persagy/"}
         maven{url MAVEN_REPO_PUBLIC_URL}
         maven{url "http://maven.aliyun.com/nexus/content/groups/public/"}
         mavenCentral()
@@ -15,12 +16,13 @@ buildscript {
         classpath group: 'com.google.protobuf', name: 'protobuf-gradle-plugin', version: PROTOBUF_GRADLE_VERSION
         // ssh插件, 用于部署
         classpath 'org.hidetake:gradle-ssh-plugin:2.10.1'
-
+        classpath 'org.geotools:gt-main:25.2'
     }
 }
 
 allprojects {
     repositories {
+        maven{url "http://47.93.132.139:8081/nexus/content/repositories/persagy/"}
         maven{ url "http://maven.aliyun.com/nexus/content/groups/public/"}
         maven{
             url MAVEN_REPO_PUBLIC_URL

+ 4 - 4
gradle.properties

@@ -22,14 +22,14 @@ SAGA_URL = http://www.sagaloud.cn
 SAGA_KOTLIN_VERSION = 1.4.108
 SAGA_SERVICE_VERSION = 1.4.140
 
+MAVEN_REPO_NEXUS_RELEASE_URL = http://47.93.132.139:8081/nexus/content/repositories/persagy/
+MAVEN_REPO_NEXUS_PUBLIC_URL = http://47.93.132.139:8081/nexus/content/groups/public/
 MAVEN_REPO_PUBLIC_URL = http://dev.dp.sagacloud.cn:8082/repository/maven-public/
 MAVEN_REPO_RELEASE_URL = http://dev.dp.sagacloud.cn:8082/repository/maven-releases/
 MAVEN_REPO_SNAPSHOT_URL = http://dev.dp.sagacloud.cn:8082/repository/maven-snapshots/
-MAVEN_REPO_NEXUS_RELEASE_URL = http://47.93.132.139:8081/nexus/content/repositories/persagy/
-MAVEN_REPO_NEXUS_PUBLIC_URL = http://47.93.132.139:8081/nexus/content/groups/public/
 
-NEXUS_USERNAME = saga
-NEXUS_PASSWORD = saga
+NEXUS_USERNAME = admin
+NEXUS_PASSWORD = 123qwe!@#
 
 LICENSE_NAME = The Apache Software License, Version 2.0
 LICENSE_URL = http://www.apache.org/licenses/LICENSE-2.0.txt

+ 3 - 1
revit-algorithm/build.gradle

@@ -133,7 +133,8 @@ dependencies {
     // https://mvnrepository.com/artifact/com.belerweb/pinyin4j
     compile group: 'com.belerweb', name: 'pinyin4j', version: '2.5.1'
 
-//    compile group: 'org.geotools', name: 'gt-main', version: '25.2'
+    // http://47.93.132.139:8081/nexus/content/repositories/persagy/
+    compile group: 'org.geotools', name: 'gt-main', version: '25.2'
 
     // 数据中心依赖
     compile project(":old-data-core")
@@ -143,6 +144,7 @@ dependencies {
 dependencyManagement {
     imports {
         mavenBom "org.springframework.cloud:spring-cloud-dependencies:${SPRING_CLOUD_DEPENDENCIES}"
+        mavenBom "org.geotools:gt-main:25.2"
     }
 }
 // 下面是配置文件选择

+ 1 - 0
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/common/utils/FloorLevelCheckUtil.java

@@ -10,6 +10,7 @@ import java.util.*;
 
 /**
  * 楼层号检查
+ * 基于python代码改写:relations.src.level.check_level
  * @author Administrator
  * @date 2021-10-21
  */

+ 1 - 1
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/common/utils/GridGroupUtil.java

@@ -18,7 +18,7 @@ import java.util.Map;
 
 /**
  * Grid分组工具
- * 基于python代码改写
+ * 基于python代码改写:relations.src.grid.check_grid
  * @author Administrator
  * @date 2021-10-21
  */

+ 57 - 9
revit-algorithm/src/main/kotlin/cn/sagacloud/server/algorithm/common/utils/SpaceAffectUtil.kt

@@ -16,17 +16,31 @@ import com.sybotan.service.models.requests.SQueryRequest
 import com.sybotan.service.models.responses.SQueryResponse
 import org.apache.commons.collections4.CollectionUtils
 import org.apache.commons.lang3.StringUtils
+import org.geotools.geometry.jts.JTSFactoryFinder
+import org.locationtech.jts.geom.Coordinate
+import org.locationtech.jts.geom.Polygon
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Component
-import java.awt.Polygon
 import java.util.*
 import java.util.stream.Collectors
 
+/**
+ * 空间冲突计算工具
+ * 基于python代码改写:relations.src.affected_space.affected_space
+ * @author ADM
+ * @date 2021-10-23
+ */
 @Component
 class SpaceAffectUtil {
 
     @Autowired
     private val service: DataCenterRequest? = null
+
+    /**
+     * 计算空间冲突
+     * @param projectId
+     * @param modelId
+     */
     fun affectedSpace(projectId: String, modelId: String): Boolean {
         if (StringUtils.isBlank(projectId) || StringUtils.isBlank(modelId)) {
             return true
@@ -81,8 +95,8 @@ class SpaceAffectUtil {
                 continue
             }
             val newPolygon = createPolygon(newSpace.outline)
-            // TODO 有交集则加入有变化的元空间列表
-            if (newPolygon == null) {
+            // 有交集则加入有变化的元空间列表
+            if (isGeoContains(polygon, newPolygon)) {
                 affectList.add(polygon)
                 continue
             }
@@ -94,18 +108,52 @@ class SpaceAffectUtil {
         val rsList: MutableList<DCISpace?> = ArrayList()
         for (space in spaces!!) {
             val polygon = createPolygon(space!!.outline)
-            // TODO 有交集则加入有变化的空间列表
-            if (polygon == null) {
-                // TODO state设置为1
-                rsList.add(space)
-                continue
+            // 有交集则加入有变化的空间列表
+            for(affect in affectList) {
+                if (isGeoContains(polygon, affect!!)) {
+                    // TODO state设置为1
+                    rsList.add(space)
+                    break;
+                }
             }
         }
         return rsList
     }
 
+    /**
+     * 点面包含关系判断
+     * 用途:判断一个面是否包含一个点,即一个点是否在一个面内
+     * @param fromOutLines: 轮廓坐标
+     * @param toOutLines: 轮廓坐标
+     * @return
+     */
+    fun isGeoContains(fromPolygon: Polygon, toPolygon: Polygon): Boolean {
+        if (fromPolygon == null || toPolygon == null) {
+            return false
+        }
+        //判断面-面包含关系
+        return (fromPolygon.contains(toPolygon)
+                || fromPolygon.equalsTopo(toPolygon)
+                || fromPolygon.overlaps(toPolygon)
+                || toPolygon.contains(fromPolygon))
+    }
+
+    /**
+     * 创建平面对象
+     * @param list 轮廓线
+     */
     private fun createPolygon(list: ArrayList<ArrayList<Point>>?): Polygon {
-        return Polygon()
+        val geometryFactory = JTSFactoryFinder.getGeometryFactory()
+        val objects: MutableList<Coordinate> = ArrayList()
+        for (outLines in list!!) {
+            for(point in outLines!!) {
+                objects.add(Coordinate(point.x, point.y, point.z))
+            }
+        }
+        //注意数据的闭合
+        val coordinates = objects.toTypedArray()
+        val ring = geometryFactory.createLinearRing(coordinates)
+        return geometryFactory.createPolygon(ring, null)
     }
 
     /**