JAVA中的ESRI几何压缩算法
我正在用JAVA编写ESRI几何体压缩算法,我正在使用它 使用提供的链接中提到的说明,这是我当前的代码:JAVA中的ESRI几何压缩算法,java,algorithm,compression,esri,Java,Algorithm,Compression,Esri,我正在用JAVA编写ESRI几何体压缩算法,我正在使用它 使用提供的链接中提到的说明,这是我当前的代码: public static void main(String[] args) { String dirPoints = "-118.356654545455,34.1146;-118.356436363636,34.1143272727273;-118.356418181818,34.1142363636364;-118.356490909091,34.1137636363636";
public static void main(String[] args) {
String dirPoints = "-118.356654545455,34.1146;-118.356436363636,34.1143272727273;-118.356418181818,34.1142363636364;-118.356490909091,34.1137636363636";
String compressedGeometry = "";
double xPointPrev = 0.0;
double yPointPrev = 0.0;
int coefficient = 55000;
String coefficient_32 = Integer.toString(coefficient, 32);
compressedGeometry = coefficient_32 + compressedGeometry;
String[] path_XY = dirPoints.split(";");
for (int i = 0, leni = path_XY.length; i < leni; i++) {
String[] xy = path_XY[i].split(",");
double pointX = Double.parseDouble(xy[0].trim());
double pointY = Double.parseDouble(xy[1].trim());
int xDifference = (int) Math.round(coefficient * (pointX - xPointPrev));
int yDifference = (int) Math.round(coefficient * (pointY - yPointPrev));
String xDifference_32 = Integer.toString(xDifference, 32);
compressedGeometry += xDifference_32;
String yDifference_32 = Integer.toString(yDifference, 32);
compressedGeometry += yDifference_32;
xPointPrev = pointX;
yPointPrev = pointY;
}
System.out.println(compressedGeometry);
}
publicstaticvoidmain(字符串[]args){
String dirPoints=“-118.3566545455,34.1146;-118.35643636,34.11432727273;-118.3564181818,34.1142363636364;-118.3564909091,34.113763636”;
字符串压缩测量=”;
双xPointPrev=0.0;
双yPointPrev=0.0;
int系数=55000;
字符串系数_32=整数.toString(系数,32);
压缩测量法=系数_32+压缩测量法;
String[]path_XY=dirPoints.split(“;”);
for(int i=0,leni=path_XY.length;i
预期输出:“+1lmo-66l1f+1p8af+c-f+1-5-4-q”
但我明白了:“1lmo-66l1g1p8afc-f1-5-4-q”
我错过了什么?非常感谢您的帮助。
谢谢,根据Integer.toString()的 因此,我认为您需要添加“+” (我认为f-g是他们的打字错误)
"If the first argument is not negative, no sign character appears in the result."