Strabon

changeset 390:c10fc476477b

removed the implementation of GMLread through GMLReader and used the initial implementation by Constans. She knows better!
author Babis Nikolaou <charnik@di.uoa.gr>
date Wed Jun 27 22:54:19 2012 +0300 (2012-06-27)
parents 578b40921312
children 4d62506caa02
files evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java
line diff
     1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java	Wed Jun 27 22:28:49 2012 +0300
     1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java	Wed Jun 27 22:54:19 2012 +0300
     1.3 @@ -20,6 +20,8 @@
     1.4  import org.xml.sax.SAXException;
     1.5  
     1.6  import com.vividsolutions.jts.geom.Geometry;
     1.7 +import com.vividsolutions.jts.geom.GeometryFactory;
     1.8 +import com.vividsolutions.jts.geom.PrecisionModel;
     1.9  import com.vividsolutions.jts.io.gml2.GMLReader;
    1.10  import com.vividsolutions.jts.io.ParseException;
    1.11  import com.vividsolutions.jts.io.WKBReader;
    1.12 @@ -63,12 +65,6 @@
    1.13  	 */
    1.14  	private WKBWriter wkbw;
    1.15  	
    1.16 -	/**
    1.17 -	 * Reader for GML
    1.18 -	 */
    1.19 -	private GMLReader gmlr;
    1.20 -	
    1.21 -	
    1.22  	private JTSWrapper() {
    1.23  		// use a private constructor to force call of getInstance method and forbid subclassing
    1.24  		wktr = new WKTReader();
    1.25 @@ -76,7 +72,6 @@
    1.26  		wkbr = new WKBReader();
    1.27  		wkbw = new WKBWriter(); // PostGIS
    1.28  //		wkbw = new WKBWriter(2, WKBConstants.wkbXDR); // MonetDB
    1.29 -		gmlr = new GMLReader();
    1.30  	}
    1.31  	
    1.32  	public static synchronized JTSWrapper getInstance() {
    1.33 @@ -150,40 +145,26 @@
    1.34  		}
    1.35  		
    1.36  		return output;
    1.37 -	}
    1.38 +	}		
    1.39  	
    1.40  	/**
    1.41  	 * Parses and returns a {@link Geometry} object constructed from the given GML representation.
    1.42  	 * 
    1.43 -	 * @param gml
    1.44 -	 * @return
    1.45 -	 * @throws ParserConfigurationException 
    1.46 -	 * @throws IOException 
    1.47 -	 * @throws SAXException 
    1.48 -	 */
    1.49 -	public Geometry GMLread(String gml) throws SAXException, IOException, ParserConfigurationException {
    1.50 -			return gmlr.read(gml, null);
    1.51 -	}
    1.52 -		
    1.53 -	
    1.54 -	/**
    1.55 -	 * Parses and returns a {@link Geometry} object constructed from the given GML representation.
    1.56 -	 * 
    1.57 -	 * Why not use the class {@link GMLReader} that does the job and need to load on our own
    1.58 -	 * the XML parser of JTS?
    1.59 +	 * We do not use class {@link GMLReader} that does the job transparently (i.e. we wouldn't 
    1.60 +	 * need to load the XML parser of JTS on our own), since in such a case we are enforced to 
    1.61 +	 * mention a specific SRID, otherwise the #getSRID() function returns a value of 0. Doing 
    1.62 +	 * it the hard way, the SRID field is filled with the SRID that is present in the GML 
    1.63 +	 * representation. 
    1.64  	 * 
    1.65  	 * @param gml
    1.66  	 * @return
    1.67  	 * @throws JAXBException
    1.68  	 */
    1.69 -	@Deprecated
    1.70 -	private static Geometry GMLReader(String gml) throws JAXBException {
    1.71 +	public Geometry GMLread(String gml) throws JAXBException {
    1.72          StringReader reader = new StringReader(gml);
    1.73  		
    1.74          JAXBContext context = JAXBContext.newInstance("org.jvnet.ogc.gml.v_3_1_1.jts");	
    1.75 -		
    1.76          Unmarshaller unmarshaller = context.createUnmarshaller();
    1.77 -		
    1.78          Geometry geometry = (Geometry) unmarshaller.unmarshal(reader);
    1.79  		
    1.80  		reader.close();