Browse Source

fix bug: 修复空间数据的轮廓存在null值的问题

lijie 2 years ago
parent
commit
9fe5296276

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

@@ -15,6 +15,7 @@ import com.sybotan.service.models.SCascadeQuery
 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.ObjectUtils
 import org.apache.commons.lang3.StringUtils
 import org.geotools.geometry.jts.JTSFactoryFinder
 import org.locationtech.jts.geom.Coordinate
@@ -167,6 +168,9 @@ class SpaceAffectUtil {
      */
     private fun createPolygonV2(list: ArrayList<Point>?): Polygon? {
         val geometryFactory = JTSFactoryFinder.getGeometryFactory()
+        if (list.isNullOrEmpty()){
+            return null
+        }
         var ring: LinearRing? =null
         try {
             try {
@@ -183,7 +187,9 @@ class SpaceAffectUtil {
                 list.add(newPoint)
                 ring = createRing(geometryFactory,list)
             }
-        }catch (e:Exception){}
+        }catch (e:Exception){
+            logger.error(e.message,e)
+        }
         if (null==ring){
             return null
         }
@@ -195,6 +201,13 @@ class SpaceAffectUtil {
      */
     private fun createRing(geometryFactory: GeometryFactory, list: ArrayList<Point>?): LinearRing {
         val objects: MutableList<Coordinate> = ArrayList()
+        val iterator = list!!.iterator()
+        while (iterator.hasNext()){
+            val next = iterator.next()
+            if (ObjectUtils.isEmpty(next)) {
+                iterator.remove()
+            }
+        }
         for (point in list!!) {
             objects.add(Coordinate(point.x, point.y, point.z))
         }

+ 1 - 1
revit-algorithm/src/main/resources-dev/application.yml

@@ -93,7 +93,7 @@ properties:
   fileService:
     # 基本属性
     # url:                               http://api.sagacloud.cn/dp-auxiliary/image-service/ # http://47.93.33.207:28888/image-service/ #http://adm.sagacloud.cn/image-service/
-    url:                               http://common.ysbdtp.com/image-service/ # http://47.93.33.207:28888/image-service/ #http://adm.sagacloud.cn/image-service/
+    url:                               http://develop.ysbdtp.com/image-service/ # http://47.93.33.207:28888/image-service/ #http://adm.sagacloud.cn/image-service/
     #url:                               http://image-service:8080/
     systemId: revit
     secret: 63afbef6906c342b