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

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

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

Point.equals介绍

暂无

代码示例

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

public boolean equals(Object obj) {
  return point.equals(obj);
}

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

public boolean isClosed() {
  LineString firstComponent = components.get(0);
  LineString lastComponent = components.get(components.size() - 1);
  return firstComponent.getStartPoint().equals(lastComponent.getEndPoint());
}

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

/** Creates a compound curve with the given components */
public LineString createCurvedGeometry(List<LineString> components) {
  if (components.isEmpty()) {
    // return an empty lineString?
    return new CompoundCurve(components, this, tolerance);
  }
  LineString first = components.get(0);
  LineString last = components.get(components.size() - 1);
  if (first.getStartPoint().equals(last.getEndPoint())) {
    return new CompoundRing(components, this, tolerance);
  } else {
    return new CompoundCurve(components, this, tolerance);
  }
}

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

public void testSetNonSequential() throws Exception {
  GeometryFactory gf = new GeometryFactory();
  builder.set("float", new Float(2.0));
  builder.set("point", gf.createPoint(new Coordinate(0, 0)));
  builder.set("integer", Integer.valueOf(1));
  SimpleFeature feature = builder.buildFeature("fid");
  assertNotNull(feature);
  assertEquals(3, feature.getAttributeCount());
  assertTrue(gf.createPoint(new Coordinate(0, 0)).equals(feature.getAttribute(0)));
  assertEquals(Integer.valueOf(1), feature.getAttribute(1));
  assertEquals(new Float(2.0), feature.getAttribute(2));
}

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

public void testSetSequential() throws Exception {
  GeometryFactory gf = new GeometryFactory();
  builder.set("point", gf.createPoint(new Coordinate(0, 0)));
  builder.set("integer", Integer.valueOf(1));
  builder.set("float", new Float(2.0));
  SimpleFeature feature = builder.buildFeature("fid");
  assertNotNull(feature);
  assertEquals(3, feature.getAttributeCount());
  assertTrue(gf.createPoint(new Coordinate(0, 0)).equals(feature.getAttribute(0)));
  assertEquals(Integer.valueOf(1), feature.getAttribute(1));
  assertEquals(new Float(2.0), feature.getAttribute(2));
}

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

public void testSanity() throws Exception {
  GeometryFactory gf = new GeometryFactory();
  builder.add(gf.createPoint(new Coordinate(0, 0)));
  builder.add(Integer.valueOf(1));
  builder.add(new Float(2.0));
  SimpleFeature feature = builder.buildFeature("fid");
  assertNotNull(feature);
  assertEquals(3, feature.getAttributeCount());
  assertTrue(gf.createPoint(new Coordinate(0, 0)).equals(feature.getAttribute("point")));
  assertEquals(Integer.valueOf(1), feature.getAttribute("integer"));
  assertEquals(new Float(2.0), feature.getAttribute("float"));
}

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

public void testTooFewAttributes() throws Exception {
  GeometryFactory gf = new GeometryFactory();
  builder.add(gf.createPoint(new Coordinate(0, 0)));
  builder.add(Integer.valueOf(1));
  SimpleFeature feature = builder.buildFeature("fid");
  assertNotNull(feature);
  assertEquals(3, feature.getAttributeCount());
  assertTrue(gf.createPoint(new Coordinate(0, 0)).equals(feature.getAttribute("point")));
  assertEquals(Integer.valueOf(1), feature.getAttribute("integer"));
  assertNull(feature.getAttribute("float"));
}

代码示例来源:origin: org.n52.arctic-sea/shetland

@Override
public boolean equals(Object obj) {
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final PointValuePair other = (PointValuePair) obj;
  if ((getPoint() == null) ? (other.getPoint() != null) : !getPoint().equals(other.getPoint())) {
    return false;
  }
  if ((getValue() == null) ? (other.getValue() != null) : !getValue().equals(other.getValue())) {
    return false;
  }
  return super.equals(obj);
}

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

public void testNegRounding1() throws Exception {
 Point pLo = (Point) reader.read("POINT(-1.233 5.678)");
 Point pHi = (Point) reader.read("POINT(-1.232 5.678)");
 Point p1 = (Point) reader.read("POINT(-1.2326 5.678)");
 Point p2 = (Point) reader.read("POINT(-1.2325 5.678)");
 Point p3 = (Point) reader.read("POINT(-1.2324 5.678)");
 assertTrue(! p1.equals(p2));
 assertTrue(p3.equals(p2));
 assertTrue(p1.equals(pLo));
 assertTrue(p2.equals(pHi));
 assertTrue(p3.equals(pHi));
}

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

public void testEquals5() throws Exception {
 Point p1 = (Point) reader.read("POINT(1.2334 5.678)");
 Point p2 = (Point) reader.read("POINT(1.2335 5.678)");
 assertTrue(! p1.equals(p2));
}

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

public void testEquals4() throws Exception {
 Point p1 = (Point) reader.read("POINT(1.2334 5.678)");
 Point p2 = (Point) reader.read("POINT(1.2333 5.678)");
 assertTrue(p1.equals(p2));
}

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

public void testEquals2() throws Exception {
 Point p1 = (Point) reader.read("POINT(1.23 5.67)");
 Point p2 = (Point) reader.read("POINT(1.23 5.67)");
 assertTrue(p1.equals(p2));
}

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

public void testEquals3() throws Exception {
 Point p1 = (Point) reader.read("POINT(1.235 5.678)");
 Point p2 = (Point) reader.read("POINT(1.234 5.678)");
 assertTrue(! p1.equals(p2));
}

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

public void testEquals6() throws Exception {
 Point p1 = (Point) reader.read("POINT(1.2324 5.678)");
 Point p2 = (Point) reader.read("POINT(1.2325 5.678)");
 assertTrue(! p1.equals(p2));
}

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

public void testEquals1() throws Exception {
 Point p1 = (Point) reader.read("POINT(1.234 5.678)");
 Point p2 = (Point) reader.read("POINT(1.234 5.678)");
 assertTrue(p1.equals(p2));
}

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

public void testPredicatesReturnFalseForEmptyGeometries() {
 Point p1 = new GeometryFactory().createPoint((Coordinate)null);
 Point p2 = new GeometryFactory().createPoint(new Coordinate(5,5));
 assertEquals(false, p1.equals(p2));
 assertEquals(true, p1.disjoint(p2));
 assertEquals(false, p1.intersects(p2));
 assertEquals(false, p1.touches(p2));
 assertEquals(false, p1.crosses(p2));
 assertEquals(false, p1.within(p2));
 assertEquals(false, p1.contains(p2));
 assertEquals(false, p1.overlaps(p2));
 assertEquals(false, p2.equals(p1));
 assertEquals(true, p2.disjoint(p1));
 assertEquals(false, p2.intersects(p1));
 assertEquals(false, p2.touches(p1));
 assertEquals(false, p2.crosses(p1));
 assertEquals(false, p2.within(p1));
 assertEquals(false, p2.contains(p1));
 assertEquals(false, p2.overlaps(p1));
}

相关文章