當前位置: 首頁>>代碼示例>>Java>>正文


Java Point.getX方法代碼示例

本文整理匯總了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;
}
 
開發者ID:synthetichealth,項目名稱:synthea_java,代碼行數:19,代碼來源:Hospital.java

示例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;
}
 
開發者ID:synthetichealth,項目名稱:synthea_java,代碼行數:19,代碼來源:Hospital.java

示例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;
}
 
開發者ID:synthetichealth,項目名稱:synthea_java,代碼行數:19,代碼來源:Hospital.java

示例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;
}
 
開發者ID:RWTH-i5-IDSG,項目名稱:xsharing-services-router,代碼行數:31,代碼來源:AbstractModeStrategy.java

示例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();
}
 
開發者ID:graphium-project,項目名稱:graphium,代碼行數:4,代碼來源:GeoHelper.java

示例6: toGeoCoord

import com.vividsolutions.jts.geom.Point; //導入方法依賴的package包/類
public static GeoCoord toGeoCoord(Point p) {
    return new GeoCoord(p.getX(), p.getY());
}
 
開發者ID:RWTH-i5-IDSG,項目名稱:xsharing-services-router,代碼行數:4,代碼來源:BasicUtils.java

示例7: isEqualX

import com.vividsolutions.jts.geom.Point; //導入方法依賴的package包/類
private static boolean isEqualX(Point p, GeoCoord gc) {
    return p.getX() == gc.getX();
}
 
開發者ID:RWTH-i5-IDSG,項目名稱:xsharing-services-router,代碼行數:4,代碼來源:BasicUtils.java

示例8: toGeoCoord

import com.vividsolutions.jts.geom.Point; //導入方法依賴的package包/類
private static GeoCoord toGeoCoord(Point geoPos) {
    return new GeoCoord(geoPos.getX(), geoPos.getY());
}
 
開發者ID:RWTH-i5-IDSG,項目名稱:xsharing-services-router,代碼行數:4,代碼來源:EsriFactory.java

示例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;
}
 
開發者ID:graphium-project,項目名稱:graphium,代碼行數:11,代碼來源:GeometryUtils.java


注:本文中的com.vividsolutions.jts.geom.Point.getX方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。