Package chunmap.model.geom

Examples of chunmap.model.geom.Polygon


  @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();
    IntersectionMatrix rt2 = ComputeImFactory.getInstance().getImComputer(p2, 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);

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

            }
            catch(GeometryException ex) {
              ex.printStackTrace();
              return;
            }
            onCreateFinish.fire(new Polygon(ls));
        }
    }
View Full Code Here

      CPoint pp = new Coordinate2D(p.getX() + dx, p.getY() + dy);
      points.add(pp);
    }
    CoordSeqEditor ls = new CoordSeqEditor(points);
    ls.close();
    Polygon pg = new Polygon(new Ring(ls.toCoordinateSeq()));
    return pg;
  }
View Full Code Here

    ls.addPointToLast(p2);
    ls.addPointToLast(p3);
    ls.addPointToLast(p4);
    ls.addPointToLast(p1);

    Polygon pg = new Polygon(new Ring(ls.toCoordinateSeq()));
    return pg;
  }
View Full Code Here

  @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;
    Geometry g2 = wkt.read("LINESTRING(1 1,1 2,2 2,3 2)");
    LineString ls = (LineString) g2;

    // IntersectionMatrix rt2 = ComputeIm.getInstance().getIM(ls, pg);
    LineString_Polygon l2a = new LineString_Polygon(ls, pg);
View Full Code Here

          "very little distance in singleLineNoCapBuffer");
    }
    OverLayOp op = new OverLayOp();
    PointBuffer pb = new PointBuffer();
    // 开始点的缓冲
    Polygon pg = pb.createBuffer(ls.firstPoint(), distance);

    for (int i = 0, n = ls.size() - 1; i < n; i++) {
      LineSegment lseg = ls.getLineSegment(i);

      // 线的缓冲区
      Polygon lineBuffer = singleLineNoCapBuffer(lseg, distance);
      CPoint point = ls.getPoint(i + 1);

      // 结尾点的缓冲
      Polygon pointBuffer = pb.createBuffer(point, distance);

      pg = op.computeUnion(lineBuffer, pg).getGeometry(0);

      // debug
      pg.isValid();
View Full Code Here

  @Test
  public void testGetIM2() {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("POLYGON((-5.0 -8.0,10.0 -20.0,20.0 15.0,-10.0 10.0,-5.0 -8.0),(1.0 2.0,3.0 1.0,4.0 0.0,3.0 -2.0,0.0 0.0,1.0 2.0))");
    Polygon pg = (Polygon) g;
    Geometry g2 = wkt
        .read("LINESTRING(1.0 0.5,3.0 0.5,3.5 0.0,3.0 -1.0,1.0 0.0,1.0 0.5)");
    LineString ls = (LineString) g2;

    // IntersectionMatrix rt = ComputeIm.getInstance().getIM(ls, pg);
View Full Code Here

  @Test
  public void testGetIM3() {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("POLYGON((1.0 0.5,3.0 0.5,3.5 0.0,3.0 -1.0,1.0 0.0,1.0 0.5))");
    Polygon pg = (Polygon) g;
    Geometry g2 = wkt
        .read("LINESTRING(1.0 2.0,3.0 1.0,4.0 0.0,3.0 -2.0,0.0 0.0,1.0 2.0)");
    LineString ls = (LineString) g2;

    // IntersectionMatrix rt = ComputeIm.getInstance().getIM(ls, pg);
View Full Code Here

  @Test
  public void testGetIM4() {
    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("POLYGON((1.0 2.0,3.0 1.0,4.0 0.0,3.0 -2.0,0.0 0.0,1.0 2.0))");
    Polygon pg = (Polygon) g;
    Geometry g2 = wkt
        .read("LINESTRING(4.0 0.5,6.0 0.5,6.5 0.0,6.0 -1.0,4.0 0.0,4.0 0.5)");
    LineString ls = (LineString) g2;

    // IntersectionMatrix rt = ComputeIm.getInstance().getIM(ls, pg);
View Full Code Here

TOP

Related Classes of chunmap.model.geom.Polygon

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.