private void adjustDateLineCrossingPoints() { ArrayList<LatLon> corners = new ArrayList<LatLon>(Arrays.asList(sw, se, nw, ne)); if (!LatLon.locationsCrossDateLine(corners)) return; double lonSign = 0; for (LatLon corner : corners) { if (Math.abs(corner.getLongitude().degrees) != 180) lonSign = Math.signum(corner.getLongitude().degrees); } if (lonSign == 0) return; if (Math.abs(sw.getLongitude().degrees) == 180 && Math.signum(sw.getLongitude().degrees) != lonSign) sw = new Position(sw.getLatitude(), sw.getLongitude().multiply(-1), sw.getElevation()); if (Math.abs(se.getLongitude().degrees) == 180 && Math.signum(se.getLongitude().degrees) != lonSign) se = new Position(se.getLatitude(), se.getLongitude().multiply(-1), se.getElevation()); if (Math.abs(nw.getLongitude().degrees) == 180 && Math.signum(nw.getLongitude().degrees) != lonSign) nw = new Position(nw.getLatitude(), nw.getLongitude().multiply(-1), nw.getElevation()); if (Math.abs(ne.getLongitude().degrees) == 180 && Math.signum(ne.getLongitude().degrees) != lonSign) ne = new Position(ne.getLatitude(), ne.getLongitude().multiply(-1), ne.getElevation()); }
public AppFrame() { // Create the rectangular array of numeric values in the range from 0.0 to 1.0, inclusive, and // assign the // array a geographic sector. this.createRectangularArray(); // Display the rectangular array of numeric values as a surface that maps each numeric value // to a hue, and // interpolates the colors between array points. RenderableLayer arrayLayer = new RenderableLayer(); arrayLayer.setName("Rectangular Array"); this.getWwd().getModel().getLayers().add(arrayLayer); this.addRectangularArrayShapes(arrayLayer); // Create a layer to group the contour line shapes. RenderableLayer contourLayer = new RenderableLayer(); contourLayer.setName("Contour Lines"); this.getWwd().getModel().getLayers().add(contourLayer); // Create a ContourBuilder with the rectangular array of numeric values as a one-dimensional // array of // floating point numbers. The contour builder assumes that the array is organized in // row-major order, with // the first value indicating the value at the upper-left corner. ContourBuilder cb = new ContourBuilder(this.arrayWidth, this.arrayHeight, this.arrayValues); // Build contour lines for a list of pre-determined threshold values. Contour line coordinates // are computed // by mapping the rectangular array's coordinates to a geographic sector. for (double value : Arrays.asList(0.083, 0.250, 0.416, 0.583, 0.75, 0.916)) { List<List<Position>> contourList = cb.buildContourLines(value, this.arraySector, 0); // altitude 0 this.addContourShapes(contourList, value, contourLayer); } }
/** {@inheritDoc} */ public Iterable<AVList> getLinks() { if (this.webViewWindowPtr != 0) { AVList[] links = WindowsWebViewJNI.getLinks(this.webViewWindowPtr); if (links != null) return Arrays.asList(links); } return Collections.emptyList(); }
/** * Create the paths necessary to draw the graphic. * * @param dc Current draw context. */ @Override protected void createShapes(DrawContext dc) { this.paths = new Path[5]; // Create a path for the line parts of the arrows this.paths[0] = this.createPath(Arrays.asList(this.position1, this.position3)); this.paths[1] = this.createPath(Arrays.asList(this.position2, this.position4)); // Create the arrowheads List<Position> positions = this.computeArrowheadPositions(dc, this.position1, this.position3); this.paths[2] = createPath(positions); positions = this.computeArrowheadPositions(dc, this.position2, this.position4); this.paths[3] = createPath(positions); // Create the trapezoid base positions = this.computeBasePositions(dc, this.position1, this.position2, this.position3); this.paths[4] = createPath(positions); }
protected List<Position> computePathPositions( Position startPosition, Position endPosition, Angle delta) { Angle dist = LatLon.greatCircleDistance(startPosition, endPosition); dist = dist.multiply(0.6); Angle azimuth = LatLon.greatCircleAzimuth(startPosition, endPosition); LatLon locA = LatLon.greatCircleEndPosition(startPosition, azimuth.add(delta), dist); dist = dist.multiply(0.9); LatLon locB = LatLon.greatCircleEndPosition(startPosition, azimuth.subtract(delta), dist); return Arrays.asList(startPosition, new Position(locA, 0), new Position(locB, 0), endPosition); }
public AppFrame() { super(true, true, false); // Create list of positions along the control line. List<Position> positions = Arrays.asList( Position.fromDegrees(49.0457, -122.8115, 100), Position.fromDegrees(49.0539, -122.8091, 110), Position.fromDegrees(49.0621, -122.7937, 120), Position.fromDegrees(49.0681, -122.8044, 130), Position.fromDegrees(49.0682, -122.7730, 140), Position.fromDegrees(49.0482, -122.7764, 150), Position.fromDegrees(49.0498, -122.7466, 140), Position.fromDegrees(49.0389, -122.7453, 130), Position.fromDegrees(49.0321, -122.7759, 120), Position.fromDegrees(49.0394, -122.7689, 110), Position.fromDegrees(49.0629, -122.7666, 100)); // We will generate four paths parallel to the control path. Allocate lists to store the // positions of these // paths. List<Position> pathPositions1 = new ArrayList<Position>(); List<Position> pathPositions2 = new ArrayList<Position>(); List<Position> pathPositions3 = new ArrayList<Position>(); List<Position> pathPositions4 = new ArrayList<Position>(); Globe globe = getWwd().getModel().getGlobe(); // Generate two sets of lines parallel to the control line. The positions will be added to the // pathPosition lists. WWMath.generateParallelLines(positions, pathPositions1, pathPositions2, 50, globe); WWMath.generateParallelLines(positions, pathPositions3, pathPositions4, 100, globe); // Create Path objects from the position lists, and add them to a layer. RenderableLayer layer = new RenderableLayer(); this.addPath(layer, positions, "Control Path"); this.addPath(layer, pathPositions1, "Path 1"); this.addPath(layer, pathPositions2, "Path 2"); this.addPath(layer, pathPositions3, "Path 3"); this.addPath(layer, pathPositions4, "Path 4"); insertBeforePlacenames(getWwd(), layer); }
/** * {@inheritDoc} * * <p>The dummy graphic requires exactly three control points. Any positions beyond the first * three will be ignored. * * @throws IllegalArgumentException if less than three control points are provided. */ public void setPositions(Iterable<? extends Position> positions) { if (positions == null) { String message = Logging.getMessage("nullValue.PositionsListIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } try { Iterator<? extends Position> iterator = positions.iterator(); Position pt1 = iterator.next(); Position pt2 = iterator.next(); Position pt3 = iterator.next(); this.path.setPositions(Arrays.asList(pt2, pt1, pt3)); } catch (NoSuchElementException e) { String message = Logging.getMessage("generic.InsufficientPositions"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } }
public List<Tile> getTiles() { if (tileKeys.isEmpty()) { Tile[] tiles = buildTiles(this.placeNameService, this); // load tileKeys for (Tile t : tiles) { tileKeys.add(t.getFileCachePath()); WorldWind.getMemoryCache(Tile.class.getName()).add(t.getFileCachePath(), t); } return Arrays.asList(tiles); } else { List<Tile> dataTiles = new ArrayList<Tile>(); for (String s : tileKeys) { Tile t = (Tile) WorldWind.getMemoryCache(Tile.class.getName()).getObject(s); if (t != null) { dataTiles.add(t); } } return dataTiles; } }
public SquareSector( int UTMZone, String hemisphere, Sector UTMZoneSector, double SWEasting, double SWNorthing, double size) { this.UTMZone = UTMZone; this.hemisphere = hemisphere; this.UTMZoneSector = UTMZoneSector; this.SWEasting = SWEasting; this.SWNorthing = SWNorthing; this.size = size; // Compute corners positions this.sw = computePosition(this.UTMZone, this.hemisphere, SWEasting, SWNorthing); this.se = computePosition(this.UTMZone, this.hemisphere, SWEasting + size, SWNorthing); this.nw = computePosition(this.UTMZone, this.hemisphere, SWEasting, SWNorthing + size); this.ne = computePosition(this.UTMZone, this.hemisphere, SWEasting + size, SWNorthing + size); this.squareCenter = computePosition( this.UTMZone, this.hemisphere, SWEasting + size / 2, SWNorthing + size / 2); // Compute approximate bounding sector and center point if (this.sw != null && this.se != null && this.nw != null && this.ne != null) { adjustDateLineCrossingPoints(); this.boundingSector = Sector.boundingSector(Arrays.asList(sw, se, nw, ne)); if (!isInsideGridZone()) this.boundingSector = this.UTMZoneSector.intersection(this.boundingSector); this.centroid = this.boundingSector != null ? this.boundingSector.getCentroid() : this.squareCenter; // this.squareCenter = this.boundingSector.getCentroid(); } // Check whether this square is truncated by the grid zone boundary this.isTruncated = !isInsideGridZone(); }
/** * Indicates the graphics supported by this class. * * @return List of masked SIDC strings that identify graphics that this class supports. */ public static List<String> getSupportedGraphics() { return Arrays.asList(TacGrpSidc.C2GM_DCPN_DMY); }
/** {@inheritDoc} */ @Override public Iterable<? extends Position> getPositions() { return Arrays.asList(this.position1, this.position2, this.position3, this.position4); }
/** * Indicates the graphics supported by this class. * * @return List of masked SIDC strings that identify graphics that this class supports. */ public static List<String> getSupportedGraphics() { return Arrays.asList(TacGrpSidc.C2GM_OFF_ARS_SFP); }
/** * Indicates the graphics supported by this class. * * @return List of masked SIDC strings that identify graphics that this class supports. */ public static List<String> getSupportedGraphics() { return Arrays.asList(TacGrpSidc.C2GM_GNL_ARS_SRHARA); }
protected List<Sector> computeSectors(Globe globe) { if (this.sector == null || this.sector.equals(Sector.EMPTY_SECTOR)) return null; return Arrays.asList(this.sector); }
/** * Indicates the graphics supported by this class. * * @return List of masked SIDC strings that identify graphics that this class supports. */ public static List<String> getSupportedGraphics() { return Arrays.asList(TacGrpSidc.C2GM_GNL_LNE_LOC); }
/** {@inheritDoc} */ public Iterable<? extends Position> getPositions() { return Arrays.asList(new Position(this.quad.getCenter(), 0)); }
/** * Indicates the graphics supported by this class. * * @return List of masked SIDC strings that identify graphics that this class supports. */ public static List<String> getSupportedGraphics() { return Arrays.asList(TacGrpSidc.MOBSU_CBRN_MSDZ); }