Package chunmap.model.geom

Examples of chunmap.model.geom.Geometry


   * {@link chunmap.model.geom.WktReader#read(java.lang.String)} 的测试方法。
   */
  @Test
  public void testReadPoint() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("POINT(1230.09 234)");
    Geometry g2 = wkt.read(g.toString());
    assertTrue(g2.toString().equals("POINT(1230.09 234.0)"));
  }
View Full Code Here


  }

  @Test
  public void testReadLineString() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("LineString(1230.09 234,334 23)");
    Geometry g2 = wkt.read(g.toString());
    assertTrue(g2.toString().equals("LINESTRING(1230.09 234.0,334.0 23.0)"));
  }
View Full Code Here

  }

  @Test
  public void testReadPolygon() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("POLYGON((10 20,1230.09 234,334 23,10 20)"
        + ",(30 20,45 33,23 10,30 20))");
    Geometry g2 = wkt.read(g.toString());
    assertTrue(g2.toString().equals(
        "POLYGON((10.0 20.0,1230.09 234.0,334.0 23.0,10.0 20.0)"
            + ",(30.0 20.0,45.0 33.0,23.0 10.0,30.0 20.0))"));
  }
View Full Code Here

  }

  @Test
  public void testReadMultiPoint() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("MULTIPOINT(1230.09 234,334 23)");
    Geometry g2 = wkt.read(g.toString());
    assertTrue(g2.toString().equals("MULTIPOINT(1230.09 234.0,334.0 23.0)"));
  }
View Full Code Here

  }

  @Test
  public void testReadMultiLineString() {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("MULTILINESTRING((10 20,1230.09 234,334 23,10 20)"
            + ",(30 20,45 33,23 10,30 20))");
    Geometry g2 = wkt.read(g.toString());
    assertTrue(g2.toString().equals(
        "MULTILINESTRING((10.0 20.0,1230.09 234.0,334.0 23.0,10.0 20.0)"
            + ",(30.0 20.0,45.0 33.0,23.0 10.0,30.0 20.0))"));
  }
View Full Code Here

  }

  @Test
  public void testReadMultiPolygon() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("MULTIPOLYGON(((10 20,40 50,60 70,10 20)),"
        + "((0 0,0 100,100 100,100 0,0 0)))");
    Geometry g2 = wkt.read(g.toString());
    assertTrue(g2
        .toString()
        .equals(
            "MULTIPOLYGON"
                + "(((10.0 20.0,40.0 50.0,60.0 70.0,10.0 20.0)),"
                + "((0.0 0.0,0.0 100.0,100.0 100.0,100.0 0.0,0.0 0.0)))"));
View Full Code Here

  }

  @Test
  public void testReadMultiGeometry() {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("GEOMETRYCOLLECTION(MULTIPOLYGON(((10 20,40 50,60 70,10 20)),"
            + "((0 0,0 100,100 100,100 0,0 0))),POINT(1230.09 234))");
    Geometry g2 = wkt.read(g.toString());
    String s = g2.toString();
    assertTrue(s.equals("GEOMETRYCOLLECTION(MULTIPOLYGON"
        + "(((10.0 20.0,40.0 50.0,60.0 70.0,10.0 20.0)),"
        + "((0.0 0.0,0.0 100.0,100.0 100.0,100.0 0.0,0.0 0.0))),POINT(1230.09 234.0))"));
  }
View Full Code Here

public class LineAlgorithmTest {
  WktReader reader=new WktReader();
  @Test
  public void testHasIntersection() {
    Geometry g=reader.read("LINESTRING(92.28571428571429 100.21428571428572,93.71428571428571 100.21428571428572,93.71428571428571 101.64285714285715,92.28571428571429 101.64285714285715,92.28571428571429 100.21428571428572)");
    Geometry g2=reader.read("LINESTRING(0.0 100.0,100.0 101.0)");
    LineString ls=(LineString)g;
    LineString ls2=(LineString)g2;
    Assert.assertTrue(LineAlgorithm.hasIntersection(ls.getPoints(), ls2.getPoints()));
  }
View Full Code Here

public class Point_PolygonTest {

  @Test
  public void testGetIM() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("POLYGON((1 2,3 1,4 0,3 -2,0 0,1 2))");
    Polygon pg = (Polygon) g;
    GeoPoint p1 = new GeoPoint(1, 0);
    GeoPoint p2 = new GeoPoint(2, 2);

    IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(p1, pg).getIM();
View Full Code Here

  }

  @Test
  public void testGetIM2() {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("POLYGON((-5 -8,10 -20,20 15,-10 10,-5 -8),(1 2,3 1,4 0,3 -2,0 0,1 2))");
    Polygon pg = (Polygon) g;
    GeoPoint p1 = new GeoPoint(1, 0);
    GeoPoint p2 = new GeoPoint(2, 2);
    GeoPoint p3 = new GeoPoint(100, 2);
View Full Code Here

TOP

Related Classes of chunmap.model.geom.Geometry

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.