Mercurial > dive4elements > gnv-client
comparison 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 |
comparison
equal
deleted
inserted
replaced
265:e5379e129799 | 266:1530890b28c9 |
---|---|
1 /** | 1 /** |
2 * | 2 * |
3 */ | 3 */ |
4 package de.intevation.gnv.geobackend.sde.datasources; | 4 package de.intevation.gnv.geobackend.sde.datasources; |
5 | 5 |
6 import java.sql.Connection; | 6 import java.sql.Connection; |
7 import java.sql.ResultSet; | 7 import java.sql.ResultSet; |
8 import java.sql.SQLException; | 8 import java.sql.SQLException; |
9 import java.sql.SQLWarning; | 9 import java.sql.SQLWarning; |
12 import org.apache.log4j.Logger; | 12 import org.apache.log4j.Logger; |
13 | 13 |
14 import com.esri.sde.sdk.client.SDEPoint; | 14 import com.esri.sde.sdk.client.SDEPoint; |
15 import com.esri.sde.sdk.client.SeColumnDefinition; | 15 import com.esri.sde.sdk.client.SeColumnDefinition; |
16 import com.esri.sde.sdk.client.SeConnection; | 16 import com.esri.sde.sdk.client.SeConnection; |
17 import com.esri.sde.sdk.client.SeCoordinateReference; | |
18 import com.esri.sde.sdk.client.SeException; | 17 import com.esri.sde.sdk.client.SeException; |
19 import com.esri.sde.sdk.client.SeFilter; | 18 import com.esri.sde.sdk.client.SeFilter; |
20 import com.esri.sde.sdk.client.SeLayer; | 19 import com.esri.sde.sdk.client.SeLayer; |
21 import com.esri.sde.sdk.client.SeQuery; | 20 import com.esri.sde.sdk.client.SeQuery; |
22 import com.esri.sde.sdk.client.SeRow; | 21 import com.esri.sde.sdk.client.SeRow; |
23 import com.esri.sde.sdk.client.SeShape; | 22 import com.esri.sde.sdk.client.SeShape; |
24 import com.esri.sde.sdk.client.SeShapeFilter; | 23 import com.esri.sde.sdk.client.SeShapeFilter; |
25 import com.esri.sde.sdk.client.SeSqlConstruct; | 24 import com.esri.sde.sdk.client.SeSqlConstruct; |
26 import com.vividsolutions.jts.geom.Geometry; | 25 import com.vividsolutions.jts.geom.Geometry; |
27 import com.vividsolutions.jts.geom.GeometryFactory; | |
28 import com.vividsolutions.jts.io.WKTReader; | 26 import com.vividsolutions.jts.io.WKTReader; |
29 | 27 |
30 | 28 |
31 /** | 29 /** |
32 * @author Tim Englich <tim.englich@intevation.de> | 30 * @author Tim Englich <tim.englich@intevation.de> |
172 throws SQLException { | 170 throws SQLException { |
173 log.debug("executeQuery()"); | 171 log.debug("executeQuery()"); |
174 try { | 172 try { |
175 // get the layer for querying | 173 // get the layer for querying |
176 SeLayer lLayer = new SeLayer(con, pLayername, pSpatialColumnName); | 174 SeLayer lLayer = new SeLayer(con, pLayername, pSpatialColumnName); |
177 SeCoordinateReference cref = lLayer.getCoordRef(); | 175 SeShapeFilter[] filters = null; |
178 | 176 if (g != null){ |
179 SeShape shape = new SeShape(); | 177 SeShape shape = new SeShape(); |
180 shape.setCoordRef(lLayer.getCoordRef()); | 178 shape.setCoordRef(lLayer.getCoordRef()); |
181 SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g); | 179 |
182 | 180 SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g); |
183 shape.generatePolygon(lPoints.length, 1, null, lPoints); | 181 |
184 SeShapeFilter filter = new SeShapeFilter(pLayername, | 182 shape.generatePolygon(lPoints.length, 1, null, lPoints); |
185 pSpatialColumnName, shape, SeFilter.METHOD_AI); | 183 SeShapeFilter filter = new SeShapeFilter(pLayername, |
186 SeShapeFilter[] filters = new SeShapeFilter[1]; | 184 pSpatialColumnName, shape, SeFilter.METHOD_AI); |
187 filters[0] = filter; | 185 filters = new SeShapeFilter[1]; |
186 filters[0] = filter; | |
187 } | |
188 | 188 |
189 SeQuery spatialQuery = null; | 189 SeQuery spatialQuery = null; |
190 SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere); | 190 SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere); |
191 spatialQuery = new SeQuery(con, pReturnFields, sqlCons); | 191 spatialQuery = new SeQuery(con, pReturnFields, sqlCons); |
192 spatialQuery.prepareQuery(); | 192 spatialQuery.prepareQuery(); |
193 /* | 193 /* |
194 * Set spatial constraints | 194 * Set spatial constraints |
195 */ | 195 */ |
196 spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, | 196 if (filters != null){ |
197 filters); | 197 spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, |
198 filters); | |
199 } | |
198 spatialQuery.execute(); | 200 spatialQuery.execute(); |
199 | 201 |
200 return this.handleResultSet(spatialQuery); | 202 return this.handleResultSet(spatialQuery); |
201 | 203 |
202 } catch (Exception e) { | 204 } catch (Exception e) { |