while (!recordset.isEOF()) {
GeoRegion geometry = (GeoRegion)recordset.getGeometry();
// 判断几何对象是否为空,不为空时对几何对象进行平移操作
if (!geometry.isEmpty()) {
GeoRegion geoRegion = new GeoRegion();
for(int a = 0; a < geometry.getPartCount(); a++) {
Point2Ds point2ds = geometry.getPart(a);
Point2Ds point2dsNew = new Point2Ds();
//获取坐标集合
for (int i = 0; i < point2ds.getCount(); i++) {
Point2D InputPoint = point2ds.getItem(i);
offsetDatapoint(InputPoint);
Point2D pointNew = new Point2D();
pointNew.setX(InputPoint.getX());
pointNew.setY(InputPoint.getY());
point2dsNew.add(pointNew);
}
geoRegion.addPart(point2dsNew);
}
recordsetnew.edit();
recordsetnew.addNew(geoRegion);
recordsetnew.update();
geoRegion.dispose();
}
recordset.moveNext();
geometry.dispose(); //一定要先moveNext再释放Geometry,否则会保存失败
}
最后添加新的数据集进入scene,发现数据没有更新。 顺带问个问题,shp文件的地理坐标系统在哪获取?