public void updateEffectiveAreaSize(SARData sarData) { // System.out.println("Is the sar data null? "); // System.out.println(sarData == null); // System.out.println("Is the effective area null? "); // System.out.println(sarData.getFirstEffortAllocationData()==null); // if (sarData.getEffortAllocationData().size() > id) { sarData.getEffortAllocationData().get(id).setEffectiveAreaA(A); sarData.getEffortAllocationData().get(id).setEffectiveAreaB(B); sarData.getEffortAllocationData().get(id).setEffectiveAreaC(C); sarData.getEffortAllocationData().get(id).setEffectiveAreaD(D); } }
public EffectiveSRUAreaGraphics( Double width, Double height, SARData data, int id, String labelName) { super(); this.id = id; this.sarData = data; totalSize = width * height; // Find center point Position centerPosition = null; if (sarData instanceof RapidResponseData) { RapidResponseData rapidResponseData = (RapidResponseData) data; centerPosition = rapidResponseData.getDatum(); verticalBearing = Calculator.bearing(rapidResponseData.getA(), rapidResponseData.getD(), Heading.RL); horizontalBearing = Calculator.bearing(rapidResponseData.getA(), rapidResponseData.getB(), Heading.RL); // Vertical and horizontal must be swapped since the direction has // been set to very east or very west if (verticalBearing < 280 && verticalBearing > 260 || verticalBearing < 100 && verticalBearing > 70) { double newVer = verticalBearing; System.out.println("swapping"); verticalBearing = horizontalBearing; horizontalBearing = newVer; } // Reversing if direction is opposite way of assumed, assumed to be // headed in 90 direction ie. right if (horizontalBearing > 180 || horizontalBearing < 0) { horizontalBearing = Calculator.reverseDirection(horizontalBearing); } if (verticalBearing > 270 || verticalBearing < 90) { verticalBearing = Calculator.reverseDirection(verticalBearing); } System.out.println("Vertical bearing is: " + verticalBearing); System.out.println("Horizontal bearing is: " + horizontalBearing); } if (sarData instanceof DatumPointData) { DatumPointData datumData = (DatumPointData) data; verticalBearing = Calculator.bearing(datumData.getA(), datumData.getD(), Heading.RL); horizontalBearing = Calculator.bearing(datumData.getA(), datumData.getB(), Heading.RL); centerPosition = datumData.getDatumDownWind(); // Vertical and horizontal must be swapped since the direction has // been set to very east or very west if (verticalBearing < 280 && verticalBearing > 260 || verticalBearing < 100 && verticalBearing > 70) { double newVer = verticalBearing; System.out.println("swapping"); verticalBearing = horizontalBearing; horizontalBearing = newVer; } // Reversing if direction is opposite way of assumed, assumed to be // headed in 90 direction ie. right if (horizontalBearing > 180 || horizontalBearing < 0) { horizontalBearing = Calculator.reverseDirection(horizontalBearing); } if (verticalBearing > 270 || verticalBearing < 90) { verticalBearing = Calculator.reverseDirection(verticalBearing); } System.out.println("Vertical bearing is: " + verticalBearing); System.out.println("Horizontal bearing is: " + horizontalBearing); } // Find A position Position topCenter = Calculator.findPosition( centerPosition, Calculator.reverseDirection(verticalBearing), Converter.nmToMeters(height / 2)); A = Calculator.findPosition( topCenter, Calculator.reverseDirection(horizontalBearing), Converter.nmToMeters(width / 2)); B = Calculator.findPosition(A, horizontalBearing, Converter.nmToMeters(width)); C = Calculator.findPosition(A, verticalBearing, Converter.nmToMeters(height)); D = Calculator.findPosition(C, horizontalBearing, Converter.nmToMeters(width)); sarData.getEffortAllocationData().get(id).setEffectiveAreaA(A); sarData.getEffortAllocationData().get(id).setEffectiveAreaB(B); sarData.getEffortAllocationData().get(id).setEffectiveAreaC(C); sarData.getEffortAllocationData().get(id).setEffectiveAreaD(D); effectiveArea = new AreaInternalGraphics( A, B, C, D, width, height, this, verticalBearing, horizontalBearing, labelName); topLine = new SarEffectiveAreaLines(A, B, LineType.TOP, this); bottomLine = new SarEffectiveAreaLines(C, D, LineType.BOTTOM, this); leftLine = new SarEffectiveAreaLines(A, C, LineType.LEFT, this); rightLine = new SarEffectiveAreaLines(B, D, LineType.RIGHT, this); add(effectiveArea); add(bottomLine); add(topLine); add(leftLine); add(rightLine); }