/** * Build the resource map from the KML Model's <i>ResourceMap</i> element. * * @param model Model from which to create the resource map. * @return Map that relates relative paths in the COLLADA document to paths relative to the KML * document. */ protected Map<String, String> createResourceMap(KMLModel model) { Map<String, String> map = new HashMap<String, String>(); KMLResourceMap resourceMap = model.getResourceMap(); if (resourceMap == null) return Collections.emptyMap(); for (KMLAlias alias : resourceMap.getAliases()) { if (alias != null && !WWUtil.isEmpty(alias.getSourceRef()) && !WWUtil.isEmpty(alias.getTargetHref())) { map.put(alias.getSourceRef(), alias.getTargetHref()); } } return map.size() > 0 ? map : Collections.<String, String>emptyMap(); }
/** * 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); } }
/** * Thread's off a task to determine whether the resource is local or remote and then retrieves it * either from disk cache or a remote server. * * @param dc the current draw context. */ protected void requestResource(DrawContext dc) { if (WorldWind.getTaskService().isFull()) return; KMLLink link = this.model.getLink(); if (link == null) return; String address = link.getAddress(dc); if (address != null) address = address.trim(); if (WWUtil.isEmpty(address)) return; WorldWind.getTaskService().addTask(new RequestTask(this, address)); }