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


Java WorldWind.RELATIVE_TO_GROUND属性代码示例

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


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

示例1: computeCenterPosition

/**
 * 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,代码行数:49,代码来源:Map3View.java

示例2: getSliderYPosition

private double getSliderYPosition(final float trackAltitude, final Position eyePosition) {

		final TourTrackConfig config = TourTrackConfigManager.getActiveConfig();

		double sliderYPosition = 0;

		switch (config.altitudeMode) {
		case WorldWind.ABSOLUTE:

			sliderYPosition = trackAltitude + getAltitudeOffset(eyePosition);
			break;

		case WorldWind.RELATIVE_TO_GROUND:

			sliderYPosition = trackAltitude;
			break;

		default:

			// WorldWind.CLAMP_TO_GROUND -> y position = 0

			break;
		}

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

示例3: computeArrowPositions

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,代码行数:76,代码来源:TrackPathOptimized.java

示例4: setSliderPosition

/**
 * @param dc
 * @return Return slider position or <code>null</code> when it's not fully initialized.
 */
public Position setSliderPosition(final DrawContext dc) {

	if (latLon == null) {
		// is not fully initialized, this can happen
		return null;
	}

	final TourTrackConfig config = TourTrackConfigManager.getActiveConfig();

	float sliderElevation = 0;

	switch (config.altitudeMode) {
	case WorldWind.ABSOLUTE:

		sliderElevation = trackAltitude;

		if (config.isAltitudeOffset) {

			// append offset
			sliderElevation += Map3View.getAltitudeOffset(dc.getView().getEyePosition());
		}

		break;

	case WorldWind.RELATIVE_TO_GROUND:

		sliderElevation = trackAltitude;
		break;

	default:

		// WorldWind.CLAMP_TO_GROUND -> y position = 0

		break;
	}

	final Position sliderPosition = new Position(latLon, sliderElevation);

	setPosition(sliderPosition);

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


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