Package chunmap.model.geom

Examples of chunmap.model.geom.LineString


    }
  }

  protected void finished(CoordSeqEditor lse) {
    if (lse.size() > 1) {
      LineString ls = new LineString(lse.toCoordinateSeq());
      onCreateFinish.fire(ls);
    }
  }
View Full Code Here


  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);
    IntersectionMatrix rt = l2a.getIM();
    assertTrue(rt.match(IntersectionMatrix.CrossesPattern));
View Full Code Here

    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);
    LineString_Polygon l2a = new LineString_Polygon(ls, pg);
    IntersectionMatrix rt = l2a.getIM();
    assertTrue(rt.match(IntersectionMatrix.DisjointPattern));
View Full Code Here

    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);
    LineString_Polygon l2a = new LineString_Polygon(ls, pg);
    IntersectionMatrix rt = l2a.getIM();
    assertTrue(rt.match(IntersectionMatrix.DisjointPattern));
View Full Code Here

    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);
    LineString_Polygon l2a = new LineString_Polygon(ls, pg);
    IntersectionMatrix rt = l2a.getIM();
    assertTrue(rt.get(IntersectionMatrix.Inner, IntersectionMatrix.Inner) == IntersectionMatrix.EmptyDim);
View Full Code Here

  public void testGetIM5() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("LINESTRING(2.0 2.0,0.0 0.0)");
    Geometry g2 = wkt
        .read("POLYGON((0.98 0.94,1.0466666666666666 0.94,1.0466666666666666 1.0066666666666666,0.98 1.0066666666666666,0.98 0.94))");
    LineString ls = (LineString) g;
    Polygon pg = (Polygon) g2;

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

    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("LINESTRING(1.0 6.0,5.999998414659173 1.0039816335536662,1.0079632645824341 -3.999993658637697,-3.9999857319385903 0.9880551094385923,1.0 6.0)");
    Geometry g2 = wkt
        .read("POLYGON((-2.639991350383829 -1.7999950537374092,-1.8399918576928131 -1.7999950537374092,-1.8399918576928131 -0.9999955610463935,-2.639991350383829 -0.9999955610463935,-2.639991350383829 -1.7999950537374092))");
    LineString ls = (LineString) g;
    Polygon pg = (Polygon) g2;

    LineString_LinearRing l2a = new LineString_LinearRing(ls, pg.getShell());
    IntersectionMatrix rt = l2a.getIM();
    assertTrue(rt.get(IntersectionMatrix.Inner, IntersectionMatrix.Inner) != IntersectionMatrix.EmptyDim);
View Full Code Here

    WktReader wkt = new WktReader();
    Geometry g = wkt
        .read("LINESTRING(1.0 6.0,5.999998414659173 1.0039816335536662,1.0079632645824341 -3.999993658637697,-3.9999857319385903 0.9880551094385923,1.0 6.0)");
    Geometry g2 = wkt
        .read("POLYGON((3.3400048574815147 -2.1999948000829175,4.140004350172529 -2.1999948000829175,4.140004350172529 -1.399995307391901,3.3400048574815147 -1.399995307391901,3.3400048574815147 -2.1999948000829175))");
    LineString ls = (LineString) g;
    Polygon pg = (Polygon) g2;

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

  private boolean cross = false;// 是否有交叉
  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);
    }
    // 片段在里面
View Full Code Here

        }
    }

    private void addWeiXian(List<Geometry> geometrys, double weidu)
    {
        LineString ls = new LineString(
            new CPoint[] { new Coordinate2D(-180, weidu), new Coordinate2D(180, weidu) });
        geometrys.add(ls);
    }
View Full Code Here

TOP

Related Classes of chunmap.model.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.