com.vividsolutions.jts.geom.Geometry.relate()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(156)

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

Geometry.relate介绍

[英]Returns the DE-9IM IntersectionMatrix for the two Geometrys.
[中]返回两个Geometry的DE-9IM相交矩阵。

代码示例

代码示例来源:origin: com.vividsolutions/jts

/**
 * Tests whether the elements in the DE-9IM
 * {@link IntersectionMatrix} for the two <code>Geometry</code>s match the elements in <code>intersectionPattern</code>.
 * The pattern is a 9-character string, with symbols drawn from the following set:
 *  <UL>
 *    <LI> 0 (dimension 0)
 *    <LI> 1 (dimension 1)
 *    <LI> 2 (dimension 2)
 *    <LI> T ( matches 0, 1 or 2)
 *    <LI> F ( matches FALSE)
 *    <LI> * ( matches any value)
 *  </UL>
 *  For more information on the DE-9IM, see the <i>OpenGIS Simple Features
 *  Specification</i>.
 *
 *@param  g                the <code>Geometry</code> with which to compare
 *      this <code>Geometry</code>
 *@param  intersectionPattern  the pattern against which to check the
 *      intersection matrix for the two <code>Geometry</code>s
 *@return                      <code>true</code> if the DE-9IM intersection
 *      matrix for the two <code>Geometry</code>s match <code>intersectionPattern</code>
 * @see IntersectionMatrix
 */
public boolean relate(Geometry g, String intersectionPattern) {
 return relate(g).matches(intersectionPattern);
}

代码示例来源:origin: com.vividsolutions/jts

public void run()
 throws ParseException
{
 GeometryFactory fact = new GeometryFactory();
 WKTReader wktRdr = new WKTReader(fact);
 String wktA = "POLYGON((40 100, 40 20, 120 20, 120 100, 40 100))";
 String wktB = "LINESTRING(20 80, 80 60, 100 140)";
 Geometry A = wktRdr.read(wktA);
 Geometry B = wktRdr.read(wktB);
 Geometry C = A.intersection(B);
 System.out.println("A = " + A);
 System.out.println("B = " + B);
 System.out.println("A intersection B = " + C);
 System.out.println("A relate C = " + A.relate(B));
}

代码示例来源:origin: com.vividsolutions/jts

/**
 * Default implementation.
 */
public boolean containsProperly(Geometry g)
{
  // since raw relate is used, provide some optimizations
  
 // short-circuit test
 if (! baseGeom.getEnvelopeInternal().contains(g.getEnvelopeInternal()))
  return false;
  
 // otherwise, compute using relate mask
 return baseGeom.relate(g, "T**FF*FF*");
}

代码示例来源:origin: com.vividsolutions/jts

return relate(g).isCovers();

代码示例来源:origin: com.vividsolutions/jts

/**
 * Tests whether this geometry overlaps the
 * specified geometry.
 * <p>
 * The <code>overlaps</code> predicate has the following equivalent definitions:
 * <ul>
 * <li>The geometries have at least one point each not shared by the other
 * (or equivalently neither covers the other),
 * they have the same dimension,
 * and the intersection of the interiors of the two geometries has
 * the same dimension as the geometries themselves.
 * <li>The DE-9IM Intersection Matrix for the two geometries matches
 *   <code>[T*T***T**]</code> (for two points or two surfaces)
 *   or <code>[1*T***T**]</code> (for two curves)
 * </ul>
 * If the geometries are of different dimension this predicate returns <code>false</code>.
 *
 *@param  g  the <code>Geometry</code> with which to compare this <code>Geometry</code>
 *@return        <code>true</code> if the two <code>Geometry</code>s overlap.
 */
public boolean overlaps(Geometry g) {
 // short-circuit test
 if (! getEnvelopeInternal().intersects(g.getEnvelopeInternal()))
  return false;
 return relate(g).isOverlaps(getDimension(), g.getDimension());
}

代码示例来源:origin: com.vividsolutions/jts

/**
 * Tests whether this geometry touches the
 * argument geometry.
 * <p>
 * The <code>touches</code> predicate has the following equivalent definitions:
 * <ul>
 * <li>The geometries have at least one point in common, but their interiors do not intersect.
 * <li>The DE-9IM Intersection Matrix for the two geometries matches
 * at least one of the following patterns
 *  <ul>
 *   <li><code>[FT*******]</code>
 *   <li><code>[F**T*****]</code>
 *   <li><code>[F***T****]</code>
 *  </ul>
 * </ul>
 * If both geometries have dimension 0, this predicate returns <code>false</code>.
 * 
 *
 *@param  g  the <code>Geometry</code> with which to compare this <code>Geometry</code>
 *@return        <code>true</code> if the two <code>Geometry</code>s touch;
 *      Returns <code>false</code> if both <code>Geometry</code>s are points
 */
public boolean touches(Geometry g) {
 // short-circuit test
 if (! getEnvelopeInternal().intersects(g.getEnvelopeInternal()))
  return false;
 return relate(g).isTouches(getDimension(), g.getDimension());
}

代码示例来源:origin: org.geotools/gt2-main

static public boolean relatePattern(Geometry arg0,Geometry arg1,String arg2)
{
   Geometry _this = arg0;
   return _this.relate(arg1,arg2);
}

代码示例来源:origin: com.vividsolutions/jts

/**
 * Tests whether this geometry crosses the
 * argument geometry.
 * <p>
 * The <code>crosses</code> predicate has the following equivalent definitions:
 * <ul>
 * <li>The geometries have some but not all interior points in common.
 * <li>The DE-9IM Intersection Matrix for the two geometries matches
 * one of the following patterns:
 *   <ul>
 *    <li><code>[T*T******]</code> (for P/L, P/A, and L/A situations)
 *    <li><code>[T*****T**]</code> (for L/P, A/P, and A/L situations)
 *    <li><code>[0********]</code> (for L/L situations)
 *   </ul>
 * </ul>
 * For any other combination of dimensions this predicate returns <code>false</code>.
 * <p>
 * The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations.
 * In order to make the relation symmetric,
 * JTS extends the definition to apply to L/P, A/P and A/L situations as well.
 *
 *@param  g  the <code>Geometry</code> with which to compare this <code>Geometry</code>
 *@return        <code>true</code> if the two <code>Geometry</code>s cross.
 */
public boolean crosses(Geometry g) {
 // short-circuit test
 if (! getEnvelopeInternal().intersects(g.getEnvelopeInternal()))
  return false;
 return relate(g).isCrosses(getDimension(), g.getDimension());
}

代码示例来源:origin: com.vividsolutions/jts

return relate(g).isEquals(getDimension(), g.getDimension());

代码示例来源:origin: org.geotools/gt-main

static public boolean relatePattern(Geometry arg0,Geometry arg1,String arg2)
{
   if (arg0 == null || arg1 == null || arg2 == null) return false;
   Geometry _this = arg0;
   return _this.relate(arg1,arg2);
}

代码示例来源:origin: com.vividsolutions/jts

return relate(g).isContains();

代码示例来源:origin: com.vividsolutions/jts

return relate(g).isIntersects();

代码示例来源:origin: org.orbisgis/h2gis

/**
 * @param a Geometry Geometry.
 * @param b Geometry instance
 * @return 9-character String representation of the 2 geometries IntersectionMatrix
 */
public static String relate(Geometry a,Geometry b) {
  if(a==null || b==null) {
    return null;
  }
  return a.relate(b).toString();
}

代码示例来源:origin: org.geotools/gt-main

static public String relate(Geometry arg0,Geometry arg1)
{
   if (arg0 == null || arg1 == null) return null;
   Geometry _this = arg0;
   return _this.relate(arg1).toString();
}

代码示例来源:origin: org.geotools/gt2-main

static public String relate(Geometry arg0,Geometry arg1)
{
   Geometry _this = arg0;
   return _this.relate(arg1).toString();
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

public static Boolean relate(GeometryType geom1, GeometryType geom2, String intersectionPattern) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return g1.relate(g2, intersectionPattern);
}

代码示例来源:origin: org.teiid/teiid-engine

public static Boolean relate(GeometryType geom1, GeometryType geom2, String intersectionPattern) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return g1.relate(g2, intersectionPattern);
}

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

public static Boolean relate(GeometryType geom1, GeometryType geom2, String intersectionPattern) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return g1.relate(g2, intersectionPattern);
}

代码示例来源:origin: com.vividsolutions/jts-core

/**
 * Default implementation.
 */
public boolean containsProperly(Geometry g)
{
  // since raw relate is used, provide some optimizations
  
 // short-circuit test
 if (! baseGeom.getEnvelopeInternal().contains(g.getEnvelopeInternal()))
  return false;
  
 // otherwise, compute using relate mask
 return baseGeom.relate(g, "T**FF*FF*");
}

代码示例来源:origin: BaseXdb/basex

@Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
  final Geometry geo1 = checkGeo(0, qc);
  final Geometry geo2 = checkGeo(1, qc);
  final byte[] matrix = toToken(exprs[2], qc);
  try {
   return Bln.get(geo1.relate(geo2, Token.string(matrix)));
  } catch(final IllegalArgumentException ex) {
   Util.debug(ex);
   throw GEO_ARG.get(info, matrix);
  }
 }
}

相关文章