• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java IdentifyLayerResult类的典型用法和代码示例

java 1次浏览

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

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

示例1: identifyResult

点赞 3

import com.esri.arcgisruntime.mapping.view.IdentifyLayerResult; //导入依赖的package包/类
/**
 * Performs an identify on layers at the given screenpoint and calls handleIdentifyResults(...) to process them.
 *
 * @param screenPoint in Android graphic coordinates.
 */
private void identifyResult(android.graphics.Point screenPoint) {

  final ListenableFuture<List<IdentifyLayerResult>> identifyLayerResultsFuture = mMapView
      .identifyLayersAsync(screenPoint, 12, false, 10);

  identifyLayerResultsFuture.addDoneListener(new Runnable() {
    @Override public void run() {
      try {
        List<IdentifyLayerResult> identifyLayerResults = identifyLayerResultsFuture.get();
        handleIdentifyResults(identifyLayerResults);
      } catch (InterruptedException | ExecutionException e) {
        Log.e(TAG, "Error identifying results: " + e.getMessage());
      }
    }
  });
}
 

开发者ID:Esri,
项目名称:arcgis-runtime-samples-android,
代码行数:22,
代码来源:MainActivity.java

示例2: handleIdentifyResults

点赞 3

import com.esri.arcgisruntime.mapping.view.IdentifyLayerResult; //导入依赖的package包/类
/**
 * Processes identify results into a string which is passed to showAlertDialog(...).
 *
 * @param identifyLayerResults a list of identify results generated in identifyResult().
 */
private void handleIdentifyResults(List<IdentifyLayerResult> identifyLayerResults) {
  StringBuilder message = new StringBuilder();
  int totalCount = 0;
  for (IdentifyLayerResult identifyLayerResult : identifyLayerResults) {
    int count = geoElementsCountFromResult(identifyLayerResult);
    String layerName = identifyLayerResult.getLayerContent().getName();
    message.append(layerName).append(": ").append(count);

    // add new line character if not the final element in array
    if (!identifyLayerResult.equals(identifyLayerResults.get(identifyLayerResults.size() - 1))) {
      message.append("\n");
    }
    totalCount += count;
  }

  // if any elements were found show the results, else notify user that no elements were found
  if (totalCount > 0) {
    showAlertDialog(message);
  } else {
    Toast.makeText(this, "No element found", Toast.LENGTH_SHORT).show();
    Log.i(TAG, "No element found.");
  }
}
 

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

示例3: geoElementsCountFromResult

点赞 2

import com.esri.arcgisruntime.mapping.view.IdentifyLayerResult; //导入依赖的package包/类
/**
 * Gets a count of the GeoElements in the passed result layer.
 *
 * @param result from a single layer.
 * @return the total count of GeoElements.
 */
private int geoElementsCountFromResult(IdentifyLayerResult result) {
  // create temp array
  List<IdentifyLayerResult> tempResults = new ArrayList<>();
  tempResults.add(result);

  // using Depth First Search approach to handle recursion
  int count = 0;
  int index = 0;

  while (index < tempResults.size()) {
    // get the result object from the array
    IdentifyLayerResult identifyResult = tempResults.get(index);

    // update count with geoElements from the result
    count += identifyResult.getElements().size();

    // if sublayer has any results, add result objects in the tempResults array after the current result
    if (identifyResult.getSublayerResults().size() > 0) {
      tempResults.add(identifyResult.getSublayerResults().get(index));
    }

    // update the count and repeat
    index += 1;
  }
  return count;
}
 

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

示例4: onEditClicked

点赞 2

import com.esri.arcgisruntime.mapping.view.IdentifyLayerResult; //导入依赖的package包/类
@FXML
private void onEditClicked(ActionEvent editClickEvent) {
  functionOnMapClick = ((mapClickEvent) -> {

    if (mapClickEvent.getButton() == MouseButton.SECONDARY) {
      mapView.getCallout().setVisible(false);
      return null;
    }

    // clear previous results
    featureLayer.clearSelection();

    // identify the clicked features

    // create a point from where the user clicked
    Point2D pointOnScreen = new Point2D(mapClickEvent.getX(), mapClickEvent.getY());

    ListenableFuture<IdentifyLayerResult> identifyResultFuture = mapView.identifyLayerAsync(offlineFeatureLayer, pointOnScreen, 10, 1);
    identifyResultFuture.addDoneListener(() -> {
      try {
        IdentifyLayerResult identifyResult = identifyResultFuture.get();
        Feature hitFeature = (Feature) identifyResult.getIdentifiedElements().get(0);
        featureLayer.selectFeature(hitFeature);
        displayFeature(hitFeature, pointOnScreen);
      } catch (Exception e) {
        e.printStackTrace();
      }
    });

    return null;
  });
}
 

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

示例5: onSingleTapConfirmed

点赞 2

import com.esri.arcgisruntime.mapping.view.IdentifyLayerResult; //导入依赖的package包/类
/**
 * When a user taps on the map, an identify action is initiated and
 * any features found are displayed in a callout view.
 * @param e - MotionEvent
 * @return boolean
 */
@Override
public boolean onSingleTapConfirmed(final MotionEvent e) {

  if (!mGraphicsOverlay.getGraphics().isEmpty()) {
    if (mGraphicsOverlay.getGraphics().get(0).isSelected()) {
      mGraphicsOverlay.getGraphics().get(0).setSelected(false);
    }
  }
  // clear any previous selections
  clearSelections();

  // get the screen point where user tapped
  final android.graphics.Point screenPoint = new android.graphics.Point((int) e.getX(), (int) e.getY());

  final ListenableFuture<List<IdentifyLayerResult>> identifyLayers = mMapView.identifyLayersAsync(screenPoint,5d,false, 1);

  identifyLayers.addDoneListener(new Runnable() {
    @Override
    public void run() {
      try {
        final Point clickedLocation = mMapView.screenToLocation(screenPoint);

        final List<IdentifyLayerResult> results = identifyLayers.get();
        final List<FeatureContent> content = mPresenter.identifyFeatures(results);
        if (content.isEmpty()){
          showMessage(getString(R.string.no_features_found));
          displaySearchResult(clickedLocation, null, false);
        }else{
          final View v = buildContentView(content);
          displaySearchResult(clickedLocation,v, false);
        }

      } catch (InterruptedException | ExecutionException ie) {
        Log.e(TAG,ie.getMessage());
      }

    }
  });


  return super.onSingleTapConfirmed(e);
}
 

开发者ID:Esri,
项目名称:mapbook-android,
代码行数:49,
代码来源:MapFragment.java

示例6: identifyFeatures

点赞 1

import com.esri.arcgisruntime.mapping.view.IdentifyLayerResult; //导入依赖的package包/类
/**
 * Returns list of featured content given the results of an identify operation.

 * @param results - List of IdentifyLayerResults
 * @return List of FeatureContent
 */
List<FeatureContent> identifyFeatures(List<IdentifyLayerResult> results);
 

开发者ID:Esri,
项目名称:mapbook-android,
代码行数:8,
代码来源:MapContract.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)