/******************************************************************************************************************* * * ******************************************************************************************************************/ @Override @Nonnull public Coordinate pointToCoordinates (final @Nonnull Point point) { final View view = worldWindow.getView(); return toCoordinate(view.computePositionFromScreenPoint(point.x, point.y)); }
@Override public void axisUpdated( Axis2D axis ) { double diffX = axis.getMaxX( ) - axis.getMinX( ); double diffY = axis.getMaxY( ) - axis.getMinY( ); double centerX = axis.getMinX( ) + diffX / 2.0; double centerY = axis.getMinY( ) + diffY / 2.0; LatLonGeo center = projection.unproject( centerX, centerY ); double elevation = wwd.getView( ).getEyePosition( ).getElevation( ); Position pos = toPosition( center, elevation ); wwd.getView( ).setEyePosition( pos ); } } );
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Override public void fitView (final @Nonnull Sector sector) { logger.info("fitView(%s)", sector); final double angle = sector.getMaxDelta(); final OrbitView view = (OrbitView)worldWindow.getView(); final Angle fov = view.getFieldOfView(); // TODO: see http://forum.worldwindcentral.com/showthread.php?p=49433#post49433 final double elevation = 6400 * 1000 * angle / (fov.getDegrees() / 2); logger.fine(">>>> fov: %f, sector delta: %s, elevation: %f", fov.getDegrees(), angle, elevation); setCenterPosition(sector.getCenter(), elevation, Angle.ZERO, Angle.fromDegrees(45)); }
final OrbitView view = (OrbitView)worldWindow.getView();
@Override public void moved( PositionEvent event ) { Position pos = wwd.getView( ).getCurrentEyePosition( ); LatLonGeo latlon = fromPosition( pos ); Vector2d center = projection.project( latlon ); double diffX = axis.getMaxX( ) - axis.getMinX( ); double diffY = axis.getMaxY( ) - axis.getMinY( ); double newMinX = center.getX( ) - diffX / 2.0; double newMaxX = center.getX( ) + diffX / 2.0; double newMinY = center.getY( ) - diffY / 2.0; double newMaxY = center.getY( ) + diffY / 2.0; axis.set( newMinX, newMaxX, newMinY, newMaxY ); axis.validate( ); } } );