Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.IntersectionMatrix


    jtsGeo = shiftPoly(jtsGeo, 180);
    assertEquals(161+20,jtsGeo.getBoundingBox().getWidth(), 0.001);
  }

  private void assertJtsConsistentRelate(Shape shape) {
    IntersectionMatrix expectedM = POLY_SHAPE.getGeom().relate(((JtsSpatialContext) ctx).getGeometryFrom(shape));
    SpatialRelation expectedSR = JtsGeometry.intersectionMatrixToSpatialRelation(expectedM);
    //JTS considers a point on a boundary INTERSECTS, not CONTAINS
    if (expectedSR == SpatialRelation.INTERSECTS && shape instanceof Point)
      expectedSR = SpatialRelation.CONTAINS;
    assertRelation(null, expectedSR, POLY_SHAPE, shape);
View Full Code Here


    tickCrossLabel.setIcon(clearIcon);
  }

  public void runTests() {
    if (testCase.getGeometry(0) != null && testCase.getGeometry(1) != null) {
      IntersectionMatrix im = testCase.getIM();
      IntersectionMatrix imBA = new IntersectionMatrix(im);
      //IntersectionMatrix expectedIm = new IntersectionMatrix(expectedImTextField.getText());
      imBA.transpose();
      setRelateLabel(relateII, im.get(Location.INTERIOR, Location.INTERIOR));
      setRelateLabel(relateIB, im.get(Location.INTERIOR, Location.BOUNDARY));
      setRelateLabel(relateIE, im.get(Location.INTERIOR, Location.EXTERIOR));
      setRelateLabel(relateBI, im.get(Location.BOUNDARY, Location.INTERIOR));
      setRelateLabel(relateBB, im.get(Location.BOUNDARY, Location.BOUNDARY));
      setRelateLabel(relateBE, im.get(Location.BOUNDARY, Location.EXTERIOR));
      setRelateLabel(relateEI, im.get(Location.EXTERIOR, Location.INTERIOR));
      setRelateLabel(relateEB, im.get(Location.EXTERIOR, Location.BOUNDARY));
      setRelateLabel(relateEE, im.get(Location.EXTERIOR, Location.EXTERIOR));
      //tickCrossLabel.setIcon(im.matches(expectedIm.toString()) ? tickIcon : crossIcon);
      txtAB.setText(im.toString());
      txtBA.setText(imBA.toString());

      setPredicate(equalsAB, im.isEquals(testCase.getGeometry(0).getDimension(),
          testCase.getGeometry(1).getDimension()));
      setPredicate(disjointAB, im.isDisjoint());
      setPredicate(intersectsAB, im.isIntersects());
      setPredicate(touchesAB, im.isTouches(testCase.getGeometry(0).getDimension(),
          testCase.getGeometry(1).getDimension()));
      setPredicate(crossesAB, im.isCrosses(testCase.getGeometry(0).getDimension(),
          testCase.getGeometry(1).getDimension()));
      setPredicate(withinAB, im.isWithin());
      setPredicate(containsAB, im.isContains());
      setPredicate(overlapsAB, im.isOverlaps(testCase.getGeometry(0).getDimension(),
          testCase.getGeometry(1).getDimension()));
      setPredicate(coversAB, im.isCovers());
      setPredicate(coveredByAB, im.isCoveredBy());


      setPredicate(equalsBA, imBA.isEquals(testCase.getGeometry(1).getDimension(),
          testCase.getGeometry(0).getDimension()));
      setPredicate(disjointBA, imBA.isDisjoint());
      setPredicate(intersectsBA, imBA.isIntersects());
      setPredicate(touchesBA, imBA.isTouches(testCase.getGeometry(1).getDimension(),
          testCase.getGeometry(0).getDimension()));
      setPredicate(crossesBA, imBA.isCrosses(testCase.getGeometry(1).getDimension(),
          testCase.getGeometry(0).getDimension()));
      setPredicate(withinBA, imBA.isWithin());
      setPredicate(containsBA, imBA.isContains());
      setPredicate(overlapsBA, imBA.isOverlaps(testCase.getGeometry(1).getDimension(),
          testCase.getGeometry(0).getDimension()));
      setPredicate(coversBA, imBA.isCovers());
      setPredicate(coveredByBA, imBA.isCoveredBy());
    }
  }
View Full Code Here

  private static int P = Dimension.P;

  public static Test suite() { return new TestSuite(IntersectionMatrixTest.class); }

  public void testToString() throws Exception {
    IntersectionMatrix i = new IntersectionMatrix();
    i.set("012*TF012");
    assertEquals("012*TF012", i.toString());

    IntersectionMatrix c = new IntersectionMatrix(i);
    assertEquals("012*TF012", c.toString());
  }
View Full Code Here

    IntersectionMatrix c = new IntersectionMatrix(i);
    assertEquals("012*TF012", c.toString());
  }

  public void testTranspose() {
    IntersectionMatrix x = new IntersectionMatrix("012*TF012");

    IntersectionMatrix i = new IntersectionMatrix(x);
    IntersectionMatrix j = i.transpose();
    assertSame(i, j);

    assertEquals("0*01T12F2", i.toString());

    assertEquals("012*TF012", x.toString());
View Full Code Here

    assertEquals("012*TF012", x.toString());
  }

  public void testIsDisjoint() {
    assertTrue((new IntersectionMatrix("FF*FF****")).isDisjoint());
    assertTrue((new IntersectionMatrix("FF1FF2T*0")).isDisjoint());
    assertTrue(! (new IntersectionMatrix("*F*FF****")).isDisjoint());
  }
View Full Code Here

    assertTrue((new IntersectionMatrix("FF1FF2T*0")).isDisjoint());
    assertTrue(! (new IntersectionMatrix("*F*FF****")).isDisjoint());
  }

  public void testIsTouches() {
    assertTrue((new IntersectionMatrix("FT*******")).isTouches(P,A));
    assertTrue((new IntersectionMatrix("FT*******")).isTouches(A,P));
    assertTrue(! (new IntersectionMatrix("FT*******")).isTouches(P,P));
  }
View Full Code Here

    assertTrue((new IntersectionMatrix("FT*******")).isTouches(A,P));
    assertTrue(! (new IntersectionMatrix("FT*******")).isTouches(P,P));
  }

  public void testIsIntersects() {
    assertTrue(! (new IntersectionMatrix("FF*FF****")).isIntersects());
    assertTrue(! (new IntersectionMatrix("FF1FF2T*0")).isIntersects());
    assertTrue((new IntersectionMatrix("*F*FF****")).isIntersects());
  }
View Full Code Here

    assertTrue(! (new IntersectionMatrix("FF1FF2T*0")).isIntersects());
    assertTrue((new IntersectionMatrix("*F*FF****")).isIntersects());
  }

  public void testIsCrosses() {
    assertTrue((new IntersectionMatrix("TFTFFFFFF")).isCrosses(P,L));
    assertTrue(! (new IntersectionMatrix("TFTFFFFFF")).isCrosses(L,P));
    assertTrue(! (new IntersectionMatrix("TFFFFFTFF")).isCrosses(P,L));
    assertTrue((new IntersectionMatrix("TFFFFFTFF")).isCrosses(L,P));
    assertTrue((new IntersectionMatrix("0FFFFFFFF")).isCrosses(L,L));
    assertTrue(! (new IntersectionMatrix("1FFFFFFFF")).isCrosses(L,L));
  }
View Full Code Here

    assertTrue((new IntersectionMatrix("0FFFFFFFF")).isCrosses(L,L));
    assertTrue(! (new IntersectionMatrix("1FFFFFFFF")).isCrosses(L,L));
  }

  public void testIsWithin() {
    assertTrue((new IntersectionMatrix("T0F00F000")).isWithin());
    assertTrue(! (new IntersectionMatrix("T00000FF0")).isWithin());
  }
View Full Code Here

    assertTrue((new IntersectionMatrix("T0F00F000")).isWithin());
    assertTrue(! (new IntersectionMatrix("T00000FF0")).isWithin());
  }

  public void testIsContains() {
    assertTrue(! (new IntersectionMatrix("T0F00F000")).isContains());
    assertTrue((new IntersectionMatrix("T00000FF0")).isContains());
  }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.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.