本文整理汇总了Java中gov.nasa.worldwind.WorldWind.CLAMP_TO_GROUND属性的典型用法代码示例。如果您正苦于以下问题:Java WorldWind.CLAMP_TO_GROUND属性的具体用法?Java WorldWind.CLAMP_TO_GROUND怎么用?Java WorldWind.CLAMP_TO_GROUND使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gov.nasa.worldwind.WorldWind
的用法示例。
在下文中一共展示了WorldWind.CLAMP_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;
}
示例2: getValidAltitudeModeValue
public static int getValidAltitudeModeValue(final int stateAltitudeMode) {
for (final ComboEntry altiMode : ALTITUDE_MODE) {
if (altiMode.value == stateAltitudeMode) {
return altiMode.value;
}
}
// return default value
return WorldWind.CLAMP_TO_GROUND;
}
示例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();
}
示例4: drawLine_Line
private void drawLine_Line(final DrawContext dc, final Vec4 annotationPoint) {
// Compute a terrain point if needed.
Vec4 terrainPoint = null;
if (this.altitudeMode != WorldWind.CLAMP_TO_GROUND) {
terrainPoint = dc.computeTerrainPoint(position.getLatitude(), position.getLongitude(), 0);
}
if (terrainPoint == null) {
return;
}
final GL2 gl = dc.getGL().getGL2();
if ((!dc.isDeepPickingEnabled())) {
gl.glEnable(GL.GL_DEPTH_TEST);
}
gl.glDepthFunc(GL.GL_LEQUAL);
// gl.glDepthFunc(GL.GL_GREATER); // draw the part that is behind an intersecting surface
gl.glDepthMask(true);
// gl.glDepthMask(false);
gl.glDepthRange(0.0, 1.0);
try {
dc.getView().pushReferenceCenter(dc, annotationPoint); // draw relative to the place point
//
// !!! THIS CAUSES A stack overflow1283 because there are only 4 available stack entries !!!
//
//
// // Pull the arrow triangles forward just a bit to ensure they show over the terrain.
// dc.pushProjectionOffest(0.95);
final Color color = this.getAttributes().getTextColor();
gl.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 0xff);
gl.glLineWidth(1.5f);
gl.glHint(GL.GL_LINE_SMOOTH_HINT, Polyline.ANTIALIAS_FASTEST);
gl.glEnable(GL.GL_LINE_SMOOTH);
// System.out.println((UI.timeStampNano() + " [" + getClass().getSimpleName() + "] ")
// + ("\t" + dc.getFrameTimeStamp()));
// GLLogger.logDepth(dc, getClass().getSimpleName());
// TODO remove SYSTEM.OUT.PRINTLN
gl.glBegin(GL2.GL_LINE_STRIP);
{
gl.glVertex3d(Vec4.ZERO.x, Vec4.ZERO.y, Vec4.ZERO.z);
gl.glVertex3d(//
terrainPoint.x - annotationPoint.x,
terrainPoint.y - annotationPoint.y,
terrainPoint.z - annotationPoint.z);
}
gl.glEnd();
// GLLogger.logDepth(dc, "trackpt");
} finally {
// dc.popProjectionOffest();
dc.getView().popReferenceCenter(dc);
}
}