|
@@ -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))
|
|
|
}
|