From 7c60f02794a42ad5611a832e1a25971002a5d371 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 4 Feb 2005 09:05:24 +0000 Subject: [PATCH] Applied Markus Shaber licensing patches. git-svn-id: http://svn.osgeo.org/postgis/trunk@1363 b70326c6-7e19-0410-871a-916f4a2858ee --- jdbc2/Makefile | 22 +++++++- jdbc2/README | 14 +++++ jdbc2/build.xml | 15 +++++- jdbc2/src/examples/Test.java | 54 ++++++++++++++----- jdbc2/src/examples/TestBoxes.java | 39 +++++++++----- jdbc2/src/examples/TestParser.java | 29 +++++++--- jdbc2/src/examples/TestServer.java | 34 ++++++++++-- jdbc2/src/org/postgis/ComposedGeom.java | 29 +++++++--- jdbc2/src/org/postgis/DriverWrapper.java | 21 ++++++-- jdbc2/src/org/postgis/Geometry.java | 34 ++++++++++-- jdbc2/src/org/postgis/GeometryCollection.java | 29 ++++++++-- jdbc2/src/org/postgis/LineString.java | 29 +++++++++- jdbc2/src/org/postgis/LinearRing.java | 26 +++++++++ jdbc2/src/org/postgis/MultiLineString.java | 26 +++++++++ jdbc2/src/org/postgis/MultiPoint.java | 26 +++++++++ jdbc2/src/org/postgis/MultiPolygon.java | 26 +++++++++ jdbc2/src/org/postgis/PGbox2d.java | 30 ++++++++++- jdbc2/src/org/postgis/PGbox3d.java | 29 +++++++++- jdbc2/src/org/postgis/PGboxbase.java | 37 +++++++++++-- jdbc2/src/org/postgis/PGgeometry.java | 26 +++++++-- jdbc2/src/org/postgis/Point.java | 46 +++++++++++++--- jdbc2/src/org/postgis/PointComposedGeom.java | 20 ++++++- jdbc2/src/org/postgis/Polygon.java | 26 +++++++++ .../src/org/postgis/binary/BinaryParser.java | 20 +++++-- jdbc2/src/org/postgis/binary/ByteGetter.java | 23 ++++++-- jdbc2/src/org/postgis/binary/ValueGetter.java | 26 +++++++-- 26 files changed, 643 insertions(+), 93 deletions(-) diff --git a/jdbc2/Makefile b/jdbc2/Makefile index bc079b591..6ada82f6e 100644 --- a/jdbc2/Makefile +++ b/jdbc2/Makefile @@ -1,3 +1,19 @@ +# PostGIS Makefile + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + JAVAC = javac JAVA = java JAR = jar @@ -47,8 +63,10 @@ all: jar \ offlinetests jar: compile - $(JAR) -cf postgis.jar -C $(BUILD) . -C $(SRCDIR) org/postgresql/postgresql.properties README - $(JAR) -cf postgis_debug.jar -C $(BUILD) . README + $(JAR) -cf postgis.jar -C $(BUILD) . \ + -C $(SRCDIR) org/postgresql/postgresql.properties \ + README COPYING_LGPL -C .. COPYING + $(JAR) -cf postgis_debug.jar -C $(BUILD) . README COPYING_LGPL -C .. COPYING $(JAR) -uf postgis_debug.jar -C $(SRCDIR) . $(BUILD): diff --git a/jdbc2/README b/jdbc2/README index e12bbb40c..f0dc39c2c 100644 --- a/jdbc2/README +++ b/jdbc2/README @@ -50,6 +50,20 @@ PGgeometry.geomFromString() as well as Geometry.toString() to convert between WKT strings and geometry objects. +* Is it free? * + +Yes. The actual Driver extension code is licensed under the GNU LGPL, +this allows everyone to include the code in his projects. You do not +have to pay any license fees, and you can keep your own application +code proprietary, but you have to make the PostGIS source code available +to any receivers, including any modifications you apply to it. For +details, please see the license file COPYING_LGPL. + +The Build files and examples are licensed under GNU GPL, just like the +rest of PostGIS is. This is not LGPL as applications usually do not +link against those. + + * How do I build it? * You need a recent pgjdbc driver jar, see the gborg.postgresql link diff --git a/jdbc2/build.xml b/jdbc2/build.xml index 9fc8ea40c..3d1ea057e 100644 --- a/jdbc2/build.xml +++ b/jdbc2/build.xml @@ -2,7 +2,20 @@ diff --git a/jdbc2/src/examples/Test.java b/jdbc2/src/examples/Test.java index fce567394..009cd1007 100644 --- a/jdbc2/src/examples/Test.java +++ b/jdbc2/src/examples/Test.java @@ -1,3 +1,29 @@ +/* + * Test.java + * + * PostGIS extension for PostgreSQL JDBC driver - example and test classes + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package examples; import org.postgis.LineString; @@ -21,51 +47,51 @@ public class Test { String lr_str = "(10 10 20,34 34 34, 23 19 23 , 10 10 11)"; System.out.println("LinearRing Test:"); - System.out.println("\t"+lr_str); + System.out.println("\t" + lr_str); LinearRing lr = new LinearRing(lr_str); - System.out.println("\t"+lr.toString()); + System.out.println("\t" + lr.toString()); System.out.println(); System.out.println("Point Test:"); - System.out.println("\t"+ptg_str); + System.out.println("\t" + ptg_str); Point ptg = new Point(ptg_str); - System.out.println("\t"+ptg.toString()); + System.out.println("\t" + ptg.toString()); System.out.println(); System.out.println("LineString Test:"); - System.out.println("\t"+lng_str); + System.out.println("\t" + lng_str); LineString lng = new LineString(lng_str); - System.out.println("\t"+lng.toString()); + System.out.println("\t" + lng.toString()); System.out.println(); System.out.println("Polygon Test:"); - System.out.println("\t"+plg_str); + System.out.println("\t" + plg_str); Polygon plg = new Polygon(plg_str); - System.out.println("\t"+plg.toString()); + System.out.println("\t" + plg.toString()); System.out.println(); System.out.println("MultiPolygon Test:"); - System.out.println("\t"+mplg_str); + System.out.println("\t" + mplg_str); MultiPolygon mplg = new MultiPolygon(mplg_str); - System.out.println("\t"+mplg.toString()); + System.out.println("\t" + mplg.toString()); System.out.println(); System.out.println("MultiLineString Test:"); - System.out.println("\t"+mlng_str); + System.out.println("\t" + mlng_str); MultiLineString mlng = new MultiLineString(mlng_str); - System.out.println("\t"+mlng.toString()); + System.out.println("\t" + mlng.toString()); System.out.println(); System.out.println("PG Test:"); - System.out.println("\t"+mlng_str); + System.out.println("\t" + mlng_str); PGgeometry pgf = new PGgeometry(mlng_str); - System.out.println("\t"+pgf.toString()); + System.out.println("\t" + pgf.toString()); System.out.println(); diff --git a/jdbc2/src/examples/TestBoxes.java b/jdbc2/src/examples/TestBoxes.java index 1f8755764..7893643e5 100644 --- a/jdbc2/src/examples/TestBoxes.java +++ b/jdbc2/src/examples/TestBoxes.java @@ -1,11 +1,26 @@ /* - * Test client and server side Parsing of canonical text representations, as - * well as the PostGisWrapper jdbc extension. - * - * (C) 2005 Markus Schaber, logi-track ag, Zürich, Switzerland - * - * This file is licensed under the GNU GPL. *** put full notice here *** - * + * Test.java + * + * PostGIS extension for PostgreSQL JDBC driver - example and test classes + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * * $Id$ */ @@ -121,16 +136,16 @@ public class TestBoxes { /** * Connect to the databases - * + * * We use DriverWrapper here. For alternatives, see the DriverWrapper * Javadoc - * + * * @param dbuser - * + * * @throws ClassNotFoundException - * + * * @see org.postgis.DriverWrapper - * + * */ public static Connection connect(String url, String dbuser, String dbpass) throws SQLException, ClassNotFoundException { diff --git a/jdbc2/src/examples/TestParser.java b/jdbc2/src/examples/TestParser.java index 497534c94..3f1bab108 100644 --- a/jdbc2/src/examples/TestParser.java +++ b/jdbc2/src/examples/TestParser.java @@ -1,10 +1,25 @@ /* - * Test client and server side Parsing of canonical text representations, as - * well as the PostGisWrapper jdbc extension. + * Test.java * - * (C) 2005 Markus Schaber, logi-track ag, Zürich, Switzerland + * PostGIS extension for PostgreSQL JDBC driver - example and test classes * - * This file is licensed under the GNU GPL. *** put full notice here *** + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. * * $Id$ */ @@ -187,8 +202,8 @@ public class TestParser { for (int i = 0; i < conns.length; i++) { conns[i].close(); } - + //System.out.println("Finished."); - System.out.println("Finished, " + failcount + " tests failed!"); + System.out.println("Finished, " + failcount + " tests failed!"); } -} +} \ No newline at end of file diff --git a/jdbc2/src/examples/TestServer.java b/jdbc2/src/examples/TestServer.java index 3d59a65f9..cef15ba33 100644 --- a/jdbc2/src/examples/TestServer.java +++ b/jdbc2/src/examples/TestServer.java @@ -1,3 +1,29 @@ +/* + * Test.java + * + * PostGIS extension for PostgreSQL JDBC driver - example and test classes + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package examples; import java.sql.Connection; @@ -16,13 +42,13 @@ public class TestServer { System.err.println("tablename is 'jdbc_test' by default."); System.exit(1); } - + Connection conn; - String dburl = args[0]; + String dburl = args[0]; String dbuser = args[1]; String dbpass = args[2]; - + String dbtable = "jdbc_test"; String dropSQL = "drop table " + dbtable; @@ -45,7 +71,7 @@ public class TestServer { try { s.execute(dropSQL); } catch (Exception e) { - System.out.println("Error dropping old table: "+e.getMessage()); + System.out.println("Error dropping old table: " + e.getMessage()); } s.execute(createSQL); System.out.println("Inserting point..."); diff --git a/jdbc2/src/org/postgis/ComposedGeom.java b/jdbc2/src/org/postgis/ComposedGeom.java index d85b312c7..b3e10b00b 100644 --- a/jdbc2/src/org/postgis/ComposedGeom.java +++ b/jdbc2/src/org/postgis/ComposedGeom.java @@ -1,12 +1,29 @@ /* * ComposedGeom.java * - * (C) 15.01.2005 Markus Schaber, Logi-Track ag, CH 8001 Zuerich + * PostGIS extension for PostgreSQL JDBC driver - geometry model * - * This file is licensed under GNU GPL. + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. * * $Id$ */ + package org.postgis; import java.util.Iterator; @@ -45,10 +62,10 @@ public abstract class ComposedGeom extends Geometry { protected ComposedGeom(int type, Geometry[] geoms) { this(type); this.subgeoms = geoms; - if (geoms.length>0) { - dimension = geoms[0].dimension; + if (geoms.length > 0) { + dimension = geoms[0].dimension; } else { - dimension=0; + dimension = 0; } } @@ -145,7 +162,7 @@ public abstract class ComposedGeom extends Geometry { innerWKT(sb); sb.append(')'); } - } + } protected void innerWKT(StringBuffer sb) { subgeoms[0].mediumWKT(sb); diff --git a/jdbc2/src/org/postgis/DriverWrapper.java b/jdbc2/src/org/postgis/DriverWrapper.java index ee95fa845..e0e997ec6 100644 --- a/jdbc2/src/org/postgis/DriverWrapper.java +++ b/jdbc2/src/org/postgis/DriverWrapper.java @@ -1,12 +1,27 @@ /* * DriverWrapper.java * - * $Id$ + * PostGIS extension for PostgreSQL JDBC driver - Wrapper utility class + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. * - * (C) 2004 Markus Schaber, logi-track ag, Zürich, Switzerland + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. * - * This file currently is beta test code and licensed under the GNU LGPL. + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ */ + package org.postgis; import org.postgresql.Driver; diff --git a/jdbc2/src/org/postgis/Geometry.java b/jdbc2/src/org/postgis/Geometry.java index 3e559de36..4f1bc0a78 100644 --- a/jdbc2/src/org/postgis/Geometry.java +++ b/jdbc2/src/org/postgis/Geometry.java @@ -1,4 +1,28 @@ -package org.postgis; +/* + * Geometry.java + * + * PostGIS extension for PostgreSQL JDBC driver - geometry model + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */package org.postgis; import java.io.Serializable; @@ -218,13 +242,16 @@ public abstract class Geometry implements Serializable { mediumWKT(sb); } - /** Render the WKT without the type name, but including the brackets into the StringBuffer*/ + /** + * Render the WKT without the type name, but including the brackets into the + * StringBuffer + */ protected void mediumWKT(StringBuffer sb) { sb.append('('); innerWKT(sb); sb.append(')'); } - + /** * Render the "inner" part of the WKT (inside the brackets) into the * StringBuffer. @@ -240,5 +267,4 @@ public abstract class Geometry implements Serializable { return sb.toString(); } - } \ No newline at end of file diff --git a/jdbc2/src/org/postgis/GeometryCollection.java b/jdbc2/src/org/postgis/GeometryCollection.java index 7073dd260..f40bca9a5 100644 --- a/jdbc2/src/org/postgis/GeometryCollection.java +++ b/jdbc2/src/org/postgis/GeometryCollection.java @@ -1,12 +1,30 @@ /* * GeometryCollection.java * - * $Id$ + * PostGIS extension for PostgreSQL JDBC driver - geometry model + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. * - * (C) 2004 Markus Schaber, logi-track ag, Zürich, Switzerland + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. * - * This file currently is beta test code and licensed under the GNU GPL. - */package org.postgis; + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + +package org.postgis; import org.postgresql.util.PGtokenizer; @@ -39,7 +57,8 @@ public class GeometryCollection extends ComposedGeom { if (value.equals(EmptyColl)) { //Do nothing } else if (value.startsWith(GeoCollID)) { - PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(value.substring(GeoCollID.length()).trim()), ','); + PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(value.substring( + GeoCollID.length()).trim()), ','); int ngeoms = t.getSize(); subgeoms = new Geometry[ngeoms]; for (int p = 0; p < ngeoms; p++) { diff --git a/jdbc2/src/org/postgis/LineString.java b/jdbc2/src/org/postgis/LineString.java index fff8ff07d..c79889232 100644 --- a/jdbc2/src/org/postgis/LineString.java +++ b/jdbc2/src/org/postgis/LineString.java @@ -1,3 +1,29 @@ +/* + * LineString.java + * + * PostGIS extension for PostgreSQL JDBC driver - geometry model + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package org.postgis; import java.sql.SQLException; @@ -33,7 +59,8 @@ public class LineString extends PointComposedGeom { Point[] points = this.getPoints(); Point[] opoints = other.getPoints(); - boolean cutPoint = this.getLastPoint() == null || this.getLastPoint().equals(other.getFirstPoint()); + boolean cutPoint = this.getLastPoint() == null + || this.getLastPoint().equals(other.getFirstPoint()); int count = points.length + points.length - (cutPoint ? 1 : 0); Point[] p = new Point[count]; diff --git a/jdbc2/src/org/postgis/LinearRing.java b/jdbc2/src/org/postgis/LinearRing.java index b0fde3997..c47032e83 100644 --- a/jdbc2/src/org/postgis/LinearRing.java +++ b/jdbc2/src/org/postgis/LinearRing.java @@ -1,3 +1,29 @@ +/* + * LinearRing.java + * + * PostGIS extension for PostgreSQL JDBC driver - geometry model + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package org.postgis; import org.postgresql.util.PGtokenizer; diff --git a/jdbc2/src/org/postgis/MultiLineString.java b/jdbc2/src/org/postgis/MultiLineString.java index ca1caef57..db7c9fde5 100644 --- a/jdbc2/src/org/postgis/MultiLineString.java +++ b/jdbc2/src/org/postgis/MultiLineString.java @@ -1,3 +1,29 @@ +/* + * MultiLineString.java + * + * PostGIS extension for PostgreSQL JDBC driver - geometry model + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package org.postgis; import org.postgresql.util.PGtokenizer; diff --git a/jdbc2/src/org/postgis/MultiPoint.java b/jdbc2/src/org/postgis/MultiPoint.java index 51ea26f25..e70bbe617 100644 --- a/jdbc2/src/org/postgis/MultiPoint.java +++ b/jdbc2/src/org/postgis/MultiPoint.java @@ -1,3 +1,29 @@ +/* + * MultiPoint.java + * + * PostGIS extension for PostgreSQL JDBC driver - geometry model + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package org.postgis; import java.sql.SQLException; diff --git a/jdbc2/src/org/postgis/MultiPolygon.java b/jdbc2/src/org/postgis/MultiPolygon.java index f7cb40e7c..39fc5c826 100644 --- a/jdbc2/src/org/postgis/MultiPolygon.java +++ b/jdbc2/src/org/postgis/MultiPolygon.java @@ -1,3 +1,29 @@ +/* + * MultiPolygon.java + * + * PostGIS extension for PostgreSQL JDBC driver - geometry model + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package org.postgis; import org.postgresql.util.PGtokenizer; diff --git a/jdbc2/src/org/postgis/PGbox2d.java b/jdbc2/src/org/postgis/PGbox2d.java index be3b71494..22fd32b07 100644 --- a/jdbc2/src/org/postgis/PGbox2d.java +++ b/jdbc2/src/org/postgis/PGbox2d.java @@ -1,3 +1,29 @@ +/* + * PGbox2d.java + * + * PostGIS extension for PostgreSQL JDBC driver - bounding box model + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package org.postgis; import java.sql.SQLException; @@ -19,7 +45,7 @@ public class PGbox2d extends PGboxbase { public void setValue(String value) throws SQLException { super.setValue(value); - if (llb.dimension!=2 || urt.dimension!=2) { + if (llb.dimension != 2 || urt.dimension != 2) { throw new SQLException("PGbox2d is only allowed to have 2 dimensions!"); } } @@ -35,4 +61,4 @@ public class PGbox2d extends PGboxbase { protected PGboxbase newInstance() { return new PGbox2d(); } -} +} \ No newline at end of file diff --git a/jdbc2/src/org/postgis/PGbox3d.java b/jdbc2/src/org/postgis/PGbox3d.java index 70141fd7a..61642d2e5 100644 --- a/jdbc2/src/org/postgis/PGbox3d.java +++ b/jdbc2/src/org/postgis/PGbox3d.java @@ -1,3 +1,30 @@ +/* + * PGbox3d.java + * + * PostGIS extension for PostgreSQL JDBC driver - bounding box model + * + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package org.postgis; import java.sql.SQLException; @@ -26,4 +53,4 @@ public class PGbox3d extends PGboxbase { protected PGboxbase newInstance() { return new PGbox3d(); } -} +} \ No newline at end of file diff --git a/jdbc2/src/org/postgis/PGboxbase.java b/jdbc2/src/org/postgis/PGboxbase.java index 3b31bf9f6..0c2c8a6ff 100644 --- a/jdbc2/src/org/postgis/PGboxbase.java +++ b/jdbc2/src/org/postgis/PGboxbase.java @@ -1,3 +1,30 @@ +/* + * PGboxbase.java + * + * PostGIS extension for PostgreSQL JDBC driver - bounding box model + * + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package org.postgis; import org.postgresql.util.PGobject; @@ -24,10 +51,10 @@ public abstract class PGboxbase extends PGobject { /** * The Prefix we have in WKT rep. - * + * * I use an abstract method here so we do not need to replicate the String * object in every instance. - * + * */ public abstract String getPrefix(); @@ -114,10 +141,10 @@ public abstract class PGboxbase extends PGobject { /** * Compare two coordinates with lazy dimension checking. - * + * * As the Server always returns Box3D with three dimensions, z==0 equals * dimensions==2 - * + * */ protected static boolean compareLazyDim(Point first, Point second) { return first.x == second.x @@ -141,4 +168,4 @@ public abstract class PGboxbase extends PGobject { * callers in a sane way. */ protected abstract PGboxbase newInstance(); -} +} \ No newline at end of file diff --git a/jdbc2/src/org/postgis/PGgeometry.java b/jdbc2/src/org/postgis/PGgeometry.java index 71a003ee6..f1120a9c0 100644 --- a/jdbc2/src/org/postgis/PGgeometry.java +++ b/jdbc2/src/org/postgis/PGgeometry.java @@ -1,11 +1,27 @@ /* - * PG Geometry + * PGgeometry.java * - * Updates Oct 2002 - setValue() method now cheaks if the geometry has a SRID. - * If present, it is removed and only the wkt is used to create the new geometry + * PostGIS extension for PostgreSQL JDBC driver - PGobject Geometry Wrapper * - * Jan 2005 Add parsing of new canonical text representation which basically is - * a hex-encoded extended OGC WKB + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ */ package org.postgis; diff --git a/jdbc2/src/org/postgis/Point.java b/jdbc2/src/org/postgis/Point.java index d0f5c1a7e..f47cbc2db 100644 --- a/jdbc2/src/org/postgis/Point.java +++ b/jdbc2/src/org/postgis/Point.java @@ -1,3 +1,29 @@ +/* + * Test.java + * + * PostGIS extension for PostgreSQL JDBC driver - geometry model + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package org.postgis; import org.postgresql.util.PGtokenizer; @@ -6,8 +32,8 @@ import java.sql.SQLException; public class Point extends Geometry { - public static final boolean CUTINTS=true; - + public static final boolean CUTINTS = true; + public int hashCode() { return super.hashCode() ^ hashCode(x) ^ hashCode(y) ^ hashCode(z) ^ hashCode(m); } @@ -111,25 +137,29 @@ public class Point extends Geometry { public void innerWKT(StringBuffer sb) { sb.append(x); - if (CUTINTS) cutint(sb); + if (CUTINTS) + cutint(sb); sb.append(' '); sb.append(y); - if (CUTINTS) cutint(sb); + if (CUTINTS) + cutint(sb); if (dimension == 3) { sb.append(' '); sb.append(z); - if (CUTINTS) cutint(sb); + if (CUTINTS) + cutint(sb); } if (haveMeasure) { sb.append(' '); sb.append(m); - if (CUTINTS) cutint(sb); + if (CUTINTS) + cutint(sb); } } private static void cutint(StringBuffer sb) { - int l = sb.length()-2; - if ((sb.charAt(l+1)=='0')&&(sb.charAt(l)=='.')) { + int l = sb.length() - 2; + if ((sb.charAt(l + 1) == '0') && (sb.charAt(l) == '.')) { sb.setLength(l); } } diff --git a/jdbc2/src/org/postgis/PointComposedGeom.java b/jdbc2/src/org/postgis/PointComposedGeom.java index d89d4e9dc..9474be3d6 100644 --- a/jdbc2/src/org/postgis/PointComposedGeom.java +++ b/jdbc2/src/org/postgis/PointComposedGeom.java @@ -1,9 +1,25 @@ /* * ComposedGeom.java * - * (C) 15.01.2005 Markus Schaber, Logi-Track ag, CH 8001 Zuerich + * PostGIS extension for PostgreSQL JDBC driver - geometry model * - * This file is licensed under GNU GPL. + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. * * $Id$ */ diff --git a/jdbc2/src/org/postgis/Polygon.java b/jdbc2/src/org/postgis/Polygon.java index ce3ab79f7..cef88dcec 100644 --- a/jdbc2/src/org/postgis/Polygon.java +++ b/jdbc2/src/org/postgis/Polygon.java @@ -1,3 +1,29 @@ +/* + * Polygon.java + * + * PostGIS extension for PostgreSQL JDBC driver - geometry model + * + * (C) 2004 Paul Ramsey, pramsey@refractions.net + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. + * + * $Id$ + */ + package org.postgis; import org.postgresql.util.PGtokenizer; diff --git a/jdbc2/src/org/postgis/binary/BinaryParser.java b/jdbc2/src/org/postgis/binary/BinaryParser.java index 3d78a7c24..d91822103 100644 --- a/jdbc2/src/org/postgis/binary/BinaryParser.java +++ b/jdbc2/src/org/postgis/binary/BinaryParser.java @@ -1,9 +1,23 @@ /* - * BinReader.java + * BinaryParser.java * - * (C) 14.01.2005 Markus Schaber, Logi-Track ag, CH 8001 Zuerich + * PostGIS extension for PostgreSQL JDBC driver - Binary Parser * - * This File is Licensed under the GNU GPL. + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. * * $Id$ */ diff --git a/jdbc2/src/org/postgis/binary/ByteGetter.java b/jdbc2/src/org/postgis/binary/ByteGetter.java index 9e6a39219..7b612218e 100644 --- a/jdbc2/src/org/postgis/binary/ByteGetter.java +++ b/jdbc2/src/org/postgis/binary/ByteGetter.java @@ -1,10 +1,27 @@ /* * ByteGetter.java * - * (C) 15.01.2005 Markus Schaber, Logi-Track ag, CH 8001 Zuerich + * PostGIS extension for PostgreSQL JDBC driver - Binary Parser + * + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. * * $Id$ */ + package org.postgis.binary; public abstract class ByteGetter { @@ -46,9 +63,9 @@ public abstract class ByteGetter { if (c >= '0' && c <= '9') { return (byte) (c - '0'); } else if (c >= 'A' && c <= 'F') { - return (byte) (c - 'A'+10); + return (byte) (c - 'A' + 10); } else if (c >= 'a' && c <= 'f') { - return (byte) (c - 'a'+10); + return (byte) (c - 'a' + 10); } else { throw new IllegalArgumentException("No valid Hex char " + c); } diff --git a/jdbc2/src/org/postgis/binary/ValueGetter.java b/jdbc2/src/org/postgis/binary/ValueGetter.java index ee497e1d5..eacde4369 100644 --- a/jdbc2/src/org/postgis/binary/ValueGetter.java +++ b/jdbc2/src/org/postgis/binary/ValueGetter.java @@ -1,12 +1,27 @@ /* * ValueGetter.java * - * Currently, this is not thread safe! + * PostGIS extension for PostgreSQL JDBC driver - Binary Parser * - * (C) 15.01.2005 Markus Schaber, Logi-Track ag, CH 8001 Zuerich + * (C) 2005 Markus Schaber, schabios@logi-track.com + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation, either version 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit the web at + * http://www.gnu.org. * * $Id$ */ + package org.postgis.binary; public abstract class ValueGetter { @@ -63,8 +78,8 @@ public abstract class ValueGetter { } protected int getInt(int index) { - return (data.get(index) << 24) + (data.get(index + 1) << 16) + (data.get(index + 2) << 8) - + data.get(index + 3); + return (data.get(index) << 24) + (data.get(index + 1) << 16) + + (data.get(index + 2) << 8) + data.get(index + 3); } protected long getLong(int index) { @@ -83,7 +98,8 @@ public abstract class ValueGetter { } protected int getInt(int index) { - return (data.get(index + 3) << 24) + (data.get(index + 2) << 16) + (data.get(index + 1) << 8) + data.get(index); + return (data.get(index + 3) << 24) + (data.get(index + 2) << 16) + + (data.get(index + 1) << 8) + data.get(index); } protected long getLong(int index) { -- 2.40.0