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

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

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

Geometry.difference介绍

[英]Computes a Geometry representing the closure of the point-set of the points contained in this Geometry that are not contained in the other Geometry.

If the result is empty, it is an atomic geometry with the dimension of the left-hand input.

Non-empty GeometryCollection arguments are not supported.
[中]计算一个Geometry,表示此Geometry中包含的点集的闭合,该点集不包含在other几何图形中。
如果结果为空,则它是具有左手输入尺寸的原子几何体。
不支持非空GeometryCollection参数。

代码示例

代码示例来源:origin: opentripplanner/OpenTripPlanner

continue;
mainComponent = mainComponent.difference(geom);

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

public void difference(String wktA, String wktB, PrecisionModel pm)
   throws ParseException
 {
  System.out.println("-------------------------------------------");
  System.out.println("Running example using Precision Model = " + pm);
  GeometryFactory fact = new GeometryFactory(pm);
  WKTReader wktRdr = new WKTReader(fact);

  Geometry A = wktRdr.read(wktA);
  Geometry B = wktRdr.read(wktB);
  Geometry C = A.difference(B);

  System.out.println("A intersection B = " + C);
 }
}

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

/**
 * Computes the set-theoretic difference of two {@link Geometry}s, using enhanced precision.
 * @param geom0 the first Geometry
 * @param geom1 the second Geometry, to be subtracted from the first
 * @return the Geometry representing the set-theoretic difference of the input Geometries.
 */
public Geometry difference(Geometry geom0, Geometry geom1)
{
 Geometry[] geom = removeCommonBits(geom0, geom1);
 return computeResultPrecision(geom[0].difference(geom[1]));
}

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

public static Geometry lineStringSelfIntersections(LineString line)
{
 Geometry lineEndPts = getEndPoints(line);
 Geometry nodedLine = line.union(lineEndPts);
 Geometry nodedEndPts = getEndPoints(nodedLine);
 Geometry selfIntersections = nodedEndPts.difference(lineEndPts);
 return selfIntersections;
}

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

Geometry result = geom0.difference(geom1);
return result;

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

/**
   * @param a Geometry instance.
   * @param b Geometry instance
   * @return the difference between two geometries
   */
  public static Geometry difference(Geometry a,Geometry b) {
    if(a==null || b==null) {
      return null;
    }
    return a.difference(b);
  }
}

代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit

public static Geometry difference(Geometry a, Geometry b)
{
 return a.difference(b);
}

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

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

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

static public Geometry difference(Geometry arg0,Geometry arg1)
{
   Geometry _this = arg0;
   return _this.difference(arg1);
}

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

/**
   * @param a Geometry instance.
   * @param b Geometry instance
   * @return the difference between two geometries
   */
  public static Geometry difference(Geometry a,Geometry b) {
    if(a==null || b==null) {
      return null;
    }
    return a.difference(b);
  }
}

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

/**
   * @param a Geometry instance.
   * @param b Geometry instance
   * @return the difference between two geometries
   */
  public static Geometry difference(Geometry a,Geometry b) {
    if(a==null || b==null) {
      return null;
    }
    return a.difference(b);
  }
}

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

public void difference(String wktA, String wktB, PrecisionModel pm)
   throws ParseException
 {
  System.out.println("-------------------------------------------");
  System.out.println("Running example using Precision Model = " + pm);
  GeometryFactory fact = new GeometryFactory(pm);
  WKTReader wktRdr = new WKTReader(fact);

  Geometry A = wktRdr.read(wktA);
  Geometry B = wktRdr.read(wktB);
  Geometry C = A.difference(B);

  System.out.println("A intersection B = " + C);
 }
}

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

/**
 * Computes the set-theoretic difference of two {@link Geometry}s, using enhanced precision.
 * @param geom0 the first Geometry
 * @param geom1 the second Geometry, to be subtracted from the first
 * @return the Geometry representing the set-theoretic difference of the input Geometries.
 */
public Geometry difference(Geometry geom0, Geometry geom1)
{
 Geometry[] geom = removeCommonBits(geom0, geom1);
 return computeResultPrecision(geom[0].difference(geom[1]));
}

代码示例来源:origin: com.googlecode.jaitools/jt-utils

@Override
public ROI subtract(ROI roi) {
  final Geometry geom = getGeometry(roi);
  if (geom != null) {
    return new ROIGeometry(theGeom.getGeometry().difference(geom));
  }
  throw new UnsupportedOperationException(UNSUPPORTED_ROI_TYPE);
}

代码示例来源:origin: Stratio/cassandra-lucene-index

/**
 * Returns the difference of the specified shapes.
 *
 * @return the difference
 */
@Override
public JtsGeometry apply() {
  Geometry result = shapes.get(0).apply().getGeom();
  for (int i = 1; i < shapes.size(); i++) {
    result = result.difference(shapes.get(i).apply().getGeom());
  }
  return CONTEXT.makeShape(result);
}

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

public static GeometryType difference(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return getGeometryType(g1.difference(g2));
}

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

@Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
  return toElement(checkGeo(0, qc).difference(checkGeo(1, qc)), qc);
 }
}

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

public static Geometry lineStringSelfIntersections(LineString line)
{
 Geometry lineEndPts = getEndPoints(line);
 Geometry nodedLine = line.union(lineEndPts);
 Geometry nodedEndPts = getEndPoints(nodedLine);
 Geometry selfIntersections = nodedEndPts.difference(lineEndPts);
 return selfIntersections;
}

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

public static GeometryType difference(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return getGeometryType(g1.difference(g2), geom1.getSrid());
}

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

public static GeometryType difference(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return getGeometryType(g1.difference(g2), geom1.getSrid());
}

相关文章