本文整理汇总了Java中gov.nasa.worldwind.view.orbit.OrbitView类的典型用法代码示例。如果您正苦于以下问题:Java OrbitView类的具体用法?Java OrbitView怎么用?Java OrbitView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrbitView类属于gov.nasa.worldwind.view.orbit包,在下文中一共展示了OrbitView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterShow
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
/**
* @see org.leo.traceroute.ui.AbstractRoutePanel#afterShow()
*/
@Override
public void afterShow(final Mode mode) {
super.afterShow(mode);
SwingUtilities.invokeLater(() -> {
_container.invalidate();
_container.revalidate();
final GeoPoint localGeo = _services.getGeo().getLocalIpGeoLocation();
final Position p = new Position(Angle.fromDegrees(localGeo.getLat()), Angle.fromDegrees(localGeo.getLon()), 2000);
((OrbitView) _controller.getWWd().getView()).setCenterPosition(p);
if (mode == Mode.TRACE_ROUTE) {
_route.renotifyRoute();
} else if (mode == Mode.SNIFFER) {
_sniffer.renotifyPackets();
} else {
_whois.renotifyWhoIs();
}
});
}
示例2: doZoom
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
public void doZoom(Point2D p, double factor) {
LatLon dest = new LatLon(Angle.fromDegrees(p.getY()), Angle.fromDegrees(p.getX()));
double wwzoom = 2785 * Math.pow(factor, -.8311) * 10000;
final OrbitView view = (OrbitView) wwd.getView();
FlyToOrbitViewAnimator fto =
FlyToOrbitViewAnimator.createFlyToOrbitViewAnimator(
view,
view.getCenterPosition(), new Position(dest, 0),
view.getHeading(), Angle.fromDegrees(0),
view.getPitch(), Angle.fromDegrees(0),
view.getZoom(), wwzoom,
5000, WorldWind.CONSTANT); //was true
view.addAnimator(fto);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
((MapApp)getApp()).getFrame().toFront();
view.firePropertyChange(AVKey.VIEW, null, view);
}
});
}
示例3: createPlace
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
@Override
protected MapPlace createPlace(MapPlace root, String text, double x,
double y, double zoom) {
WorldWindowGLCanvas wwd = ((WWMap) map).wwd;
OrbitView view = (OrbitView) wwd.getView();
zoom = ((WWMap) map).getGMAZoom();
Position pos = view.getCenterPosition();
double pitch = view.getPitch().degrees;
double heading = view.getHeading().degrees;
double zoom2 = view.getZoom();
double ve = wwd.getSceneController().getVerticalExaggeration();
return new WWMapPlace(
root,
text,
pos.getLongitude().degrees,
pos.getLatitude().degrees,
zoom,
pitch,
heading,
zoom2,
ve);
}
示例4: moveToLocation
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
public static void moveToLocation(WorldWindow wwd, Sector sector, Double altitude)
{
OrbitView view = (OrbitView) wwd.getView();
Globe globe = wwd.getModel().getGlobe();
if (altitude == null || altitude == 0)
{
double t = sector.getDeltaLonRadians() > sector.getDeltaLonRadians()
? sector.getDeltaLonRadians() : sector.getDeltaLonRadians();
double w = 0.5 * t * 6378137.0;
altitude = w / wwd.getView().getFieldOfView().tanHalfAngle();
}
if (globe != null && view != null)
{
wwd.getView().goTo(new Position(sector.getCentroid(), 0), altitude);
}
}
示例5: computePanAmount
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
protected Angle computePanAmount(Globe globe, OrbitView view, ScreenAnnotation control, double panStep)
{
// Compute last pick point distance relative to pan control center
double size = control.getAttributes().getSize().width * control.getAttributes().getScale();
Vec4 center = new Vec4(control.getScreenPoint().x, control.getScreenPoint().y + size / 2, 0);
double px = lastPickPoint.x - center.x;
double py = view.getViewport().getHeight() - lastPickPoint.y - center.y;
double pickDistance = Math.sqrt(px * px + py * py);
double pickDistanceFactor = Math.min(pickDistance / 10, 5);
// Compute globe angular distance depending on eye altitude
Position eyePos = view.getEyePosition();
double radius = globe.getRadiusAt(eyePos);
double minValue = 0.5 * (180.0 / (Math.PI * radius)); // Minimum change ~0.5 meters
double maxValue = 1.0; // Maximum change ~1 degree
// Compute an interpolated value between minValue and maxValue, using (eye altitude)/(globe radius) as
// the interpolant. Interpolation is performed on an exponential curve, to keep the value from
// increasing too quickly as eye altitude increases.
double a = eyePos.getElevation() / radius;
a = (a < 0 ? 0 : (a > 1 ? 1 : a));
double expBase = 2.0; // Exponential curve parameter.
double value = minValue + (maxValue - minValue) * ((Math.pow(expBase, a) - 1.0) / (expBase - 1.0));
return Angle.fromDegrees(value * pickDistanceFactor * panStep);
}
示例6: setupFirstPersonView
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
/**
* Setup the view to a first person mode (zoom = 0)
*
* @param view the orbit view to set into a first person view.
*/
protected void setupFirstPersonView(OrbitView view)
{
if (view.getZoom() == 0) // already in first person mode
return;
Vec4 eyePoint = view.getEyePoint();
// Center pos at eye pos
Position centerPosition = wwd.getModel().getGlobe().computePositionFromPoint(eyePoint);
// Compute pitch and heading relative to center position
Vec4 normal = wwd.getModel().getGlobe().computeSurfaceNormalAtLocation(centerPosition.getLatitude(),
centerPosition.getLongitude());
Vec4 north = wwd.getModel().getGlobe().computeNorthPointingTangentAtLocation(centerPosition.getLatitude(),
centerPosition.getLongitude());
// Pitch
view.setPitch(Angle.POS180.subtract(view.getForwardVector().angleBetween3(normal)));
// Heading
Vec4 perpendicular = view.getForwardVector().perpendicularTo3(normal);
Angle heading = perpendicular.angleBetween3(north);
double direction = Math.signum(-normal.cross3(north).dot3(perpendicular));
view.setHeading(heading.multiply(direction));
// Zoom
view.setZoom(0);
// Center pos
view.setCenterPosition(centerPosition);
}
示例7: computeSurfacePoint
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
/**
* Find out where on the terrain surface the eye would be looking at with the given heading and pitch angles.
*
* @param view the orbit view
* @param heading heading direction clockwise from north.
* @param pitch view pitch angle from the surface normal at the center point.
*
* @return the terrain surface point the view would be looking at in the viewport center.
*/
protected Vec4 computeSurfacePoint(OrbitView view, Angle heading, Angle pitch)
{
Globe globe = wwd.getModel().getGlobe();
// Compute transform to be applied to north pointing Y so that it would point in the view direction
// Move coordinate system to view center point
Matrix transform = globe.computeSurfaceOrientationAtPosition(view.getCenterPosition());
// Rotate so that the north pointing axes Y will point in the look at direction
transform = transform.multiply(Matrix.fromRotationZ(heading.multiply(-1)));
transform = transform.multiply(Matrix.fromRotationX(Angle.NEG90.add(pitch)));
// Compute forward vector
Vec4 forward = Vec4.UNIT_Y.transformBy4(transform);
// Return intersection with terrain
Intersection[] intersections = wwd.getSceneController().getTerrain().intersect(
new Line(view.getEyePoint(), forward));
return (intersections != null && intersections.length != 0) ? intersections[0].getIntersectionPoint() : null;
}
示例8: focusPoint
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
@Override
protected void focusPoint(final GeoPoint point, final boolean isRunning, final boolean animation) {
final long elevation = 5000 * 1000;
if (_controller == null || _controller.getWWd() == null) {
return;
}
// center the map on the given point
final LabeledPath label = point == null ? null : _pointToLabel.get(point);
if (label != null) {
highlightAnnotation(label, point);
final View view = _controller.getWWd().getView();
final OrbitViewInputHandler ovih = (OrbitViewInputHandler) view.getViewInputHandler();
if (animation && Env.INSTANCE.getAnimationSpeed() > 0) {
final Position pos = new Position(label.getLocations().iterator().next(), 10);
ovih.addPanToAnimator(pos, view.getHeading(), view.getPitch(), elevation, Env.INSTANCE.getAnimationSpeed(), true);
// if (_mode == Mode.TRACE_ROUTE && isRunning) {
// // if tracing, move at the speed of the timeout
// final Position pos = new Position(label.getLocations().iterator().next(), 10);
// ovih.addPanToAnimator(pos, view.getHeading(), view.getPitch(), elevation,
// Env.INSTANCE.getAnimationSpeed(), true);
// } else if (_mode == Mode.TRACE_ROUTE || !isRunning) {
// _controller.getWWd().getView()
// .goTo(new Position(label.getLocations().iterator().next(), 10), elevation);
// }
} else {
final Position p = new Position(Angle.fromDegrees(point.getLat()), Angle.fromDegrees(point.getLon()), 2000);
((OrbitView) view).setCenterPosition(p);
}
}
}
示例9: mouseClicked
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
@Override
public void mouseClicked(MouseEvent evt) {
if(evt.isControlDown())return;
OrbitView view = (OrbitView) ww.getView();
Position pos =
view.computePositionFromScreenPoint(evt.getX(), evt.getY());
if (pos == null) return;
double x = pos.getLongitude().degrees;
double y = pos.getLatitude().degrees;
if (currentCruise != null &&
currentCruise.getBounds().contains(x, y)) {
// Do nothing
} else {
// Select Area
int k = cruiseList.getSelectedIndex();
k=k%cruises.length;
int k0 = k;
while(true) {
if(cruises[k].getBounds().contains(x, y) ) {
mouseE = true;
cruiseList.setSelectedItem(cruises[k]);
evt.consume();
// setSelectedCruise(cruises[k]);
return;
}
k = (k+1)%cruises.length;
if(k==k0)
break;
}
}
}
示例10: computePitch
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
protected double computePitch(View view)
{
if (view == null)
return 0.0;
if (!(view instanceof OrbitView))
return 0.0;
OrbitView orbitView = (OrbitView) view;
return orbitView.getPitch().getDegrees();
}
示例11: computeHeading
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
private double computeHeading(View view)
{
if (view == null)
return 0.0;
if (!(view instanceof OrbitView))
return 0.0;
OrbitView orbitView = (OrbitView) view;
return orbitView.getHeading().getDegrees();
}
示例12: computePitch
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
private double computePitch(View view)
{
if (view == null)
return 0.0;
if (!(view instanceof OrbitView))
return 0.0;
OrbitView orbitView = (OrbitView) view;
return orbitView.getPitch().getDegrees();
}
示例13: goTo
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
@Override
protected void goTo(MapPlace loc) {
if (!(loc instanceof WWMapPlace)) {
super.goTo(loc);
return;
}
WWMapPlace wloc = (WWMapPlace) loc;
final OrbitView view = (OrbitView) ((WWMap)map).wwd.getView();
((WWMap)map).wwd.getSceneController().setVerticalExaggeration(wloc.ve);
Position center = Position.fromDegrees(wloc.lat, wloc.lon, 0);
Angle heading = Angle.fromDegrees(wloc.heading);
Angle pitch = Angle.fromDegrees(wloc.pitch);
double zoom = wloc.zoom2;
FlyToOrbitViewAnimator fto =
FlyToOrbitViewAnimator.createFlyToOrbitViewAnimator(
view,
view.getCenterPosition(), center,
view.getHeading(), heading,
view.getPitch(), pitch,
view.getZoom(), zoom,
5000, WorldWind.CONSTANT); // was true
view.addAnimator(fto);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
((MapApp)map.getApp()).getFrame().toFront();
view.firePropertyChange(AVKey.VIEW, null, view);
}
});
}
示例14: computeNewZoom
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
protected double computeNewZoom(OrbitView view, double amount)
{
double coeff = 0.05;
double change = coeff * amount;
double logZoom = view.getZoom() != 0 ? Math.log(view.getZoom()) : 0;
// Zoom changes are treated as logarithmic values. This accomplishes two things:
// 1) Zooming is slow near the globe, and fast at great distances.
// 2) Zooming in then immediately zooming out returns the viewer to the same zoom value.
return Math.exp(logZoom + change);
}
示例15: computePanHeading
import gov.nasa.worldwind.view.orbit.OrbitView; //导入依赖的package包/类
protected Angle computePanHeading(OrbitView view, ScreenAnnotation control)
{
// Compute last pick point 'heading' relative to pan control center
double size = control.getAttributes().getSize().width * control.getAttributes().getScale();
Vec4 center = new Vec4(control.getScreenPoint().x, control.getScreenPoint().y + size / 2, 0);
double px = lastPickPoint.x - center.x;
double py = view.getViewport().getHeight() - lastPickPoint.y - center.y;
Angle heading = view.getHeading().add(Angle.fromRadians(Math.atan2(px, py)));
heading = heading.degrees >= 0 ? heading : heading.addDegrees(360);
return heading;
}