1 /*
2 * WKB4J - WKB reader for geographical mapping toolkits
3 * (C) 2002,2003, David Garnier, dgarnier@users.sourceforge.net
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation,
8 * version 2.1 of the License.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * or visit the web to http://www.gnu.org.
19 *
20 */
21 package org.wkb4j.jts;
22
23 import java.sql.Connection;
24 import java.util.List;
25
26 import org.apache.log4j.Logger;
27 import org.wkb4j.engine.AbstractWKBGetter;
28
29 /***
30 * Retrieves PostGIS geometries from the specified database Connectiion and return them in a List.
31 * This is the simplest interface offered by WKB4J. If it does not match your needs, you will
32 * need to handle the WKBParser, WKBReader and WKBFactory yourself.
33 * <code>org.wkb4j.examples.SampleCode</code> is provided as an example.
34 *
35 */
36 public class JTSGetter extends AbstractWKBGetter {
37 protected static Logger log = Logger.getLogger(JTSGetter.class);
38
39 public JTSGetter() {
40 super(new JTSFactory());
41 }
42
43 public List getData(
44 Connection dbConn,
45 String table,
46 String geocolumn,
47 String whereClause) {
48 reader.readDataWithWhereClause(
49 dbConn,
50 geocolumn,
51 table,
52 whereClause,
53 parser);
54 return ((JTSFactory) factory).getGeometries();
55 }
56
57 public List getData(Connection dbConn, String sqlQuery) {
58 reader.readData(dbConn, sqlQuery, parser);
59 return ((JTSFactory) factory).getGeometries();
60 }
61 }
This page was automatically generated by Maven