org.locationtech.jts.geom.Point.equalsExact()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(254)

本文整理了Java中org.locationtech.jts.geom.Point.equalsExact()方法的一些代码示例,展示了Point.equalsExact()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.equalsExact()方法的具体详情如下:
包路径:org.locationtech.jts.geom.Point
类名称:Point
方法名:equalsExact

Point.equalsExact介绍

暂无

代码示例

代码示例来源:origin: geotools/geotools

public boolean equalsExact(Geometry other, double tolerance) {
  return point.equalsExact(other, tolerance);
}

代码示例来源:origin: geotools/geotools

public boolean equalsExact(Geometry other) {
  return point.equalsExact(other);
}

代码示例来源:origin: geotools/geotools

public void check(int index, SimpleFeature feature) {
    assertEquals(4, feature.getAttributeCount());
    Point p = gf.createPoint(new Coordinate(index, index));
    assertTrue(
        p.equalsExact(
            (Geometry) feature.getAttribute(aname("geometry"))));
    Number ip = (Number) feature.getAttribute(aname("intProperty"));
    assertEquals(index, ip.intValue());
  }
});

代码示例来源:origin: geotools/geotools

Point pt = (Point) gt2;
if (pt.equalsExact(str) || pt.equalsExact(end)) {
  return true;

代码示例来源:origin: geotools/geotools

"geometry retrieval and match",
    ((Point) testFeature.getAttribute("testGeometry"))
        .equalsExact(gf.createPoint(new Coordinate(1, 2))));
assertTrue(
    "boolean retrieval and match",

代码示例来源:origin: geotools/geotools

public void testNormal() throws Exception {
  Iterator reproject = new ReprojectFeatureResults(delegate, target).iterator();
  Iterator reader = delegate.iterator();
  while (reader.hasNext()) {
    SimpleFeature normal = (SimpleFeature) reader.next();
    SimpleFeature reprojected = (SimpleFeature) reproject.next();
    Point p1 = (Point) normal.getAttribute("defaultGeom");
    Point p2 = (Point) reprojected.getAttribute("defaultGeom");
    if (p1 != null) {
      assertEquals(crs, p1.getUserData());
      assertEquals(target, p2.getUserData());
      p1 = (Point) transformer.transform(p1);
      assertTrue(p1.equalsExact(p2));
    } else {
      assertNull(p2);
    }
    LineString l1 = (LineString) normal.getAttribute("otherGeom");
    LineString l2 = (LineString) reprojected.getAttribute("otherGeom");
    if (l1 != null) {
      l1 = (LineString) transformer.transform(l1);
      assertTrue(l1.equalsExact(l2));
    } else {
      assertNull(l2);
    }
  }
}

代码示例来源:origin: geotools/geotools

public void testLiteralExpression() {
  LiteralExpressionImpl literal;
  literal = new LiteralExpressionImpl(1.0D);
  assertEquals(ExpressionType.LITERAL_DOUBLE, Filters.getExpressionType(literal));
  assertEquals(new Double(1.0D), literal.evaluate((Feature) null));
  GeometryFactory gf = new GeometryFactory();
  literal = new LiteralExpressionImpl(gf.createPoint(new Coordinate(0, 0)));
  assertEquals(ExpressionType.LITERAL_GEOMETRY, Filters.getExpressionType(literal));
  Geometry value = (Geometry) literal.evaluate((Feature) null);
  assertTrue(gf.createPoint(new Coordinate(0, 0)).equalsExact(value));
  literal = new LiteralExpressionImpl(1);
  assertEquals(ExpressionType.LITERAL_INTEGER, Filters.getExpressionType(literal));
  assertEquals(Integer.valueOf(1), literal.evaluate((Feature) null));
  literal = new LiteralExpressionImpl(1L);
  assertEquals(ExpressionType.LITERAL_LONG, Filters.getExpressionType(literal));
  assertEquals(Long.valueOf(1), literal.evaluate((Feature) null));
  literal = new LiteralExpressionImpl("string value");
  assertEquals(ExpressionType.LITERAL_STRING, Filters.getExpressionType(literal));
  assertEquals("string value", literal.evaluate((Feature) null));
  literal = new LiteralExpressionImpl(new Date(0));
  assertEquals(ExpressionType.LITERAL_UNDECLARED, Filters.getExpressionType(literal));
  assertEquals(new Date(0), literal.evaluate((Feature) null));
  literal = new LiteralExpressionImpl(null);
  assertEquals(ExpressionType.LITERAL_UNDECLARED, Filters.getExpressionType(literal));
  assertNull(literal.evaluate((Feature) null));
}

代码示例来源:origin: geotools/geotools

public void testModifyGeometry() throws IOException {
  // GEOT-2371
  SimpleFeatureType t = featureStore.getSchema();
  GeometryFactory gf = new GeometryFactory();
  Point point = gf.createPoint(new Coordinate(-10, 0));
  featureStore.modifyFeatures(
      new AttributeDescriptor[] {t.getDescriptor(aname("geometry"))},
      new Object[] {point},
      Filter.INCLUDE);
  SimpleFeatureCollection features = featureStore.getFeatures();
  try (SimpleFeatureIterator i = features.features()) {
    assertTrue(i.hasNext());
    while (i.hasNext()) {
      SimpleFeature feature = (SimpleFeature) i.next();
      assertTrue(point.equalsExact((Geometry) feature.getAttribute(aname("geometry"))));
    }
  }
}

代码示例来源:origin: geotools/geotools

public void testModifyMadeUpGeometry() throws IOException {
  // GEOT-2371
  SimpleFeatureType t = featureStore.getSchema();
  GeometryFactory gf = new GeometryFactory();
  Point point = gf.createPoint(new Coordinate(-10, 0));
  // make up a fake attribute with the same name, something that might happen
  // in chains of retyping where attributes are rebuilt
  AttributeTypeBuilder ab = new AttributeTypeBuilder();
  ab.binding(Point.class);
  AttributeDescriptor madeUp = ab.buildDescriptor(aname("geometry"));
  featureStore.modifyFeatures(
      new AttributeDescriptor[] {madeUp}, new Object[] {point}, Filter.INCLUDE);
  SimpleFeatureCollection features = featureStore.getFeatures();
  try (SimpleFeatureIterator i = features.features()) {
    assertTrue(i.hasNext());
    while (i.hasNext()) {
      SimpleFeature feature = (SimpleFeature) i.next();
      assertTrue(point.equalsExact((Geometry) feature.getAttribute(aname("geometry"))));
    }
  }
}

代码示例来源:origin: geotools/geotools

public void testNormal() throws Exception {
  SimpleFeatureIterator reproject =
      new ReprojectingFeatureCollection(delegate, target).features();
  SimpleFeatureIterator reader = delegate.features();
  try {
    while (reader.hasNext()) {
      SimpleFeature normal = (SimpleFeature) reader.next();
      SimpleFeature reprojected = (SimpleFeature) reproject.next();
      Point p1 = (Point) normal.getAttribute("defaultGeom");
      Point p2 = (Point) reprojected.getAttribute("defaultGeom");
      if (p1 != null) {
        p1 = (Point) transformer.transform(p1);
        assertTrue(p1.equalsExact(p2));
      } else {
        assertNull(p2);
      }
      LineString l1 = (LineString) normal.getAttribute("otherGeom");
      LineString l2 = (LineString) reprojected.getAttribute("otherGeom");
      if (l1 != null) {
        l1 = (LineString) transformer.transform(l1);
        assertTrue(l1.equalsExact(l2));
      } else {
        assertNull(l2);
      }
    }
  } finally {
    reproject.close();
    reader.close();
  }
}

代码示例来源:origin: locationtech/jts

public void testDeepCopy() throws ParseException
{
 Point g = (Point) read("POINT ( 10 10) ");
 Geometry g2 = geometryFactory.createGeometry(g);
 g.getCoordinateSequence().setOrdinate(0, 0, 99);
 assertTrue(! g.equalsExact(g2));
}

代码示例来源:origin: locationtech/jts

Point p2 = (Point) r.read(wkb);
assertTrue(p1.equalsExact(p2));
assertEquals(0, p2.getSRID());
assertTrue(p1.equalsExact(p2));
assertEquals(1234, p2.getSRID());

相关文章