当前位置: 首页>>代码示例>>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;未经允许,请勿转载。