Revision 38031
branches/v2_0_0_prep/extensions/org.gvsig.oracle/src/org/gvsig/fmap/dal/store/oracle/OracleUtils.java | ||
---|---|---|
3739 | 3739 |
|
3740 | 3740 |
STRUCT resp = null; |
3741 | 3741 |
|
3742 |
if (geom instanceof MultiPoint2D) { |
|
3742 |
GeometryType geometryType = geom.getGeometryType(); |
|
3743 |
|
|
3744 |
if (geometryType.isTypeOf(Geometry.TYPES.MULTIPOINT)) { |
|
3743 | 3745 |
resp = multiPoint2DToStruct((MultiPoint2D) geom, conn, osrid, |
3744 | 3746 |
hasSrid); |
3745 | 3747 |
return resp; |
3746 |
} |
|
3747 |
|
|
3748 |
if (geom instanceof org.gvsig.fmap.geom.primitive.impl.Point2D) { // point 2/3d |
|
3748 |
} else if (geometryType.isTypeOf(Geometry.TYPES.POINT)) { // point 2/3d |
|
3749 | 3749 |
Coordinate p = getSingleCoordinate((Point) geom); |
3750 | 3750 |
resp = getMultiPointAsStruct(p, osrid, three, conn, hasSrid); |
3751 |
} else { |
|
3752 |
if (geom instanceof Surface2D) { // polygon 2/3d |
|
3753 |
|
|
3754 |
if (geom instanceof Circle2D) { |
|
3755 |
resp = getCircleAsStruct((Circle2D) geom, osrid, conn, |
|
3756 |
hasSrid); |
|
3757 |
} else { |
|
3758 |
// also FEllipse2D |
|
3759 |
resp = getMultiPolygonAsStruct(geom, osrid, three, conn, |
|
3760 |
agu_b, hasSrid); |
|
3761 |
} |
|
3762 |
} else { // line 2/3d |
|
3763 |
|
|
3764 |
List<LineString3D> _lines = getLineStrings(geom); |
|
3765 |
resp = getMultiLineAsStruct(_lines, osrid, three, conn, hasSrid); |
|
3751 |
} else if (geometryType.isTypeOf(Geometry.TYPES.CURVE)) { // curve 2/3d |
|
3752 |
List<LineString3D> _lines = getLineStrings(geom); |
|
3753 |
resp = getMultiLineAsStruct(_lines, osrid, three, conn, hasSrid); |
|
3754 |
} else if (geometryType.isTypeOf(Geometry.TYPES.SURFACE)) { // surface 2/3d |
|
3755 |
if (geometryType.getType() == Geometry.TYPES.CIRCLE) { |
|
3756 |
resp = getCircleAsStruct((Circle2D) geom, osrid, conn, |
|
3757 |
hasSrid); |
|
3758 |
} else { |
|
3759 |
// also FEllipse2D |
|
3760 |
resp = getMultiPolygonAsStruct(geom, osrid, three, conn, |
|
3761 |
agu_b, hasSrid); |
|
3766 | 3762 |
} |
3767 |
} |
|
3763 |
} else if (geometryType.isTypeOf(Geometry.TYPES.NULL)) { // null geometry |
|
3764 |
return null; |
|
3765 |
} |
|
3768 | 3766 |
|
3769 | 3767 |
return resp; |
3770 | 3768 |
} |
branches/v2_0_0_prep/extensions/org.gvsig.oracle/src/org/gvsig/fmap/dal/store/oracle/OracleStoreProvider.java | ||
---|---|---|
145 | 145 |
selectedFields = new HashMap(); |
146 | 146 |
String[] fields = sFields.split(","); |
147 | 147 |
for (int i=0 ; i<fields.length ; i++){ |
148 |
selectedFields.put(fields[i], Boolean.TRUE); |
|
148 |
selectedFields.put(fields[i].trim(), Boolean.TRUE);
|
|
149 | 149 |
} |
150 | 150 |
} |
151 | 151 |
} |
... | ... | |
347 | 347 |
if (attr.getDataType().getType() == DataTypes.GEOMETRY) { |
348 | 348 |
Geometry geom = (Geometry) featureProvider.get(attr.getIndex()); |
349 | 349 |
|
350 |
String ora_srid_str = null; |
|
351 |
boolean is_geo = false; |
|
352 |
boolean has_srid = false; |
|
350 |
STRUCT stru = null; |
|
353 | 351 |
|
354 |
Object ora_srid = getDynValue("ora_table_srid"); |
|
355 |
if (ora_srid != null) { |
|
356 |
if (ora_srid instanceof String) { |
|
357 |
ora_srid_str = (String) ora_srid; |
|
358 |
} else { |
|
359 |
if (ora_srid instanceof Integer) { |
|
360 |
ora_srid_str = "" + ((Integer) ora_srid).intValue(); |
|
361 |
} |
|
352 |
if (geom != null){ |
|
353 |
String ora_srid_str = null; |
|
354 |
boolean is_geo = false; |
|
355 |
boolean has_srid = false; |
|
356 |
|
|
357 |
Object ora_srid = getDynValue("ora_table_srid"); |
|
358 |
if (ora_srid != null) { |
|
359 |
if (ora_srid instanceof String) { |
|
360 |
ora_srid_str = (String) ora_srid; |
|
361 |
} else { |
|
362 |
if (ora_srid instanceof Integer) { |
|
363 |
ora_srid_str = "" + ((Integer) ora_srid).intValue(); |
|
364 |
} |
|
365 |
} |
|
362 | 366 |
} |
363 |
} |
|
364 |
|
|
365 |
has_srid = ora_srid_str != null && ora_srid_str.compareToIgnoreCase("0") != 0; |
|
366 |
is_geo = OracleUtils.getIsGCS( |
|
367 |
ora_srid_str, has_srid); |
|
368 |
|
|
369 |
// OracleUtils.is |
|
370 |
|
|
371 |
STRUCT stru = OracleUtils.buildSTRUCT( |
|
372 |
geom, 0, helper.getConnection(), |
|
373 |
ora_srid_str, has_srid, false, is_geo); |
|
374 |
values.add(stru); |
|
367 |
|
|
368 |
has_srid = ora_srid_str != null && ora_srid_str.compareToIgnoreCase("0") != 0; |
|
369 |
is_geo = OracleUtils.getIsGCS( |
|
370 |
ora_srid_str, has_srid); |
|
371 |
|
|
372 |
stru = OracleUtils.buildSTRUCT( |
|
373 |
geom, 0, helper.getConnection(), |
|
374 |
ora_srid_str, has_srid, false, is_geo); |
|
375 |
|
|
376 |
values.add(stru); |
|
377 |
}else{ |
|
378 |
values.add(null); |
|
379 |
} |
|
375 | 380 |
} else { |
376 | 381 |
super.addToListFeatureValues(featureProvider, attrOfList, attr, values); |
377 | 382 |
} |
... | ... | |
743 | 748 |
sql.append("from "); |
744 | 749 |
sql.append(params.tableID()); |
745 | 750 |
sql.append(' '); |
751 |
|
|
752 |
// Where |
|
753 |
appendWhere(sql, filter); |
|
754 |
|
|
755 |
if (limit == 0 && offset > 1) { |
|
756 |
StringBuilder romNumberQuery = new StringBuilder(); |
|
757 |
romNumberQuery.append("SELECT * FROM ( SELECT A.*, ROWNUM row_number FROM ("); |
|
758 |
romNumberQuery.append(sql); |
|
759 |
romNumberQuery.append(") A WHERE ROWNUM <= "); |
|
760 |
romNumberQuery.append(offset + 100); |
|
761 |
romNumberQuery.append(" ) WHERE row_number >"); |
|
762 |
romNumberQuery.append(offset); |
|
763 |
sql = romNumberQuery; |
|
764 |
} |
|
746 | 765 |
|
747 |
// Where |
|
748 |
appendWhere(sql, filter); |
|
749 |
|
|
750 | 766 |
// Order |
751 | 767 |
/* |
752 | 768 |
if ((params.getBaseOrder() != null && params.getBaseOrder() |
... | ... | |
766 | 782 |
*/ |
767 | 783 |
} |
768 | 784 |
// limit offset |
769 |
/* |
|
770 |
if (limit > 0 || offset > 0) { |
|
771 |
sql.append(helper.compoundLimitAndOffset(limit,offset)); |
|
772 |
}^ |
|
773 |
*/ |
|
785 |
|
|
774 | 786 |
logger.info("Executing SQL: " + sql.toString()); |
775 | 787 |
return sql.toString(); |
776 | 788 |
} |
Also available in: Unified diff