/** * {@inheritDoc} * * @param positions Control points. This graphic uses only two control point, which determine the * midpoints of two opposite sides of the quad. See Fire Support Area (2.X.4.3.2.1.2) on pg. * 652 of MIL-STD-2525C for an example of how these points are interpreted. */ public void setPositions(Iterable<? extends Position> positions) { if (positions == null) { String message = Logging.getMessage("nullValue.PositionsListIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } Iterator<? extends Position> iterator = positions.iterator(); try { Position pos1 = iterator.next(); Position pos2 = iterator.next(); LatLon center = LatLon.interpolateGreatCircle(0.5, pos1, pos2); this.quad.setCenter(center); Angle heading = LatLon.greatCircleAzimuth(pos2, pos1); this.quad.setHeading(heading.subtract(Angle.POS90)); this.positions = positions; this.shapeInvalid = true; // Need to recompute quad size } catch (NoSuchElementException e) { String message = Logging.getMessage("generic.InsufficientPositions"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } }