Package chunmap.model.geom

Examples of chunmap.model.geom.Ring


  protected @Override void finished(CoordSeqEditor lse)
    {
        if (onCreateFinish != null)
        {
            lse.close();
            Ring ls = null;
            try
            {
                ls = new Ring(lse.toCoordinateSeq());
            }
            catch(GeometryException ex) {
              ex.printStackTrace();
              return;
            }
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

    return EmptyDim;
  }

  @Override
  protected boolean within(Geometry g1, Geometry g2) {
    Ring r1 = ((Polygon) g1).getShell();
    Ring r2 = ((Polygon) g2).getShell();
    if (r2.containLineStringIn(r1))
      return true;
    else
      return false;
  }
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

  private boolean within = false;// 被包含

  @Override
  protected int inner2innerDim(Geometry g1, Geometry g2) {
    LineString l1 = (LineString) g1;
    Ring r2 = ((Polygon) g2).getShell();
    // 线和环边界分离
    if (im.get(Inner, Border) == EmptyDim
        && im.get(Border, Border) == EmptyDim) {
      if (r2.containIn(l1.firstPoint())) {
        within = true;
        return LineDim;
      }
      return EmptyDim;
    }
    // 是否有十字交叉
    if (_hasCross(r2,l1)) {
      cross = true;
      return LineDim;
    }
    // 用自己的折点将线串打断
    CoordSeqEditor tLine = new CoordSeqEditor(l1.getPoints());
    for (int i = 0, n = r2.size(); i < n; i++) {
      CPoint p = r2.getPoint(i);
      tLine.tryInsertPoint(p);
    }
    // 片段在里面
    for (int i = 0, n = tLine.size() - 1; i < n; i++) {
      LineSegment lseg = tLine.getLineSegment(i);
      CPoint mp = lseg.getMiddlePoint();
      if (r2.containIn(mp) && !r2.onLineString(mp)) {
        return LineDim;
      }
    }
    return EmptyDim;
  }
View Full Code Here

      return true;
    if (cross)
      return false;

    LineString l1 = (LineString) g1;
    Ring r2 = ((Polygon) g2).getShell();
    if (r2.containLineStringIn(l1))
      return true;

    return false;
  }
View Full Code Here

    fillFragmentList(fragments, fragments1, a);
    fillFragmentList(fragments, fragments2, b);
    fillFragmentList(fragments, fragments1, Fragment.Border);

    List<Polygon> result = new ArrayList<Polygon>();
    Ring r = join(fragments);
    while (r != null) {
      assert r.isValid() : "the ring is not simple";
      addRing(r, result);
      r = join(fragments);
    }

    clearFlag(fragments);
View Full Code Here

    assert line.isClose() : "the ring is not close";

    line.deleteOverPoint();
    line.close();

    return new Ring(line.toCoordinateSeq());
  }
View Full Code Here

  @Test
  public void testGetIM() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("LINESTRING(1 2,3 1,4 0,3 -2,0 0,1 2)");
    Ring lr = ((LineString) g).toLinearRing();
    GeoPoint p1 = new GeoPoint(1, 0);

    ComputeIm p2r = new Point_LinearRing(p1, lr);
    IntersectionMatrix rt = p2r.getIM();
View Full Code Here

  @Test
  public void testGetIM2() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("LINESTRING(1 2,3 1,4 0,3 -2,0 0,1 2)");
    Ring lr = ((LineString) g).toLinearRing();
    GeoPoint p1 = new GeoPoint(2, 2);

    ComputeIm p2r = new Point_LinearRing(p1, lr);
    IntersectionMatrix rt = p2r.getIM();
View Full Code Here

TOP

Related Classes of chunmap.model.geom.Ring

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.