Package ca.carleton.gcrc.geom

Examples of ca.carleton.gcrc.geom.MultiPolygon


   
    return multiLineString;
  }
 
  private MultiPolygon parseMultiPolygon(BufferedReader br) throws Exception {
    MultiPolygon multiPolygon = new MultiPolygon();
   
    skipWhiteSpaces(br);
    popLeftParen(br);
   
    boolean done = false;
    do {
      skipWhiteSpaces(br);

      Polygon polygon = parsePolygon(br);
      multiPolygon.addPolygon(polygon);

      if( checkForRightParen(br) ) {
        done = true;
      } else {
        popComma(br);
View Full Code Here


      JSONArray polygons = geometryObj.getJSONArray("coordinates");
      if( null == polygons ) {
        throw new Exception("A geometry must contain an array called 'coordinates'");
      }
     
      MultiPolygon multiPolygon = new MultiPolygon();
     
      for(int polyIndex=0,polyEnd=polygons.length(); polyIndex<polyEnd; ++polyIndex){
        JSONArray lineStrings = polygons.getJSONArray(polyIndex);
        Polygon polygon = new Polygon();
       
        for(int lsIndex=0,lsEnd=lineStrings.length(); lsIndex<lsEnd; ++lsIndex){
          JSONArray points = lineStrings.getJSONArray(lsIndex);
          LineString lineString = new LineString();
       
          for(int pointIndex=0,pointEnd=points.length(); pointIndex<pointEnd; ++pointIndex){
            JSONArray coordinates = points.getJSONArray(pointIndex);
            Point point = new Point();
            for(int coordIndex=0,coordEnd=coordinates.length(); coordIndex<coordEnd; ++coordIndex){
              double position = coordinates.getDouble(coordIndex);
              point.addPosition(position);
            }
            lineString.addPoint(point);
          }
         
          polygon.addLinearRing(lineString);
        }
       
        multiPolygon.addPolygon(polygon);
      }
     
      return multiPolygon;
     
    } catch(Exception e) {
View Full Code Here

TOP

Related Classes of ca.carleton.gcrc.geom.MultiPolygon

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.