/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2002-2009, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ package org.geotools.data.postgis; import org.geotools.filter.FilterCapabilities; import org.geotools.jdbc.PreparedFilterToSQL; import org.opengis.feature.type.GeometryDescriptor; import org.opengis.filter.expression.Literal; import org.opengis.filter.expression.PropertyName; import org.opengis.filter.spatial.BinarySpatialOperator; public class PostgisPSFilterToSql extends PreparedFilterToSQL { FilterToSqlHelper helper; boolean functionEncodingEnabled; public PostgisPSFilterToSql(PostGISPSDialect dialect) { super(dialect); helper = new FilterToSqlHelper(this); } public boolean isLooseBBOXEnabled() { return helper.looseBBOXEnabled; } public void setLooseBBOXEnabled(boolean looseBBOXEnabled) { helper.looseBBOXEnabled = looseBBOXEnabled; } @Override protected FilterCapabilities createFilterCapabilities() { return helper.createFilterCapabilities(functionEncodingEnabled); } @Override protected Object visitBinarySpatialOperator(BinarySpatialOperator filter, PropertyName property, Literal geometry, boolean swapped, Object extraData) { helper.out = out; return helper.visitBinarySpatialOperator(filter, property, geometry, swapped, extraData); } GeometryDescriptor getCurrentGeometry() { return currentGeometry; } public void setFunctionEncodingEnabled(boolean functionEncodingEnabled) { this.functionEncodingEnabled = functionEncodingEnabled; } }