+# 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
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):
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
<!-- ================================================================
postgis ant build.xml
(C) 2004,2005 Markus.Schaber@logi-track.com, logi-track ag, Zürich
- This file is licensed under the GNU GPL.
+
+ This file 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 file 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 file; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$Id$
============================================================ -->
+/*
+ * 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;
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();
/*
- * 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$
*/
/**
* 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 {
/*
- * 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$
*/
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
+/*
+ * 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;
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;
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...");
/*
* 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;
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;
}
}
innerWKT(sb);
sb.append(')');
}
- }
+ }
protected void innerWKT(StringBuffer sb) {
subgeoms[0].mediumWKT(sb);
/*
* 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;
-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;
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.
return sb.toString();
}
-
}
\ No newline at end of file
/*
* 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;
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++) {
+/*
+ * 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;
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];
+/*
+ * 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;
+/*
+ * 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;
+/*
+ * 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;
+/*
+ * 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;
+/*
+ * 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;
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!");
}
}
protected PGboxbase newInstance() {
return new PGbox2d();
}
-}
+}
\ No newline at end of file
+/*
+ * 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;
protected PGboxbase newInstance() {
return new PGbox3d();
}
-}
+}
\ No newline at end of file
+/*
+ * 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;
/**
* 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();
/**
* 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
* callers in a sane way.
*/
protected abstract PGboxbase newInstance();
-}
+}
\ No newline at end of file
/*
- * 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;
+/*
+ * 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;
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);
}
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);
}
}
/*
* 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$
*/
+/*
+ * 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;
/*
- * 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$
*/
/*
* 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 {
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);
}
/*
* 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 {
}
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) {
}
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) {