本文整理了Java中com.vividsolutions.jts.geom.Point.getX()
方法的一些代码示例,展示了Point.getX()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.getX()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Point
类名称:Point
方法名:getX
暂无
代码示例来源:origin: opentripplanner/OpenTripPlanner
/**
* Check if a point is within an epsilon of a node.
* @param p
* @param n
* @param epsilon
* @return
*/
private static boolean checkIntersectionDistance(Point p, OSMNode n, double epsilon) {
return Math.abs(p.getY() - n.lat) < epsilon && Math.abs(p.getX() - n.lon) < epsilon;
}
代码示例来源:origin: opentripplanner/OpenTripPlanner
input = n.doubleValue();
Individual individual = new Individual(label, point.getX(), point.getY(), input);
this.addIndividual(individual);
i += 1;
代码示例来源:origin: opentripplanner/OpenTripPlanner
double x = tilePoint.getX();
if (x + labelWidth > context.tileWidth)
x -= labelWidth;
代码示例来源:origin: opentripplanner/OpenTripPlanner
public void setGeom(Geometry geom) throws EmptyPolygonException, UnsupportedGeometryException {
if (geom instanceof MultiPolygon) {
if (geom.isEmpty()) {
throw new EmptyPolygonException();
}
if (geom.getNumGeometries() > 1) {
// LOG.warn("Multiple polygons in MultiPolygon, using only the first.");
// TODO percolate this warning up somehow
}
this.geom = geom.getGeometryN(0);
} else if( geom instanceof Point || geom instanceof Polygon){
this.geom = geom;
} else {
throw new UnsupportedGeometryException( "Non-point, non-polygon Geometry, not supported." );
}
// cache a representative point
Point point = geom.getCentroid();
this.lat = point.getY();
this.lon = point.getX();
}
代码示例来源:origin: komoot/photon
@Override
public TagFilterQueryBuilder withLocationBias(Point point, double scale) {
if (point == null) return this;
Map<String, Object> params = newHashMap();
params.put("lon", point.getX());
params.put("lat", point.getY());
scale = Math.abs(scale);
String strCode = "double dist = doc['coordinate'].planeDistance(params.lat, params.lon); " +
"double score = 0.1 + " + scale + " / (1.0 + dist * 0.001 / 10.0); " +
"score";
ScriptScoreFunctionBuilder builder = ScoreFunctionBuilders.scriptFunction(new Script(ScriptType.INLINE, "painless", strCode, params));
m_alFilterFunction4QueryBuilder.add(new FilterFunctionBuilder(builder));
m_finalQueryWithoutTagFilterBuilder =
new FunctionScoreQueryBuilder(m_query4QueryBuilder, m_alFilterFunction4QueryBuilder.toArray(new FilterFunctionBuilder[0]))
.boostMode(CombineFunction.MULTIPLY);
return this;
}
代码示例来源:origin: komoot/photon
@Override
public QueryBuilder buildQuery() {
QueryBuilder fb = QueryBuilders.geoDistanceQuery("coordinate").point(location.getY(), location.getX())
.distance(radius, DistanceUnit.KILOMETERS);
BoolQueryBuilder finalQuery;
if (queryStringFilter != null && queryStringFilter.trim().length() > 0)
finalQuery = QueryBuilders.boolQuery().must(QueryBuilders.queryStringQuery(queryStringFilter)).filter(fb);
else
finalQuery = QueryBuilders.boolQuery().must(QueryBuilders.matchAllQuery()).filter(fb);
return finalQuery;
}
代码示例来源:origin: komoot/photon
@Override
public SearchResponse search(QueryBuilder queryBuilder, Integer limit, Point location,
Boolean locationDistanceSort) {
TimeValue timeout = TimeValue.timeValueSeconds(7);
SearchRequestBuilder builder = client.prepareSearch("photon").setSearchType(SearchType.QUERY_AND_FETCH)
.setQuery(queryBuilder).setSize(limit).setTimeout(timeout);
if (locationDistanceSort)
builder.addSort(SortBuilders.geoDistanceSort("coordinate", new GeoPoint(location.getY(), location.getX()))
.order(SortOrder.ASC));
return builder.execute().actionGet();
}
}
代码示例来源:origin: org.geotools/gt-main
static public double getX(Geometry arg0)
{
if (!(arg0 instanceof Point)) return 0d;
Point _this = (Point) arg0;
return _this.getX();
}
代码示例来源:origin: org.wicketstuff/wicketstuff-openlayers
/**
* Returns the longitude for this coordinate.
*
* @return Longitude value
*/
public double getLng()
{
return point.getX();
}
代码示例来源:origin: komoot/photon
public static XContentBuilder convert(PhotonDoc doc, String[] languages) throws IOException {
XContentBuilder builder = XContentFactory.jsonBuilder().startObject()
.field(Constants.OSM_ID, doc.getOsmId())
.field(Constants.OSM_TYPE, doc.getOsmType())
.field(Constants.OSM_KEY, doc.getTagKey())
.field(Constants.OSM_VALUE, doc.getTagValue())
.field(Constants.IMPORTANCE, doc.getImportance());
if (doc.getCentroid() != null) {
builder.startObject("coordinate")
.field("lat", doc.getCentroid().getY())
.field("lon", doc.getCentroid().getX())
.endObject();
}
if (doc.getHouseNumber() != null) {
builder.field("housenumber", doc.getHouseNumber());
}
if (doc.getPostcode() != null) {
builder.field("postcode", doc.getPostcode());
}
writeName(builder, doc.getName(), languages);
writeIntlNames(builder, doc.getCity(), "city", languages);
writeIntlNames(builder, doc.getCountry(), "country", languages);
writeIntlNames(builder, doc.getState(), "state", languages);
writeIntlNames(builder, doc.getStreet(), "street", languages);
writeContext(builder, doc.getContext(), languages);
writeExtent(builder, doc.getBbox());
builder.endObject();
return builder;
}
代码示例来源:origin: DataSystemsLab/GeoSpark
private boolean covers(Point point)
{
double deltaX = point.getX() - centerPoint.x;
double deltaY = point.getY() - centerPoint.y;
return (deltaX * deltaX + deltaY * deltaY) <= radius * radius;
}
代码示例来源:origin: org.geotools/gt2-main
/**
* @see java.awt.geom.PathIterator#currentSegment(double[])
*/
public int currentSegment(double[] coords) {
coords[0] = point.getX();
coords[1] = point.getY();
at.transform(coords, 0, coords, 0, 1);
return SEG_MOVETO;
}
代码示例来源:origin: com.eas.platypus/platypus-js-common-utils
public static LineString createLineString(Point begPoint, Point endPoint) {
Coordinate[] coordinates = new Coordinate[2];
coordinates[0] = new Coordinate(begPoint.getX(), begPoint.getY());
coordinates[1] = new Coordinate(endPoint.getX(), endPoint.getY());
CoordinateSequence cSeq = csFactory.create(coordinates);
return new LineString(cSeq, gFactory);
}
代码示例来源:origin: DataSystemsLab/GeoSpark
private static byte[] serialize(Point point)
{
ByteBuffer buffer = newBuffer(POINT_LENGTH);
putType(buffer, ShapeType.POINT);
buffer.putDouble(point.getX());
buffer.putDouble(point.getY());
return buffer.array();
}
代码示例来源:origin: DataSystemsLab/GeoSpark
private static void putPoints(ByteBuffer buffer, LineString geometry)
{
int numPoints = geometry.getNumPoints();
for (int i = 0; i < numPoints; i++) {
Point point = geometry.getPointN(i);
buffer.putDouble(point.getX());
buffer.putDouble(point.getY());
}
}
代码示例来源:origin: org.geoserver.web/web-core
private void updateFields() {
Point p = (Point) getModelObject();
if(p != null) {
this.x = p.getX();
this.y = p.getY();
}
}
代码示例来源:origin: matsim-org/matsim
/**
* Converts a Geotools <code>Point</code> into a MATSim {@link org.matsim.api.core.v01.Coord}
* @param point Geotools point
* @return MATSim coordinate
*/
public static Coord point2Coord(final Point point) {
return new Coord(point.getX(), point.getY());
}
代码示例来源:origin: org.wikibrainapi/wikibrain-spatial
public static LatLonPrecision getLatLonPrecision(Point p){
if (hasSigDigitsAfterDecimal(p.getX()) || hasSigDigitsAfterDecimal(p.getY())){
return LatLonPrecision.HIGH;
}else{
return LatLonPrecision.LOW;
}
}
代码示例来源:origin: org.geotools/gt2-xml-gml3
public Object getProperty(Object object, QName name) {
if (GML.pos.equals(name)) {
Point point = (Point) object;
DirectPosition2D dp = new DirectPosition2D();
dp.setOrdinate(0, point.getX());
dp.setOrdinate(1, point.getY());
return dp;
}
return null;
}
}
代码示例来源:origin: org.geoserver/wms
public void encode(Geometry g, GeoRSSTranslatorSupport t) {
//encode the centroid
Point p = g.getCentroid();
t.element("geo:lat", "" + p.getY());
t.element("geo:long", "" + p.getX());
}
};
内容来源于网络,如有侵权,请联系作者删除!