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


Java PointList.add方法代码示例

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


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

示例1: addLabel

import com.graphhopper.util.PointList; //导入方法依赖的package包/类
public void addLabel(Label label) {
	double lastLat = storage.getNodeAccess().getLat(label.adjNode);
	double lastLon = storage.getNodeAccess().getLon(label.adjNode);
	final PointList lastPoint = new PointList(1, false);
	lastPoint.add(lastLat, lastLon);

	labels.compute(lastPoint, (key, oldLabel) -> {
		if (oldLabel == null) {
			return label;
		} else if (label.currentTime < oldLabel.currentTime) {

			return label;
		} else {
			return oldLabel;
		}
	});
}
 
开发者ID:highsource,项目名称:roads-to,代码行数:18,代码来源:RoadBuilder.java

示例2: buildRoads

import com.graphhopper.util.PointList; //导入方法依赖的package包/类
private void buildRoads(Label label) {
	if (label == null || label.edge == -1) {
		return;
	}
	long currentTime;
	final PointList pointList = new PointList();
	int numberOfTransfers = 0;

	double lastLat = Double.NaN;
	double lastLon = Double.NaN;
	Label currentLabel = label;
	currentTime = currentLabel.currentTime;
	do {
		numberOfTransfers += currentLabel.nTransfers;
		final EdgeIteratorState state = storage.getEdgeIteratorState(
				currentLabel.edge, currentLabel.adjNode);
		final PointList geometry = state.fetchWayGeometry(3);
		for (int index = geometry.getSize() - 1; index >= 0; index--) {
			double currentLat = geometry.getLat(index);
			double currentLon = geometry.getLon(index);
			if (Double.doubleToLongBits(currentLat) != Double
					.doubleToLongBits(lastLat)
					&& Double.doubleToLongBits(currentLon) != Double
							.doubleToLongBits(lastLon)) {
				pointList.add(currentLat, currentLon);
			}
			lastLat = currentLat;
			lastLon = currentLon;

		}
		currentLabel = currentLabel.parent;
	} while (currentLabel != null && currentLabel.edge != -1
			&& pointList.size() < 2);
	if (pointList.size() < 2) {
		System.out.println(MessageFormat.format("Point list size is {0}.",
				pointList.size()));
	}

	pointList.reverse();
	final Road road = new Road(currentTime, numberOfTransfers, pointList);

	roads.compute(road.getPointList(), (key, oldRoad) -> {
		if (oldRoad == null) {
			return road;
		} else {
			return oldRoad.increadNumberOfThreads();
		}
	});
	buildRoads(currentLabel);
}
 
开发者ID:highsource,项目名称:roads-to,代码行数:51,代码来源:RoadBuilder.java

示例3: getEdgeInterator

import com.graphhopper.util.PointList; //导入方法依赖的package包/类
private EdgeIteratorState getEdgeInterator() {
    PointList pointList = new PointList();
    pointList.add(-3.4445, -38.9990);
    pointList.add(-3.5550, -38.7990);
    return new VirtualEdgeIteratorState(0, 0, 0, 1, 10, 0, "test of iterator", pointList);
}
 
开发者ID:graphhopper,项目名称:map-matching,代码行数:7,代码来源:MatchResultToJsonTest.java


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