/**
* Write a Coordinatesequence, part of LinearRing and Linestring, but not
* MultiPoint!
- *
- * @param haveZ
- * @param haveM
*/
private void writeCoordinates(CoordinateSequence seq, int dims, ValueSetter dest) {
for (int i = 0; i < seq.size(); i++) {
/**
* Estimate an Array of "slim" Points (without endianness and type, part of
* LinearRing and Linestring, but not MultiPoint!
- *
- * @param haveZ
- * @param haveM
*/
private int estimatePointArray(int length, Point example) {
// number of points
System.err.println("Connection initialization failed, aborting.");
e.printStackTrace();
System.exit(1);
+ // signal the compiler that code flow ends here:
+ throw new AssertionError();
}
int postgisServerMajor = 0;
} catch (SQLException e) {
System.err.println("Error fetching PostGIS version: " + e.getMessage());
System.err.println("Is PostGIS really installed in the database?");
- // Signal the compiler that code flow ends here.
- System.exit(1);
+ System.exit(1);
+ // signal the compiler that code flow ends here:
+ throw new AssertionError();
}
System.out.println("PostGIS Version: " + postgisServerMajor);
/**
* Write an Array of "slim" Points (without endianness, srid and type, part
* of LinearRing and Linestring, but not MultiPoint!
- *
- * @param haveZ
- * @param haveM
*/
private void writePointArray(Point[] geom, ValueSetter dest) {
// number of points
/**
* Write an Array of "slim" Points (without endianness and type, part of
* LinearRing and Linestring, but not MultiPoint!
- *
- * @param haveZ
- * @param haveM
*/
private int estimatePointArray(Point[] geom) {
// number of points
'org.postgis.pljava.HelloWorld.getSize'
LANGUAGE 'java' IMMUTABLE STRICT;
-CREATE OR REPLACE FUNCTION public.getHex(geometry)
+CREATE OR REPLACE FUNCTION public.getString(geometry)
RETURNS "text" AS
- 'org.postgis.pljava.HelloWorld.getHex'
- LANGUAGE 'java' IMMUTABLE STRICT;
-
- CREATE OR REPLACE FUNCTION public.getPoint()
- RETURNS "geometry" AS
- 'org.postgis.pljava.HelloWorld.getPoint'
+ 'org.postgis.pljava.HelloWorld.getString'
LANGUAGE 'java' IMMUTABLE STRICT;
\ No newline at end of file
public static void test() throws SQLException {
Session a = org.postgresql.pljava.SessionManager.current();
-
+ a.hashCode();
}
}
package org.postgis.pljava;
-import org.postgresql.pljava.example.Point;
-
public class HelloWorld {
public static String helloWorld() {
return "Hello Postgis-World";
}
public static int getSize(PLJGeometry geom) {
- return geom.rep.length();
- }
-
- public static String getHex(PLJGeometry geom) {
- return geom.rep.toString();
- }
-
- public static PLJGeometry getPoint() {
- return new PLJGeometry();
- }
-
- public static int getHash(Point p) {
- return p.hashCode();
+ return geom.geom.getNumPoints();
}
- public static int getHash(PLJGeometry p) {
- return p.hashCode();
+ public static String getString(PLJGeometry geom) {
+ return geom.toString();
}
}