当前位置: 首页>>代码示例>>Java>>正文


Java LoadStatus类代码示例

本文整理汇总了Java中com.esri.arcgisruntime.loadable.LoadStatus的典型用法代码示例。如果您正苦于以下问题:Java LoadStatus类的具体用法?Java LoadStatus怎么用?Java LoadStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LoadStatus类属于com.esri.arcgisruntime.loadable包,在下文中一共展示了LoadStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
@Override
public void run (){
  final LoadStatus status = mRouteTask.getLoadStatus();

  // Has the route task loaded successfully?
  if (status == LoadStatus.FAILED_TO_LOAD) {
    Log.i(TAG, mRouteTask.getLoadError().getMessage());
    Log.i(TAG, "CAUSE = " + mRouteTask.getLoadError().getCause().getMessage());
  } else {
    final ListenableFuture<RouteParameters> routeTaskFuture = mRouteTask
        .createDefaultParametersAsync();
    // Add a done listener that uses the returned route parameters
    // to build up a specific request for the route we need
    routeTaskFuture.addDoneListener(new Runnable() {

      @Override
      public void run() {
        try {
          final RouteParameters routeParameters = routeTaskFuture.get();
          final TravelMode mode = routeParameters.getTravelMode();
          mode.setImpedanceAttributeName("WalkTime");
          mode.setTimeAttributeName("WalkTime");
          // Set the restriction attributes for walk times
          List<String> restrictionAttributes = mode.getRestrictionAttributeNames();
          // clear default restrictions set for vehicles
          restrictionAttributes.clear();
          // add pedestrian restrictions
          restrictionAttributes.add("Avoid Roads Unsuitable for Pedestrians");
          restrictionAttributes.add("Preferred for Pedestrians");
          restrictionAttributes.add("Walking");

          // Add a stop for origin and destination
          routeParameters.setTravelMode(mode);
          routeParameters.getStops().add(origin);
          routeParameters.getStops().add(destination);
          // We want the task to return driving directions and routes
          routeParameters.setReturnDirections(true);

          routeParameters.setOutputSpatialReference(SpatialReferences.getWebMercator());

          final ListenableFuture<RouteResult> routeResFuture = mRouteTask
              .solveRouteAsync(routeParameters);
          routeResFuture.addDoneListener(new Runnable() {
            @Override
            public void run() {
              try {
                final RouteResult routeResult = routeResFuture.get();
                // Show route results
                if (routeResult != null){
                  mCallback.onRouteReturned(routeResult);

                }else{
                  Log.i(TAG, "NO RESULT FROM ROUTING");
                }

              } catch (final Exception e) {
                Log.e(TAG, e.getMessage());
              }
            }
          });
        } catch (final Exception e1){
          Log.e(TAG,e1.getMessage() );
        }
      }
    });
  }
}
 
开发者ID:Esri,项目名称:nearby-android,代码行数:68,代码来源:LocationService.java

示例2: loadMapbook

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
 * Load the mobile map package
 * @param callback- MapbookCallback to handle async response.
 */
@Override final public void loadMapbook(final DataManagerCallbacks.MapbookCallback callback) {
  final String mmpkPath = mFileManager.createMobileMapPackageFilePath();

  final MobileMapPackage mmp = new MobileMapPackage(mmpkPath);

  mmp.addDoneLoadingListener(new Runnable() {

    @Override final public void run() {
      Log.i(TAG, "MMPK load status " + mmp.getLoadStatus().name());
      if (mmp.getLoadStatus() == LoadStatus.LOADED) {
        callback.onMapbookLoaded(mmp);

      }else{
        callback.onMapbookNotLoaded(mmp.getLoadError());
      }
    }
  });
  mmp.loadAsync();
}
 
开发者ID:Esri,项目名称:mapbook-android,代码行数:24,代码来源:MapbookPresenter.java

示例3: addLocalFeatureLayer

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
 * Once the feature service starts, a feature layer is created from that service and added to the map.
 * <p>
 * When the feature layer is done loading the view will zoom to the location of were the features were added.
 * 
 * @param status status of feature service
 */
private void addLocalFeatureLayer(StatusChangedEvent status) {

  // check that the feature service has started
  if (status.getNewStatus() == LocalServerStatus.STARTED) {
    // get the url of where feature service is located
    String url = featureService.getUrl() + "/0";
    // create a feature layer using the url
    ServiceFeatureTable featureTable = new ServiceFeatureTable(url);
    featureTable.loadAsync();
    FeatureLayer featureLayer = new FeatureLayer(featureTable);
    featureLayer.addDoneLoadingListener(() -> {
      if (featureLayer.getLoadStatus() == LoadStatus.LOADED && featureLayer.getFullExtent() != null) {
        mapView.setViewpoint(new Viewpoint(featureLayer.getFullExtent()));
        Platform.runLater(() -> featureLayerProgress.setVisible(false));
      } else {
        Alert alert = new Alert(Alert.AlertType.ERROR, "Feature Layer Failed to Load!");
        alert.show();
      }
    });
    featureLayer.loadAsync();
    // add feature layer to map
    map.getOperationalLayers().add(featureLayer);

  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:33,代码来源:LocalServerFeatureLayerSample.java

示例4: addLocalMapImageLayer

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
 * Once the map service starts, a map image layer is created from that service and added to the map.
 * <p>
 * When the map image layer is done loading, the view will zoom to the location of were the image has been added.
 * 
 * @param status status of feature service
 */
private void addLocalMapImageLayer(StatusChangedEvent status) {

  // check that the map service has started
  if (status.getNewStatus() == LocalServerStatus.STARTED) {
    // get the url of where map service is located
    String url = mapImageService.getUrl();
    // create a map image layer using url
    ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer(url);
    // set viewpoint once layer has loaded
    imageLayer.addDoneLoadingListener(() -> {
      if (imageLayer.getLoadStatus() == LoadStatus.LOADED && imageLayer.getFullExtent() != null) {
        mapView.setViewpoint(new Viewpoint(imageLayer.getFullExtent()));
        Platform.runLater(() -> imageLayerProgress.setVisible(false));
      } else {
        Alert alert = new Alert(Alert.AlertType.ERROR, "Image Layer Failed to Load!");
        alert.show();
      }
    });
    imageLayer.loadAsync();
    // add image layer to map
    mapView.getMap().getOperationalLayers().add(imageLayer);
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:31,代码来源:LocalServerMapImageLayerSample.java

示例5: placePictureMarkerSymbol

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
 * Adds a Graphic to the Graphics Overlay using a Point and a Picture Marker
 * Symbol.
 * 
 * @param markerSymbol PictureMarkerSymbol to be used
 * @param graphicPoint where the Graphic is going to be placed
 */
private void placePictureMarkerSymbol(PictureMarkerSymbol markerSymbol, Point graphicPoint) {

  // set size of the image
  markerSymbol.setHeight(40);
  markerSymbol.setWidth(40);

  // load symbol asynchronously
  markerSymbol.loadAsync();

  // add to the graphic overlay once done loading
  markerSymbol.addDoneLoadingListener(() -> {
    if (markerSymbol.getLoadStatus() == LoadStatus.LOADED) {
      Graphic symbolGraphic = new Graphic(graphicPoint, markerSymbol);
      graphicsOverlay.getGraphics().add(symbolGraphic);
    } else {
      Alert alert = new Alert(Alert.AlertType.ERROR, "Picture Marker Symbol Failed to Load!");
      alert.show();
    }
  });

}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:29,代码来源:PictureMarkerSymbolSample.java

示例6: featureLayerShapefile

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
 * Creates a ShapefileFeatureTable from a service and, on loading, creates a FeatureLayer and add it to the map.
 */
private void featureLayerShapefile() {
  // load the shapefile with a local path
  ShapefileFeatureTable shapefileFeatureTable = new ShapefileFeatureTable(
      Environment.getExternalStorageDirectory() + getString(R.string.shapefile_path));

  shapefileFeatureTable.loadAsync();
  shapefileFeatureTable.addDoneLoadingListener(() -> {
    if (shapefileFeatureTable.getLoadStatus() == LoadStatus.LOADED) {

      // create a feature layer to display the shapefile
      FeatureLayer shapefileFeatureLayer = new FeatureLayer(shapefileFeatureTable);

      // add the feature layer to the map
      mMapView.getMap().getOperationalLayers().add(shapefileFeatureLayer);

      // zoom the map to the extent of the shapefile
      mMapView.setViewpointAsync(new Viewpoint(shapefileFeatureLayer.getFullExtent()));
    } else {
      String error = "Shapefile feature table failed to load: " + shapefileFeatureTable.getLoadError().toString();
      Toast.makeText(MainActivity.this, error, Toast.LENGTH_LONG).show();
      Log.e(TAG, error);
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:28,代码来源:MainActivity.java

示例7: loadMobileMapPackage

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
 * Load a mobile map package into a MapView
 *
 * @param mmpkFile Full path to mmpk file
 */
private void loadMobileMapPackage(String mmpkFile){
    //[DocRef: Name=Open Mobile Map Package-android, Category=Work with maps, Topic=Create an offline map]
    // create the mobile map package
    mapPackage = new MobileMapPackage(mmpkFile);
    // load the mobile map package asynchronously
    mapPackage.loadAsync();

    // add done listener which will invoke when mobile map package has loaded
    mapPackage.addDoneLoadingListener(new Runnable() {
        @Override
        public void run() {
            // check load status and that the mobile map package has maps
            if(mapPackage.getLoadStatus() == LoadStatus.LOADED && mapPackage.getMaps().size() > 0){
                // add the map from the mobile map package to the MapView
                mMapView.setMap(mapPackage.getMaps().get(0));
            }else{
                // Log an issue if the mobile map package fails to load
                Log.e(TAG, mapPackage.getLoadError().getMessage());
            }
        }
    });
    //[DocRef: END]
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:29,代码来源:MainActivity.java

示例8: setupOfflineNetwork

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
 * Sets up a RouteTask from the NetworkDatasets in the current map. Shows a message to user if network dataset is
 * not found.
 */
private void setupOfflineNetwork() {

  if ((mMap.getTransportationNetworks() == null) || (mMap.getTransportationNetworks().size() < 1)) {
    Snackbar.make(mMapView, getString(R.string.network_dataset_not_found), Snackbar.LENGTH_SHORT).show();
    return;
  }

  // Create the RouteTask from network data set using same map used in display
  mRouteTask = new RouteTask(GeocodeRouteActivity.this, mMap.getTransportationNetworks().get(0));
  mRouteTask.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
      if (mRouteTask.getLoadStatus() != LoadStatus.LOADED) {
        Snackbar.make(mMapView, String.format(getString(R.string.object_not_loaded), "RouteTask"),
            Snackbar.LENGTH_SHORT).show();
      }
    }
  });
  mRouteTask.loadAsync();
}
 
开发者ID:Esri,项目名称:arcgis-runtime-demos-android,代码行数:25,代码来源:GeocodeRouteActivity.java

示例9: loadMobileMapPackage

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
@Override public void loadMobileMapPackage(@NonNull final String mobileMapPackagePath,
    final DataManagerCallbacks.MapbookCallback callback) {
  mMobileMapPackage = new MobileMapPackage(mobileMapPackagePath);
  mMobileMapPackage.addDoneLoadingListener(new Runnable() {
    @Override public void run() {
      if (mMobileMapPackage.getLoadStatus() == LoadStatus.LOADED){
        callback.onMapbookLoaded(mMobileMapPackage);
      }else{
        callback.onMapbookNotLoaded(mMobileMapPackage.getLoadError());
      }
    }
  });
  mMobileMapPackage.loadAsync();
}
 
开发者ID:Esri,项目名称:mapbook-android,代码行数:15,代码来源:DataManager.java

示例10: downloadMapbook

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
 * Fetches mapbook from Portal
 */
@Override final public void downloadMapbook() {

  Log.i(TAG, "Downloading mapbook");
  final PortalItem portalItem = new PortalItem(mPortal, mPortalItemId);
  portalItem.loadAsync();
  portalItem.addDoneLoadingListener(new Runnable() {
    @Override public void run() {

      if (portalItem.getLoadStatus() == LoadStatus.LOADED){
        final ListenableFuture<InputStream> future = portalItem.fetchDataAsync();
        final long portalItemSize = portalItem.getSize();
        future.addDoneListener(new Runnable() {
          @Override public void run() {

            try {
              final InputStream inputStream = future.get();
              mView.executeDownload(portalItemSize, inputStream);


            } catch (final InterruptedException | ExecutionException e) {
              mView.showMessage("There was a problem downloading the file");
              Log.e(TAG, "Problem downloading file " + e.getMessage());
              mView.sendResult(RESULT_CANCELED, ERROR_STRING,  e.getMessage());
            }
          }
        });
      }else{
        String loadError = portalItem.getLoadError().getMessage();
        if (portalItem.getLoadError().getCause() != null){
          String cause = portalItem.getLoadError().getCause().getMessage();
          Log.e(TAG,"Portal item didn't load " + portalItem.getLoadStatus().name() + " because " + cause);
        }
        Log.e(TAG,"Portal item didn't load " + portalItem.getLoadStatus().name() + " and reported this load error " + loadError);
        mView.sendResult(RESULT_CANCELED, ERROR_STRING,  loadError);
      }
    }
  });
}
 
开发者ID:Esri,项目名称:mapbook-android,代码行数:42,代码来源:DownloadPresenter.java

示例11: getSpatialReference

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
 * Get the spatial reference of the map
 * @return SpatialReference
 */
@Override public SpatialReference getSpatialReference() {
  SpatialReference sr = null;
  if (mMap != null && mMap.getLoadStatus() == LoadStatus.LOADED){
    sr = mMap.getSpatialReference();
  }
  return sr;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:12,代码来源:MapFragment.java

示例12: start

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("Open Mobile Map Package Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a map view
    mapView = new MapView();

    //load a mobile map package
    final String mmpkPath = new File("./samples-data/mmpk/Yellowstone.mmpk").getAbsolutePath();
    MobileMapPackage mobileMapPackage = new MobileMapPackage(mmpkPath);

    mobileMapPackage.loadAsync();
    mobileMapPackage.addDoneLoadingListener(() -> {
      if (mobileMapPackage.getLoadStatus() == LoadStatus.LOADED && mobileMapPackage.getMaps().size() > 0) {
        //add the map from the mobile map package to the map view
        mapView.setMap(mobileMapPackage.getMaps().get(0));
      } else {
        Alert alert = new Alert(Alert.AlertType.ERROR, "Failed to load the mobile map package");
        alert.show();
      }
    });

    // add the map view to stack pane
    stackPane.getChildren().add(mapView);
  } catch (Exception e) {
    // on any error, display the stack trace.
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:41,代码来源:OpenMobileMapPackageSample.java

示例13: authenticate

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
void authenticate() throws Exception {

    AuthenticationDialog authenticationDialog = new AuthenticationDialog();
    authenticationDialog.show();
    authenticationDialog.setOnCloseRequest(r -> {

      OAuthConfiguration configuration = authenticationDialog.getResult();
      // check that configuration was made
      if (configuration != null) {
        AuthenticationManager.addOAuthConfiguration(configuration);

        // setup the handler that will prompt an authentication challenge to the user
        AuthenticationManager.setAuthenticationChallengeHandler(new OAuthChallengeHandler());

        Portal portal = new Portal("http://" + configuration.getPortalUrl(), true);
        portal.addDoneLoadingListener(() -> {
          if (portal.getLoadStatus() == LoadStatus.LOADED) {

            // display portal user info
            fullName.setText(portal.getUser().getFullName());
            username.setText(portal.getUser().getUsername());
            email.setText(portal.getUser().getEmail());
            memberSince.setText(formatter.format(portal.getUser().getCreated().getTime()));
            role.setText(portal.getUser().getRole() != null ? portal.getUser().getRole().name() : "");

          } else if (portal.getLoadStatus() == LoadStatus.FAILED_TO_LOAD) {

            // show alert message on error
            showMessage("Authentication failed", portal.getLoadError().getMessage(), Alert.AlertType.ERROR);
          }
        });

        // loading the portal info of a secured resource
        // this will invoke the authentication challenge
        portal.loadAsync();
      }
    });
  }
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:39,代码来源:OAuthController.java

示例14: loadMobileMapPackage

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
 * Handles read/write external storage permissions (for API 23+) and loads mobile map package
 * @param path to location of mobile map package on device
 */
private void loadMobileMapPackage(String path) {
    //for API level 23+ request permission at runtime
    if (ContextCompat.checkSelfPermission(getApplicationContext(),
            reqPermission[0]) != PackageManager.PERMISSION_GRANTED) {
        //request permission
        int requestCode = 2;
        ActivityCompat.requestPermissions(
                MobileMapViewActivity.this, reqPermission, requestCode);
    }
    //create the mobile map package
    mMobileMapPackage = new MobileMapPackage(path);
    //load the mobile map package asynchronously
    mMobileMapPackage.loadAsync();
    //add done listener which will load when package has maps
    mMobileMapPackage.addDoneLoadingListener(new Runnable() {
        @Override
        public void run() {
            //check load status and that the mobile map package has maps
            if (mMobileMapPackage.getLoadStatus() == LoadStatus.LOADED &&
                    mMobileMapPackage.getMaps().size() > 0) {
                mLocatorTask = mMobileMapPackage.getLocatorTask();
                //default to display of first map in package
                loadMap(0);
                loadMapPreviews();
            } else {
                //log an issue if the mobile map package fails to load
                Log.e(TAG, mMobileMapPackage.getLoadError().getMessage());
            }
        }
    });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:36,代码来源:MobileMapViewActivity.java

示例15: onCreate

import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // create MapView from layout
    mMapView = (MapView) findViewById(R.id.mapView);
    // create a Dark Gray Canvas Vector basemap
    ArcGISMap map = new ArcGISMap(Basemap.createDarkGrayCanvasVector());
    // add the map to a map view
    mMapView.setMap(map);
    // create image service raster as raster layer
    final ImageServiceRaster imageServiceRaster = new ImageServiceRaster(
            getResources().getString(R.string.image_service_url));
    final RasterLayer rasterLayer = new RasterLayer(imageServiceRaster);
    // add raster layer as map operational layer
    map.getOperationalLayers().add(rasterLayer);
    // zoom to the extent of the raster service
    rasterLayer.addDoneLoadingListener(new Runnable() {
        @Override
        public void run() {
            if(rasterLayer.getLoadStatus() == LoadStatus.LOADED){
                // get the center point
                Point centerPnt = imageServiceRaster.getServiceInfo().getFullExtent().getCenter();
                mMapView.setViewpointCenterAsync(centerPnt, 55000000);
            }
        }
    });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:30,代码来源:MainActivity.java


注:本文中的com.esri.arcgisruntime.loadable.LoadStatus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。