本文整理汇总了Java中com.esri.arcgisruntime.loadable.LoadStatus类的典型用法代码示例。如果您正苦于以下问题:Java LoadStatus类的具体用法?Java LoadStatus怎么用?Java LoadStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoadStatus类属于com.esri.arcgisruntime.loadable包,在下文中一共展示了LoadStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: setPeData
import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
* Check the Map has been loaded, and then set the location of the projection engine files onto the
* TransformationCatalog.
*/
private void setPeData() {
if (mMapView == null)
return;
if (mArcGISMap == null)
return;
if (mArcGISMap.getLoadStatus() != LoadStatus.LOADED)
return;
File rootDirectory = Environment.getExternalStorageDirectory();
// NOTE: You must update this resource value if files are stored in a different location on your device.
//[DocRef: Name=Set projection engine directory, Category=Fundamentals, Topic=Spatial references, RemoveChars=getResources().getString(R.string.projection_engine_location), ReplaceChars="/ArcGIS/samples/PEData"]
// Get the expected location of the projection engine files.
File peDataDirectory = new File(rootDirectory, getResources().getString(R.string.projection_engine_location));
try {
TransformationCatalog.setProjectionEngineDirectory(peDataDirectory.getAbsolutePath());
showPEDirectorySuccessMessage();
} catch (ArcGISRuntimeException agsEx) {
// If there was an error in setting the projection engine directory, the location may not exist, or if
// permissions have not been correctly set, the location cannot be accessed. Equation-based transformations can still be used, but grid-based transformations will not
// be usable.
showPEDirectoryFailureMessage(agsEx);
}
//[DocRef: END]
// Once PEData location is set (successfully or unsuccessfully), fill the ListView with
// transformations.
setupTransformsList();
}
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:36,代码来源:MainActivity.java
示例17: onCreate
import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// access MapView from layout
mMapView = (MapView) findViewById(R.id.mapView);
// list of subdomains
List<String> subDomains = Arrays.asList("a", "b", "c", "d");
// url pattern
String templateUri = "http://{subDomain}.tile.stamen.com/terrain/{level}/{col}/{row}.png";
// webtile layer
final WebTiledLayer webTiledLayer = new WebTiledLayer(templateUri, subDomains);
webTiledLayer.loadAsync();
webTiledLayer.addDoneLoadingListener(new Runnable() {
@Override
public void run() {
if(webTiledLayer.getLoadStatus() == LoadStatus.LOADED){
// use webtile layer as Basemap
ArcGISMap map = new ArcGISMap(new Basemap(webTiledLayer));
mMapView.setMap(map);
// custom attributes
webTiledLayer.setAttribution("Map tiles by <a href=\"http://stamen.com/\">Stamen Design</a>, " +
"under <a href=\"http://creativecommons.org/licenses/by/3.0\">CC BY 3.0</a>. " +
"Data by <a href=\"http://openstreetmap.org/\">OpenStreetMap</a>, " +
"under <a href=\"http://creativecommons.org/licenses/by-sa/3.0\">CC BY SA</a>.");
}
}
});
}
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:33,代码来源:MainActivity.java
示例18: loadGeodatabase
import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
* Load a local geodatabase file and add it to the map
*/
private void loadGeodatabase() {
// create path to local geodatabase
String path =
Environment.getExternalStorageDirectory() + getString(R.string.config_data_sdcard_offline_dir)
+ getString(R.string.config_geodb_name);
// create a new geodatabase from local path
final Geodatabase geodatabase = new Geodatabase(path);
// load the geodatabase
geodatabase.loadAsync();
// create feature layer from geodatabase and add to the map
geodatabase.addDoneLoadingListener(() -> {
if (geodatabase.getLoadStatus() == LoadStatus.LOADED) {
// access the geodatabase's feature table Trailheads
GeodatabaseFeatureTable geodatabaseFeatureTable = geodatabase.getGeodatabaseFeatureTable("Trailheads");
geodatabaseFeatureTable.loadAsync();
// create a layer from the geodatabase feature table and add to map
final FeatureLayer featureLayer = new FeatureLayer(geodatabaseFeatureTable);
featureLayer.addDoneLoadingListener(() -> {
if (featureLayer.getLoadStatus() == LoadStatus.LOADED) {
// set viewpoint to the feature layer's extent
mMapView.setViewpointAsync(new Viewpoint(featureLayer.getFullExtent()));
} else {
Toast.makeText(MainActivity.this, "Feature Layer failed to load!", Toast.LENGTH_LONG).show();
Log.e(TAG, "Feature Layer failed to load!");
}
});
// add feature layer to the map
mMapView.getMap().getOperationalLayers().add(featureLayer);
} else {
Toast.makeText(MainActivity.this, "Geodatabase failed to load!", Toast.LENGTH_LONG).show();
Log.e(TAG, "Geodatabase failed to load!");
}
});
}
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:42,代码来源:MainActivity.java
示例19: openGeoPackage
import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
* Opens a GeoPackage from local storage and adds it to a map.
*/
private void openGeoPackage() {
// Get the full path to the local GeoPackage
String geoPackagePath =
Environment.getExternalStorageDirectory() + getString(R.string.local_folder) + getString(R.string.file_name);
Log.d(TAG, geoPackagePath);
// Open the GeoPackage
GeoPackage geoPackage = new GeoPackage(geoPackagePath);
geoPackage.loadAsync();
geoPackage.addDoneLoadingListener(() -> {
if (geoPackage.getLoadStatus() == LoadStatus.LOADED) {
// Read the feature tables and get the first one
FeatureTable geoPackageTable = geoPackage.getGeoPackageFeatureTables().get(0);
// Make sure a feature table was found in the package
if (geoPackageTable == null) {
Toast.makeText(MainActivity.this, "No feature table found in the package!", Toast.LENGTH_LONG).show();
Log.e(TAG, "No feature table found in this package!");
return;
}
// Create a layer to show the feature table
FeatureLayer featureLayer = new FeatureLayer(geoPackageTable);
// Add the feature table as a layer to the map (with default symbology)
mMap.getOperationalLayers().add(featureLayer);
} else {
Toast.makeText(MainActivity.this, "GeoPackage failed to load! " + geoPackage.getLoadError(), Toast.LENGTH_LONG).show();
Log.e(TAG, "GeoPackage failed to load!" + geoPackage.getLoadError());
}
});
}
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:37,代码来源:MainActivity.java
示例20: calculateViewshedAt
import com.esri.arcgisruntime.loadable.LoadStatus; //导入依赖的package包/类
/**
* Uses the given point to create a FeatureCollectionTable which is passed to performGeoprocessing.
*
* @param point in MapView coordinates.
*/
private void calculateViewshedAt(Point point) {
// remove previous graphics
mResultGraphicsOverlay.getGraphics().clear();
// cancel any previous job
if (mGeoprocessingJob != null) {
mGeoprocessingJob.cancel();
}
List<Field> fields = new ArrayList<>(1);
// create field with same alias as name
Field field = Field.createString("observer", "", 8);
fields.add(field);
// create feature collection table for point geometry
final FeatureCollectionTable featureCollectionTable = new FeatureCollectionTable(fields, GeometryType.POINT,
point.getSpatialReference());
featureCollectionTable.loadAsync();
// create a new feature and assign the geometry
Feature newFeature = featureCollectionTable.createFeature();
newFeature.setGeometry(point);
// add newFeature and call performGeoprocessing on done loading
featureCollectionTable.addFeatureAsync(newFeature);
featureCollectionTable.addDoneLoadingListener(new Runnable() {
@Override public void run() {
if (featureCollectionTable.getLoadStatus() == LoadStatus.LOADED) {
performGeoprocessing(featureCollectionTable);
}
}
});
}
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:40,代码来源:MainActivity.java
注:本文中的com.esri.arcgisruntime.loadable.LoadStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论