public ReferenceWaypoint(ManeuverLocation loc, double speed) { loc.convertToAbsoluteLatLonDepth(); this.loc = loc.clone(); this.latitude = loc.getLatitudeAsDoubleValue(); this.longitude = loc.getLongitudeAsDoubleValue(); this.speed = speed; this.speedUnits = SPEED_UNITS.METERS_PS; this.z = loc.getZ(); this.zUnits = loc.getZUnits(); reference = new Reference(); reference.setLat(loc.getLatitudeAsDoubleValueRads()); reference.setLon(loc.getLongitudeAsDoubleValueRads()); reference.setZ(new DesiredZ((float) loc.getZ(), Z_UNITS.valueOf(loc.getZUnits().name()))); reference.setSpeed(new DesiredSpeed(speed, SPEED_UNITS.METERS_PS)); reference.setFlags((short) (Reference.FLAG_LOCATION | Reference.FLAG_SPEED | Reference.FLAG_Z)); }
@Override public void propertiesChanged() { loc.setZ(z); loc.setZUnits(zUnits); reference = new Reference(); if (loiter) reference.setRadius(loiterRadius); reference.setLat(loc.getLatitudeAsDoubleValueRads()); reference.setLon(loc.getLongitudeAsDoubleValueRads()); if (loc.getZUnits() != ManeuverLocation.Z_UNITS.NONE) reference.setZ(new DesiredZ((float) loc.getZ(), Z_UNITS.valueOf(loc.getZUnits().name()))); if (defineSpeed) reference.setSpeed(new DesiredSpeed(speed, speedUnits)); reference.setFlags( (short) (Reference.FLAG_LOCATION | (defineSpeed ? Reference.FLAG_SPEED : 0) | (loc.getZUnits() != ManeuverLocation.Z_UNITS.NONE ? Reference.FLAG_Z : 0) | (loiter ? Reference.FLAG_RADIUS : 0))); }