本文整理了Java中org.locationtech.jts.geom.Point
类的一些代码示例,展示了Point
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point
类的具体详情如下:
包路径:org.locationtech.jts.geom.Point
类名称:Point
[英]Represents a single point. A Point
is topologically valid if and only if:
NaN
X or Y ordinate)Point
在拓扑上有效:NaN
X或Y坐标)代码示例来源: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: graphhopper/graphhopper
public static GHPoint create(Point point) {
return new GHPoint(point.getY(), point.getX());
}
代码示例来源:origin: geotools/geotools
public CoordinateSequence getCoordinateSequence() {
return point.getCoordinateSequence();
}
代码示例来源: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
/**
* @param point
* @throws TransformException
*/
public Point transformPoint(Point point, GeometryFactory gf) throws TransformException {
// if required, init csTransformer using geometry's CSFactory
init(gf);
CoordinateSequence cs = projectCoordinateSequence(point.getCoordinateSequence());
Point transformed = gf.createPoint(cs);
transformed.setUserData(point.getUserData());
return transformed;
}
代码示例来源:origin: geotools/geotools
public static double getX(Geometry arg0) {
if (!(arg0 instanceof Point)) return 0d;
Point _this = (Point) arg0;
return _this.getX();
}
代码示例来源:origin: geotools/geotools
if (point.getY() >= 0) {
fb.add("N");
} else {
if (wgs84Point.getCoordinate().getOrdinate(fc.northDimension) >= 0) {
fb.add("N");
} else {
代码示例来源:origin: geotools/geotools
public void write(ByteBuffer buffer, Object geometry) {
Point point = (Point) geometry;
Coordinate c = point.getCoordinate();
buffer.putDouble(c.x);
buffer.putDouble(c.y);
if (shapeType == ShapeType.POINTZ) {
if (Double.isNaN(c.z)) { // nan means not defined
buffer.putDouble(0.0);
} else {
buffer.putDouble(c.z);
}
}
if ((shapeType == ShapeType.POINTZ) || (shapeType == ShapeType.POINTM)) {
double m = point.getCoordinateSequence().getM(0);
buffer.putDouble(!Double.isNaN(m) ? m : 0.0); // M
}
}
}
代码示例来源:origin: geotools/geotools
public static double getY(Geometry arg0) {
if (!(arg0 instanceof Point)) return 0d;
Point _this = (Point) arg0;
return _this.getY();
}
代码示例来源: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: locationtech/jts
public boolean equalsExact(Geometry other, double tolerance) {
if (!isEquivalentClass(other)) {
return false;
}
if (isEmpty() && other.isEmpty()) {
return true;
}
if (isEmpty() != other.isEmpty()) {
return false;
}
return equal(((Point) other).getCoordinate(), this.getCoordinate(), tolerance);
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Return a testsuite-suite point (filter, ...)
*
* @return a testsuite-suite point
*/
public Point getTestPoint() {
WKTReader reader = new WKTReader();
try {
Point point = (Point) reader.read( TEST_POINT_WKT );
point.setSRID( getTestSrid() );
return point;
}
catch (ParseException e) {
throw new RuntimeException( e );
}
}
代码示例来源:origin: geotools/geotools
@Test
public void testDecimate3DPoint() throws Exception {
Point p = gf.createPoint(csf.create(new double[] {0, 1, 2}, 3));
Decimator d = new Decimator(identity, new Rectangle(0, 0, 5, 5), 0.8);
d.decimateTransformGeneralize(p, identity);
assertEquals(1, p.getNumPoints());
assertEquals(2, p.getCoordinateSequence().getDimension());
}
代码示例来源:origin: geotools/geotools
/**
* Generates the point.
*
* @param geometryFactory Geometry factory to be used to create the point.
* @return Created Point.
*/
public Geometry create(GeometryFactory geometryFactory) {
Point point = geometryFactory.createPoint(coordinate);
point.setUserData(getSRS());
point.setSRID(getSRID());
return point;
}
}
代码示例来源:origin: locationtech/spatial4j
/** A simple constructor without normalization / validation. */
public JtsPoint(org.locationtech.jts.geom.Point pointGeom, JtsSpatialContext ctx) {
super(ctx);
this.pointGeom = pointGeom;
this.empty = pointGeom.isEmpty();
}
代码示例来源:origin: locationtech/jts
public Object parse(Handler arg, GeometryFactory gf) throws SAXException {
// one child, either a coord
// or a coordinate sequence
if(arg.children.size()!=1)
throw new SAXException("Cannot create a point without exactly one coordinate");
int srid = getSrid(arg.attrs,gf.getSRID());
Object c = arg.children.get(0);
Point p = null;
if(c instanceof Coordinate){
p = gf.createPoint((Coordinate)c);
}else{
p = gf.createPoint((CoordinateSequence)c);
}
if(p.getSRID()!=srid)
p.setSRID(srid);
return p;
}
});
代码示例来源:origin: locationtech/jts
public void apply(CoordinateSequenceFilter filter)
{
if (isEmpty())
return;
filter.filter(coordinates, 0);
if (filter.isGeometryChanged())
geometryChanged();
}
代码示例来源:origin: locationtech/jts
public Coordinate[] getCoordinates() {
return isEmpty() ? new Coordinate[]{} : new Coordinate[]{
getCoordinate()
};
}
代码示例来源:origin: geotools/geotools
public double getX() {
return point.getX();
}
代码示例来源:origin: geotools/geotools
public double getY() {
return point.getY();
}
内容来源于网络,如有侵权,请联系作者删除!