4
* PostGIS extension for PostgreSQL JDBC driver - example and test classes
6
* (C) 2004 Paul Ramsey, pramsey@refractions.net
8
* (C) 2005 Markus Schaber, markus@schabi.de
10
* This program is free software; you can redistribute it and/or modify it under
11
* the terms of the GNU General Public License as published by the Free Software
12
* Foundation; either version 2 of the License.
14
* This program is distributed in the hope that it will be useful, but WITHOUT
15
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19
* You should have received a copy of the GNU General Public License along with
20
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21
* Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at
24
* $Id: Test.java,v 1.4 2005/03/30 15:24:40 mschaber Exp $
29
import org.postgis.LineString;
30
import org.postgis.LinearRing;
31
import org.postgis.MultiLineString;
32
import org.postgis.MultiPolygon;
33
import org.postgis.PGgeometry;
34
import org.postgis.Point;
35
import org.postgis.Polygon;
37
import java.sql.SQLException;
41
public static void main(String[] args) throws SQLException {
42
String mlng_str = "MULTILINESTRING ((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))";
43
String mplg_str = "MULTIPOLYGON (((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)),((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0)))";
44
String plg_str = "POLYGON ((10 10 0,20 10 0,20 20 0,20 10 0,10 10 0),(5 5 0,5 6 0,6 6 0,6 5 0,5 5 0))";
45
String lng_str = "LINESTRING (10 10 20,20 20 20, 50 50 50, 34 34 34)";
46
String ptg_str = "POINT(10 10 20)";
47
String lr_str = "(10 10 20,34 34 34, 23 19 23 , 10 10 11)";
49
System.out.println("LinearRing Test:");
50
System.out.println("\t" + lr_str);
51
LinearRing lr = new LinearRing(lr_str);
52
System.out.println("\t" + lr.toString());
56
System.out.println("Point Test:");
57
System.out.println("\t" + ptg_str);
58
Point ptg = new Point(ptg_str);
59
System.out.println("\t" + ptg.toString());
63
System.out.println("LineString Test:");
64
System.out.println("\t" + lng_str);
65
LineString lng = new LineString(lng_str);
66
System.out.println("\t" + lng.toString());
70
System.out.println("Polygon Test:");
71
System.out.println("\t" + plg_str);
72
Polygon plg = new Polygon(plg_str);
73
System.out.println("\t" + plg.toString());
77
System.out.println("MultiPolygon Test:");
78
System.out.println("\t" + mplg_str);
79
MultiPolygon mplg = new MultiPolygon(mplg_str);
80
System.out.println("\t" + mplg.toString());
84
System.out.println("MultiLineString Test:");
85
System.out.println("\t" + mlng_str);
86
MultiLineString mlng = new MultiLineString(mlng_str);
87
System.out.println("\t" + mlng.toString());
91
System.out.println("PG Test:");
92
System.out.println("\t" + mlng_str);
93
PGgeometry pgf = new PGgeometry(mlng_str);
94
System.out.println("\t" + pgf.toString());
98
System.out.println("finished");