|
|
@@ -0,0 +1,61 @@ |
|
|
|
package com.ruoyi.common.utils.space; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
/** |
|
|
|
* author:Administrator |
|
|
|
* date2021/7/16 |
|
|
|
* |
|
|
|
* @description; |
|
|
|
*/ |
|
|
|
public class SpaceUtils { |
|
|
|
|
|
|
|
//面坐标装换 |
|
|
|
public static String space(String theGeom){ |
|
|
|
|
|
|
|
//判断获取到数据是否是地图画质坐标,画制坐标第一位传入是:[ 否:M |
|
|
|
if((theGeom != null && theGeom.startsWith("[") && theGeom !="")) { |
|
|
|
//删除无用坐标数组括号 |
|
|
|
String theGeom_left = theGeom.replaceAll("\\[", ""); |
|
|
|
String theGeom_right = theGeom_left.replaceAll("]", ""); |
|
|
|
String theGeomZb = null; |
|
|
|
ArrayList theGeomList = new ArrayList(); |
|
|
|
//按照逗号拆分传入数组 |
|
|
|
String[] theGeomListLists = theGeom_right.split(","); |
|
|
|
int bb = theGeomListLists.length - 1; //数组循环少循环一次 否则数组越界 |
|
|
|
for (int i = 0; i < bb; i++) { |
|
|
|
//前一位与后一位数组拼接 |
|
|
|
theGeomZb = theGeomListLists[i] + " " + theGeomListLists[++i]; |
|
|
|
theGeomList.add(theGeomZb); |
|
|
|
} |
|
|
|
//拼接需要保存坐标MULTIPOLYGON |
|
|
|
String startMultipolygon = "MULTIPOLYGON((("; |
|
|
|
String endMultipolygon = ")))"; |
|
|
|
String allMultipolygon = startMultipolygon + theGeomList + endMultipolygon; |
|
|
|
allMultipolygon = allMultipolygon.replaceAll("\\[", ""); |
|
|
|
allMultipolygon = allMultipolygon.replaceAll("]", ""); |
|
|
|
return theGeom =allMultipolygon; |
|
|
|
} else { |
|
|
|
//没有编辑图像则 the_geom空间数据不更新 |
|
|
|
return theGeom =null; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//点坐标装换 |
|
|
|
public static String point(String theGeom){ |
|
|
|
//判断获取到数据是否是地图画质坐标,画制坐标第一位传入是:[ 否:M |
|
|
|
if((theGeom != null && theGeom.startsWith("[") && theGeom !="")) { |
|
|
|
//删除无用坐标数组括号 |
|
|
|
//坐标转换 |
|
|
|
String theGeom_left = theGeom.replaceAll("\\[", ""); |
|
|
|
String theGeom_right = theGeom_left.replaceAll("]", ""); |
|
|
|
String pointMap = theGeom_right.replaceAll(",", " "); |
|
|
|
String point = "POINT(" + pointMap + ")"; |
|
|
|
return point; |
|
|
|
}else { |
|
|
|
//没有编辑图像则 the_geom空间数据不更新 |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |