使用ArcGIS Runtime API for Java 中的查询代码解析
ArcGISRuntimeEnvironment
ArcGISRuntimeEnvironment是设置ArcGIS运行环境配置的类
包含全局方法,这些方法会影响整个运行时环境。还包含用于为应用程序设置部署许可的静态方法。
setInstallDirectory是设置包含运行时库和资源的目录在该代码中设置为ArcGIS SDK所在的本地路径
https://developers.arcgis.com/java/api-reference/reference/com/esri/arcgisruntime/ArcGISRuntimeEnvironment.html(官网的介绍)
ServiceFeatureTable
ServiceFeatureTable是ArcGIS要素服务的要素表
用于控制是否在本地缓存要素(以便通过地图和场景图层更快地访问),以及是在本地缓存还是在服务器上执行查询
queryFeaturesAsync(QueryParameters query) 方法是从该表的缓存和/或用于创建该表的服务中异步查询。
https://developers.arcgis.com/java/api-reference/reference/com/esri/arcgisruntime/data/ServiceFeatureTable.html(官网的介绍)
QueryParameters
QueryParameters表示查询的输入参数。
**setWhereClause(String whereClause)**方法是用来设置where语句的
此处的1=1即查询所有
https://developers.arcgis.com/java/api-reference/reference/com/esri/arcgisruntime/data/QueryParameters.html (官网的介绍)
ListenableFuture
ListenableFuture<> 一个特殊的Future,允许在异步计算完成后将侦听器设置为运行。
<>中为 计算结果的类型
addDoneListener(Runnable listener) 方法是用来添加一个侦听器,以在异步计算成功或不成功完成时运行。
https://developers.arcgis.com/java/api-reference/reference/com/esri/arcgisruntime/concurrent/ListenableFuture.html(官网的介绍)
FeatureQueryResult
FeatureQueryResult表示对FeatureTable的查询结果。
iterator() 方法用以获取查询结果的迭代器
https://developers.arcgis.com/java/api-reference/reference/com/esri/arcgisruntime/data/FeatureQueryResult.html(官网的介绍)