Fallback on simple replacement when hitting Oracle complex geometries
---------------------------------------------------------------------

                 Key: GEOT-2672
                 URL: http://jira.codehaus.org/browse/GEOT-2672
             Project: GeoTools
          Issue Type: Improvement
          Components: data jdbc-ng
    Affects Versions: 2.5.7
            Reporter: Andrea Aime
            Assignee: Andrea Aime
             Fix For: 2.5.8, 2.6-M2


Patch contributed by Kris Geusebroek:

{code}
Index: 
D:/projects/xebia/vtsPolitie/workspace/geotools-2.5.x/modules/plugin/jdbc/jdbc-oracle/src/main/java/org/geotools/data/oracle/sdo/SDO.java

===================================================================

--- 
D:/projects/xebia/vtsPolitie/workspace/geotools-2.5.x/modules/plugin/jdbc/jdbc-oracle/src/main/java/org/geotools/data/oracle/sdo/SDO.java
   (revision 33597)

+++ 
D:/projects/xebia/vtsPolitie/workspace/geotools-2.5.x/modules/plugin/jdbc/jdbc-oracle/src/main/java/org/geotools/data/oracle/sdo/SDO.java
   (working copy)

@@ -2293,6 +2293,26 @@

                     point);
             elemInfo = new int[] { 1, ETYPE.POINT, 1 };
         } else {
+            int element = 0;
+            int etype = ETYPE(elemInfo, element);
+            if (etype == 0) {
+               //complex type, search for encapsulated simpletype
+               int startpointCoordinates = 0;
+               
+               do {
+                       element++;
+                       etype = ETYPE(elemInfo, element);
+                       startpointCoordinates = STARTING_OFFSET(elemInfo, 
element);
+               } while (etype == 0);
+               if (etype != -1) {
+                       int ol = ordinates.length;
+                       int elemsToCopy = ol - (startpointCoordinates - 1);
+                       double[] newOrdinates = new double[elemsToCopy];
+                       System.arraycopy(ordinates, startpointCoordinates - 1, 
newOrdinates, 0, elemsToCopy);
+                    elemInfo = new int[] { 1, ETYPE.POINT, 1 };
+                    ordinates = newOrdinates;
+               }
+            }
             coords = SDO.coordinates(gf.getCoordinateSequenceFactory(), GTYPE,
                     ordinates);
         }
{code}

-- 
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

        

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to