当前位置: 首页>>代码示例>>Java>>正文


Java LatLng.getLongitude方法代码示例

本文整理汇总了Java中com.javadocmd.simplelatlng.LatLng.getLongitude方法的典型用法代码示例。如果您正苦于以下问题:Java LatLng.getLongitude方法的具体用法?Java LatLng.getLongitude怎么用?Java LatLng.getLongitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.javadocmd.simplelatlng.LatLng的用法示例。


在下文中一共展示了LatLng.getLongitude方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RectangularWindow

import com.javadocmd.simplelatlng.LatLng; //导入方法依赖的package包/类
/**
 * Creates a pseudo-rectangular window. Note: this constructor must not be
 * used with polar coordinates, where the notions of east and west are
 * invalid.
 * 
 * @param northeast
 *            the northeastern corner of this window.
 * @param southwest
 *            the southwestern corner of this window.
 * @throws IllegalArgumentException
 *             if either northeast or southwest are polar coordinates, also
 *             if the northeast point is south of the southwest point.
 */
public RectangularWindow(LatLng northeast, LatLng southwest) {
    if (northeast.isPolar() || southwest.isPolar())
        throw new IllegalArgumentException(
                "Window constructor is not valid for polar coordinates.");
    if (northeast.getLatitudeInternal() < southwest.getLatitudeInternal())
        throw new IllegalArgumentException(
                "Provided northeast point is not north of provided southwest point.");

    double deltaLat = northeast.getLatitude() - southwest.getLatitude();
    double deltaLng = northeast.getLongitude() - southwest.getLongitude();
    if (northeast.getLongitude() < southwest.getLongitude())
        deltaLng += 360;

    double centerLat = southwest.getLatitude() + deltaLat / 2;
    double centerLng = southwest.getLongitude() + deltaLng / 2;

    this.setWindow(new LatLng(centerLat, centerLng), deltaLat, deltaLng);
}
 
开发者ID:wangbai,项目名称:simplelatlng,代码行数:32,代码来源:RectangularWindow.java

示例2: getKeys

import com.javadocmd.simplelatlng.LatLng; //导入方法依赖的package包/类
private List<String> getKeys(LatLng latLong) {
	double latitude = latLong.getLatitude() * 100;
	double longitude = latLong.getLongitude() * 100;
	double shiftSize = this.cellSize  / (double)2;
	
	List<String> keys = new LinkedList<String>();
	
	keys.add(Integer.toString((int) (latitude/this.cellSize)) + "&&" + Integer.toString((int) (longitude/this.cellSize)));
	
	keys.add(Integer.toString((int) (latitude+shiftSize/this.cellSize)) + "&&" + Integer.toString((int) (longitude/this.cellSize)));
	keys.add(Integer.toString((int) (latitude-shiftSize/this.cellSize)) + "&&" + Integer.toString((int) (longitude/this.cellSize)));
	keys.add(Integer.toString((int) (latitude/this.cellSize)) + "&&" + Integer.toString((int) (longitude+shiftSize/this.cellSize)));
	keys.add(Integer.toString((int) (latitude/this.cellSize)) + "&&" + Integer.toString((int) (longitude-shiftSize/this.cellSize)));
	keys.add(Integer.toString((int) (latitude+shiftSize/this.cellSize)) + "&&" + Integer.toString((int) (longitude+shiftSize/this.cellSize)));
	keys.add(Integer.toString((int) (latitude+shiftSize/this.cellSize)) + "&&" + Integer.toString((int) (longitude-shiftSize/this.cellSize)));
	keys.add(Integer.toString((int) (latitude-shiftSize/this.cellSize)) + "&&" + Integer.toString((int) (longitude+shiftSize/this.cellSize)));
	keys.add(Integer.toString((int) (latitude-shiftSize/this.cellSize)) + "&&" + Integer.toString((int) (longitude-shiftSize/this.cellSize)));
			
	return keys;
}
 
开发者ID:mdredze,项目名称:carmen,代码行数:21,代码来源:GeocodeLocationResolver.java

示例3: isLeft

import com.javadocmd.simplelatlng.LatLng; //导入方法依赖的package包/类
public static boolean isLeft(LatLng p1, LatLng p2, LatLng p) {
    double judgeValueX = (p1.getLongitude() - p2.getLongitude())
            / (p1.getLatitude() - p2.getLatitude())
            * (p.getLatitude() - p2.getLatitude()) + p2.getLongitude();

    if (judgeValueX > p.getLongitude()) {
        return true;
    }

    return false;
}
 
开发者ID:wangbai,项目名称:simplelatlng,代码行数:12,代码来源:PolygonWindow.java

示例4: transcodeFromGcj02toWgs84

import com.javadocmd.simplelatlng.LatLng; //导入方法依赖的package包/类
public LatLng transcodeFromGcj02toWgs84(LatLng gcPoint) {
    LatLng tmpPoint = transcodeFromWgs84toGcj02(gcPoint);
    double tmpLat = tmpPoint.getLatitude();
    double tmpLon = tmpPoint.getLongitude();

    double gcLat = gcPoint.getLatitude();
    double gcLon = gcPoint.getLongitude();

    double deltaLat = tmpLat - gcLat;
    double deltaLon = tmpLon - gcLon;

    return new LatLng(gcLat - deltaLat, gcLon - deltaLon);
}
 
开发者ID:wangbai,项目名称:simplelatlng,代码行数:14,代码来源:WorldToMars.java

示例5: transcodeFromGcj02toBd09

import com.javadocmd.simplelatlng.LatLng; //导入方法依赖的package包/类
public LatLng transcodeFromGcj02toBd09(LatLng gcPoint) {
    double gcLat = gcPoint.getLatitude();
    double gcLon = gcPoint.getLongitude();

    double x = gcLon, y = gcLat;
    double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
    double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);

    return new LatLng(z * Math.sin(theta) + 0.006, z * Math.cos(theta)
            + 0.0065);
}
 
开发者ID:wangbai,项目名称:simplelatlng,代码行数:12,代码来源:MarsToBaidu.java

示例6: transcodeFromBd09toGcj02

import com.javadocmd.simplelatlng.LatLng; //导入方法依赖的package包/类
public LatLng transcodeFromBd09toGcj02(LatLng bdPoint) {
    double bdLat = bdPoint.getLatitude();
    double bdLon = bdPoint.getLongitude();

    double x = bdLon - 0.0065, y = bdLat - 0.006;
    double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
    double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);

    return new LatLng(z * Math.sin(theta), z * Math.cos(theta));
}
 
开发者ID:wangbai,项目名称:simplelatlng,代码行数:11,代码来源:MarsToBaidu.java


注:本文中的com.javadocmd.simplelatlng.LatLng.getLongitude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。