• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LatLongUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.mapsforge.core.util.LatLongUtils的典型用法代码示例。如果您正苦于以下问题:Java LatLongUtils类的具体用法?Java LatLongUtils怎么用?Java LatLongUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LatLongUtils类属于org.mapsforge.core.util包,在下文中一共展示了LatLongUtils类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getWayBoundingBox

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
private static TileCoordinate[] getWayBoundingBox(final CB_TDWay way, byte zoomlevel, int enlargementInMeter) {
    double maxx = Double.NEGATIVE_INFINITY, maxy = Double.NEGATIVE_INFINITY, minx = Double.POSITIVE_INFINITY, miny = Double.POSITIVE_INFINITY;
    for (CB_TDNode coordinate : way.getWayNodes()) {
        maxy = Math.max(maxy, LatLongUtils.microdegreesToDegrees(coordinate.getLatitude()));
        miny = Math.min(miny, LatLongUtils.microdegreesToDegrees(coordinate.getLatitude()));
        maxx = Math.max(maxx, LatLongUtils.microdegreesToDegrees(coordinate.getLongitude()));
        minx = Math.min(minx, LatLongUtils.microdegreesToDegrees(coordinate.getLongitude()));
    }

    double[] epsilonsTopLeft = computeTileEnlargement(maxy, enlargementInMeter);
    double[] epsilonsBottomRight = computeTileEnlargement(miny, enlargementInMeter);

    TileCoordinate[] bbox = new TileCoordinate[2];
    bbox[0] = new TileCoordinate((int) MercatorProjection.longitudeToTileX(minx - epsilonsTopLeft[1], zoomlevel),
            (int) MercatorProjection.latitudeToTileY(maxy + epsilonsTopLeft[0], zoomlevel), zoomlevel);
    bbox[1] = new TileCoordinate(
            (int) MercatorProjection.longitudeToTileX(maxx + epsilonsBottomRight[1], zoomlevel),
            (int) MercatorProjection.latitudeToTileY(miny - epsilonsBottomRight[0], zoomlevel), zoomlevel);

    return bbox;
}
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:22,代码来源:CB_UTILS.java


示例2: addPOI

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
protected void addPOI(CB_TDNode poi) {
    if (!poi.isPOI()) {
        return;
    }

    byte minZoomLevel = poi.getZoomAppear();
    for (int i = 0; i < this.zoomIntervalConfiguration.getNumberOfZoomIntervals(); i++) {
        // is POI seen in a zoom interval?
        if (minZoomLevel <= this.zoomIntervalConfiguration.getMaxZoom(i)) {
            long tileCoordinateX = MercatorProjection.longitudeToTileX(
                    LatLongUtils.microdegreesToDegrees(poi.getLongitude()),
                    this.zoomIntervalConfiguration.getBaseZoom(i));
            long tileCoordinateY = MercatorProjection.latitudeToTileY(
                    LatLongUtils.microdegreesToDegrees(poi.getLatitude()),
                    this.zoomIntervalConfiguration.getBaseZoom(i));
            CB_TileData tileData = getTileImpl(i, (int) tileCoordinateX, (int) tileCoordinateY);
            if (tileData != null) {
                tileData.addPOI(poi);
                countPoiTags(poi);
            }
        }
    }
}
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:24,代码来源:CB_BaseTileBasedDataProcessor.java


示例3: setMapPosition

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
public void setMapPosition(BoundingBox _bbox) {
	byte zoomLevel = LatLongUtils.zoomForBounds(
			getModel().mapViewDimension.getDimension(), _bbox,
			getModel().displayModel.getTileSize());
	getModel().mapViewPosition.setMapPosition(new MapPosition(_bbox
			.getCenterPoint(), zoomLevel));
}
 
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:8,代码来源:MapView.java


示例4: fromNode

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
/**
 * Constructs a new CB_TDNode from a given osmosis node entity. Checks the validity of the entity.
 *
 * @param node               the osmosis entity
 * @param preferredLanguages the preferred language(s) or null if no preference
 * @return a new CB_TDNode
 */
public static CB_TDNode fromNode(Node node, List<String> preferredLanguages) {
    SpecialTagExtractionResult ster = OSMUtils.extractSpecialFields(node, preferredLanguages);
    short[] knownWayTags = OSMUtils.extractKnownPOITags(node);

    return new CB_TDNode(node.getId(), LatLongUtils.degreesToMicrodegrees(node.getLatitude()),
            LatLongUtils.degreesToMicrodegrees(node.getLongitude()), ster.getElevation(), ster.getLayer(),
            ster.getHousenumber(), ster.getName(), knownWayTags);
}
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:16,代码来源:CB_TDNode.java


示例5: bufferInDegrees

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
private static double[] bufferInDegrees(long tileY, byte zoom, int enlargementInMeter) {
    if (enlargementInMeter == 0) {
        return EPSILON_ZERO;
    }

    double[] epsilons = new double[2];
    double lat = MercatorProjection.tileYToLatitude(tileY, zoom);
    epsilons[0] = LatLongUtils.latitudeDistance(enlargementInMeter);
    epsilons[1] = LatLongUtils.longitudeDistance(enlargementInMeter, lat);

    return epsilons;
}
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:13,代码来源:CB_UTILS.java


示例6: computeTileEnlargement

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
private static double[] computeTileEnlargement(double lat, int enlargementInMeter) {
    if (enlargementInMeter == 0) {
        return EPSILON_ZERO;
    }

    double[] epsilons = new double[2];

    epsilons[0] = LatLongUtils.latitudeDistance(enlargementInMeter);
    epsilons[1] = LatLongUtils.longitudeDistance(enlargementInMeter, lat);

    return epsilons;
}
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:13,代码来源:CB_UTILS.java


示例7: onWindowFocusChanged

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
@Override
public void onWindowFocusChanged(boolean hasFocus) {
	super.onWindowFocusChanged(hasFocus);
	if (hasFocus) {
		BoundingBox bb = new BoundingBox(latLong2.latitude,
				latLong3.longitude, latLong3.latitude, latLong2.longitude);
		Dimension dimension = this.mapView.getModel().mapViewDimension.getDimension();
		this.mapView.getModel().mapViewPosition.setMapPosition(new MapPosition(
						bb.getCenterPoint(),
						LatLongUtils.zoomForBounds(
								dimension,
								bb,
								this.mapView.getModel().displayModel.getTileSize())));
	}
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:16,代码来源:ZoomToBounds.java


示例8: roundDoubleCoordinate

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
public static double roundDoubleCoordinate(double value) {
    value = Math.round(LatLongUtils.degreesToMicrodegrees(value));
    value = LatLongUtils.microdegreesToDegrees((int) value);
    return value;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:6,代码来源:TestUtils.java


示例9: IntBoundingBox

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
public IntBoundingBox(BoundingBox bb) {
    this.maxLatitude = LatLongUtils.degreesToMicrodegrees(bb.maxLatitude);
    this.maxLongitude = LatLongUtils.degreesToMicrodegrees(bb.maxLongitude);
    this.minLatitude = LatLongUtils.degreesToMicrodegrees(bb.minLatitude);
    this.minLongitude = LatLongUtils.degreesToMicrodegrees(bb.minLongitude);
}
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:7,代码来源:IntBoundingBox.java


示例10: getValueOfProperty_LAT_LON

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
private static int getValueOfProperty_LAT_LON(IByteArray array, IByteArray property, int start, int end) {

        int s = -1;
        int e = -1;

        //search for property start
        s = array.searchFirst(property, start);

        //search for property end
        e = array.searchFirst(PROPERTY_END, s + property.getLength() + 1);

        if (s == -1 || e == -1)
            throw new RuntimeException("Cant parse ID");

        double value = 0;
        double multiplier = 1;

        //search decimal point and calculate multiplier
        boolean found = false;
        int decimalIndex = -1;
        for (int i = s + property.getLength(); i < e - 1; i++) {
            if (!found && array.get(i) == NUM_POINT) {
                found = true;
                decimalIndex = i;
            }
            if (found) {
                multiplier /= 10.0;
            }
        }

        if (decimalIndex == -1) decimalIndex = e - 1;

        for (int i = e - 1; i > s + property.getLength(); i--) {
            if (i == decimalIndex)
                continue;
            value = value + ((double) getNumericValuefromByte(array, i)) * multiplier;
            multiplier *= 10.0;
        }

        int intValue = LatLongUtils.degreesToMicrodegrees(value);
        return intValue;
    }
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:43,代码来源:ReadOsm.java


示例11: toCoordinate

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
private static Coordinate toCoordinate(int latitude, int longitude) {
    return new Coordinate(LatLongUtils.microdegreesToDegrees(longitude),
            LatLongUtils.microdegreesToDegrees(latitude));
}
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:5,代码来源:CB_UTILS.java


示例12: addMapStartPosition

import org.mapsforge.core.util.LatLongUtils; //导入依赖的package包/类
/**
 * Convenience method.
 * 
 * @param position
 *            the map start position in format latitude, longitude
 */
public void addMapStartPosition(String position) {
	if (position != null) {
		setMapStartPosition(LatLongUtils.fromString(position));
	}
}
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:12,代码来源:CB_MapWriterConfiguration.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CommandDataVersions类代码示例发布时间:2022-05-22
下一篇:
Java CloseIndexResponse类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap