本文整理了Java中com.vividsolutions.jts.geom.Geometry.getCoordinate()
方法的一些代码示例,展示了Geometry.getCoordinate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.getCoordinate()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:getCoordinate
[英]Returns a vertex of this Geometry
(usually, but not necessarily, the first one). The returned coordinate should not be assumed to be an actual Coordinate object used in the internal representation.
[中]返回此Geometry
的顶点(通常,但不一定是第一个)。不应假定返回的坐标是内部表示中使用的实际坐标对象。
代码示例来源:origin: com.vividsolutions/jts
public void filter(Geometry geom)
{
if (geom instanceof Point
|| geom instanceof LineString
|| geom instanceof Polygon )
pts.add(geom.getCoordinate());
}
代码示例来源:origin: com.vividsolutions/jts
public void filter(Geometry geom)
{
// add coordinates from connected components
if (geom instanceof LineString
|| geom instanceof Point)
coords.add(geom.getCoordinate());
}
代码示例来源:origin: com.vividsolutions/jts
public void filter(Geometry geom)
{
if (geom instanceof Point
|| geom instanceof LineString
|| geom instanceof Polygon )
locations.add(new GeometryLocation(geom, 0, geom.getCoordinate()));
}
代码示例来源:origin: com.vividsolutions/jts
public Coordinate getCoordinate() {
if (isEmpty()) return null;
return geometries[0].getCoordinate();
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Adds the point(s) defined by a Geometry to the centroid total.
* If the geometry is not of dimension 0 it does not contribute to the centroid.
* @param geom the geometry to add
*/
public void add(Geometry geom)
{
if (geom instanceof Point) {
add(geom.getCoordinate());
}
else if (geom instanceof GeometryCollection) {
GeometryCollection gc = (GeometryCollection) geom;
for (int i = 0; i < gc.getNumGeometries(); i++) {
add(gc.getGeometryN(i));
}
}
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Tests the point(s) defined by a Geometry for the best inside point.
* If a Geometry is not of dimension 0 it is not tested.
* @param geom the geometry to add
*/
private void add(Geometry geom)
{
if (geom instanceof Point) {
add(geom.getCoordinate());
}
else if (geom instanceof GeometryCollection) {
GeometryCollection gc = (GeometryCollection) geom;
for (int i = 0; i < gc.getNumGeometries(); i++) {
add(gc.getGeometryN(i));
}
}
}
private void add(Coordinate point)
代码示例来源:origin: com.vividsolutions/jts
public static void computeDistance(Geometry geom, Coordinate pt, PointPairDistance ptDist)
{
if (geom instanceof LineString) {
computeDistance((LineString) geom, pt, ptDist);
}
else if (geom instanceof Polygon) {
computeDistance((Polygon) geom, pt, ptDist);
}
else if (geom instanceof GeometryCollection) {
GeometryCollection gc = (GeometryCollection) geom;
for (int i = 0; i < gc.getNumGeometries(); i++) {
Geometry g = gc.getGeometryN(i);
computeDistance(g, pt, ptDist);
}
}
else { // assume geom is Point
ptDist.setMinimum(geom.getCoordinate(), pt);
}
}
public static void computeDistance(LineString line, Coordinate pt, PointPairDistance ptDist)
代码示例来源:origin: com.vividsolutions/jts
public static void computeDistance(Geometry geom, Coordinate pt, PointPairDistance ptDist)
{
if (geom instanceof LineString) {
computeDistance((LineString) geom, pt, ptDist);
}
else if (geom instanceof Polygon) {
computeDistance((Polygon) geom, pt, ptDist);
}
else if (geom instanceof GeometryCollection) {
GeometryCollection gc = (GeometryCollection) geom;
for (int i = 0; i < gc.getNumGeometries(); i++) {
Geometry g = gc.getGeometryN(i);
computeDistance(g, pt, ptDist);
}
}
else { // assume geom is Point
ptDist.setMinimum(geom.getCoordinate(), pt);
}
}
public static void computeDistance(LineString line, Coordinate pt, PointPairDistance ptDist)
代码示例来源:origin: DataSystemsLab/GeoSpark
@Override
public Coordinate getCoordinate()
{
return this.centerGeometry.getCoordinate();
}
代码示例来源:origin: org.orbisgis/h2gis-functions
/**
* @param geometry Geometry instance
* @return A z coordinate or null if null or empty geometry.
*/
public static Double getZ(Geometry geometry) {
if(geometry==null) {
return null;
}
return geometry.getCoordinate().z;
}
}
代码示例来源:origin: com.vividsolutions/jts-core
public void filter(Geometry geom)
{
// add coordinates from connected components
if (geom instanceof LineString
|| geom instanceof Point)
coords.add(geom.getCoordinate());
}
代码示例来源:origin: com.vividsolutions/jts-core
public void filter(Geometry geom)
{
if (geom instanceof Point
|| geom instanceof LineString
|| geom instanceof Polygon )
pts.add(geom.getCoordinate());
}
代码示例来源:origin: codice/ddf
@Override
public Map toJsonMap() {
List<Double> coordinatesList = new ArrayList<Double>();
coordinatesList.add(geometry.getCoordinate().x);
coordinatesList.add(geometry.getCoordinate().y);
return createMap(COORDINATES_KEY, coordinatesList);
}
代码示例来源:origin: org.teiid/teiid-engine
public static Integer coordDim(GeometryType geom) throws FunctionExecutionException {
Geometry g = getGeometry(geom);
Coordinate c = g.getCoordinate();
if (c != null && !Double.isNaN(c.z)) {
return 3;
}
return 2;
}
代码示例来源:origin: org.orbisgis/core-map
public static void flashPoint(final Geometry geometry, Graphics2D graphics,
MapTransform mt) {
Point2D p = new Point2D.Double(geometry.getCoordinate().x, geometry
.getCoordinate().y);
p = mt.getAffineTransform().transform(p, null);
int IND_CIRCLE_RADIUS = 20;
Ellipse2D.Double circle = new Ellipse2D.Double(p.getX()
- (IND_CIRCLE_RADIUS / 2), p.getY() - (IND_CIRCLE_RADIUS / 2),
IND_CIRCLE_RADIUS, IND_CIRCLE_RADIUS);
flash(circle, graphics, Color.red, new BasicStroke(1,
BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND), 1000);
}
代码示例来源:origin: org.wikibrainapi/wikibrain-spatial
public double getDistance(Geometry a, Geometry b){
GeodeticCalculator geoCalc = new GeodeticCalculator();
geoCalc.setStartingGeographicPoint(a.getCoordinate().x, a.getCoordinate().y);
geoCalc.setDestinationGeographicPoint(b.getCoordinate().x, b.getCoordinate().y);
return geoCalc.getOrthodromicDistance() / 1000;
}
代码示例来源:origin: teiid/teiid
public static Integer coordDim(GeometryType geom) throws FunctionExecutionException {
Geometry g = getGeometry(geom);
Coordinate c = g.getCoordinate();
if (c != null && !Double.isNaN(c.z)) {
return 3;
}
return 2;
}
代码示例来源:origin: org.jboss.teiid/teiid-engine
public static Integer coordDim(GeometryType geom) throws FunctionExecutionException {
Geometry g = getGeometry(geom);
Coordinate c = g.getCoordinate();
if (c != null && !Double.isNaN(c.z)) {
return 3;
}
return 2;
}
代码示例来源:origin: BaseXdb/basex
@Override
public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
return Dbl.get(geo(0, qc, POINT, Q_GML_POINT).getCoordinate().y);
}
}
代码示例来源:origin: BaseXdb/basex
@Override
public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
return Dbl.get(geo(0, qc, POINT, Q_GML_POINT).getCoordinate().x);
}
}
内容来源于网络,如有侵权,请联系作者删除!