本文整理汇总了Java中gov.nasa.worldwind.geom.LatLon.getLatitude方法的典型用法代码示例。如果您正苦于以下问题:Java LatLon.getLatitude方法的具体用法?Java LatLon.getLatitude怎么用?Java LatLon.getLatitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nasa.worldwind.geom.LatLon
的用法示例。
在下文中一共展示了LatLon.getLatitude方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertVertex
import gov.nasa.worldwind.geom.LatLon; //导入方法依赖的package包/类
public final void insertVertex(final Position newVertex) {
double distance = Double.MAX_VALUE;
int closestVertexIndex = -1;
final List<LatLon> locationList = obstacle.locations();
for (int index = 0; index < locationList.size(); index++) {
final double d = LatLon.greatCircleDistance(locationList.get(index), newVertex).degrees;
if (d < distance) {
distance = d;
closestVertexIndex = index;
}
}
final int previousVertexIndex = closestVertexIndex == 0 ? locationList.size() - 1 : closestVertexIndex - 1;
final int nextVertexIndex = closestVertexIndex == locationList.size() - 1 ? 0 : closestVertexIndex + 1;
final LatLon closestVertex = locationList.get(closestVertexIndex);
final LatLon previousVertex = locationList.get(previousVertexIndex);
final LatLon nextVertex = locationList.get(nextVertexIndex);
final Vec4 vClosest = new Vec4(closestVertex.getLongitude().radians, closestVertex.getLatitude().radians, 0);
final Vec4 vPrevious = new Vec4(previousVertex.getLongitude().radians, previousVertex.getLatitude().radians, 0);
final Vec4 vNext = new Vec4(nextVertex.getLongitude().radians, nextVertex.getLatitude().radians, 0);
final Vec4 vNew = new Vec4(newVertex.getLongitude().radians, newVertex.getLatitude().radians, 0);
final int insertIndex;
if (Line.fromSegment(vClosest, vNext).isPointBehindLineOrigin(vNew)) {
insertIndex = closestVertexIndex;
} else if (Line.fromSegment(vClosest, vPrevious).isPointBehindLineOrigin(vNew)) {
insertIndex = nextVertexIndex;
} else {
throw new IllegalStateException("Could not find a suitable edge to insert position: " + newVertex.toString());
}
locationList.add(insertIndex, newVertex);
obstacle.newLocations(locationList);
fireObstacleChanged();
}