Mercurial > dive4elements > gnv-client
diff geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java @ 266:1530890b28c9
Added SFS-Support to ArcSDE-Query-Part without any Spatial restriction in the where clause
geo-backend/trunk@216 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 13 Oct 2009 14:30:52 +0000 |
parents | 031ef9649cd1 |
children | 000e00592ba5 |
line wrap: on
line diff
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java Tue Oct 13 13:20:26 2009 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java Tue Oct 13 14:30:52 2009 +0000 @@ -1,7 +1,7 @@ /** * */ - package de.intevation.gnv.geobackend.sde.datasources; +package de.intevation.gnv.geobackend.sde.datasources; import java.sql.Connection; import java.sql.ResultSet; @@ -14,7 +14,6 @@ import com.esri.sde.sdk.client.SDEPoint; import com.esri.sde.sdk.client.SeColumnDefinition; import com.esri.sde.sdk.client.SeConnection; -import com.esri.sde.sdk.client.SeCoordinateReference; import com.esri.sde.sdk.client.SeException; import com.esri.sde.sdk.client.SeFilter; import com.esri.sde.sdk.client.SeLayer; @@ -24,7 +23,6 @@ import com.esri.sde.sdk.client.SeShapeFilter; import com.esri.sde.sdk.client.SeSqlConstruct; import com.vividsolutions.jts.geom.Geometry; -import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.io.WKTReader; @@ -174,17 +172,19 @@ try { // get the layer for querying SeLayer lLayer = new SeLayer(con, pLayername, pSpatialColumnName); - SeCoordinateReference cref = lLayer.getCoordRef(); - - SeShape shape = new SeShape(); - shape.setCoordRef(lLayer.getCoordRef()); - SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g); - - shape.generatePolygon(lPoints.length, 1, null, lPoints); - SeShapeFilter filter = new SeShapeFilter(pLayername, - pSpatialColumnName, shape, SeFilter.METHOD_AI); - SeShapeFilter[] filters = new SeShapeFilter[1]; - filters[0] = filter; + SeShapeFilter[] filters = null; + if (g != null){ + SeShape shape = new SeShape(); + shape.setCoordRef(lLayer.getCoordRef()); + + SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g); + + shape.generatePolygon(lPoints.length, 1, null, lPoints); + SeShapeFilter filter = new SeShapeFilter(pLayername, + pSpatialColumnName, shape, SeFilter.METHOD_AI); + filters = new SeShapeFilter[1]; + filters[0] = filter; + } SeQuery spatialQuery = null; SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere); @@ -193,8 +193,10 @@ /* * Set spatial constraints */ - spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, - filters); + if (filters != null){ + spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, + filters); + } spatialQuery.execute(); return this.handleResultSet(spatialQuery);