use of com.revolsys.oracle.recordstore.esri.ArcSdeStGeometryFieldDefinition in project com.revolsys.open by revolsys.
the class OracleRecordStore method appendEnvelopeIntersects.
private void appendEnvelopeIntersects(final Query query, final StringBuilder sql, final EnvelopeIntersects envelopeIntersects) {
final FieldDefinition geometryField = query.getGeometryField();
if (geometryField instanceof OracleSdoGeometryJdbcFieldDefinition) {
sql.append("SDO_RELATE(");
final QueryValue boundingBox1Value = envelopeIntersects.getBoundingBox1Value();
if (boundingBox1Value == null) {
sql.append("NULL");
} else {
boundingBox1Value.appendSql(query, this, sql);
}
sql.append(",");
final QueryValue boundingBox2Value = envelopeIntersects.getBoundingBox2Value();
if (boundingBox2Value == null) {
sql.append("NULL");
} else {
boundingBox2Value.appendSql(query, this, sql);
}
sql.append(",'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'");
} else if (geometryField instanceof ArcSdeStGeometryFieldDefinition) {
sql.append("SDE.ST_ENVINTERSECTS(");
final QueryValue boundingBox1Value = envelopeIntersects.getBoundingBox1Value();
if (boundingBox1Value == null) {
sql.append("NULL");
} else {
boundingBox1Value.appendSql(query, this, sql);
}
sql.append(",");
final QueryValue boundingBox2Value = envelopeIntersects.getBoundingBox2Value();
if (boundingBox2Value == null) {
sql.append("NULL");
} else {
boundingBox2Value.appendSql(query, this, sql);
}
sql.append(") = 1");
} else {
throw new IllegalArgumentException("Unknown geometry attribute type " + geometryField.getClass());
}
}
use of com.revolsys.oracle.recordstore.esri.ArcSdeStGeometryFieldDefinition in project com.revolsys.open by revolsys.
the class OracleRecordStore method appendGeometryEqual2d.
private void appendGeometryEqual2d(final Query query, final StringBuilder sql, final GeometryEqual2d equals) {
final FieldDefinition geometryField = query.getGeometryField();
if (geometryField instanceof OracleSdoGeometryJdbcFieldDefinition) {
sql.append("MDSYS.SDO_EQUAL(");
final QueryValue geometry1Value = equals.getGeometry1Value();
if (geometry1Value == null) {
sql.append("NULL");
} else {
geometry1Value.appendSql(query, this, sql);
}
sql.append(",");
final QueryValue geometry2Value = equals.getGeometry2Value();
if (geometry2Value == null) {
sql.append("NULL");
} else {
geometry2Value.appendSql(query, this, sql);
}
sql.append(") = 'TRUE'");
} else if (geometryField instanceof ArcSdeStGeometryFieldDefinition) {
sql.append("SDE.ST_EQUALS(");
final QueryValue geometry1Value = equals.getGeometry1Value();
if (geometry1Value == null) {
sql.append("NULL");
} else {
geometry1Value.appendSql(query, this, sql);
}
sql.append(",");
final QueryValue geometry2Value = equals.getGeometry2Value();
if (geometry2Value == null) {
sql.append("NULL");
} else {
geometry2Value.appendSql(query, this, sql);
}
sql.append(") = 1");
} else {
throw new IllegalArgumentException("Unknown geometry attribute type " + geometryField.getClass());
}
}
use of com.revolsys.oracle.recordstore.esri.ArcSdeStGeometryFieldDefinition in project com.revolsys.open by revolsys.
the class OracleRecordStore method appendWithinDistance.
private void appendWithinDistance(final Query query, final StringBuilder sql, final WithinDistance withinDistance) {
final FieldDefinition geometryField = query.getGeometryField();
if (geometryField instanceof OracleSdoGeometryJdbcFieldDefinition) {
sql.append("MDSYS.SDO_WITHIN_DISTANCE(");
final QueryValue geometry1Value = withinDistance.getGeometry1Value();
if (geometry1Value == null) {
sql.append("NULL");
} else {
geometry1Value.appendSql(query, this, sql);
}
sql.append(", ");
final QueryValue geometry2Value = withinDistance.getGeometry2Value();
if (geometry2Value == null) {
sql.append("NULL");
} else {
geometry2Value.appendSql(query, this, sql);
}
sql.append(",'distance = ' || ");
final QueryValue distanceValue = withinDistance.getDistanceValue();
if (distanceValue == null) {
sql.append("0");
} else {
distanceValue.appendSql(query, this, sql);
}
sql.append(") = 'TRUE'");
} else if (geometryField instanceof ArcSdeStGeometryFieldDefinition) {
final Column column = (Column) withinDistance.getGeometry1Value();
final GeometryFactory geometryFactory = column.getFieldDefinition().getRecordDefinition().getGeometryFactory();
final Value geometry2Value = (Value) withinDistance.getGeometry2Value();
final Value distanceValue = (Value) withinDistance.getDistanceValue();
final Number distance = (Number) distanceValue.getValue();
final Object geometryObject = geometry2Value.getValue();
BoundingBox boundingBox;
if (geometryObject instanceof BoundingBox) {
boundingBox = (BoundingBox) geometryObject;
} else if (geometryObject instanceof Geometry) {
final Geometry geometry = (Geometry) geometryObject;
boundingBox = geometry.getBoundingBox();
} else {
boundingBox = geometryFactory.newBoundingBoxEmpty();
}
boundingBox = boundingBox.expand(distance.doubleValue());
boundingBox = boundingBox.convert(geometryFactory);
sql.append("(SDE.ST_ENVINTERSECTS(");
column.appendSql(query, this, sql);
sql.append(",");
sql.append(boundingBox.getMinX());
sql.append(",");
sql.append(boundingBox.getMinY());
sql.append(",");
sql.append(boundingBox.getMaxX());
sql.append(",");
sql.append(boundingBox.getMaxY());
sql.append(") = 1 AND SDE.ST_DISTANCE(");
column.appendSql(query, this, sql);
sql.append(", ");
geometry2Value.appendSql(query, this, sql);
sql.append(") <= ");
distanceValue.appendSql(query, this, sql);
sql.append(")");
} else {
throw new IllegalArgumentException("Unknown geometry attribute type " + geometryField.getClass());
}
}
Aggregations