本文整理匯總了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;
}