/* * GeometryMetadata.java * * Created on January 24, 2001, 10:16 AM */ package uk.ac.leeds.ccg.sfsql; import java.sql.*; /** * * @author jamesm * @version */ public class GeometryMetadata extends java.lang.Object { private final static boolean DEBUG=true; public static final int GEOMETRY=0,POINT=1,CURVE=2,LINESTRING=3,SURFACE=4; public static final int POLYGON=5,COLLECTION=6,MULTIPOINT=7,MULTICURVE=8; public static final int MULTILINESTRING=9,MULTISURFACE=10,MULTIPOLYGON=11; String featureTableCatalog,featureTableSchema,featureTableName,featureGeometeryColumn; String geometryTableCatalog,geometryTableName; boolean isBinary; int geometryType; int coordDimension; int maxPointsPerRow; SpatialReferenceSystem srs; Connection c; /** Creates new GeometryMetadata */ public GeometryMetadata(Connection c,String fTableCatalog,String fTableSchema,String fTableName,String fGeometryColumn, String gTableCatalog, String gTableScheme, String gTableName, boolean isBinary, int type,int dimensions, int maxPPR, int srid ) { if(DEBUG)System.out.println("---->uk.ac.leeds.ccg.sfsql.GeometryMetadata constructed. Will identify itself as GMe->"); this.featureTableCatalog = fTableCatalog; this.featureTableName = fTableName; this.featureTableSchema = fTableSchema; this.featureGeometeryColumn = fGeometryColumn; this.geometryType = type; this.geometryTableCatalog = gTableCatalog; this.isBinary = isBinary; if(DEBUG)System.out.println("GMe->Storage is binary "+isBinary); this.geometryTableName = gTableName; this.c = c; } public int[] getIds() throws SQLException { Statement stmt = c.createStatement(); String pre = "SELECT COUNT(*) from "+geometryTableName; ResultSet count = stmt.executeQuery(pre); count.next(); int size = count.getInt(1); String query = "SELECT DISTINCT GID from "+geometryTableName; if(DEBUG)System.out.println("GMe->Query is "+query); ResultSet res = stmt.executeQuery(query); if(DEBUG)System.out.println("GMe->Size "+size); int ids[] = new int[size]; for(int i=0;i