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


Java MercatorProjection.toLongitude方法代码示例

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


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

示例1: initialize

import org.oscim.core.MercatorProjection; //导入方法依赖的package包/类
static TileSource.OpenResult initialize(SQLiteTileSource tileSource, SQLiteDatabase database) {
    try {
        int minZoom = (int) database.compileStatement(SQL_GET_MIN_ZOOM).simpleQueryForLong();
        int maxZoom = (int) database.compileStatement(SQL_GET_MAX_ZOOM).simpleQueryForLong();
        tileSource.setMinZoom(minZoom);
        tileSource.setMaxZoom(maxZoom);

        String[] args = {String.valueOf(17 - maxZoom)};
        int minX = getInt(database, SQL_GET_MIN_X, args);
        int minY = getInt(database, SQL_GET_MIN_Y, args);
        int maxX = getInt(database, SQL_GET_MAX_X, args) + 1;
        int maxY = getInt(database, SQL_GET_MAX_Y, args) + 1;

        double scale = 1 << maxZoom;
        tileSource.mBoundingBox = new BoundingBox(
                MercatorProjection.toLatitude(maxY / scale),
                MercatorProjection.toLongitude(minX / scale),
                MercatorProjection.toLatitude(minY / scale),
                MercatorProjection.toLongitude(maxX / scale)
        );

        //TODO Try to fill zoom table and see what happens
    } catch (SQLException e) {
        return new TileSource.OpenResult(e.getMessage());
    }
    return TileSource.OpenResult.SUCCESS;
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:28,代码来源:RMapsDatabase.java

示例2: contains

import org.oscim.core.MercatorProjection; //导入方法依赖的package包/类
/**
 * Checks if map contains given point
 */
public boolean contains(double x, double y) {
    if (polygonPoints == null) {
        GeoPoint geoPoint = new GeoPoint(MercatorProjection.toLatitude(y), MercatorProjection.toLongitude(x));
        return boundingBox.contains(geoPoint);
    }
    // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
    //  Note that division by zero is avoided because the division is protected
    //  by the "if" clause which surrounds it.
    int j = polygonPoints.length - 2;
    boolean inside = false;

    for (int i = 0; i < polygonPoints.length; i += 2) {
        double ix = polygonPoints[i];
        double iy = polygonPoints[i + 1];
        double jx = polygonPoints[j];
        double jy = polygonPoints[j + 1];
        if (iy < y && jy >= y || jy < y && iy >= y) {
            if (ix + (y - iy) * 1. / (jy - iy) * (jx - ix) < x) {
                inside = !inside;
            }
        }
        j = i;
    }

    return inside;
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:30,代码来源:MapFile.java

示例3: toLatLngBounds

import org.oscim.core.MercatorProjection; //导入方法依赖的package包/类
public static LatLngBounds toLatLngBounds(Box box) {
    double minLon = MercatorProjection.toLongitude(box.xmin);
    double maxLon = MercatorProjection.toLongitude(box.xmax);
    double minLat = MercatorProjection.toLatitude(box.ymax);
    double maxLat = MercatorProjection.toLatitude(box.ymin);
    if (Double.isNaN(minLon) || Double.isNaN(maxLon) || Double.isNaN(minLat) || Double.isNaN(maxLat))
        minLon = maxLon = minLat = maxLat = 0;
    return new LatLngBounds(new LatLng(minLat, minLon), new LatLng(maxLat, maxLon));
}
 
开发者ID:microg,项目名称:android_packages_apps_GmsCore,代码行数:10,代码来源:GmsMapsTypeHelper.java

示例4: getBBox

import org.oscim.core.MercatorProjection; //导入方法依赖的package包/类
/**
 * Get the minimal axis-aligned BoundingBox that encloses
 * the visible part of the map.
 * 
 * @return BoundingBox containing view
 */
public synchronized BoundingBox getBBox(int expand) {
	getBBox(mMapBBox, expand);

	/* scale map-pixel coordinates at current scale to
	 * absolute coordinates and apply mercator projection. */
	double minLon = MercatorProjection.toLongitude(mMapBBox.xmin);
	double maxLon = MercatorProjection.toLongitude(mMapBBox.xmax);
	double minLat = MercatorProjection.toLatitude(mMapBBox.ymax);
	double maxLat = MercatorProjection.toLatitude(mMapBBox.ymin);

	return new BoundingBox(minLat, minLon, maxLat, maxLon);
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:19,代码来源:Viewport.java

示例5: run

import org.oscim.core.MercatorProjection; //导入方法依赖的package包/类
@Override
public void run() {
	mMap.viewport().getMapPosition(pos);
	int lat = (int) (MercatorProjection.toLatitude(pos.y) * 1000);
	int lon = (int) (MercatorProjection.toLongitude(pos.x) * 1000);
	int rot = (int) (pos.bearing);
	rot = (int) (pos.bearing) % 360;
	//rot = rot < 0 ? -rot : rot;

	if (curZoom != pos.zoomLevel || curLat != lat || curLon != lon
	        || curTilt != rot || curRot != (int) (pos.bearing)) {

		curLat = lat;
		curLon = lon;
		curZoom = pos.zoomLevel;
		curTilt = (int) pos.tilt;
		curRot = rot;

		String newURL = Window.Location
		    .createUrlBuilder()
		    .setHash(mParams
		            + "scale=" + pos.zoomLevel
		            + "&rot=" + curRot
		            + "&tilt=" + curTilt
		            + "&lat=" + (curLat / 1000f)
		            + "&lon=" + (curLon / 1000f))
		    .buildString();
		Window.Location.replace(newURL);
	}
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:31,代码来源:MapUrl.java

示例6: getViewBox

import org.oscim.core.MercatorProjection; //导入方法依赖的package包/类
/**
 * Get the minimal axis-aligned BoundingBox that encloses
 * the visible part of the map.
 *
 * @return BoundingBox containing view
 */
public synchronized BoundingBox getViewBox() {
	getViewBox(mMapBBox);

	// scale map-pixel coordinates at current scale to
	// absolute coordinates and apply mercator projection.
	double minLon = MercatorProjection.toLongitude(mMapBBox.minX);
	double maxLon = MercatorProjection.toLongitude(mMapBBox.maxX);
	// sic(k)
	double minLat = MercatorProjection.toLatitude(mMapBBox.maxY);
	double maxLat = MercatorProjection.toLatitude(mMapBBox.minY);

	return new BoundingBox(minLat, minLon, maxLat, maxLon);
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:20,代码来源:MapViewPosition.java

示例7: addLabels

import org.oscim.core.MercatorProjection; //导入方法依赖的package包/类
private void addLabels(final int x, final int y, final int z, final MapPosition mapPosition) {

		final int s = Tile.SIZE;

		final int tileZ = 1 << z;
		final float lineHeight = _textStyle.fontSize + 1;

		final TextBucket textBucket = mTextBucket;
		textBucket.clear();

		for (int yy = -2; yy < 2; yy++) {
			for (int xx = -2; xx < 2; xx++) {

				final int tileX = x + xx;
				final int tileY = y + yy;

				final double latitude = MercatorProjection.toLatitude((double) tileY / tileZ);
				final double longitude = MercatorProjection.toLongitude((double) tileX / tileZ);

				final String labelTile = String.format("%d / %d / %d", z, tileX, tileY); //$NON-NLS-1$

				final String labelLat = String.format("lat %.4f", latitude); //$NON-NLS-1$
				final String labelLon = String.format("lon %.4f", longitude); //$NON-NLS-1$

				final int textX = s * xx + s / 2;
				final int textY = s * yy + s / 2;

				TextItem textItem = TextItem.pool.get();
				textItem.set(textX, textY, labelTile, _textStyle);
				textBucket.addText(textItem);

				/*
				 * Lat/Lon
				 */
				textItem = TextItem.pool.get();
				textItem.set(textX, textY + lineHeight, labelLat, _textStyle);
				textBucket.addText(textItem);

				textItem = TextItem.pool.get();
				textItem.set(textX, textY + lineHeight * 2, labelLon, _textStyle);
				textBucket.addText(textItem);
			}
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:45,代码来源:GridRendererMT.java

示例8: getMapCenter

import org.oscim.core.MercatorProjection; //导入方法依赖的package包/类
/** @return the current center point of the MapView. */
public synchronized GeoPoint getMapCenter() {
	return new GeoPoint(MercatorProjection.toLatitude(mAbsY),
			MercatorProjection.toLongitude(mAbsX));
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:6,代码来源:MapViewPosition.java

示例9: fromScreenPoint

import org.oscim.core.MercatorProjection; //导入方法依赖的package包/类
/**
 * Get the GeoPoint for x,y in screen coordinates.
 * 
 * @param x screen coordinate
 * @param y screen coordinate
 * @return the corresponding GeoPoint
 */
public synchronized GeoPoint fromScreenPoint(float x, float y) {
	fromScreenPoint(x, y, mMovePoint);
	return new GeoPoint(
	                    MercatorProjection.toLatitude(mMovePoint.y),
	                    MercatorProjection.toLongitude(mMovePoint.x));
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:14,代码来源:Viewport.java

示例10: fromScreenPixels

import org.oscim.core.MercatorProjection; //导入方法依赖的package包/类
/**
 * Get the GeoPoint for x,y in screen coordinates.
 * (only used by MapEventsOverlay currently)
 *
 * @param x screen coordinate
 * @param y screen coordinate
 * @return the corresponding GeoPoint
 */
public synchronized GeoPoint fromScreenPixels(float x, float y) {
	fromScreenPixels(x, y, mMovePoint);
	return new GeoPoint(
			MercatorProjection.toLatitude(mMovePoint.y),
			MercatorProjection.toLongitude(mMovePoint.x));
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:15,代码来源:MapViewPosition.java


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