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


Java QueryParameters类代码示例

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


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

示例1: queryEmuSummaryStatistics

import com.esri.arcgisruntime.data.QueryParameters; //导入依赖的package包/类
/**
 * Query for all EMU summary statistics (~40 rows of data).
 * This is done once and the results cached locally.
 * @param callback - The StatCallback called when query is completed
 */
public void queryEmuSummaryStatistics(final ServiceApi.StatCallback callback){
  if (summary_table.size() > 0){
    callback.onStatsLoaded(true);
  }else{
    mSummaryStats.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE);
    mSummaryStats.loadAsync();
    mSummaryStats.addDoneLoadingListener(new Runnable() {
      @Override public void run() {
        final QueryParameters queryParameters = new QueryParameters();
        // Get all the rows in the table
        queryParameters.setWhereClause("1 = 1");
        final Collection<String> outFields = new ArrayList<String>();
        // Get all the fields in the table
        outFields.add("*");
        final ListenableFuture<FeatureQueryResult> futureResult = mSummaryStats.populateFromServiceAsync(queryParameters,true,outFields);
        processQueryForEmuStats(futureResult, callback);
      }
    });
  }
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:26,代码来源:DataManager.java

示例2: fetchCacheManually

import com.esri.arcgisruntime.data.QueryParameters; //导入依赖的package包/类
/**
 * Fetches the cache from a Service Feature Table manually.
 */
private void fetchCacheManually() {

  // create query to select all tree or damage features
  QueryParameters queryParams = new QueryParameters();
  queryParams.setWhereClause("req_type = 'Tree Maintenance or Damage'");

  // * means all features
  List<String> outfields = Collections.singletonList("*");
  // get queried features from service feature table and clear previous cache
  tableResult = featureTable.populateFromServiceAsync(queryParams, true, outfields);

  tableResult.addDoneListener(() -> {
    try {
      // find the number of features returned from query
      AtomicInteger featuresReturned = new AtomicInteger();
      tableResult.get().forEach(feature -> featuresReturned.getAndIncrement());

      // display to user how many features where returned
      Platform.runLater(() -> featuresReturnLabel.setText("Features Returned: " + featuresReturned));
    } catch (Exception e) {
      // on any error, display the stack trace
      e.printStackTrace();
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:29,代码来源:ServiceFeatureTableManualCacheSample.java

示例3: queryForEmuAtLocation

import com.esri.arcgisruntime.data.QueryParameters; //导入依赖的package包/类
/**
 * Query for water column data at the given geometry
 * @param envelope - represents a buffered geometry around selected point in map
 * @param callback - SummaryCallback used when query is completed
 */
public void queryForEmuAtLocation(final Envelope envelope, final ServiceApi.SummaryCallback callback){
  final QueryParameters queryParameters = new QueryParameters();
  queryParameters.setGeometry(envelope);
  final ListenableFuture<FeatureQueryResult> futureResult = mMeshClusterTable.queryFeaturesAsync(queryParameters, ServiceFeatureTable.QueryFeatureFields.LOAD_ALL);
  processQueryForEmuAtLocation(envelope, futureResult, callback);
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:12,代码来源:DataManager.java

示例4: queryForEmuColumnProfile

import com.esri.arcgisruntime.data.QueryParameters; //导入依赖的package包/类
/**
 * Query for data for a specific ocean location from the mesh point table.
 * @param point - a point representing the location of a specific water column
 * @param callback - The ColumnProfileCallback called when query is completed.
 */
public void queryForEmuColumnProfile(final Point point, final ServiceApi.ColumnProfileCallback callback){
  final QueryParameters queryParameters = new QueryParameters();
  queryParameters.setGeometry(point);
  final ListenableFuture<FeatureQueryResult> futureResult = mMeshPointTable.queryFeaturesAsync(queryParameters, ServiceFeatureTable.QueryFeatureFields.LOAD_ALL);
  final WaterProfile profile = new WaterProfile();
  processQueryForEmuColumnProfile(futureResult, callback, profile);
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:13,代码来源:DataManager.java

示例5: searchForState

import com.esri.arcgisruntime.data.QueryParameters; //导入依赖的package包/类
/**
 * Searches for a US state inside the current ServiceFeatureTable.
 * 
 * @param state a US state that is being searched
 */
private void searchForState(String state) {

  // create a query for the state that was entered
  QueryParameters query = new QueryParameters();
  query.setWhereClause("upper(STATE_NAME) LIKE '" + state.toUpperCase() + "'");

  // search for the state feature in the feature table
  tableQueryResult = featureTable.queryFeaturesAsync(query);

  tableQueryResult.addDoneListener(() -> {
    try {
      // get the result from the query
      FeatureQueryResult result = tableQueryResult.get();
      // if a state feature was found
      if (result.iterator().hasNext()) {
        // get state feature and zoom to it
        Feature feature = result.iterator().next();
        Envelope envelope = feature.getGeometry().getExtent();
        mapView.setViewpointGeometryAsync(envelope, 200);

        // set the state feature to be selected
        featureLayer.selectFeature(feature);
      } else {
        Platform.runLater(() -> {
          dialog.setContentText("State Not Found! Add a valid state name.");
          dialog.showAndWait();
          mapView.setViewpointCenterAsync(startPoint, SCALE);
        });
      }
    } catch (Exception e) {
      // on any error, display the stack trace
      e.printStackTrace();
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:41,代码来源:FeatureLayerQuerySample.java

示例6: searchForState

import com.esri.arcgisruntime.data.QueryParameters; //导入依赖的package包/类
public void searchForState(final String searchString) {

        // clear any previous selections
        mFeaturelayer.clearSelection();

        // create objects required to do a selection with a query
        QueryParameters query = new QueryParameters();
        //make search case insensitive
        query.setWhereClause("upper(STATE_NAME) LIKE '%" + searchString.toUpperCase() + "%'");

        // call select features
        final ListenableFuture<FeatureQueryResult> future = mServiceFeatureTable.queryFeaturesAsync(query);
        // add done loading listener to fire when the selection returns
        future.addDoneListener(new Runnable() {
            @Override
            public void run() {
                try {
                    // call get on the future to get the result
                    FeatureQueryResult result = future.get();

                    // check there are some results
                    if (result.iterator().hasNext()) {

                        // get the extend of the first feature in the result to zoom to
                        Feature feature = result.iterator().next();
                        Envelope envelope = feature.getGeometry().getExtent();
                        mMapView.setViewpointGeometryAsync(envelope, 200);

                        //Select the feature
                        mFeaturelayer.selectFeature(feature);

                    } else {
                        Toast.makeText(MainActivity.this, "No states found with name: " + searchString, Toast.LENGTH_SHORT).show();
                    }
                } catch (Exception e) {
                    Toast.makeText(MainActivity.this, "Feature search failed for: " + searchString + ". Error=" + e.getMessage(), Toast.LENGTH_SHORT).show();
                    Log.e(getResources().getString(R.string.app_name), "Feature search failed for: " + searchString + ". Error=" + e.getMessage());
                }
            }
        });
    }
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:42,代码来源:MainActivity.java

示例7: onCreate

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

  // inflate MapView from layout
  mMapView = (MapView) findViewById(R.id.mapView);

  //initialize map with basemap
  ArcGISMap map = new ArcGISMap();
  map.setBasemap(Basemap.createOceans());

  //assign map to the map view
  mMapView.setMap(map);

  //initialize service feature table to be queried
  FeatureTable featureTable = new ServiceFeatureTable(getResources().getString(R.string.wildfire_feature_server));

  //create query parameters
  QueryParameters queryParams = new QueryParameters();

  // 1=1 will give all the features from the table
  queryParams.setWhereClause("1=1");

  //query feature from the table
  final ListenableFuture<FeatureQueryResult> queryResult = featureTable.queryFeaturesAsync(queryParams);
  queryResult.addDoneListener(new Runnable() {
    @Override public void run() {
      try {
        //create a feature collection table from the query results
        FeatureCollectionTable featureCollectionTable = new FeatureCollectionTable(queryResult.get());

        //create a feature collection from the above feature collection table
        FeatureCollection featureCollection = new FeatureCollection();
        featureCollection.getTables().add(featureCollectionTable);

        //create a feature collection layer
        FeatureCollectionLayer featureCollectionLayer = new FeatureCollectionLayer(featureCollection);

        //add the layer to the operational layers array
        mMapView.getMap().getOperationalLayers().add(featureCollectionLayer);
      } catch (InterruptedException | ExecutionException e) {
        Log.e(TAG, "Error in FeatureQueryResult: " + e.getMessage());
      }
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:48,代码来源:MainActivity.java

示例8: onCreate

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

    // inflate MapView from layout
    mMapView = (MapView) findViewById(R.id.mapView);

    // create a map with the topographic basemap
    ArcGISMap map = new ArcGISMap(Basemap.createTopographic());

    // create feature layer with its service feature table
    // create the service feature table
    final ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(getResources().getString(R.string.sample_service_url));

    //explicitly set the mode to on manual cache (which means you need to call populate from service)
    serviceFeatureTable.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE);

    // create the feature layer using the service feature table
    FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);

    // add the layer to the map
    map.getOperationalLayers().add(featureLayer);

    // load the table
    serviceFeatureTable.loadAsync();
    // add a done loading listener to call populate from service when the table is loaded is done
    serviceFeatureTable.addDoneLoadingListener(new Runnable() {
        @Override
        public void run() {

            // set up the query parameters
            QueryParameters params = new QueryParameters();
            // for a specific 311 request type
            params.setWhereClause("req_type = 'Tree Maintenance or Damage'");
            // set all outfields
            List<String> outFields = new ArrayList<>();
            outFields.add("*");
            //populate the table based on the query, listen for result in a listenable future
            final ListenableFuture<FeatureQueryResult> future = serviceFeatureTable.populateFromServiceAsync(params, true, outFields);
            //add done listener to the future which fires when the async method is complete
            future.addDoneListener(new Runnable() {
                @Override
                public void run() {
                    try {
                        //call get on the future to get the result
                        FeatureQueryResult result = future.get();
                        // create an Iterator
                        Iterator<Feature> iterator = result.iterator();
                        Feature feature;
                        // cycle through selections
                        int counter = 0;
                        while (iterator.hasNext()){
                            feature = iterator.next();
                            counter++;
                            Log.d(getResources().getString(R.string.app_name), "Selection #: " + counter + " Table name: " + feature.getFeatureTable().getTableName());
                        }
                        Toast.makeText(getApplicationContext(), counter + " features returned", Toast.LENGTH_SHORT).show();

                    } catch (Exception e) {
                        Log.e(getResources().getString(R.string.app_name), "Populate from service failed: " + e.getMessage());
                    }
                }
            });
        }
    });


    // set the map to be displayed in the mapview
    mMapView.setMap(map);

    //set a viewpoint on the mapview so it zooms to the features once they are cached.
    mMapView.setViewpoint(new Viewpoint(new Point(-13630484, 4545415, SpatialReferences.getWebMercator()), 500000));

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

示例9: generateEmuByDepthQueryParameters

import com.esri.arcgisruntime.data.QueryParameters; //导入依赖的package包/类
/**
 * Prepare the query parameters to query the service
 * by depth
 * @param depth - Integer representing depth level
 * @return QueryParameters
 */
private static QueryParameters generateEmuByDepthQueryParameters(final int depth){
  final QueryParameters queryParameters = new QueryParameters();
  queryParameters.setWhereClause(" Depth = " + depth);
  return queryParameters;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:12,代码来源:DataManager.java


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