本文整理汇总了Java中com.vividsolutions.jts.geom.Point.getX方法的典型用法代码示例。如果您正苦于以下问题:Java Point.getX方法的具体用法?Java Point.getX怎么用?Java Point.getX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geom.Point
的用法示例。
在下文中一共展示了Point.getX方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findClosestAmbulatory
import com.vividsolutions.jts.geom.Point; //导入方法依赖的package包/类
public static Hospital findClosestAmbulatory(Point personLocation) {
double personLat = personLocation.getY();
double personLong = personLocation.getX();
double closestDistance = Double.MAX_VALUE;
Provider closestHospital = null;
for (Provider p : Provider.getServices().get(Provider.AMBULATORY)) {
Point hospitalLocation = p.getCoordinates();
double hospitalLat = hospitalLocation.getY();
double hospitalLong = hospitalLocation.getX();
double sphericalDistance = haversine(personLat, personLong, hospitalLat, hospitalLong);
if (sphericalDistance < closestDistance) {
closestDistance = sphericalDistance;
closestHospital = p;
}
}
return (Hospital) closestHospital;
}
示例2: findClosestInpatient
import com.vividsolutions.jts.geom.Point; //导入方法依赖的package包/类
public static Hospital findClosestInpatient(Point personLocation) {
double personLat = personLocation.getY();
double personLong = personLocation.getX();
double closestDistance = Double.MAX_VALUE;
Provider closestHospital = null;
for (Provider p : Provider.getServices().get(Provider.INPATIENT)) {
Point hospitalLocation = p.getCoordinates();
double hospitalLat = hospitalLocation.getY();
double hospitalLong = hospitalLocation.getX();
double sphericalDistance = haversine(personLat, personLong, hospitalLat, hospitalLong);
if (sphericalDistance < closestDistance) {
closestDistance = sphericalDistance;
closestHospital = p;
}
}
return (Hospital) closestHospital;
}
示例3: findClosestEmergency
import com.vividsolutions.jts.geom.Point; //导入方法依赖的package包/类
public static Hospital findClosestEmergency(Point personLocation) {
double personLat = personLocation.getY();
double personLong = personLocation.getX();
double closestDistance = Double.MAX_VALUE;
Provider closestHospital = null;
for (Provider p : Provider.getServices().get(Provider.EMERGENCY)) {
Point hospitalLocation = p.getCoordinates();
double hospitalLat = hospitalLocation.getY();
double hospitalLong = hospitalLocation.getX();
double sphericalDistance = haversine(personLat, personLong, hospitalLat, hospitalLong);
if (sphericalDistance < closestDistance) {
closestDistance = sphericalDistance;
closestHospital = p;
}
}
return (Hospital) closestHospital;
}
示例4: cacheOrQuery
import com.vividsolutions.jts.geom.Point; //导入方法依赖的package包/类
/**
* Cache implementation. Look in the cache first, if miss then query the database.
*
* We only cache Bike or Car legs, and not Walk legs! Walk legs are attached to BikeStationTuple or CarStationTuple
* and therefore are always present in memory.
*/
RouteLeg cacheOrQuery(Point from, GeoCoord to) throws DatabaseException {
GeoCoordTuple key = new GeoCoordTuple(from.getX(), from.getY(), to.getX(), to.getY());
// 1. Look in cache
//
RouteLeg leg = RouteLegCache.SINGLETON.getIfPresent(key);
if (leg != null) {
return leg;
}
GeoCoord fromCoord = BasicUtils.toGeoCoord(from);
// 2. Look in db
//
leg = routeLegRepository.findLegByFromTo(fromCoord, to, getRouteLegClass());
if (leg != null) {
RouteLegCache.SINGLETON.put(key, leg);
return leg;
}
// 3. All options failed. Could not find entity for the coordinates
return null;
}
示例5: equalsPoint
import com.vividsolutions.jts.geom.Point; //导入方法依赖的package包/类
public static boolean equalsPoint(Point first, Point second) {
return first.getX() == second.getX() && first.getY() == second.getY();
}
示例6: toGeoCoord
import com.vividsolutions.jts.geom.Point; //导入方法依赖的package包/类
public static GeoCoord toGeoCoord(Point p) {
return new GeoCoord(p.getX(), p.getY());
}
示例7: isEqualX
import com.vividsolutions.jts.geom.Point; //导入方法依赖的package包/类
private static boolean isEqualX(Point p, GeoCoord gc) {
return p.getX() == gc.getX();
}
示例8: toGeoCoord
import com.vividsolutions.jts.geom.Point; //导入方法依赖的package包/类
private static GeoCoord toGeoCoord(Point geoPos) {
return new GeoCoord(geoPos.getX(), geoPos.getY());
}
示例9: createEnvelope
import com.vividsolutions.jts.geom.Point; //导入方法依赖的package包/类
/**
* Creates an envelop around Point with distance distance
* @param p
* @param distance in units of the p SRID
* @return
*/
public static Envelope createEnvelope(Point p, double distance) {
Envelope env = new Envelope(p.getX() - distance, p.getX() + distance, p.getY() - distance, p.getY() + distance);
return env;
}