Package ca.carleton.gcrc.geom

Examples of ca.carleton.gcrc.geom.LineString


    Point point = new Point(positions);
    return point;
  }
 
  private LineString parseLineString(BufferedReader br) throws Exception {
    LineString lineString = new LineString();
   
    skipWhiteSpaces(br);
    popLeftParen(br);
   
    // Accumulate points
    boolean done = false;
    do {
      List<Number> positions = parsePositions(br);
      if( positions.size() < 2 ){
        throw new Exception("A point must have 2 or more positions");
      }

      Point point = new Point(positions);
      lineString.addPoint(point);
     
      if( checkForRightParen(br) ) {
        done = true;
      } else {
        popComma(br);
View Full Code Here


    Polygon polygon = new Polygon();
   
    skipWhiteSpaces(br);
    popLeftParen(br);
   
    LineString ls = parseLineString(br);
    polygon.addLinearRing(ls);
    skipWhiteSpaces(br);
    while( false == checkForRightParen(br) ){
      popComma(br);
     
View Full Code Here

   
    boolean done = false;
    do {
      skipWhiteSpaces(br);

      LineString lineString = parseLineString(br);
      multiLineString.addLineString(lineString);

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

      JSONArray points = geometryObj.getJSONArray("coordinates");
      if( null == points ) {
        throw new Exception("A geometry must contain an array called 'coordinates'");
      }
     
      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);
      }
     
      return lineString;
     
    } catch(Exception e) {
View Full Code Here

     
      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);
      }
     
View Full Code Here

     
      MultiLineString multiLineString = new MultiLineString();
     
      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);
        }
       
        multiLineString.addLineString(lineString);
      }
     
View Full Code Here

        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);
        }
       
View Full Code Here

TOP

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

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.