我有一个esri要素图层,其中包含多个属性。
我需要根据属性值之一为其标记设置不同的图标
是否可以基于某种编码为同一层提供多个渲染器?
这就是我尝试过的
QueryParameters parameters = new QueryParameters();
parameters.setWhere("1=1");
parameters.setReturnGeometry(true);
parameters.setOutFields(mHafilatLayerOptions.outFields);
parameters.setOutSpatialReference(_mapView.getSpatialReference());
try {
QueryTask queryTask = new QueryTask(mHafilatLayer.getUrl(),Utilities.getUserCredentials());
queryTask.execute(parameters, new CallbackListener<FeatureResult>() {
@Override
public void onCallback(FeatureResult objects) {
for (Object currentElem : objects) {
if (currentElem instanceof Feature) {
Feature currentFeature = (Feature) currentElem;
Point point = GeometryEngine.project(((Point)currentFeature.getGeometry()).getX(),
((Point)currentFeature.getGeometry()).getY(), _mapView.getSpatialReference());
String deviceType = (String) currentFeature.getAttributes().get("DEVICE");
switch (deviceType) {
case "TVM":
mHafilatLayer.addGraphic(new Graphic(point,Utilities.createPictureMarkerSymbol(getPointOfInterestIcon(AppConstants.LayerConstants.PARKING_HANDICAP, true),false)));
break;
case "BBR":
mHafilatLayer.addGraphic(new Graphic(point,Utilities.createPictureMarkerSymbol(getPointOfInterestIcon(AppConstants.LayerConstants.HafilatKiosks, true),false)));
break;
case "TOM":
mHafilatLayer.addGraphic(new Graphic(point,Utilities.createPictureMarkerSymbol(getPointOfInterestIcon(AppConstants.LayerConstants.HafilatKiosks, true),false)));
break;
default:
mHafilatLayer.addGraphic(new Graphic(point,Utilities.createPictureMarkerSymbol(getPointOfInterestIcon(AppConstants.LayerConstants.HafilatKiosks, true),false)));
}
}
}
}
@Override
public void onError(Throwable throwable) {
}
});
} catch (EsriSecurityException e) {
e.printStackTrace();
}
mHafilatLayer.setRenderer(new SimpleRenderer(Utilities.createPictureMarkerSymbol(getPointOfInterestIcon(AppConstants.LayerConstants.HafilatKiosks, true), false)));
这不起作用,我们非常感谢您的帮助。
答案 0 :(得分:1)
根据属性值之一为其标记设置不同的图标-可以。
ArcGIS可以选择基于要素图层中的属性进行渲染,例如:唯一值渲染器