Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.MultiLineString


   * @param o The <code>MultiLineString</code> to be encoded.
   */
  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    document.writeElement("vml:shape", asChild);
    document.writeAttributeStart("path");
    MultiLineString ml = (MultiLineString) o;
    for (int i = 0; i < ml.getNumGeometries(); i++) {
      document.writePathContent(ml.getGeometryN(i).getCoordinates());
    }
    document.writeAttributeEnd();
  }
View Full Code Here


  }

  @Test
  public void dtoMultiLineStringToJts() throws GeomajasException {
    // Test DTO MultiLineString to JTS:
    MultiLineString multiLineString = (MultiLineString) converter.toInternal(createDtoMultiLineString());
    Assert.assertEquals(dtoC7.getX(), multiLineString.getGeometryN(1).getCoordinates()[2].x);
  }
View Full Code Here

   * @param o The <code>MultiLineString</code> to be encoded.
   */
  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    document.writeElement("path", asChild);
    document.writeAttributeStart("d");
    MultiLineString ml = (MultiLineString) o;
    for (int i = 0; i < ml.getNumGeometries(); i++) {
      document.writePathContent(ml.getGeometryN(i).getCoordinates());
    }
    document.writeAttributeEnd();
  }
View Full Code Here

    MultiPoint multipoint = (MultiPoint) reader.read("MULTIPOINT ((1 1),(2 1))");
    geometry = geoService.transform(multipoint, new ThrowingTransform());
    Assert.assertEquals(MultiPoint.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    MultiLineString multilineString = (MultiLineString) reader.read("MULTILINESTRING ((0 1,1 1),(0 2,2 2))");
    geometry = geoService.transform(multilineString, new ThrowingTransform());
    Assert.assertEquals(MultiLineString.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    MultiPolygon multipolygon = (MultiPolygon) reader.read("MULTIPOLYGON (((0 0,1 1,0 1,0 0)),((0 0,2 2,0 2,0 0)))");
View Full Code Here

    GeometrySerializer ser = new GeometrySerializer();
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] {
        new Coordinate(12.0, 34.23), new Coordinate(12.000, 54.555), new Coordinate(-0.01, -0.0)});
    LineString l = new LineString(coords, factory);
    MultiLineString m = new MultiLineString(new LineString[] {l}, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, m);
    assertEquals("MultiLineString", jo.get("type").toString());
    assertEquals("31300", jo.get("srid").toString());
    assertEquals("2", jo.get("precision").toString());
    JSONArray lineStrings = jo.getJSONArray("lineStrings");
View Full Code Here

      MultiPolygon mpoly = (MultiPolygon) g;
      for (int i = 0; i < mpoly.getNumGeometries(); i++) {
        drawGeometry(mpoly.getGeometryN(i), symbol);
      }
    } else if (g instanceof MultiLineString) {
      MultiLineString mline = (MultiLineString) g;
      for (int i = 0; i < mline.getNumGeometries(); i++) {
        drawGeometry(mline.getGeometryN(i), symbol);
      }
    } else if (g instanceof MultiPoint) {
      MultiPoint mpoint = (MultiPoint) g;
      for (int i = 0; i < mpoint.getNumGeometries(); i++) {
        drawGeometry(mpoint.getGeometryN(i), symbol);
View Full Code Here

  public void testMultiLineString() throws MarshallException, GeomajasException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(10000.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] { new Coordinate(12.0, 34.23),
        new Coordinate(12.000, 54.555), new Coordinate(-0.01, 0.0) });
    LineString l = new LineString(coords, factory);
    MultiLineString m = new MultiLineString(new LineString[] { l }, factory);
    JSONObject jtsJson = (JSONObject) jtsSerializer.marshall(null, m);
    Geometry dto = converter.toDto(m);
    JSONObject dtoJson = (JSONObject) dtoSerializer.marshall(null, dto);
    Assert.assertEquals(jtsJson.toString(), dtoJson.toString());
  }
View Full Code Here

    MultiGenerator pg = new MultiGenerator(pgc);
    pg.setBoundingBox(new Envelope(0,10,0,10));
    pg.setNumberGeometries(3);
    pg.setGeometryFactory(geometryFactory);
   
    MultiLineString pt = (MultiLineString) pg.create();

    GMLWriter out = new GMLWriter();
    out.setPrefix(null);
    out.write(pt,getWriter());
   
    GMLReader in = new GMLReader();
    MultiLineString pt2 = (MultiLineString) in.read(getReader(),geometryFactory);
   
//    System.out.println((pt==null?"NULL":pt.toString()));
//    System.out.println((pt2==null?"NULL":pt2.toString()));
    assertTrue("The input MultiLineString is not the same as the output MultiLineString",pt.equals(pt2));
  }
View Full Code Here

    MultiGenerator pg = new MultiGenerator(pgc);
    pg.setBoundingBox(new Envelope(0,10,0,10));
    pg.setNumberGeometries(3);
    pg.setGeometryFactory(geometryFactory);
   
    MultiLineString pt = (MultiLineString) pg.create();
//    System.out.println((pt==null?"NULL":pt.toString()));


    GMLWriter out = new GMLWriter();
    out.setPrefix(null);
    out.write(pt,getWriter());
   
    GMLReader in = new GMLReader();
    MultiLineString pt2 = (MultiLineString) in.read(getReader(),geometryFactory);

//    System.out.println((pt==null?"NULL":pt.toString()));
//    System.out.println((pt2==null?"NULL":pt2.toString()));
    assertTrue("The input MultiLineString is not the same as the output MultiLineString",pt.equals(pt2));
  }
View Full Code Here

                  {
                    Logger.error("Unexpected geometry type: ", geomType);
                    continue;
                  }
               
                  MultiLineString multiLineString = (MultiLineString)JTS.transform((Geometry)feature.getDefaultGeometry(), transform);
                 
               
                  GisRoute route = new GisRoute();
                   
                    route.gisUpload = gisUpload;
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.MultiLineString

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.