Revision 10152
branches/v10/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/oracle/OracleSpatialDriver.java | ||
---|---|---|
1136 | 1136 |
|
1137 | 1137 |
return ig; |
1138 | 1138 |
} |
1139 |
|
|
1140 |
private IGeometry getFMapGeometry(STRUCT st, boolean force_not_collection) { |
|
1139 |
private IGeometry getFMapGeometryCollection(Datum[] the_data, int dim, int __srid) { |
|
1141 | 1140 |
|
1142 |
int jgtype = OracleSpatialUtils.getStructType(st); |
|
1143 |
jgtype = OracleSpatialUtils.oracleGTypeToFShapeType(jgtype); |
|
1141 |
// Connection conn = null; |
|
1142 |
// |
|
1143 |
// try { |
|
1144 |
// conn = st.getOracleConnection(); |
|
1145 |
// } catch (SQLException se) { |
|
1146 |
// logger.error("Unexpected error: " + se.getMessage()); |
|
1147 |
// } |
|
1148 |
|
|
1149 |
NUMBER main_type = new NUMBER(dim * 1000 + OracleSpatialUtils.getStructType(the_data)); |
|
1150 |
NUMBER _srid = new NUMBER(__srid); |
|
1144 | 1151 |
|
1145 |
int dim = OracleSpatialUtils.getStructDimensions(st); |
|
1146 |
IGeometry ig = null; |
|
1152 |
Datum[] all_info_array = null; |
|
1153 |
Object[] elems_info_aray = null; |
|
1154 |
Datum[] all_ords = null; |
|
1147 | 1155 |
|
1148 |
if (isActuallyACollection(st)) { |
|
1149 |
jgtype = FShape.MULTI; |
|
1156 |
try { |
|
1157 |
all_info_array = ((ARRAY) the_data[3]).getOracleArray(); |
|
1158 |
// iadesc = ((ARRAY) st.getOracleAttributes()[3]).getDescriptor(); |
|
1159 |
|
|
1160 |
elems_info_aray = groupByElement(all_info_array); |
|
1161 |
|
|
1162 |
all_ords = ((ARRAY) the_data[4]).getOracleArray(); |
|
1163 |
// oadesc = ((ARRAY) st.getOracleAttributes()[4]).getDescriptor(); |
|
1164 |
|
|
1165 |
} catch (SQLException e) { |
|
1166 |
logger.error("Unexpected error: " + e.getMessage()); |
|
1167 |
} |
|
1168 |
|
|
1169 |
Object[] ords_of_groups = getOrdOfGroups(all_ords, elems_info_aray); |
|
1170 |
Object[] _elems_info_aray = new Object[elems_info_aray.length]; |
|
1171 |
for (int i=0; i<elems_info_aray.length; i++) { |
|
1172 |
_elems_info_aray[i] = updateIndexes((Datum[]) elems_info_aray[i]); |
|
1150 | 1173 |
} |
1151 |
|
|
1152 |
switch (jgtype) { |
|
1153 | 1174 |
|
1154 |
case FShape.MULTI: |
|
1155 |
int srid = OracleSpatialUtils.getStructSRID(st); |
|
1156 |
ig = getFMapGeometryCollection(st, dim, srid); |
|
1157 |
break; |
|
1175 |
// _elems_info_aray, ords_of_groups |
|
1176 |
int no_of_elems = ords_of_groups.length; |
|
1177 |
IGeometry[] geoms = new IGeometry[no_of_elems]; |
|
1178 |
for (int i=0; i<no_of_elems; i++) { |
|
1179 |
|
|
1180 |
Datum[] item_info_array = null; |
|
1181 |
Datum[] item_ords = null; |
|
1182 |
NUMBER gtype = null; |
|
1183 |
|
|
1184 |
try { |
|
1185 |
item_info_array = (Datum[]) _elems_info_aray[i]; |
|
1186 |
item_ords = (Datum[]) ords_of_groups[i]; |
|
1187 |
|
|
1188 |
gtype = new NUMBER(dim * 1000 + item_info_array[1].intValue() % 1000); |
|
1189 |
} catch (SQLException se) { |
|
1190 |
logger.error("Unexpected error: " + se.getMessage()); |
|
1191 |
} |
|
1192 |
|
|
1193 |
// if it's the first geometry, the type is the collection's main type (no?) |
|
1194 |
if (i==0) { |
|
1195 |
gtype = main_type; |
|
1196 |
} |
|
1158 | 1197 |
|
1159 |
case FShape.POINT: |
|
1160 |
ig = getFMapGeometryPoint(st, dim); |
|
1161 |
break; |
|
1198 |
STRUCT itemst = null; |
|
1199 |
if (tableHasSrid) { |
|
1200 |
itemst = OracleSpatialUtils.createStruct( |
|
1201 |
gtype, _srid, item_info_array, item_ords, conn); |
|
1202 |
} else { |
|
1203 |
itemst = OracleSpatialUtils.createStruct( |
|
1204 |
gtype, null, item_info_array, item_ords, conn); |
|
1205 |
} |
|
1206 |
geoms[i] = getFMapGeometry(itemst, true); |
|
1207 |
} |
|
1208 |
return new FGeometryCollection(geoms); |
|
1209 |
} |
|
1210 |
|
|
1211 |
private IGeometry getFMapGeometry(STRUCT st, boolean force_not_collection) { |
|
1212 |
// FJP: Esto es para evitar hacer esta llamada varias veces, |
|
1213 |
// que consume bastante tiempo. |
|
1214 |
Datum[] the_data = null; |
|
1215 |
try |
|
1216 |
{ |
|
1217 |
the_data = st.getOracleAttributes(); |
|
1218 |
// Evitamos getOracleAttributes |
|
1219 |
// int jgtype = OracleSpatialUtils.getStructType(st); |
|
1220 |
int jgtype = ((NUMBER) the_data[0]).intValue() % 1000; |
|
1221 |
|
|
1222 |
jgtype = OracleSpatialUtils.oracleGTypeToFShapeType(jgtype); |
|
1223 |
|
|
1224 |
// int dim = OracleSpatialUtils.getStructDimensions(st); |
|
1225 |
int dim = ((NUMBER) the_data[0]).intValue() / 1000; |
|
1226 |
if (dim < 2) dim = 2; |
|
1227 |
|
|
1228 |
IGeometry ig = null; |
|
1229 |
|
|
1230 |
if (isActuallyACollection(the_data)) { |
|
1231 |
jgtype = FShape.MULTI; |
|
1232 |
} |
|
1162 | 1233 |
|
1163 |
case FShape.LINE: |
|
1164 |
ig = getFMapGeometryMultiLineString(st, dim); |
|
1165 |
break; |
|
1234 |
switch (jgtype) { |
|
1235 |
|
|
1236 |
case FShape.MULTI: |
|
1237 |
// idem |
|
1238 |
// int srid = OracleSpatialUtils.getStructSRID(st); |
|
1239 |
int srid = ((NUMBER) the_data[1]).intValue(); |
|
1240 |
ig = getFMapGeometryCollection(the_data, dim, srid); |
|
1241 |
break; |
|
1166 | 1242 |
|
1167 |
case FShape.POLYGON: |
|
1168 |
ig = getFMapGeometryMultipolygon(st, dim); |
|
1169 |
break; |
|
1243 |
case FShape.POINT: |
|
1244 |
ig = getFMapGeometryPoint(the_data, dim); |
|
1245 |
break; |
|
1246 |
|
|
1247 |
case FShape.LINE: |
|
1248 |
ig = getFMapGeometryMultiLineString(the_data, dim); |
|
1249 |
break; |
|
1250 |
|
|
1251 |
case FShape.POLYGON: |
|
1252 |
ig = getFMapGeometryMultipolygon(the_data, dim); |
|
1253 |
break; |
|
1254 |
} |
|
1255 |
return ig; |
|
1170 | 1256 |
} |
1171 |
|
|
1172 |
return ig; |
|
1257 |
catch (SQLException e) |
|
1258 |
{ |
|
1259 |
logger.error(e); |
|
1260 |
} |
|
1261 |
return null; |
|
1173 | 1262 |
} |
1174 | 1263 |
|
1175 | 1264 |
|
... | ... | |
1214 | 1303 |
return ig; |
1215 | 1304 |
} |
1216 | 1305 |
|
1217 |
private IGeometry getFMapGeometryMultipolygon(STRUCT st, int dim) {
|
|
1306 |
private IGeometry getFMapGeometryMultipolygon(Datum[] the_data, int dim) {
|
|
1218 | 1307 |
|
1219 | 1308 |
IGeometry ig = null; |
1220 | 1309 |
|
1221 |
if (OracleSpatialUtils.isCircle(st)) {
|
|
1310 |
if (OracleSpatialUtils.isCircle(the_data)) {
|
|
1222 | 1311 |
|
1223 |
ig = getCircleFromStruct(st);
|
|
1312 |
ig = getCircleFromStruct(the_data);
|
|
1224 | 1313 |
|
1225 | 1314 |
} else { |
1226 | 1315 |
|
1227 |
GeneralPathX gpx = OracleSpatialUtils.structToGPX(st);
|
|
1316 |
GeneralPathX gpx = OracleSpatialUtils.structToGPX(the_data);
|
|
1228 | 1317 |
|
1229 | 1318 |
if (dim == 2) { |
1230 | 1319 |
ig = ShapeFactory.createPolygon2D(gpx); |
1231 | 1320 |
} else { |
1232 | 1321 |
double[] ords = null; |
1233 | 1322 |
try { |
1234 |
ords = ((ARRAY) st.getOracleAttributes()[4]).getDoubleArray();
|
|
1323 |
ords = ((ARRAY) the_data[4]).getDoubleArray();
|
|
1235 | 1324 |
} catch (SQLException se) { |
1236 | 1325 |
logger.error("While getting ordinates: " + se.getMessage(), se); |
1237 | 1326 |
} |
... | ... | |
1260 | 1349 |
return circ; |
1261 | 1350 |
} |
1262 | 1351 |
|
1263 |
private IGeometry getCircleFromStruct(STRUCT st) {
|
|
1352 |
private IGeometry getCircleFromStruct(Datum[] the_data) {
|
|
1264 | 1353 |
|
1265 | 1354 |
double[] threep = null; |
1266 | 1355 |
|
1267 | 1356 |
try { |
1268 |
threep = ((ARRAY) st.getOracleAttributes()[4]).getDoubleArray();
|
|
1357 |
threep = ((ARRAY) the_data[4]).getDoubleArray();
|
|
1269 | 1358 |
} catch (SQLException se) { |
1270 | 1359 |
logger.error("While getting ords from struct: " + se.getMessage(), se); |
1271 | 1360 |
return new FNullGeometry(); |
... | ... | |
1300 | 1389 |
return ig; |
1301 | 1390 |
} |
1302 | 1391 |
|
1303 |
private IGeometry getFMapGeometryMultiLineString(STRUCT st, int dim) {
|
|
1304 |
GeneralPathX gpx = OracleSpatialUtils.structToGPX(st);
|
|
1392 |
private IGeometry getFMapGeometryMultiLineString(Datum[] the_data, int dim) {
|
|
1393 |
GeneralPathX gpx = OracleSpatialUtils.structToGPX(the_data);
|
|
1305 | 1394 |
IGeometry ig = null; |
1306 | 1395 |
double[] ords = null; |
1307 | 1396 |
|
1308 | 1397 |
if (dim == 2) { |
1309 | 1398 |
ig = ShapeFactory.createPolyline2D(gpx); |
1310 | 1399 |
} else { |
1311 |
ords = OracleSpatialUtils.getOrds(st);
|
|
1400 |
ords = OracleSpatialUtils.getOrds(the_data);
|
|
1312 | 1401 |
double[] z = getIndBigDecimalModule(ords, 2, dim); |
1313 | 1402 |
ig = ShapeFactory.createPolyline3D(gpx, z); |
1314 | 1403 |
} |
... | ... | |
1355 | 1444 |
|
1356 | 1445 |
} |
1357 | 1446 |
|
1358 |
private IGeometry getFMapGeometryPoint(STRUCT stpoint, int dim) {
|
|
1447 |
private IGeometry getFMapGeometryPoint(Datum[] the_data, int dim) {
|
|
1359 | 1448 |
|
1360 |
double[] ords = OracleSpatialUtils.getOrds(stpoint);
|
|
1449 |
double[] ords = OracleSpatialUtils.getOrds(the_data);
|
|
1361 | 1450 |
|
1362 | 1451 |
if (ords == null) { // sdo_point |
1363 |
return getFMapGeometrySdoPoint(stpoint, dim);
|
|
1452 |
return getFMapGeometrySdoPoint(the_data, dim);
|
|
1364 | 1453 |
} |
1365 | 1454 |
|
1366 | 1455 |
IGeometry ig = null; |
... | ... | |
1407 | 1496 |
return ig; |
1408 | 1497 |
} |
1409 | 1498 |
|
1410 |
private IGeometry getFMapGeometrySdoPoint(STRUCT stpoint, int d) {
|
|
1499 |
private IGeometry getFMapGeometrySdoPoint(Datum[] the_data, int d) {
|
|
1411 | 1500 |
double x = 0, y = 0, z = 0; |
1412 | 1501 |
try { |
1413 |
STRUCT aux = (STRUCT) stpoint.getOracleAttributes()[2];
|
|
1414 |
x = ((NUMBER) aux.getOracleAttributes()[0]).doubleValue();
|
|
1415 |
y = ((NUMBER) aux.getOracleAttributes()[1]).doubleValue();
|
|
1502 |
Datum[] aux = ((STRUCT) the_data[2]).getOracleAttributes();
|
|
1503 |
x = ((NUMBER) aux[0]).doubleValue(); |
|
1504 |
y = ((NUMBER) aux[1]).doubleValue(); |
|
1416 | 1505 |
if (d > 2) { |
1417 |
z = ((NUMBER) aux.getOracleAttributes()[2]).doubleValue();
|
|
1506 |
z = ((NUMBER) aux[2]).doubleValue(); |
|
1418 | 1507 |
} |
1419 | 1508 |
} catch (SQLException se) { |
1420 | 1509 |
logger.error("While getting sdo point ordinates: " + se.getMessage(), se); |
... | ... | |
1453 | 1542 |
return false; |
1454 | 1543 |
} |
1455 | 1544 |
|
1456 |
private boolean isActuallyACollection(STRUCT st) {
|
|
1545 |
private boolean isActuallyACollection(Datum[] the_data) {
|
|
1457 | 1546 |
|
1458 | 1547 |
int[] info = null; |
1459 | 1548 |
try { |
1460 |
ARRAY aux = (ARRAY) st.getOracleAttributes()[3];
|
|
1549 |
ARRAY aux = (ARRAY) the_data[3];
|
|
1461 | 1550 |
if (aux == null) { |
1462 | 1551 |
return false; |
1463 | 1552 |
} |
... | ... | |
1553 | 1642 |
return new FGeometryCollection(geoms); |
1554 | 1643 |
} |
1555 | 1644 |
|
1556 |
private IGeometry getFMapGeometryCollection(STRUCT st, int dim, int __srid) { |
|
1557 |
|
|
1558 |
Connection conn = null; |
|
1559 |
|
|
1560 |
try { |
|
1561 |
conn = st.getOracleConnection(); |
|
1562 |
} catch (SQLException se) { |
|
1563 |
logger.error("Unexpected error: " + se.getMessage()); |
|
1564 |
} |
|
1565 |
|
|
1566 |
NUMBER main_type = new NUMBER(dim * 1000 + OracleSpatialUtils.getStructType(st)); |
|
1567 |
NUMBER _srid = new NUMBER(__srid); |
|
1568 |
|
|
1569 |
Datum[] all_info_array = null; |
|
1570 |
Object[] elems_info_aray = null; |
|
1571 |
Datum[] all_ords = null; |
|
1572 |
|
|
1573 |
try { |
|
1574 |
all_info_array = ((ARRAY) st.getOracleAttributes()[3]).getOracleArray(); |
|
1575 |
// iadesc = ((ARRAY) st.getOracleAttributes()[3]).getDescriptor(); |
|
1576 |
|
|
1577 |
elems_info_aray = groupByElement(all_info_array); |
|
1578 |
|
|
1579 |
all_ords = ((ARRAY) st.getOracleAttributes()[4]).getOracleArray(); |
|
1580 |
// oadesc = ((ARRAY) st.getOracleAttributes()[4]).getDescriptor(); |
|
1581 |
|
|
1582 |
} catch (SQLException e) { |
|
1583 |
logger.error("Unexpected error: " + e.getMessage()); |
|
1584 |
} |
|
1585 |
|
|
1586 |
Object[] ords_of_groups = getOrdOfGroups(all_ords, elems_info_aray); |
|
1587 |
Object[] _elems_info_aray = new Object[elems_info_aray.length]; |
|
1588 |
for (int i=0; i<elems_info_aray.length; i++) { |
|
1589 |
_elems_info_aray[i] = updateIndexes((Datum[]) elems_info_aray[i]); |
|
1590 |
} |
|
1591 |
|
|
1592 |
// _elems_info_aray, ords_of_groups |
|
1593 |
int no_of_elems = ords_of_groups.length; |
|
1594 |
IGeometry[] geoms = new IGeometry[no_of_elems]; |
|
1595 |
for (int i=0; i<no_of_elems; i++) { |
|
1596 |
|
|
1597 |
Datum[] item_info_array = null; |
|
1598 |
Datum[] item_ords = null; |
|
1599 |
NUMBER gtype = null; |
|
1600 |
|
|
1601 |
try { |
|
1602 |
item_info_array = (Datum[]) _elems_info_aray[i]; |
|
1603 |
item_ords = (Datum[]) ords_of_groups[i]; |
|
1604 |
|
|
1605 |
gtype = new NUMBER(dim * 1000 + item_info_array[1].intValue() % 1000); |
|
1606 |
} catch (SQLException se) { |
|
1607 |
logger.error("Unexpected error: " + se.getMessage()); |
|
1608 |
} |
|
1609 |
|
|
1610 |
// if it's the first geometry, the type is the collection's main type (no?) |
|
1611 |
if (i==0) { |
|
1612 |
gtype = main_type; |
|
1613 |
} |
|
1614 |
|
|
1615 |
STRUCT itemst = null; |
|
1616 |
if (tableHasSrid) { |
|
1617 |
itemst = OracleSpatialUtils.createStruct( |
|
1618 |
gtype, _srid, item_info_array, item_ords, conn); |
|
1619 |
} else { |
|
1620 |
itemst = OracleSpatialUtils.createStruct( |
|
1621 |
gtype, null, item_info_array, item_ords, conn); |
|
1622 |
} |
|
1623 |
geoms[i] = getFMapGeometry(itemst, true); |
|
1624 |
} |
|
1625 |
return new FGeometryCollection(geoms); |
|
1626 |
} |
|
1627 | 1645 |
|
1628 | 1646 |
|
1629 | 1647 |
private Datum[] updateIndexes(Datum[] info) { |
... | ... | |
2384 | 2402 |
|
2385 | 2403 |
String resp = "select rowid, c." + geoColName |
2386 | 2404 |
+ ".SDO_ELEM_INFO from " + getTableName() + " c"; |
2405 |
|
|
2406 |
// String resp = "select rowid from " + getTableName(); |
|
2387 | 2407 |
|
2408 |
|
|
2388 | 2409 |
if (originalOracleWAStruct == null) { |
2389 | 2410 |
if (emptyWhereClause) { |
2390 | 2411 |
// return "select rowid from " + getTableName(); |
branches/v10/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/oracle/OracleSpatialUtils.java | ||
---|---|---|
1790 | 1790 |
} |
1791 | 1791 |
|
1792 | 1792 |
|
1793 |
public static GeneralPathX structToGPX(STRUCT st) {
|
|
1793 |
public static GeneralPathX structToGPX(Datum[] aux) {
|
|
1794 | 1794 |
|
1795 | 1795 |
GeneralPathX resp = new GeneralPathX(); |
1796 | 1796 |
ARRAY infoARRAY = null; |
... | ... | |
1803 | 1803 |
boolean next_must_do_first = true; |
1804 | 1804 |
|
1805 | 1805 |
try { |
1806 |
infoARRAY = (ARRAY) st.getOracleAttributes()[3];
|
|
1807 |
ordsARRAY = (ARRAY) st.getOracleAttributes()[4];
|
|
1806 |
infoARRAY = (ARRAY) aux[3];
|
|
1807 |
ordsARRAY = (ARRAY) aux[4];
|
|
1808 | 1808 |
|
1809 | 1809 |
if (polStructIsRectStruct(infoARRAY, ordsARRAY)) { |
1810 | 1810 |
infoARRAY = getDevelopedInfoArray(infoARRAY); |
1811 | 1811 |
ordsARRAY = getDevelopedOrdsArray(ordsARRAY); |
1812 | 1812 |
} |
1813 | 1813 |
|
1814 |
dims = ((NUMBER) st.getOracleAttributes()[0]).intValue() / 1000;
|
|
1814 |
dims = ((NUMBER) aux[0]).intValue() / 1000;
|
|
1815 | 1815 |
if (dims == 0) dims = 2; |
1816 | 1816 |
|
1817 | 1817 |
info_array = (Datum[]) infoARRAY.getOracleArray(); |
... | ... | |
2102 | 2102 |
return FShape.NULL; |
2103 | 2103 |
} |
2104 | 2104 |
|
2105 |
public static int getStructType(STRUCT st) {
|
|
2105 |
public static int getStructType(Datum[] the_data) {
|
|
2106 | 2106 |
int resp = -1; |
2107 | 2107 |
try { |
2108 |
resp = ((NUMBER) st.getOracleAttributes()[0]).intValue() % 1000;
|
|
2108 |
resp = ((NUMBER) the_data[0]).intValue() % 1000;
|
|
2109 | 2109 |
} catch (SQLException se) { |
2110 | 2110 |
logger.error("Error: " + se.getMessage(), se); |
2111 | 2111 |
} |
2112 | 2112 |
return resp; |
2113 | 2113 |
} |
2114 | 2114 |
|
2115 |
public static int getStructSRID(STRUCT st) {
|
|
2115 |
public static int getStructSRID(Datum[] the_data) {
|
|
2116 | 2116 |
int resp = -1; |
2117 | 2117 |
try { |
2118 |
resp = ((NUMBER) st.getOracleAttributes()[1]).intValue();
|
|
2118 |
resp = ((NUMBER) the_data[1]).intValue();
|
|
2119 | 2119 |
} catch (SQLException se) { |
2120 | 2120 |
logger.error("Error: " + se.getMessage(), se); |
2121 | 2121 |
} |
2122 | 2122 |
return resp; |
2123 | 2123 |
} |
2124 | 2124 |
|
2125 |
public static boolean isCircle(STRUCT st) {
|
|
2125 |
public static boolean isCircle(Datum[] the_data) {
|
|
2126 | 2126 |
int[] info = null; |
2127 | 2127 |
try { |
2128 |
info = ((ARRAY) st.getOracleAttributes()[3]).getIntArray();
|
|
2128 |
info = ((ARRAY) the_data[3]).getIntArray();
|
|
2129 | 2129 |
} catch (SQLException se) { |
2130 | 2130 |
logger.error("While cheking circle: " + se.getMessage(), se); |
2131 | 2131 |
return false; |
... | ... | |
2148 | 2148 |
return resp; |
2149 | 2149 |
} |
2150 | 2150 |
|
2151 |
public static double[] getOrds(STRUCT st) {
|
|
2151 |
public static double[] getOrds(Datum[] the_data) {
|
|
2152 | 2152 |
|
2153 | 2153 |
double[] resp = null; |
2154 | 2154 |
try { |
2155 |
ARRAY aux = (ARRAY) st.getOracleAttributes()[4];
|
|
2155 |
ARRAY aux = (ARRAY) the_data[4];
|
|
2156 | 2156 |
if (aux == null) { |
2157 | 2157 |
return null; |
2158 | 2158 |
} |
branches/v10/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/oracle/testOracle.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 03-mar-2005 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
package com.iver.cit.gvsig.fmap.drivers.jdbc.oracle; |
|
45 |
|
|
46 |
import java.awt.geom.PathIterator; |
|
47 |
import java.awt.geom.Rectangle2D; |
|
48 |
import java.io.BufferedInputStream; |
|
49 |
import java.io.ByteArrayInputStream; |
|
50 |
import java.nio.ByteBuffer; |
|
51 |
import java.nio.ByteOrder; |
|
52 |
import java.sql.Connection; |
|
53 |
import java.sql.DriverManager; |
|
54 |
import java.sql.PreparedStatement; |
|
55 |
import java.sql.ResultSet; |
|
56 |
import java.sql.ResultSetMetaData; |
|
57 |
import java.sql.SQLException; |
|
58 |
import java.sql.Statement; |
|
59 |
|
|
60 |
import oracle.jdbc.driver.OracleDriver; |
|
61 |
import oracle.spatial.geometry.JGeometry; |
|
62 |
import oracle.sql.ARRAY; |
|
63 |
import oracle.sql.Datum; |
|
64 |
import oracle.sql.NUMBER; |
|
65 |
import oracle.sql.STRUCT; |
|
66 |
|
|
67 |
import org.cresques.cts.IProjection; |
|
68 |
import org.postgresql.fastpath.Fastpath; |
|
69 |
|
|
70 |
import com.iver.andami.messages.NotificationManager; |
|
71 |
import com.iver.cit.gvsig.fmap.core.FPolyline2D; |
|
72 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
|
73 |
import com.iver.cit.gvsig.fmap.core.ICanReproject; |
|
74 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
|
75 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
76 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
|
77 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
78 |
import com.iver.cit.gvsig.fmap.drivers.DBLayerDefinition; |
|
79 |
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator; |
|
80 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver; |
|
81 |
import com.iver.cit.gvsig.fmap.drivers.VectorialJDBCDriver; |
|
82 |
import com.iver.cit.gvsig.fmap.drivers.WKBParser2; |
|
83 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
84 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
|
85 |
import com.iver.cit.gvsig.fmap.layers.ISpatialDB; |
|
86 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
|
87 |
import com.vividsolutions.jts.geom.MultiLineString; |
|
88 |
import com.vividsolutions.jts.io.oracle.OraReader; |
|
89 |
|
|
90 |
/** |
|
91 |
* @author FJP |
|
92 |
* |
|
93 |
* TODO To change the template for this generated type comment go to Window - |
|
94 |
* Preferences - Java - Code Generation - Code and Comments |
|
95 |
*/ |
|
96 |
public class testOracle { |
|
97 |
|
|
98 |
private static boolean addOrdsToGPX(GeneralPathX gpx, int zero_based_start, |
|
99 |
int zero_based_include_end, Datum[] ords, int d, int ltype, |
|
100 |
boolean do_the_move, boolean must_do_first) { |
|
101 |
|
|
102 |
int length = ords.length; |
|
103 |
boolean return_following_must_do_first = true; |
|
104 |
|
|
105 |
double x = ((NUMBER) ords[zero_based_start]).doubleValue(); |
|
106 |
double y = ((NUMBER) ords[zero_based_start + 1]).doubleValue(); |
|
107 |
|
|
108 |
if (must_do_first) { |
|
109 |
if (do_the_move) { |
|
110 |
gpx.moveTo(x, y); |
|
111 |
} else { |
|
112 |
gpx.lineTo(x, y); |
|
113 |
} |
|
114 |
} |
|
115 |
int ind = 1; |
|
116 |
|
|
117 |
int size = ((zero_based_include_end - zero_based_start) / d) + 1; |
|
118 |
int indx, indx2; |
|
119 |
|
|
120 |
if (ltype == PathIterator.SEG_QUADTO) { // (interpretation = 2) |
|
121 |
|
|
122 |
double x2, y2; |
|
123 |
while (ind < size) { |
|
124 |
indx = zero_based_start + ind * d; |
|
125 |
x = ((NUMBER) ords[indx]).doubleValue(); |
|
126 |
y = ((NUMBER) ords[indx + 1]).doubleValue(); |
|
127 |
|
|
128 |
indx2 = zero_based_start + (ind + 1) * d; |
|
129 |
if (indx >= length) { |
|
130 |
indx2 = zero_based_start; |
|
131 |
} |
|
132 |
|
|
133 |
x2 = ((NUMBER) ords[indx2]).doubleValue(); |
|
134 |
y2 = ((NUMBER) ords[indx2 + 1]).doubleValue(); |
|
135 |
gpx.quadTo(x, y, x2, y2); |
|
136 |
ind++; |
|
137 |
ind++; |
|
138 |
} |
|
139 |
|
|
140 |
return_following_must_do_first = false; |
|
141 |
|
|
142 |
} else { // PathIterator.SEG_LINETO (interpretation = 1) |
|
143 |
|
|
144 |
while (ind < size) { |
|
145 |
indx = zero_based_start + ind * d; |
|
146 |
x = ((NUMBER) ords[indx]).doubleValue(); |
|
147 |
y = ((NUMBER) ords[indx + 1]).doubleValue(); |
|
148 |
gpx.lineTo(x, y); |
|
149 |
ind++; |
|
150 |
} |
|
151 |
|
|
152 |
} |
|
153 |
|
|
154 |
return return_following_must_do_first; |
|
155 |
|
|
156 |
} |
|
157 |
|
|
158 |
private static int getLineToType(Datum[] infos, int i) { |
|
159 |
|
|
160 |
int resp = PathIterator.SEG_LINETO; |
|
161 |
try { |
|
162 |
if (((NUMBER) infos[3 * i + 2]).intValue() == 2) { |
|
163 |
resp = PathIterator.SEG_QUADTO; |
|
164 |
} |
|
165 |
} catch (SQLException e) { |
|
166 |
e.printStackTrace(); |
|
167 |
} |
|
168 |
return resp; |
|
169 |
} |
|
170 |
|
|
171 |
// CREATE TYPE sdo_geometry AS OBJECT ( |
|
172 |
// SDO_GTYPE NUMBER, |
|
173 |
// SDO_SRID NUMBER, |
|
174 |
// SDO_POINT SDO_POINT_TYPE, |
|
175 |
// SDO_ELEM_INFO SDO_ELEM_INFO_ARRAY, |
|
176 |
// SDO_ORDINATES SDO_ORDINATE_ARRAY); |
|
177 |
private static GeneralPathX parseOracleStruct(STRUCT s) throws SQLException { |
|
178 |
GeneralPathX resp = new GeneralPathX(); |
|
179 |
ARRAY infoARRAY = null; |
|
180 |
ARRAY ordsARRAY = null; |
|
181 |
Datum[] info_array = null; |
|
182 |
Datum[] ords_array = null; |
|
183 |
int info_array_size = 0; |
|
184 |
int[] start_ind, end_ind; |
|
185 |
int dims = 0; |
|
186 |
boolean next_must_do_first = true; |
|
187 |
Datum[] aux = s.getOracleAttributes(); |
|
188 |
|
|
189 |
infoARRAY = (ARRAY) aux[3]; |
|
190 |
ordsARRAY = (ARRAY) aux[4]; |
|
191 |
|
|
192 |
dims = ((NUMBER) aux[0]).intValue() / 1000; |
|
193 |
if (dims == 0) |
|
194 |
dims = 2; |
|
195 |
|
|
196 |
info_array = (Datum[]) infoARRAY.getOracleArray(); |
|
197 |
ords_array = (Datum[]) ordsARRAY.getOracleArray(); |
|
198 |
info_array_size = info_array.length / 3; |
|
199 |
int last_index = ords_array.length - dims + 1; |
|
200 |
|
|
201 |
// set indices: |
|
202 |
start_ind = new int[info_array_size]; |
|
203 |
end_ind = new int[info_array_size]; |
|
204 |
for (int i = 0; i < info_array_size; i++) |
|
205 |
start_ind[i] = ((NUMBER) info_array[3 * i]).intValue(); |
|
206 |
for (int i = 0; i < (info_array_size - 1); i++) |
|
207 |
end_ind[i] = start_ind[i + 1] - 1; |
|
208 |
end_ind[info_array_size - 1] = last_index; |
|
209 |
|
|
210 |
int lineType = PathIterator.SEG_LINETO; |
|
211 |
|
|
212 |
if (end_ind[0] == 0) { // collection of paths |
|
213 |
|
|
214 |
for (int i = 1; i < info_array_size; i++) { |
|
215 |
lineType = getLineToType(info_array, i); |
|
216 |
next_must_do_first = addOrdsToGPX(resp, start_ind[i] - 1, |
|
217 |
end_ind[i] - 1, ords_array, dims, lineType, (i == 1), |
|
218 |
next_must_do_first); |
|
219 |
} |
|
220 |
|
|
221 |
} else { |
|
222 |
|
|
223 |
// standard case, do the moveto always |
|
224 |
|
|
225 |
for (int i = 0; i < info_array_size; i++) { |
|
226 |
lineType = getLineToType(info_array, i); |
|
227 |
addOrdsToGPX(resp, start_ind[i] - 1, end_ind[i] - 1, |
|
228 |
ords_array, dims, lineType, true, true); |
|
229 |
} |
|
230 |
|
|
231 |
} |
|
232 |
|
|
233 |
return resp; |
|
234 |
|
|
235 |
} |
|
236 |
|
|
237 |
public static void main(String[] args) { |
|
238 |
/* |
|
239 |
* System.err.println("dburl has the following format:"); |
|
240 |
* System.err.println("jdbc:postgresql://HOST:PORT/DATABASENAME"); |
|
241 |
* System.err.println("tablename is 'jdbc_test' by default."); |
|
242 |
* System.exit(1); |
|
243 |
*/ |
|
244 |
|
|
245 |
// String dburl = "jdbc:postgresql://localhost/latin1"; |
|
246 |
// String dbuser = "postgres"; |
|
247 |
// String dbpass = "aquilina"; |
|
248 |
String dburl = "jdbc:oracle:thin:@//localhost:1521/xe"; |
|
249 |
String dbuser = "system"; |
|
250 |
String dbpass = "aquilina"; |
|
251 |
|
|
252 |
String dbtable = "vias"; |
|
253 |
|
|
254 |
Connection conn = null; |
|
255 |
System.out.println("Creating JDBC connection..."); |
|
256 |
try { |
|
257 |
DriverManager.registerDriver(new OracleDriver()); |
|
258 |
|
|
259 |
conn = DriverManager.getConnection(dburl, dbuser, dbpass); |
|
260 |
|
|
261 |
conn.setAutoCommit(false); |
|
262 |
|
|
263 |
long t1 = System.currentTimeMillis(); |
|
264 |
test1(conn, dburl, dbuser, dbpass, dbtable); |
|
265 |
// testHashID(conn, dburl, dbuser, dbpass, dbtable); |
|
266 |
long t2 = System.currentTimeMillis(); |
|
267 |
System.out.println("Tiempo de consulta1:" + (t2 - t1) |
|
268 |
+ " milisegundos"); |
|
269 |
|
|
270 |
conn.close(); |
|
271 |
|
|
272 |
} catch (SQLException e) { |
|
273 |
// TODO Auto-generated catch block |
|
274 |
e.printStackTrace(); |
|
275 |
} |
|
276 |
|
|
277 |
} |
|
278 |
|
|
279 |
/** |
|
280 |
* @param conn |
|
281 |
* @param dburl |
|
282 |
* @param dbuser |
|
283 |
* @param dbpass |
|
284 |
* @param dbtable |
|
285 |
*/ |
|
286 |
private static void test1(Connection conn, String dburl, String dbuser, |
|
287 |
String dbpass, String dbtable) { |
|
288 |
try { |
|
289 |
// String strSQL = "select c.geometry from " + dbtable + " c"; |
|
290 |
String strSQL = "select c.GEOMETRY, ROWID from VIAS c where (sdo_filter(GEOMETRY, mdsys.sdo_geometry(2003, 82337, null, mdsys.sdo_elem_info_array(1, 1003, 1), mdsys.sdo_ordinate_array(-167305.445478584,3826564.14408529, 1026816.46891846,3826564.14408529, 1026816.46891846,4919672.72433395, -167305.445478584,4919672.72433395, -167305.445478584,3826564.14408529)), 'mask=anyinteract querytype=window') = 'TRUE')"; |
|
291 |
|
|
292 |
Statement s = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, |
|
293 |
ResultSet.CONCUR_READ_ONLY); |
|
294 |
int fetchSize = 20000; |
|
295 |
s.setFetchSize(fetchSize); |
|
296 |
s.setFetchDirection(ResultSet.FETCH_FORWARD); |
|
297 |
|
|
298 |
long t1 = System.currentTimeMillis(); |
|
299 |
ResultSet r = s.executeQuery(strSQL); |
|
300 |
long t2 = System.currentTimeMillis(); |
|
301 |
System.out.println("Tiempo de consulta:" + (t2 - t1) + " msecs."); |
|
302 |
ResultSetMetaData metadata = r.getMetaData(); |
|
303 |
System.out.println(metadata.getColumnClassName(1)); |
|
304 |
|
|
305 |
// Estar?a bien tener una clase OraParser separada, |
|
306 |
// igual que tenemos WKBParser y WKTParser. |
|
307 |
WKBParser2 parser = new WKBParser2(); |
|
308 |
int numReg = 0; |
|
309 |
while (r.next()) { |
|
310 |
/* |
|
311 |
* ?Hay otros m?todos de leer el campo SDO_GEOMETRY? |
|
312 |
* STRUCT parece muy lento, sobre todo al tener que procesarlo |
|
313 |
* despu?s. |
|
314 |
*/ |
|
315 |
STRUCT _st = (oracle.sql.STRUCT) r.getObject(1); |
|
316 |
// System.out.println(_st.getDescriptor().getJavaClassName()); |
|
317 |
// System.out.println(_st.dump()); |
|
318 |
GeneralPathX gpx = parseOracleStruct(_st); |
|
319 |
|
|
320 |
// Prueba con la parte de Prodevelop |
|
321 |
// GeneralPathX gpx = OracleSpatialUtils.structToGPX(_st |
|
322 |
// .getOracleAttributes()); |
|
323 |
IGeometry geom = ShapeFactory.createGeometry(new FPolyline2D( |
|
324 |
gpx)); |
|
325 |
|
|
326 |
/* PRUEBA CON LA CARGA STANDARD DE ORACLE */ |
|
327 |
// JGeometry jg = JGeometry.load(_st); |
|
328 |
|
|
329 |
// GeneralPathX gpx = OracleSpatialUtils.structToGPX(_st); |
|
330 |
|
|
331 |
numReg++; |
|
332 |
|
|
333 |
} |
|
334 |
System.out.println("numReg = " + numReg); |
|
335 |
s.close(); |
|
336 |
|
|
337 |
} catch (Exception e) { |
|
338 |
e.printStackTrace(); |
|
339 |
} |
|
340 |
} |
|
341 |
|
|
342 |
private static void testHashID(Connection conn, String dburl, |
|
343 |
String dbuser, String dbpass, String dbtable) { |
|
344 |
try { |
|
345 |
/* |
|
346 |
* Create a statement and execute a select query. |
|
347 |
*/ |
|
348 |
// String strSQL = "select rowid, c.geometry.SDO_ELEM_INFO from " + |
|
349 |
// dbtable + " |
|
350 |
// c"; |
|
351 |
String strSQL = "select rowid from " + dbtable; |
|
352 |
|
|
353 |
PreparedStatement s = conn.prepareStatement(strSQL); |
|
354 |
|
|
355 |
// Statement s = |
|
356 |
// conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, |
|
357 |
// ResultSet.CONCUR_READ_ONLY); |
|
358 |
int fetchSize = 5000; |
|
359 |
s.setFetchSize(fetchSize); |
|
360 |
ResultSet r = s.executeQuery(strSQL); |
|
361 |
int id = 0; |
|
362 |
while (r.next()) { |
|
363 |
String strAux = r.getString(1); |
|
364 |
id++; |
|
365 |
// System.out.println("Row " + id + ":" + strAux); |
|
366 |
} |
|
367 |
s.close(); |
|
368 |
} catch (Exception e) { |
|
369 |
e.printStackTrace(); |
|
370 |
} |
|
371 |
} |
|
372 |
|
|
373 |
/** |
|
374 |
* Prueba con JTS_IO. (OraReader) |
|
375 |
* @param conn |
|
376 |
* @param dburl |
|
377 |
* @param dbuser |
|
378 |
* @param dbpass |
|
379 |
* @param dbtable |
|
380 |
* @throws SQLException |
|
381 |
*/ |
|
382 |
private static void test3(Connection conn, String dburl, String dbuser, |
|
383 |
String dbpass, String dbtable) throws SQLException { |
|
384 |
// Usando el OraReader de JTSIO. |
|
385 |
OraReader or = new OraReader(); |
|
386 |
|
|
387 |
|
|
388 |
String strSQL = "select c.GEOMETRY, ROWID from VIAS c where (sdo_filter(GEOMETRY, mdsys.sdo_geometry(2003, 82337, null, mdsys.sdo_elem_info_array(1, 1003, 1), mdsys.sdo_ordinate_array(-167305.445478584,3826564.14408529, 1026816.46891846,3826564.14408529, 1026816.46891846,4919672.72433395, -167305.445478584,4919672.72433395, -167305.445478584,3826564.14408529)), 'mask=anyinteract querytype=window') = 'TRUE')"; |
|
389 |
|
|
390 |
Statement s = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, |
|
391 |
ResultSet.CONCUR_READ_ONLY); |
|
392 |
int fetchSize = 20000; |
|
393 |
s.setFetchSize(fetchSize); |
|
394 |
s.setFetchDirection(ResultSet.FETCH_FORWARD); |
|
395 |
|
|
396 |
long t1 = System.currentTimeMillis(); |
|
397 |
ResultSet r = s.executeQuery(strSQL); |
|
398 |
long t2 = System.currentTimeMillis(); |
|
399 |
System.out.println("Tiempo de consulta:" + (t2 - t1) + " msecs."); |
|
400 |
ResultSetMetaData metadata = r.getMetaData(); |
|
401 |
System.out.println(metadata.getColumnClassName(1)); |
|
402 |
|
|
403 |
WKBParser2 parser = new WKBParser2(); |
|
404 |
int numReg = 0; |
|
405 |
while (r.next()) { |
|
406 |
STRUCT st = (oracle.sql.STRUCT) r.getObject(1); |
|
407 |
MultiLineString pt2 = (MultiLineString) or.read(st); |
|
408 |
numReg++; |
|
409 |
|
|
410 |
} |
|
411 |
System.out.println("numReg = " + numReg); |
|
412 |
s.close(); |
|
413 |
|
|
414 |
} |
|
415 |
|
|
416 |
private static void test4(FLyrVect lyr) { |
|
417 |
try { |
|
418 |
ISpatialDB dbAdapter = (ISpatialDB) lyr.getSource(); |
|
419 |
VectorialDatabaseDriver dbDriver = (VectorialDatabaseDriver) dbAdapter |
|
420 |
.getDriver(); |
|
421 |
IFeatureIterator geomIt = dbDriver.getFeatureIterator(lyr |
|
422 |
.getFullExtent(), "23030"); |
|
423 |
while (geomIt.hasNext()) { |
|
424 |
IFeature feat = geomIt.next(); |
|
425 |
IGeometry geom = feat.getGeometry(); |
|
426 |
} |
|
427 |
} catch (Exception e) { |
|
428 |
e.printStackTrace(); |
|
429 |
} |
|
430 |
|
|
431 |
} |
|
432 |
|
|
433 |
private static FLyrVect initLayerPostGIS() { |
|
434 |
String dbURL = "jdbc:postgresql://localhost:5432/latin1"; // latin1 is |
|
435 |
// the |
|
436 |
// catalog |
|
437 |
// name |
|
438 |
String user = "postgres"; |
|
439 |
String pwd = "aquilina"; |
|
440 |
String layerName = "vias"; |
|
441 |
String tableName = "vias"; |
|
442 |
Connection conn; |
|
443 |
LayerFactory |
|
444 |
.setDriversPath("D:/eclipse/workspace/_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers"); |
|
445 |
try { |
|
446 |
conn = DriverManager.getConnection(dbURL, user, pwd); |
|
447 |
conn.setAutoCommit(false); |
|
448 |
|
|
449 |
String fidField = "gid"; // BE CAREFUL => MAY BE NOT!!! |
|
450 |
String geomField = "the_geom"; // BE CAREFUL => MAY BE NOT!!! => |
|
451 |
// You should read table |
|
452 |
// GEOMETRY_COLUMNS. |
|
453 |
// See PostGIS help. |
|
454 |
|
|
455 |
// To obtain the fields, make a connection and get them. |
|
456 |
/* |
|
457 |
* Statement st = conn.createStatement(); ResultSet rs = |
|
458 |
* st.executeQuery("select * from " + tableName + " LIMIT 1"); |
|
459 |
* ResultSetMetaData rsmd = rs.getMetaData(); String[] fields = new |
|
460 |
* String[rsmd.getColumnCount()-1]; // We don't want to include |
|
461 |
* the_geom field int j = 0; for (int i = 0; i < fields.length; i++) { |
|
462 |
* if (!rsmd.getColumnName(i+1).equalsIgnoreCase(geomField)) { |
|
463 |
* fields[j++] = rsmd.getColumnName(i+1); } } rs.close(); |
|
464 |
*/ |
|
465 |
|
|
466 |
String[] fields = new String[1]; |
|
467 |
fields[0] = "gid"; |
|
468 |
|
|
469 |
String whereClause = ""; |
|
470 |
|
|
471 |
VectorialJDBCDriver driver = (VectorialJDBCDriver) LayerFactory |
|
472 |
.getDM().getDriver("PostGIS JDBC Driver"); |
|
473 |
|
|
474 |
// Here you can set the workingArea |
|
475 |
// driver.setWorkingArea(dbLayerDefinition.getWorkingArea()); |
|
476 |
|
|
477 |
String strEPSG = "23030"; |
|
478 |
DBLayerDefinition lyrDef = new DBLayerDefinition(); |
|
479 |
lyrDef.setName(layerName); |
|
480 |
lyrDef.setTableName(tableName); |
|
481 |
lyrDef.setWhereClause(whereClause); |
|
482 |
lyrDef.setFieldNames(fields); |
|
483 |
lyrDef.setFieldGeometry(geomField); |
|
484 |
lyrDef.setFieldID(fidField); |
|
485 |
// if (dbLayerDefinition.getWorkingArea() != null) |
|
486 |
// lyrDef.setWorkingArea(dbLayerDefinition.getWorkingArea()); |
|
487 |
|
|
488 |
lyrDef.setSRID_EPSG(strEPSG); |
|
489 |
if (driver instanceof ICanReproject) { |
|
490 |
((ICanReproject) driver).setDestProjection(strEPSG); |
|
491 |
} |
|
492 |
driver.setData(conn, lyrDef); |
|
493 |
IProjection proj = null; |
|
494 |
if (driver instanceof ICanReproject) { |
|
495 |
proj = CRSFactory.getCRS("EPSG:" |
|
496 |
+ ((ICanReproject) driver).getSourceProjection()); |
|
497 |
} |
|
498 |
|
|
499 |
FLayer lyr = LayerFactory.createDBLayer(driver, layerName, proj); |
|
500 |
Rectangle2D rectAux = lyr.getFullExtent(); |
|
501 |
return (FLyrVect) lyr; |
|
502 |
} catch (Exception e) { |
|
503 |
e.printStackTrace(); |
|
504 |
} |
|
505 |
return null; |
|
506 |
} |
|
507 |
} |
|
0 | 508 |
branches/v10/extensions/extJDBC/.classpath | ||
---|---|---|
18 | 18 |
<classpathentry kind="lib" path="lib/ojdbc14.jar"/> |
19 | 19 |
<classpathentry kind="lib" path="lib/sdoapi.jar"/> |
20 | 20 |
<classpathentry kind="lib" path="lib/gt2-oracle-spatial-2.2.1.jar"/> |
21 |
<classpathentry kind="lib" path="/libFMap/lib/jtsio-1.7.jar"/> |
|
21 | 22 |
<classpathentry kind="output" path="bin"/> |
22 | 23 |
</classpath> |
Also available in: Unified diff