本文整理汇总了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;
}
});
}
示例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);
}
示例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);
}