/** * Checks to see if the literal is a geometry, and encodes it if it is, if * not just sends to the parent class. * * @param expression the expression to visit and encode. * * @throws RuntimeException for IO exception (need a better error) */ public void visit(LiteralExpression expression) throws RuntimeException { LOGGER.finer("exporting LiteralExpression"); try { if (expression.getType() == DefaultExpression.LITERAL_GEOMETRY) { visitLiteralGeometry(expression); } else { super.visit(expression); } } catch (java.io.IOException ioe) { LOGGER.warning("Unable to export expression" + ioe); throw new RuntimeException("io error while writing", ioe); } }
/** * Converts a literal expression into a valid SDO object. Only handles * Literal Geometries, all other literals are passed up to the parent. * * @param literal The Literal expression to encode. * * @see org.geotools.filter.FilterVisitor#visit(org.geotools.filter.LiteralExpression) */ public void visit(LiteralExpression literal) { if (literal.getType() == DefaultExpression.LITERAL_GEOMETRY) { Geometry geometry = (Geometry) literal.getLiteral(); try { int srid = -1; Integer sridO = (Integer) srids.get(currentGeomColumnName); if (sridO == null) { // try for default sridO = (Integer) srids.get(null); } if (sridO != null) { srid = sridO.intValue(); } out.write(toSDOGeom(geometry, srid)); } catch (IOException e) { LOGGER.warning("IO Error exporting Literal Geometry"); } } else { // can't do it, send it off to the parent super.visit(literal); } }
/** * @see org.geotools.filter.FilterVisitor#visit(org.geotools.filter.LiteralExpression) */ public void visit(LiteralExpression expression) { if (expression.getType() == DefaultExpression.LITERAL_GEOMETRY) { Geometry bbox = (Geometry) expression.getLiteral(); if (this.bounds == null) { this.bounds = bbox.getEnvelopeInternal(); } else { this.bounds.expandToInclude(bbox.getEnvelopeInternal()); } } else { LOGGER.warning("LiteralExpression ignored!"); } }
short type = expression.getType();
short type = expression.getType();