Need to support MultiString, MulitPoint, MultiPolygon in SQLEncoderOracle
-------------------------------------------------------------------------

         Key: GEOT-714
         URL: http://jira.codehaus.org/browse/GEOT-714
     Project: GeoTools
        Type: Improvement
  Components: oraclespatial  
    Versions: 2.2.M0    
 Reporter: Marc Risney
    Priority: Minor


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();
    }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to