public AnimateCameraCommand(WorldWindow wwd, Camera end, int steps) { this.wwd = wwd; this.endCamera.set(end); this.endPos.set(end.latitude, end.longitude, end.altitude); this.steps = steps; }
/** * Sets this label's geographic position to the values in the supplied position. * * @param position the new position where this label is displayed * * @return this label, with its position set to the specified value * * @throws IllegalArgumentException If the position is null */ public Label setPosition(Position position) { if (position == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "Text", "setPosition", "missingPosition")); } this.position.set(position); return this; }
/** * Constructs a label with specified attributes that displays at a geographic position once its text is set to a * non-null value. * * @param position the position where the label is displayed * @param attributes a reference to an attributes bundle used by this label when not highlighted * * @throws IllegalArgumentException If the position is null */ public Label(Position position, TextAttributes attributes) { if (position == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "Label", "constructor", "missingPosition")); } this.position.set(position); this.attributes = attributes; }
/** * Sets this sightline's geographic position to the values in the supplied position. * * @param position the new position where this sightline is centered * * @return this sightline, with its position set to the specified value * * @throws IllegalArgumentException If the position is null */ public OmnidirectionalSightline setPosition(Position position) { if (position == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "OmnidirectionalSightline", "setPosition", "missingPosition")); } this.position.set(position); return this; }
/** * Constructs a label with specified attributes that displays text at a geographic position. * * @param position the position where the label is displayed * @param text the text to display, or null to display nothing * @param attributes a reference to an attributes bundle used by this label when not highlighted * * @throws IllegalArgumentException If the position is null */ public Label(Position position, String text, TextAttributes attributes) { if (position == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "Label", "constructor", "missingPosition")); } this.position.set(position); this.text = text; this.attributes = attributes; }
/** * Constructs a label that displays text at a geographic position. * * @param position the position where the label is displayed * @param text the text to display, or null to display nothing * * @throws IllegalArgumentException If the position is null */ public Label(Position position, String text) { if (position == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "Label", "constructor", "missingPosition")); } this.position.set(position); this.text = text; this.attributes = new TextAttributes(); }
/** * Sets this placemark's geographic position to the values in the supplied position. * * @param position The new position where this placemark will be drawn * * @return This placemark */ public Placemark setPosition(Position position) { if (position == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "Placemark", "setPosition", "missingPosition")); } if (this.position == null) { this.position = new Position(position); } else { this.position.set(position); } return this; }
/** * Sets the geographic position of this ellipse's center. The position may be null, in which case the ellipse does * not display. * * @param position the new center position; may be null * * @return this ellipse with its center position set to the specified position */ public Ellipse setCenter(Position position) { if (position == null) { this.center = null; } else if (this.center == null) { this.center = new Position(position); } else { this.center.set(position); } this.reset(); return this; }
/** * Constructs an OmnidirectionalSightline that displays the line-of-sight from a specified center position and * range. Visible features are displayed in the specified attributes, while occluded features are displayed in red. * * @param position the position where the sightline is centered * @param range the sightline's range in meters from its position * @param attributes a reference to an attributes bundle used by this sightline when not highlighted * * @throws IllegalArgumentException If the position is null, or if the range is negative */ public OmnidirectionalSightline(Position position, double range, ShapeAttributes attributes) { if (position == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "OmnidirectionalSightline", "constructor", "missingPosition")); } if (range < 0) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "OmnidirectionalSightline", "constructor", "invalidRange")); } this.position.set(position); this.range = range; this.attributes = attributes; this.occludeAttributes = new ShapeAttributes(); this.occludeAttributes.setInteriorColor(new Color(1, 0, 0, 1)); // red }
/** * Constructs an OmnidirectionalSightline that displays the line-of-sight from a specified center position and * range. Visible features are displayed in white, while occluded features are displayed in red. * * @param position the position where the sightline is centered * @param range the sightline's range in meters from its position * * @throws IllegalArgumentException If the position is null, or if the range is negative */ public OmnidirectionalSightline(Position position, double range) { if (position == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "OmnidirectionalSightline", "constructor", "missingPosition")); } if (range < 0) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "OmnidirectionalSightline", "constructor", "invalidRange")); } this.position.set(position); this.range = range; this.attributes = new ShapeAttributes(); this.occludeAttributes = new ShapeAttributes(); this.occludeAttributes.setInteriorColor(new Color(1, 0, 0, 1)); // red }
/** * Tests that we handled a null argument correctly. * * @throws Exception */ @Test(expected = IllegalArgumentException.class) public void testSet_WithNull() throws Exception { Position position = new Position(); position.set(null); fail("Expected a InvalidArgumentException."); }
@Override public void run() { this.wwd.getNavigator().getAsCamera(this.wwd.getGlobe(), this.beginCamera); this.beginPos.set(this.beginCamera.latitude, this.beginCamera.longitude, this.beginCamera.altitude); for (int i = 0; i < this.steps; i++) { double amount = (double) i / (double) (this.steps - 1); this.beginPos.interpolateAlongPath(this.endPos, WorldWind.GREAT_CIRCLE, amount, this.curPos); this.curCamera.latitude = this.curPos.latitude; this.curCamera.longitude = this.curPos.longitude; this.curCamera.altitude = this.curPos.altitude; this.curCamera.heading = WWMath.interpolateAngle360(amount, this.beginCamera.heading, this.endCamera.heading); this.curCamera.tilt = WWMath.interpolateAngle180(amount, this.beginCamera.tilt, this.endCamera.tilt); this.curCamera.roll = WWMath.interpolateAngle180(amount, this.beginCamera.roll, this.endCamera.roll); Runnable setCommand = SetCameraCommand.obtain(this.wwd, this.curCamera); runOnActivityThread(setCommand); sleepQuietly(FRAME_INTERVAL); } } }
/** * Tests that we read back the same doubles we set. * * @throws Exception */ @Test public void testSet_WithDoubles() throws Exception { // KOXR Airport double lat = 34.2; double lon = -119.2; double elev = 13.7; // 45' Position pos = new Position(); pos.set(lat, lon, elev); assertEquals("latitude", lat, pos.latitude, 0); assertEquals("longitude", lon, pos.longitude, 0); assertEquals("altitude", elev, pos.altitude, 0); }
/** * Test that we read back the same Location data that we set. * * @throws Exception */ @Test public void testSet() throws Exception { // KOXR Airport double lat = 34.2; double lon = -119.2; double elev = 13.7; // 45' Position oxr = new Position(lat, lon, elev); Position other = new Position(); other.set(oxr); assertEquals("latitude", oxr.latitude, other.latitude, 0); assertEquals("longitude", oxr.longitude, other.longitude, 0); assertEquals("altitude", oxr.altitude, other.altitude, 0); }