Changeset 83:6f653aacd449
 Timestamp:
 03/30/12 16:00:13 (6 years ago)
 Branch:
 default
 Location:
 evaluation/src/main/java/org/openrdf/query/algebra/evaluation
 Files:

 1 added
 1 edited
Legend:
 Unmodified
 Added
 Removed

evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java
r55 r83 1 1 package org.openrdf.query.algebra.evaluation.function.spatial; 2 2 import java.util.ArrayList; 3 4 import org.geotools.geometry.jts.JTS; 5 import org.geotools.referencing.CRS; 6 import org.opengis.geometry.MismatchedDimensionException; 7 import org.opengis.referencing.FactoryException; 8 import org.opengis.referencing.crs.CoordinateReferenceSystem; 9 import org.opengis.referencing.operation.MathTransform; 10 import org.opengis.referencing.operation.TransformException; 11 import org.openrdf.model.URI; 12 import org.openrdf.model.Value; 13 import org.openrdf.query.algebra.evaluation.util.JTSWrapper; 3 14 4 15 import com.vividsolutions.jts.geom.Coordinate; … … 16 27 import com.vividsolutions.jts.geom.impl.CoordinateArraySequence; 17 28 import com.vividsolutions.jts.io.ParseException; 18 import com.vividsolutions.jts.io.WKBReader;19 import com.vividsolutions.jts.io.WKBWriter;20 import com.vividsolutions.jts.io.WKTReader;21 import com.vividsolutions.jts.io.WKTWriter;22 23 import org.geotools.geometry.jts.JTS;24 import org.geotools.referencing.CRS;25 import org.opengis.geometry.MismatchedDimensionException;26 import org.opengis.referencing.FactoryException;27 import org.opengis.referencing.NoSuchAuthorityCodeException;28 import org.opengis.referencing.crs.CoordinateReferenceSystem;29 import org.opengis.referencing.operation.MathTransform;30 import org.opengis.referencing.operation.TransformException;31 import org.openrdf.model.URI;32 import org.openrdf.model.Value;33 29 34 30 public class StrabonPolyhedron implements Value { 35 31 32 33 private static final long serialVersionUID = 894529468109904724L; 34 36 35 public static String CACHEPATH = ""; 37 36 public static String TABLE_COUNTS = "counts.bin"; … … 133 132 private static int MAX_POINTS = Integer.MAX_VALUE;//40000;//Integer.MAX_VALUE;//10000; 134 133 134 /** 135 * Get JTS singleton instance. 136 */ 137 private static JTSWrapper jts = JTSWrapper.getInstance(); 138 135 139 private Geometry geometry; 136 140 … … 148 152 149 153 public static StrabonPolyhedron ConstructFromWKB(byte[] byteArray) throws Exception { 150 return new StrabonPolyhedron( new WKBReader().read(byteArray));154 return new StrabonPolyhedron(jts.WKBread((byteArray))); 151 155 } 152 156 … … 185 189 //public StrabonPolyhedron(int partitionAlgorithmIgnored, String constraints) throws Exception { 186 190 // Polyhedron poly = new Polyhedron(constraints); 187 // this.geometry = new WKTReader().read(poly.toWKT());191 // this.geometry = jts.WKTread(poly.toWKT()); 188 192 //} 189 193 … … 635 639 geometry.startsWith("MULTIPOLYGON")  636 640 geometry.startsWith("GEOMETRYCOLLECTION")) { 637 Geometry geo = new WKTReader().read(geometry);641 Geometry geo = jts.WKTread(geometry); 638 642 this.geometry = new StrabonPolyhedron(geo).geometry; 639 643 //Default … … 642 646 //Polyhedron polyhedron = new Polyhedron(geometry); 643 647 //String polyhedronWKT = polyhedron.toWKT(); 644 //WKTReader reader = new WKTReader(); 645 //Geometry geo = reader.read(polyhedronWKT); 648 //Geometry geo = jts.WKTread(polyhedronWKT); 646 649 // 647 650 //if (!EnableConstraintRepresentation) { … … 652 655 653 656 public StrabonPolyhedron(String WKT, int algorithm) throws Exception { 654 Geometry geo = new WKTReader().read(WKT); 657 System.out.println(" new StrabonPolyhedron: before WKTReader"); 658 Geometry geo = jts.WKTread(WKT); 659 System.out.println(" new StrabonPolyhedron: after WKTReader"); 655 660 this.geometry = new StrabonPolyhedron(geo, algorithm).geometry; 656 661 } 657 662 658 663 public StrabonPolyhedron(String WKT, int algorithm, int maxPoints) throws Exception { 659 Geometry geo = new WKTReader().read(WKT);664 Geometry geo = jts.WKTread(WKT); 660 665 this.geometry = new StrabonPolyhedron(geo, algorithm).geometry; 661 666 } … … 663 668 public StrabonPolyhedron(byte[] byteArray) throws ParseException { 664 669 665 this.geometry = new WKBReader().read(byteArray);670 this.geometry = jts.WKBread(byteArray); 666 671 // System.out.println(geometry.toString()+" "+geometry.getSRID()); 667 672 } … … 669 674 public StrabonPolyhedron(byte[] byteArray, int srid) throws ParseException { 670 675 671 this.geometry = new WKBReader().read(byteArray);676 this.geometry = jts.WKBread(byteArray); 672 677 this.geometry.setSRID(srid); 673 678 } … … 696 701 697 702 public byte[] toWKB() { 698 WKBWriter writer = new WKBWriter(); 699 return writer.write(this.geometry); 703 return jts.WKBwrite(this.geometry); 700 704 } 701 705 702 706 public String toWKT() { 703 WKTWriter writer = new WKTWriter(); 704 return writer.write(this.geometry); 707 return jts.WKTwrite(this.geometry); 705 708 } 706 709 707 710 public byte[] toByteArray() { 708 return new WKBWriter().write(this.geometry);711 return jts.WKBwrite(this.geometry); 709 712 } 710 713 … … 940 943 941 944 start = System.nanoTime(); 942 Geometry geo = new WKTReader().read(WKT);945 Geometry geo = jts.WKTread(WKT); 943 946 geo.isValid(); 944 947 geo.isSimple();
Note: See TracChangeset
for help on using the changeset viewer.