/** * Called by doInBackground(); creates place icons from places collection and adds them to the places layer. */ private void createPlaceIcons() { publishProgress("Creating place icons..."); for (Place place : this.places) { // Create and configure a Placemark for this place, using a PlaceLevelOfDetailSelector to // dynamically set the PlacemarkAttributes. Placemark placemark = new Placemark(place.position, null, place.name); placemark.setLevelOfDetailSelector(new PlaceLevelOfDetailSelector(getResources(), place)); placemark.setEyeDistanceScaling(true); placemark.setEyeDistanceScalingThreshold(PlaceLevelOfDetailSelector.LEVEL_1_DISTANCE); // On a background thread, we can add Placemarks to a RenderableLayer that is // NOT attached to the WorldWindow. If the layer was attached to the WorldWindow // then we'd have to do this on the UI thread. Later, we'll add the layer to // WorldWindow on the UI thread in the onPostExecute() method. this.placeLayer.addRenderable(placemark); this.numPlacesCreated++; } } }