Strabon

changeset 609:9a3bfee64a39

Ticket #10
Handles more geometric types (other that polygons)
author Kostis Kyzirakos <kkyzir@di.uoa.gr>
date Fri Sep 28 21:57:34 2012 +0300 (2012-09-28)
parents 0223607ec93f
children 1be8836acc03 0332207eb9ea
files resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java
line diff
     1.1 --- a/resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java	Fri Sep 28 21:23:29 2012 +0300
     1.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java	Fri Sep 28 21:57:34 2012 +0300
     1.3 @@ -46,7 +46,7 @@
     1.4  /**
     1.5   * @author Manos Karpathiotakis <mk@di.uoa.gr>
     1.6   * @author Charalampos Nikolaou <charnik@di.uoa.gr>
     1.7 - * @authro Panayiotis Smeros <psmeros@di.uoa.gr>
     1.8 + * @author Panayiotis Smeros <psmeros@di.uoa.gr>
     1.9   *
    1.10   */
    1.11  public class stSPARQLResultsKMLWriter implements TupleQueryResultWriter
    1.12 @@ -379,7 +379,6 @@
    1.13  				
    1.14  			} else if (geom instanceof GeometryCollection) {
    1.15  				geometryType = KML.MultiGeometry;
    1.16 -				
    1.17  			}
    1.18  			
    1.19  			if (geometryType == null) {
    1.20 @@ -390,7 +389,24 @@
    1.21  				polygon = baos.toString().substring(38).replaceAll(" xmlns:kml=\"http://earth.google.com/kml/2.1\"", "").replaceAll("kml:", "");
    1.22  				
    1.23  				// get the polygon from the kml
    1.24 -				polygon = polygon.substring(polygon.indexOf("<Polygon>"), polygon.indexOf("</Polygon>")+10);
    1.25 +				//FIXME: test
    1.26 +				//polygon = polygon.substring(polygon.indexOf("<Polygon>"), polygon.indexOf("</Polygon>")+10);
    1.27 +				if (geom instanceof Point) {
    1.28 +					polygon = polygon.substring(polygon.indexOf("<Point>"), polygon.indexOf("</Point>")+8);
    1.29 +				} else if (geom instanceof Polygon) {
    1.30 +					polygon = polygon.substring(polygon.indexOf("<Polygon>"), polygon.indexOf("</Polygon>")+10);
    1.31 +				} else if (geom instanceof LineString) {
    1.32 +					polygon = polygon.substring(polygon.indexOf("<LineString>"), polygon.indexOf("</LineString>")+13);
    1.33 +				} else if (geom instanceof MultiPoint) {
    1.34 +					polygon = polygon.substring(polygon.indexOf("<MultiPoint>"), polygon.indexOf("</MultiPoint>")+13);
    1.35 +				} else if (geom instanceof MultiLineString) {
    1.36 +					polygon = polygon.substring(polygon.indexOf("<MultiLineString>"), polygon.indexOf("</MultiLineString>")+18);
    1.37 +				} else if (geom instanceof MultiPolygon) {
    1.38 +					polygon = polygon.substring(polygon.indexOf("<MultiPolygon>"), polygon.indexOf("</MultiPolygon>")+15);
    1.39 +				} else if (geom instanceof GeometryCollection) {
    1.40 +					polygon = polygon.substring(polygon.indexOf("<GeometryCollection>"), polygon.indexOf("</GeometryCollection>")+21);
    1.41 +				}
    1.42 +				//FIXME: test end 
    1.43  				baos.reset();
    1.44  			}
    1.45  		} catch (ParseException e) {