create download area graphic after map is loaded
@@ -87,6 +87,13 @@ public class GenerateOfflineMapOverridesController {
Portal portal = new Portal("https://www.arcgis.com", true);
PortalItem portalItem = new PortalItem(portal, "acc027394bc84c2fb04d1ed317aac674");
+ // create a map with the portal item
+ map = new ArcGISMap(portalItem);
+ map.addDoneLoadingListener(() -> {
+ // enable the generate offline map button when the map is loaded
+ if (map.getLoadStatus() == LoadStatus.LOADED) {
+ generateOfflineMapButton.setDisable(false);
+
// create a graphics overlay for displaying the download area
graphicsOverlay = new GraphicsOverlay();
mapView.getGraphicsOverlays().add(graphicsOverlay);
@@ -97,14 +104,8 @@ public class GenerateOfflineMapOverridesController {
SimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFFFF0000, 2);
downloadArea.setSymbol(simpleLineSymbol);
- // create a map with the portal item
- map = new ArcGISMap(portalItem);
- map.addDoneLoadingListener(() -> {
- // enable the generate offline map button when the map is loaded
- if (map.getLoadStatus() == LoadStatus.LOADED) {
- generateOfflineMapButton.setDisable(false);
- }
updateDownloadArea();
+ }
});
// update the download area whenever the viewpoint changes
