~ubuntu-branches/ubuntu/feisty/postgis/feisty

« back to all changes in this revision

Viewing changes to jdbc2/src/examples/Test.java

  • Committer: Bazaar Package Importer
  • Author(s): Alex Bodnaru
  • Date: 2005-05-05 10:02:45 UTC
  • Revision ID: james.westby@ubuntu.com-20050505100245-3005l6jn1jwvpsrw
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Test.java
 
3
 * 
 
4
 * PostGIS extension for PostgreSQL JDBC driver - example and test classes
 
5
 * 
 
6
 * (C) 2004 Paul Ramsey, pramsey@refractions.net
 
7
 * 
 
8
 * (C) 2005 Markus Schaber, markus@schabi.de
 
9
 * 
 
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.
 
13
 * 
 
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
 
17
 * details.
 
18
 * 
 
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
 
22
 * http://www.gnu.org.
 
23
 * 
 
24
 * $Id: Test.java,v 1.4 2005/03/30 15:24:40 mschaber Exp $
 
25
 */
 
26
 
 
27
package examples;
 
28
 
 
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;
 
36
 
 
37
import java.sql.SQLException;
 
38
 
 
39
public class Test {
 
40
 
 
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)";
 
48
 
 
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());
 
53
 
 
54
        System.out.println();
 
55
 
 
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());
 
60
 
 
61
        System.out.println();
 
62
 
 
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());
 
67
 
 
68
        System.out.println();
 
69
 
 
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());
 
74
 
 
75
        System.out.println();
 
76
 
 
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());
 
81
 
 
82
        System.out.println();
 
83
 
 
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());
 
88
 
 
89
        System.out.println();
 
90
 
 
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());
 
95
 
 
96
        System.out.println();
 
97
 
 
98
        System.out.println("finished");
 
99
    }
 
100
}
 
101