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

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

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

Geometry.getGeometryType介绍

[英]Returns the name of this Geometry's actual class.
[中]返回此几何体的实际类的名称。

代码示例

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

private void write(Geometry geom, Writer writer, int level)
    throws IOException 
    {
  isRootTag = true;
  if (geom instanceof Point) {
    writePoint((Point) geom, writer, level);
  } else if (geom instanceof LineString) {
    writeLineString((LineString) geom, writer, level);
  } else if (geom instanceof Polygon) {
    writePolygon((Polygon) geom, writer, level);
  } else if (geom instanceof MultiPoint) {
    writeMultiPoint((MultiPoint) geom, writer, level);
  } else if (geom instanceof MultiLineString) {
    writeMultiLineString((MultiLineString) geom, writer, level);
  } else if (geom instanceof MultiPolygon) {
    writeMultiPolygon((MultiPolygon) geom, writer, level);
  } else if (geom instanceof GeometryCollection) {
    writeGeometryCollection((GeometryCollection) geom, writer,
        startingIndentIndex);
  } else {
    throw new IllegalArgumentException("Unhandled geometry type: "
        + geom.getGeometryType());
  }
  writer.flush();
}

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

/**
   * @param geometry Geometry instance
   * @return Geometry type equivalent to {@link com.vividsolutions.jts.geom.Geometry#getGeometryType()}
   */
  public static String getGeometryType(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.getGeometryType();
  }
}

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

static public String geometryType(Geometry arg0)
{
   if (arg0 == null) return null;
   Geometry _this = arg0;
   return _this.getGeometryType();
}

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

static public String geometryType(Geometry arg0)
{
   Geometry _this = arg0;
   return _this.getGeometryType();
}

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

/**
   * @param geometry Geometry instance
   * @return Geometry type equivalent to {@link com.vividsolutions.jts.geom.Geometry#getGeometryType()}
   */
  public static String getGeometryType(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.getGeometryType();
  }
}

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

/**
   * @param geometry Geometry instance
   * @return Geometry type equivalent to {@link com.vividsolutions.jts.geom.Geometry#getGeometryType()}
   */
  public static String getGeometryType(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.getGeometryType();
  }
}

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

/**
 * Tests if the geometry is a MultiPoint.
 * @param geometry
 * @return
 */
public static boolean isMultiPoint(Geometry geometry) {
  return geometry.getGeometryType().equals(MULTIPOINT_GEOMETRY_TYPE);
}

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

/**
 * Tests if the geometry is a MultiPolygon.
 * @param geometry
 * @return
 */
public static boolean isMultiPolygon(Geometry geometry) {
  return geometry.getGeometryType().equals(MULTIPOLYGON_GEOMETRY_TYPE);
}

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

/**
 * Tests if the geometry is a Point.
 * @param geometry
 * @return
 */
public static boolean isPoint(Geometry geometry) {
  return geometry.getGeometryType().equals(POINT_GEOMETRY_TYPE);
}

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

/**
 * Tests if the geometry is a LineString.
 * @param geometry
 * @return
 */
public static boolean isLineString(Geometry geometry) {
  return geometry.getGeometryType().equals(LINESTRING_GEOMETRY_TYPE);
}

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

/**
 * Tests if the geometry is a LinearRing.
 * @param geometry
 * @return
 */
public static boolean isLinearRing(Geometry geometry) {
  return geometry.getGeometryType().equals(LINEARRING_GEOMETRY_TYPE);
}

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

/**
 * Tests if the geometry is a Polygon.
 * @param geometry
 * @return
 */
public static boolean isPolygon(Geometry geometry) {
  return geometry.getGeometryType().equals(POLYGON_GEOMETRY_TYPE);
}

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

/**
 * Tests if the geometry is a MultiPoint.
 * @param geometry
 * @return
 */
public static boolean isMultiLineString(Geometry geometry) {
  return geometry.getGeometryType().equals(MULTILINESTRING_GEOMETRY_TYPE);
}

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

/**
 * Tests if the geometry is a GeometryCollection.
 * @param geometry
 * @return
 */
public static boolean isGeometryCollection(Geometry geometry) {
  return geometry.getGeometryType().equals(GEOMETRYCOLLECTION_GEOMETRY_TYPE);
}

代码示例来源:origin: net.disy.wps/wps-samples

private String getType(Geometry geometry) {
 if (geometry instanceof Point) {
  return "point"; //$NON-NLS-1$
 }
 if (geometry instanceof LineString) {
  return "polyline"; //$NON-NLS-1$
 }
 throw new IllegalArgumentException("Type '" //$NON-NLS-1$
   + geometry.getGeometryType()
   + "' is not supported."); //$NON-NLS-1$
}

代码示例来源:origin: sinergise/Sentinel2ProductIngestor

public Geometry getCoverage(double bufferSize) throws Exception {
  Geometry geom =   bufferSize == 0 ? coveragesIntersection : coveragesIntersection == null ? null : shrink(coveragesIntersection, bufferSize);
  if (!(geom instanceof Polygon || geom instanceof MultiPolygon)) {
    logger.error("The result of buffering should be a polygon or multipolygon, its {} instead.",
        geom.getGeometryType());
    System.out.println(geom.toText());
    throw new Exception("The result of buffering should be a polygon or multipolygon, its "
        + geom.getGeometryType() + " instead.");
  }
  return geom;
}

代码示例来源:origin: codice/ddf

@Override
public Map toJsonMap() {
 Map map = new HashMap();
 if (TYPE.equals(geometry.getGeometryType())) {
  map.put(TYPE_KEY, TYPE);
  List linearRingsList = buildJsonPolygon((com.vividsolutions.jts.geom.Polygon) geometry);
  map.put(COORDINATES_KEY, linearRingsList);
 } else {
  throw new UnsupportedOperationException("Geometry is not a " + TYPE);
 }
 return map;
}

代码示例来源:origin: DataSystemsLab/GeoSpark

@Override
public boolean equalsExact(Geometry g, double tolerance)
{
  String type1 = this.getGeometryType();
  String type2 = ((Geometry) g).getGeometryType();
  double radius1 = this.radius;
  double radius2 = ((Circle) g).radius;
  if (type1 != type2) { return false; }
  if (radius1 != radius2) { return false; }
  return this.centerGeometry.equals(((Circle) g).centerGeometry);
}

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

@Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
  return new QNm(GML, checkGeo(0, qc).getGeometryType(), URI);
 }
}

代码示例来源:origin: org.datasyslab/geospark

@Override
public boolean equalsExact(Geometry g, double tolerance)
{
  String type1 = this.getGeometryType();
  String type2 = ((Geometry) g).getGeometryType();
  double radius1 = this.radius;
  double radius2 = ((Circle) g).radius;
  if (type1 != type2) { return false; }
  if (radius1 != radius2) { return false; }
  return this.centerGeometry.equals(((Circle) g).centerGeometry);
}

相关文章