Package chunmap.model.relate

Examples of chunmap.model.relate.IntersectionMatrix


    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();

    assertTrue(rt.match(IntersectionMatrix.DisjointPattern));
  }
View Full Code Here


    Geometry g2 = wkt.read("POLYGON((1 0.5,3 0.5,3.5 0,3 -1,1 0,1 0.5))");
    Polygon pg2 = (Polygon) g2;
    Geometry g3 = wkt.read("POLYGON((4 0.5,6 0.5,6.5 0,6 -1,4 0,4 0.5))");
    Polygon pg3 = (Polygon) g3;

    IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(
        pg, pg2).getIM();
    assertTrue(rt.match(IntersectionMatrix.DisjointPattern));

    // IntersectionMatrix rt2 = ComputeIm.getInstance().getIM(pg, pg3);
    Polygon_Polygon l2a = new Polygon_Polygon(pg3, pg);
    IntersectionMatrix rt2 = l2a.getIM();
    assertTrue(rt2.match(IntersectionMatrix.WithinsPattern));
  }
View Full Code Here

    Geometry g2 = wkt.read("POLYGON((-5 -8,10 -20,20 15,-10 10,-5 -8))");
    Polygon pg2 = (Polygon) g2;
    Geometry g3 = wkt.read("POLYGON((4 0.5,6 0.5,6.5 0,6 -1,4 0,4 0.5))");
    Polygon pg3 = (Polygon) g3;

    IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(
        pg, pg2).getIM();
    // Polygon_Polygon l2a1 = new Polygon_Polygon(pg, pg2);
    // IntersectionMatrix rt = l2a1.getIM();
    assertTrue(rt.match(IntersectionMatrix.WithinsPattern));

    IntersectionMatrix rt2 = ComputeImFactory.getInstance().getImComputer(
        pg3, pg2).getIM();
    // Polygon_Polygon l2a = new Polygon_Polygon(pg3, pg2);
    // IntersectionMatrix rt2 = l2a.getIM();
    assertTrue(rt2.match(IntersectionMatrix.WithinsPattern));
  }
View Full Code Here

    // IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(
    // pg, pg2).getIM();
    LinearRing_LinearRing r2r = new LinearRing_LinearRing(pg.getShell(),
        pg2.getShell());
    IntersectionMatrix rt = r2r.getIM();
    assertTrue(!rt.match(IntersectionMatrix.DisjointPattern));
  }
View Full Code Here

    // IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(
    // pg, pg2).getIM();
    LinearRing_LinearRing r2r = new LinearRing_LinearRing(pg.getShell(),
        pg2.getShell());
    IntersectionMatrix rt = r2r.getIM();
    assertTrue(!rt.match(IntersectionMatrix.DisjointPattern));
  }
View Full Code Here

  public IntersectionMatrix getIM() {
    if (im == null) {
      if (!g1.isValid() || !g2.isValid()) {
        throw new GeometryException();
      }
      im = new IntersectionMatrix();
      im.set(Outer, Outer, AreaDim);
      computeIM();
      // 转置
      if (isReverse) {
        im = im.reverse();
View Full Code Here

   * 设置边界处的IM
   */
  private void setBorderIM() {
    Geometry b2 = g2.getBoundary();
    if (b2 != null) {
      IntersectionMatrix tim = ComputeImFactory.getInstance()
          .getImComputer(g1, b2).getIM();
      im.set(Inner, Border, getDim(tim, Inner));
      im.set(Border, Border, getDim(tim, Border));
      im.set(Outer, Border, getDim(tim, Outer));
    }

    Geometry b1 = g1.getBoundary();
    if (b1 != null) {
      IntersectionMatrix tim = ComputeImFactory.getInstance()
          .getImComputer(b1, g2).getIM();
      im.set(Border, Inner, getDim2(tim, Inner));
      im.set(Border, Border, getDim2(tim, Border));
      im.set(Border, Outer, getDim2(tim, Outer));
    }
View Full Code Here

  protected int inner2innerDim(Geometry g1, Geometry g2) {
    LineString l1 = (LineString) g1;
    Polygon a2 = (Polygon) g2;

    ComputeIm l2r = new LineString_LinearRing(l1, a2.getShell());
    IntersectionMatrix tim = l2r.getIM();

    if (tim.get(Inner, Inner) == EmptyDim)
      return EmptyDim;

    if (a2.inHoles(l1)) {
      return EmptyDim;
    }
View Full Code Here

      return false;
    }

    for (Ring r : a2.getHoles()) {
      ComputeIm l2r = new LineString_LinearRing(l1, r);
      IntersectionMatrix tim = l2r.getIM();
      if (tim.get(Inner, Inner) != EmptyDim) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

  protected int inner2innerDim(Geometry g1, Geometry g2) {
    LineString l1 = (LineString) g1;
    Polygon a2 = (Polygon) g2;

    ComputeIm l2r = new LineString_LinearRing(l1, a2.getShell());
    IntersectionMatrix tim = l2r.getIM();

    if (tim.get(Inner, Inner) == EmptyDim)
      return EmptyDim;

    if (a2.inHoles(l1)) {
      return EmptyDim;
    }
View Full Code Here

TOP

Related Classes of chunmap.model.relate.IntersectionMatrix

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.