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


Java Position.getAltitude方法代码示例

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


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

示例1: computeCenterPosition

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
/**
 * Compute a center position from an eye position and an orientation. If the view is looking at
 * the earth, the center position is the intersection point of the globe and a ray beginning at
 * the eye point, in the direction of the forward vector. If the view is looking at the horizon,
 * the center position is the eye position. Otherwise, the center position is null.
 * 
 * @param eyePosition
 *            The eye position.
 * @param forward
 *            The forward vector.
 * @param pitch
 *            View pitch.
 * @param altitudeMode
 *            Altitude mode of {@code eyePosition}.
 * @return The center position of the view.
 */
protected Position computeCenterPosition(	final Position eyePosition,
											final Vec4 forward,
											final Angle pitch,
											final int altitudeMode) {
	double height;

	final Angle latitude = eyePosition.getLatitude();
	final Angle longitude = eyePosition.getLongitude();

	final Globe globe = _wwCanvas.getModel().getGlobe();

	if (altitudeMode == WorldWind.CLAMP_TO_GROUND) {
		height = globe.getElevation(latitude, longitude);
	} else if (altitudeMode == WorldWind.RELATIVE_TO_GROUND) {
		height = globe.getElevation(latitude, longitude) + eyePosition.getAltitude();
	} else {
		height = eyePosition.getAltitude();
	}

	final Vec4 eyePoint = globe.computePointFromPosition(new Position(latitude, longitude, height));

	// Find the intersection of the globe and the camera's forward vector. Looking at the horizon (tilt == 90)
	// is a special case because it is a valid view, but the view vector does not intersect the globe.
	Position lookAtPosition;
	final double tolerance = 0.001;
	if (Math.abs(pitch.degrees - 90.0) > tolerance) {
		lookAtPosition = globe.getIntersectionPosition(new Line(eyePoint, forward));
	} else {
		lookAtPosition = globe.computePositionFromPoint(eyePoint);
	}

	return lookAtPosition;
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:50,代码来源:Map3View.java

示例2: findMaxAltitude

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
/**
 * Get the maximum altitude in a list of positions.
 * 
 * @param positions
 *            List of positions to search for max altitude.
 * @return The maximum elevation in the list of positions. Returns {@code Double.MIN_VALUE} if
 *         {@code positions} is empty.
 */
protected double findMaxAltitude(final List<? extends Position> positions) {
	double maxAltitude = -Double.MAX_VALUE;
	for (final Position p : positions) {
		final double altitude = p.getAltitude();
		if (altitude > maxAltitude) {
			maxAltitude = altitude;
		}
	}

	return maxAltitude;
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:20,代码来源:Map3ViewController.java

示例3: computeArrowPositions

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
private void computeArrowPositions(final DrawContext dc, final List<Position> positions, final PathData pathData) {

//		System.out.println(UI.timeStampNano() + " [" + getClass().getSimpleName() + "] \tcomputeArrowPositions()");
//		// TODO remove SYSTEM.OUT.PRINTLN

		final int elemsPerPoint = 3;
		final int positionSize = positions.size();
		final int polePositionSize = (positionSize / SKIP_COUNTER) + 3;
		final int numPoints = polePositionSize * 1;

		final int bufferSize = elemsPerPoint * numPoints;
		FloatBuffer arrowPositions = (FloatBuffer) pathData.getValue(ARROW_POSITION_KEY);

		if (arrowPositions == null || arrowPositions.capacity() < bufferSize) {
			arrowPositions = Buffers.newDirectFloatBuffer(bufferSize);
		}
		pathData.setValue(ARROW_POSITION_KEY, arrowPositions);
		arrowPositions.clear();

		if (_arrowPositionIndizes == null || _arrowPositionIndizes.size() < polePositionSize) {
			_arrowPositionIndizes = new TIntArrayList(polePositionSize);
		}
		_arrowPositionIndizes.clear();

		final Globe globe = dc.getGlobe();
		final Vec4 referencePoint = pathData.getReferencePoint();

		// vertical exaggeration
		final double verticalExaggeration = dc.getVerticalExaggeration();

		final TourTrackConfig config = TourTrackConfigManager.getActiveConfig();

		final int altitudeMode = config.altitudeMode;
		final double altitudeOffset = Map3View.getAltitudeOffset(dc.getView().getEyePosition());

		final double poleHeight = pathData.getEyeDistance() / (100.0 / config.directionArrowDistance * 1.5);
//		poleHeight *= verticalExaggeration;

		for (int posIndex = 0; posIndex < positionSize; posIndex++) {

			if (posIndex % SKIP_COUNTER == 0 || posIndex == 0 || posIndex == positionSize - 1) {

				_arrowPositionIndizes.add(posIndex);

				final Position geoPosition = positions.get(posIndex);
				final double trackAltitude = (geoPosition.getAltitude() + altitudeOffset) * verticalExaggeration;

				// create arrow position vertex
				Vec4 pt;
				if (altitudeMode == WorldWind.CLAMP_TO_GROUND) {

					pt = dc.computeTerrainPoint(geoPosition.getLatitude(), geoPosition.getLongitude(), 0 + poleHeight);

				} else if (altitudeMode == WorldWind.RELATIVE_TO_GROUND) {

					pt = dc.computeTerrainPoint(//
							geoPosition.getLatitude(),
							geoPosition.getLongitude(),
							trackAltitude + poleHeight);

				} else { // WorldWind.ABSOLUTE

					pt = globe.computePointFromPosition(//
							geoPosition.getLatitude(),
							geoPosition.getLongitude(),
							trackAltitude + poleHeight);

				}

				putVertexIntoBuffer(arrowPositions, pt, referencePoint);
			}
		}

		// since the buffer is reused the limit might not be the same as the previous usage
		arrowPositions.flip();
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:77,代码来源:TrackPathOptimized.java


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