/** * Create a collection of layer lists and their included layers described by an array of XML * layer-list description elements. * * <p>Any exceptions occurring during creation of the layer lists or their included layers are * logged and not re-thrown. The layers associated with the exceptions are not included in the * returned layer list. * * @param elements the XML elements describing the layer lists to create. * @param params any parameters to apply when creating the included layers. * @return an array containing the specified layer lists. */ protected LayerList[] createLayerLists(Element[] elements, AVList params) { ArrayList<LayerList> layerLists = new ArrayList<LayerList>(); for (Element element : elements) { try { String href = WWXML.getText(element, "@href"); if (href != null && href.length() > 0) { Object o = this.createFromConfigSource(href, params); if (o == null) continue; if (o instanceof Layer) { LayerList ll = new LayerList(); ll.add((Layer) o); o = ll; } if (o instanceof LayerList) { LayerList list = (LayerList) o; if (list != null && list.size() > 0) layerLists.add(list); } else if (o instanceof LayerList[]) { LayerList[] lists = (LayerList[]) o; if (lists != null && lists.length > 0) layerLists.addAll(Arrays.asList(lists)); } else { String msg = Logging.getMessage("LayerFactory.UnexpectedTypeForLayer", o.getClass().getName()); Logging.logger().log(java.util.logging.Level.WARNING, msg); } continue; } String title = WWXML.getText(element, "@title"); Element[] children = WWXML.getElements(element, "./Layer", null); if (children != null && children.length > 0) { LayerList list = this.createLayerList(children, params); if (list != null && list.size() > 0) { layerLists.add(list); if (title != null && title.length() > 0) list.setValue(AVKey.DISPLAY_NAME, title); } } } catch (Exception e) { Logging.logger().log(java.util.logging.Level.WARNING, e.getMessage(), e); // keep going to create other layers } } return layerLists.toArray(new LayerList[layerLists.size()]); }
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; } }
/** * Determines and stores the network sites to test for public network connectivity. The sites are * drawn from the JVM's gov.nasa.worldwind.avkey.NetworkStatusTestSites property ({@link * AVKey#NETWORK_STATUS_TEST_SITES}). If that property is not defined, the sites are drawn from * the same property in the World Wind or application configuration file. If the sites are not * specified there, the set of sites specified in {@link #DEFAULT_NETWORK_TEST_SITES} are used. To * indicate an empty list in the JVM property or configuration file property, specify an empty * site list, "". */ protected void establishNetworkTestSites() { String testSites = System.getProperty(AVKey.NETWORK_STATUS_TEST_SITES); if (testSites == null) testSites = Configuration.getStringValue(AVKey.NETWORK_STATUS_TEST_SITES); if (testSites == null) { this.networkTestSites.addAll(Arrays.asList(DEFAULT_NETWORK_TEST_SITES)); } else { String[] sites = testSites.split(","); List<String> actualSites = new ArrayList<String>(sites.length); for (String site : sites) { site = WWUtil.removeWhiteSpace(site); if (!WWUtil.isEmpty(site)) actualSites.add(site); } this.setNetworkTestSites(actualSites); } }