Tabnine Logo
Geometry.equalsExact
Code IndexAdd Tabnine to your IDE (free)

How to use
equalsExact
method
in
com.vividsolutions.jts.geom.Geometry

Best Java code snippets using com.vividsolutions.jts.geom.Geometry.equalsExact (Showing top 20 results out of 315)

origin: com.vividsolutions/jts

/**
 * Returns true if the two <code>Geometry</code>s are exactly equal.
 * Two Geometries are exactly equal iff:
 * <ul>
 * <li>they have the same structure
 * <li>they have the same values for their vertices,
 * in exactly the same order.
 * </ul>
 * This provides a stricter test of equality than
 * {@link #equalsTopo(Geometry)}, which is more useful
 * in certain situations
 * (such as using geometries as keys in collections).
 * <p>
 * This method does <i>not</i>
 * test the values of the <code>GeometryFactory</code>, the <code>SRID</code>, 
 * or the <code>userData</code> fields.
 * <p>
 * To properly test equality between different geometries,
 * it is usually necessary to {@link #normalize()} them first.
 *
 *@param  other  the <code>Geometry</code> with which to compare this <code>Geometry</code>
 *@return <code>true</code> if this and the other <code>Geometry</code>
 *      have identical structure and point values.
 *      
 * @see #equalsExact(Geometry, double)
 * @see #normalize()
 * @see #norm()
 */
public boolean equalsExact(Geometry other) { return equalsExact(other, 0); }
origin: com.vividsolutions/jts

return equalsExact(g);
origin: com.vividsolutions/jts

public boolean equalsExact(Geometry other, double tolerance) {
 if (!isEquivalentClass(other)) {
  return false;
 }
 Polygon otherPolygon = (Polygon) other;
 Geometry thisShell = shell;
 Geometry otherPolygonShell = otherPolygon.shell;
 if (!thisShell.equalsExact(otherPolygonShell, tolerance)) {
  return false;
 }
 if (holes.length != otherPolygon.holes.length) {
  return false;
 }
 for (int i = 0; i < holes.length; i++) {
  if (!((Geometry) holes[i]).equalsExact(otherPolygon.holes[i], tolerance)) {
   return false;
  }
 }
 return true;
}
origin: com.vividsolutions/jts

public boolean equalsExact(Geometry other, double tolerance) {
 if (!isEquivalentClass(other)) {
  return false;
 }
 GeometryCollection otherCollection = (GeometryCollection) other;
 if (geometries.length != otherCollection.geometries.length) {
  return false;
 }
 for (int i = 0; i < geometries.length; i++) {
  if (!((Geometry) geometries[i]).equalsExact(otherCollection.geometries[i], tolerance)) {
   return false;
  }
 }
 return true;
}
origin: com.vividsolutions/jts

/**
 * Tests whether two geometries are exactly equal
 * in their normalized forms.
 * This is a convenience method which creates normalized
 * versions of both geometries before computing
 * {@link #equalsExact(Geometry)}.
 * <p>
 * This method is relatively expensive to compute.  
 * For maximum performance, the client 
 * should instead perform normalization on the individual geometries
 * at an appropriate point during processing.
 * 
 * @param g a Geometry
 * @return true if the input geometries are exactly equal in their normalized form
 */
public boolean equalsNorm(Geometry g)
{
 if (g == null) return false;
 return norm().equalsExact(g.norm());
}
 
origin: org.geotools/gt-main

static public boolean equalsExactTolerance(Geometry arg0,Geometry arg1, Double arg2)
{
   if (arg0 == null || arg1 == null || arg2 == null) return false;
   Geometry _this = arg0;
   return _this.equalsExact(arg1,arg2);
}
origin: org.geotools/gt2-main

static public boolean equalsExact(Geometry arg0,Geometry arg1)
{
   Geometry _this = arg0;
   return _this.equalsExact(arg1);
}
origin: org.geotools/gt2-main

static public boolean equalsExactTolerance(Geometry arg0,Geometry arg1,double arg2)
{
   Geometry _this = arg0;
   return _this.equalsExact(arg1,arg2);
}
origin: org.geotools/gt-main

static public boolean equalsExact(Geometry arg0,Geometry arg1)
{
   if (arg0 == null || arg1 == null) return false;
   Geometry _this = arg0;
   return _this.equalsExact(arg1);
}
origin: org.hibernatespatial/hibernate-spatial

public boolean equals(Object x, Object y) throws HibernateException {
  if (x == y)
    return true;
  if (x == null || y == null)
    return false;
  return ((Geometry) x).equalsExact((Geometry) y);
}
origin: com.spatial4j/spatial4j

@Override
public boolean equals(Object o) {
 if (this == o) return true;
 if (o == null || getClass() != o.getClass()) return false;
 JtsGeometry that = (JtsGeometry) o;
 return geom.equalsExact(that.geom);//fast equality for normalized geometries
}
origin: org.locationtech.geogig/geogig-core

private static boolean geomEquals(@Nullable Geometry g1, @Nullable Geometry g2) {
  if (g1 == null || g2 == null) {
    return g1 == null && g2 == null;
  }
  return g1.equalsExact(g2);
}
origin: org.locationtech.geogig/geogig-core

private boolean geomEquals(@Nullable Geometry g1, @Nullable Geometry g2) {
  if (g1 == null || g2 == null) {
    return g1 == null && g2 == null;
  }
  return g1.equalsExact(g2);
}
origin: harbby/presto-connectors

@Override
public boolean equals(Object o) {
 if (this == o) return true;
 if (o == null || getClass() != o.getClass()) return false;
 JtsGeometry that = (JtsGeometry) o;
 return geom.equalsExact(that.geom);//fast equality for normalized geometries
}
origin: org.geotools/gt-main

/**
 * Compares two geometries for equality.
 */
protected void assertEquals(Geometry expected, Geometry actual) {
  if (expected == actual) {
    return;
  }
  assertNotNull(expected);
  assertNotNull(actual);
  assertTrue(expected.equalsExact(actual));
}
origin: org.geotools/gt-main

@Override
  public boolean evaluateInternal(Geometry left, Geometry right) {
  Envelope envLeft = left.getEnvelopeInternal();
  Envelope envRight = right.getEnvelopeInternal();
  if (envRight.equals(envLeft))
    return left.equalsExact(right);
  else
    return false;
}
origin: org.geotools/gt-main

/**
 * Compares two geometries for equality.
 */
protected void assertEquals(String message, Geometry expected, Geometry actual) {
  if (expected == actual) {
    return;
  }
  assertNotNull(message, expected);
  assertNotNull(message, actual);
  assertTrue(message, expected.equalsExact(actual));
}
origin: bcdev/beam

private void testFormatting(Geometry expectedGeometry) throws ParseException {
  final WKTReader wktReader = new WKTReader();
  final String geometryWkt = converter.format(expectedGeometry);
  final Geometry geometry = wktReader.read(geometryWkt);
  assertTrue(expectedGeometry.equalsExact(geometry));
}
origin: bcdev/beam

  private void testParsing(Geometry expectedGeometry) throws ConversionException {
    final WKTWriter wktWriter = new WKTWriter();
    final String geometryWkt = wktWriter.write(expectedGeometry);
    final Geometry geometry = converter.parse(geometryWkt);
    assertTrue(expectedGeometry.equalsExact(geometry));

    assertEquals(null, converter.parse(""));
  }
}
origin: org.locationtech.geogig/geogig-core

  @Test
  public void testNoConflictIfSameDiff2() throws Exception {
    String wkt = "MULTIPOLYGON (((-75.0740073 38.6938098, -75.0739683 38.6935296, "
        + "-75.0745695 38.6934786, -75.0745824 38.6935715, -75.0741091 38.6936117, "
        + "-75.0741352 38.6937989, -75.0740073 38.6938098)))";

    Geometry oldGeom = new WKTReader().read(wkt);
    Geometry newGeom = new WKTReader().read(wkt);
    assertTrue(oldGeom.equalsExact(newGeom));

    GeometryAttributeDiff diff = new GeometryAttributeDiff(oldGeom, newGeom);
    GeometryAttributeDiff diff2 = new GeometryAttributeDiff(oldGeom, newGeom);
    assertFalse(diff.conflicts(diff2));
  }
}
com.vividsolutions.jts.geomGeometryequalsExact

Javadoc

Returns true if the two Geometrys are exactly equal. Two Geometries are exactly equal iff:
  • they have the same structure
  • they have the same values for their vertices, in exactly the same order.
This provides a stricter test of equality than #equalsTopo(Geometry), which is more useful in certain situations (such as using geometries as keys in collections).

This method does not test the values of the GeometryFactory, the SRID, or the userData fields.

To properly test equality between different geometries, it is usually necessary to #normalize() them first.

Popular methods of Geometry

  • getEnvelopeInternal
    Gets an Envelope containing the minimum and maximum x and y values in this Geometry. If the geometr
  • getCoordinates
    Returns an array containing the values of all the vertices for this geometry. If the geometry is a c
  • isEmpty
    Tests whether the set of points covered by this Geometry is empty.
  • getCentroid
    Computes the centroid of this Geometry. The centroid is equal to the centroid of the set of componen
  • getGeometryN
    Returns an element Geometry from a GeometryCollection(or this, if the geometry is not a collection).
  • toText
    Returns the Well-known Text representation of this Geometry. For a definition of the Well-known Text
  • getNumGeometries
    Returns the number of Geometrys in a GeometryCollection(or 1, if the geometry is not a collection).
  • getFactory
    Gets the factory which contains the context in which this geometry was created.
  • getGeometryType
    Returns the name of this Geometry's actual class.
  • getSRID
    Returns the ID of the Spatial Reference System used by the Geometry. JTS supports Spatial Reference
  • getCoordinate
    Returns a vertex of this Geometry (usually, but not necessarily, the first one). The returned coordi
  • intersection
    Computes a Geometry representing the point-set which is common to both this Geometry and the other
  • getCoordinate,
  • intersection,
  • buffer,
  • contains,
  • getArea,
  • getEnvelope,
  • intersects,
  • union,
  • apply,
  • getLength

Popular in Java

  • Running tasks concurrently on multiple threads
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • JLabel (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now