/** * Gets the geometric extent of this obstacle path for a specified globe. * * @param globe the globe to be used for the conversion * * @return the geometric extent of this obstacle path * * @see Path#getExtent(Globe, double) */ @Override public Extent getExtent(Globe globe) { return super.getExtent(globe, 1d); }
/** * Gets the waypoints of this trajectory. * * @return the waypoints of this trajectory * * @see Path#getPositions() */ @SuppressWarnings("unchecked") public Iterable<? extends Waypoint> getWaypoints() { return (Iterable<Waypoint>) super.getPositions(); }
/** * Renders this obstacle path. * * @see Renderable#render(DrawContext) */ @Override public void render(DrawContext dc) { super.render(dc); if (null != this.depiction) { this.depiction.render(dc); } }
private double computeSegmentLength(Path path, DrawContext dc, Position posA, Position posB) { final LatLon llA = new LatLon(posA.getLatitude(), posA.getLongitude()); final LatLon llB = new LatLon(posB.getLatitude(), posB.getLongitude()); Angle ang; String pathType = path.getPathType(); if (Objects.equals(pathType, AVKey.LINEAR)) { ang = LatLon.linearDistance(llA, llB); } else if (Objects.equals(pathType, AVKey.RHUMB_LINE) || Objects.equals(pathType, AVKey.LOXODROME)) { ang = LatLon.rhumbDistance(llA, llB); } else { // Great circle ang = LatLon.greatCircleDistance(llA, llB); } if (path.getAltitudeMode() == WorldWind.CLAMP_TO_GROUND) { return ang.radians * (dc.getGlobe().getRadius()); } final double height = 0.5 * (posA.getElevation() + posB.getElevation()); return ang.radians * (dc.getGlobe().getRadius() + height * dc.getVerticalExaggeration()); }
/** * Computes the estimated cost of a specified target waypoint when reached * via a specified source waypoint. * * @param source the source waypoint in globe coordinates * @param target the target waypoint in globe coordinates */ protected void computeCost(Waypoint source, Waypoint target) { Path leg = new Path(source, target); Capabilities capabilities = this.getAircraft().getCapabilities(); Globe globe = this.getEnvironment().getGlobe(); // TODO: catch IllegalArgumentException (incapable) and exit ZonedDateTime end = capabilities.getEstimatedTime(leg, globe, source.getEto()); double cost = this.getEnvironment().getStepCost( source, target, source.getEto(), end, this.getCostPolicy(), this.getRiskPolicy()); if ((source.getG() + cost) < target.getG()) { target.setParent(source); target.setG(source.getG() + cost); target.setEto(end); } }
/** * Moves this obstacle path to a specified position. * * @param position the position to move this obstacle path to * * @see Movable#moveTo(Position) */ @Override public void moveTo(Position position) { super.moveTo(position); if (this.hasDepiction()) { this.depiction.moveTo(position); } }
/** * Moves this trajectory by adding a specified position. * * @param position the position to be added to this trajectory's position * * @see Movable#move(Position) */ @Override public void move(Position position) { super.move(position); if (this.hasDepiction()) { this.depiction.move(position); } }
/** * Moves this trajectory to a specified position. * * @param position the position to move this trajectory to * * @see Movable#moveTo(Position) */ @Override public void moveTo(Position position) { super.moveTo(position); if (this.hasDepiction()) { this.depiction.moveTo(position); } }
/** * Moves this obstacle path by adding a specified position. * * @param position the position to be added to this obstacle path's position * * @see Movable#move(Position) */ @Override public void move(Position position) { super.move(position); if (this.hasDepiction()) { this.depiction.move(position); } }
/** * Renders this trajectory. * * @param dc the drawing context * * @see Renderable#render */ @Override public void render(DrawContext dc) { super.render(dc); if (null != this.depiction) { this.depiction.render(dc); } if (null != this.getWaypoints()) { for (Waypoint waypoint : this.getWaypoints()) { waypoint.render(dc); } } }
/** * Gets the estimated duration to travel along a path of positions at * cruise speed including climbs and descents in still air. * * @param path the path of positions * @param globe the globe associated with the positions * * @return the estimated duration to travel along the path of positions at * cruise speed including climbs and descents in still air */ public Duration getEstimatedDuration(Path path, Globe globe) { Duration estimatedDuration = Duration.ZERO; @SuppressWarnings("unchecked") Iterator<Position> positions = (Iterator<Position>) path.getPositions().iterator(); Position current = null; if (positions.hasNext()) { current = positions.next(); } while (positions.hasNext()) { estimatedDuration = estimatedDuration.plus(this.getEstimatedDuration(current, positions.next(), globe)); } return estimatedDuration; }