本文整理了Java中org.locationtech.jts.geom.Point.getCoordinate()
方法的一些代码示例,展示了Point.getCoordinate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.getCoordinate()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Point
类名称:Point
方法名:getCoordinate
暂无
代码示例来源:origin: prestodb/presto
private static void writePoint(Point point, SliceOutput output)
{
output.writeByte(GeometrySerializationType.POINT.code());
if (!point.isEmpty()) {
writeCoordinate(point.getCoordinate(), output);
}
else {
output.writeDouble(NaN);
output.writeDouble(NaN);
}
}
代码示例来源:origin: geotools/geotools
public Object getProperty(Object object, QName name) throws Exception {
Point point = (Point) object;
if (GML.coord.equals(name)) {
return point.getCoordinate();
}
return null;
}
}
代码示例来源:origin: hibernate/hibernate-orm
Coordinate coordinate = event.getLocation().getCoordinate();
assertEquals( 10.0d, coordinate.getOrdinate( Coordinate.X), 0.1);
assertEquals( 5.0d, coordinate.getOrdinate( Coordinate.Y), 0.1);
.getSingleResult();
Coordinate coordinate = event.getLocation().getCoordinate();
assertEquals( 10.0d, coordinate.getOrdinate( Coordinate.X), 0.1);
assertEquals( 5.0d, coordinate.getOrdinate( Coordinate.Y), 0.1);
代码示例来源:origin: mapsforge/mapsforge
/**
* @param geometry the JTS {@link Geometry} object
* @return the centroid of the given geometry
*/
public static LatLong computeCentroid(Geometry geometry) {
Point centroid = geometry.getCentroid();
if (centroid != null) {
return new LatLong(centroid.getCoordinate().y, centroid.getCoordinate().x);
}
return null;
}
代码示例来源:origin: geotools/geotools
protected LineSegment alterLine(LineSegment line, Node n1, Node n2) {
Point c1added = ((Point) n1.getObject());
Point c2added = ((Point) n2.getObject());
if (!c1added.getCoordinate().equals(line.p0) || c2added.getCoordinate().equals(line.p1)) {
line = new LineSegment(c1added.getCoordinate(), c2added.getCoordinate());
}
return line;
}
代码示例来源:origin: geotools/geotools
public Object evaluate(Object feature) {
Geometry arg0;
try { // attempt to get value and perform conversion
arg0 = (Geometry) getExpression(0).evaluate(feature);
} catch (Exception e) // probably a type error
{
throw new IllegalArgumentException(
"Filter Function problem for function getZ argument #0 - expected type Geometry");
}
return new Double(arg0.getCentroid().getCoordinate().z);
}
}
代码示例来源:origin: geotools/geotools
/**
* Gets a point to represent the Geometry. If the Geometry is a point, this is returned.
* Otherwise, the centroid is used.
*
* @param g the geometry to find a point for
* @return a point representing the Geometry
*/
private static Coordinate getPoint(Geometry g) {
if (g.getNumPoints() == 1) return g.getCoordinate();
return g.getCentroid().getCoordinate();
}
代码示例来源:origin: geotools/geotools
public DBObject toObject(Point p) {
return BasicDBObjectBuilder.start()
.add("type", "Point")
.add("coordinates", toList(p.getCoordinate()))
.get();
}
代码示例来源:origin: geotools/geotools
public void testPos() throws Exception {
document.appendChild(GML3MockData.linearRingWithPos(document, null));
LinearRing line = (LinearRing) parse();
assertNotNull(line);
assertEquals(new Coordinate(1d, 2d), line.getPointN(0).getCoordinate());
assertEquals(new Coordinate(3d, 4d), line.getPointN(1).getCoordinate());
assertEquals(new Coordinate(5d, 6d), line.getPointN(2).getCoordinate());
assertEquals(new Coordinate(1d, 2d), line.getPointN(3).getCoordinate());
}
代码示例来源:origin: geotools/geotools
public void testPosList() throws Exception {
document.appendChild(GML3MockData.linearRingWithPosList(document, null));
LinearRing line = (LinearRing) parse();
assertNotNull(line);
assertEquals(new Coordinate(1d, 2d), line.getPointN(0).getCoordinate());
assertEquals(new Coordinate(3d, 4d), line.getPointN(1).getCoordinate());
assertEquals(new Coordinate(5d, 6d), line.getPointN(2).getCoordinate());
assertEquals(new Coordinate(1d, 2d), line.getPointN(3).getCoordinate());
}
代码示例来源:origin: geotools/geotools
public void testPosList() throws Exception {
document.appendChild(GML3MockData.lineStringWithPosList(document, null));
LineString line = (LineString) parse();
assertNotNull(line);
assertEquals(new Coordinate(1d, 2d), line.getPointN(0).getCoordinate());
assertEquals(new Coordinate(3d, 4d), line.getPointN(1).getCoordinate());
}
代码示例来源:origin: geotools/geotools
public void testPos() throws Exception {
document.appendChild(GML3MockData.lineStringWithPos(document, null));
LineString line = (LineString) parse();
assertNotNull(line);
assertEquals(new Coordinate(1d, 2d), line.getPointN(0).getCoordinate());
assertEquals(new Coordinate(3d, 4d), line.getPointN(1).getCoordinate());
}
代码示例来源:origin: geotools/geotools
public void testPos3D() throws Exception {
document.appendChild(GML3MockData.linearRingWithPos3D(document, null, true));
LinearRing line = (LinearRing) parse();
assertNotNull(line);
assertTrue(new Coordinate(1d, 2d, 10d).equals3D(line.getPointN(0).getCoordinate()));
assertTrue(new Coordinate(3d, 4d, 20d).equals3D(line.getPointN(1).getCoordinate()));
assertTrue(new Coordinate(5d, 6d, 30d).equals3D(line.getPointN(2).getCoordinate()));
assertTrue(new Coordinate(1d, 2d, 10d).equals3D(line.getPointN(3).getCoordinate()));
}
代码示例来源:origin: geotools/geotools
public void testPosList3D() throws Exception {
document.appendChild(GML3MockData.linearRingWithPosList3D(document, null, true));
LinearRing line = (LinearRing) parse();
assertNotNull(line);
assertTrue(new Coordinate(1d, 2d, 10d).equals3D(line.getPointN(0).getCoordinate()));
assertTrue(new Coordinate(3d, 4d, 20d).equals3D(line.getPointN(1).getCoordinate()));
assertTrue(new Coordinate(5d, 6d, 30d).equals3D(line.getPointN(2).getCoordinate()));
assertTrue(new Coordinate(1d, 2d, 10d).equals3D(line.getPointN(3).getCoordinate()));
}
}
代码示例来源:origin: geotools/geotools
public void testPosList3D() throws Exception {
document.appendChild(GML3MockData.lineStringWithPosList3D(document, null));
LineString line = (LineString) parse();
assertNotNull(line);
assertTrue(new Coordinate(1d, 2d, 10d).equals3D(line.getPointN(0).getCoordinate()));
assertTrue(new Coordinate(3d, 4d, 20d).equals3D(line.getPointN(1).getCoordinate()));
}
代码示例来源:origin: geotools/geotools
public void testPos3D() throws Exception {
document.appendChild(GML3MockData.lineStringWithPos3D(document, null));
LineString line = (LineString) parse();
assertNotNull(line);
assertTrue(new Coordinate(1d, 2d, 10d).equals3D(line.getPointN(0).getCoordinate()));
assertTrue(new Coordinate(3d, 4d, 20d).equals3D(line.getPointN(1).getCoordinate()));
}
代码示例来源:origin: geotools/geotools
public void testPos() throws Exception {
GML3MockData.point(document, document);
Point p = (Point) parse();
assertNotNull(p);
assertEquals(new Coordinate(1d, 2d), p.getCoordinate());
assertTrue(p.getUserData() instanceof CoordinateReferenceSystem);
}
代码示例来源:origin: geotools/geotools
public void test3D() throws Exception {
GML3MockData.multiLineString3D(document, document);
MultiLineString multiLineString = (MultiLineString) parse();
assertNotNull(multiLineString);
assertEquals(2, multiLineString.getNumGeometries());
LineString line = (LineString) multiLineString.getGeometryN(0);
assertTrue(new Coordinate(1d, 2d, 10d).equals3D(line.getPointN(0).getCoordinate()));
assertTrue(new Coordinate(3d, 4d, 20d).equals3D(line.getPointN(1).getCoordinate()));
}
代码示例来源:origin: geotools/geotools
public void testPos3D() throws Exception {
GML3MockData.point3D(document, document);
Point p = (Point) parse();
assertNotNull(p);
assertTrue(new Coordinate(1d, 2d, 10d).equals3D(p.getCoordinate()));
assertTrue(p.getUserData() instanceof CoordinateReferenceSystem);
}
代码示例来源:origin: geotools/geotools
public void test3D() throws Exception {
GML3MockData.multiPoint3D(document, document);
MultiPoint multiPoint = (MultiPoint) parse();
assertNotNull(multiPoint);
assertEquals(4, multiPoint.getNumPoints());
Point p = (Point) multiPoint.getGeometryN(0);
assertTrue(new Coordinate(1d, 2d, 10d).equals3D(p.getCoordinate()));
}
内容来源于网络,如有侵权,请联系作者删除!