Details
-
Type:
Improvement
-
Status:
Reopened
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 2.2.M0
-
Fix Version/s: 2.3.6
-
Component/s: jdbc-oracle plugin
-
Labels:None
Description
Converts JTS Geometry to a String version of a SDO Geometry for the Multi's , this is rather simple, by making use of the
Oracle MDSYS.SDO_UTIL.APPEND command, e.g. for MultiPoint this can be accomplished in a method like this:
private static String toSDOGeom(MultiPoint multiPoint, int srid) {
String SDOAppendStmnt = "MDSYS.SDO_UTIL.APPEND(";
StringBuffer buffer = new StringBuffer(SDOAppendStmnt);
int i = 1;
int pts = multiPoint.getNumGeometries();
while (i <= pts) {
Point point = (Point) multiPoint.getGeometryN(i - 1);
String SDOPointGeomStmnt = toSDOGeom(point, srid);
if (i == pts) {
// This is the last point, iterating through a collection of points.
buffer.append(SDOPointGeomStmnt);
for (int j = 0; j < (pts - 1); j++)
{ buffer.append(")"); }} else if ((pts - i) >= 2)
{ // At least 2 points remain in the iteration a collection of points buffer.append(SDOPointGeomStmnt); buffer.append(","); buffer.append(SDOAppendStmnt); }else
{ // 2 points left in the iteration of multipoint collection. buffer.append(SDOPointGeomStmnt); buffer.append(","); } i++;
}
return buffer.toString();
}