我正在使用L.GeoJSON.AJAX来加载我的json。我有以下样式来标记标记:
var weakClusterMarkerOptions = {
radius: 5,
fillColor: "#FFFF00",
color: "#000",
weight: 2,
opacity: 1,
fillOpacity: 0.8
},
strongClusterMarkerOptions = {
radius: 7,
fillColor: "#CC0000",
color: "#CC0000",
opacity: 1,
fillOpacity: 0.8
};
function customizeClusterIcon(feature, latlng) {
if (feature.properties.strongCl === 'strong') {
return L.circleMarker(latlng, strongClusterMarkerOptions);
} else {
return L.circleMarker(latlng, weakClusterMarkerOptions);
}
}
然后我使用以下内容进行过滤:
function toggleStrength(strength, showLayer) {
jsonLayer.refilter(function (feature, layer) {
if (strength == 'all') {
return true;
} else {
if (showLayer) {
return feature.properties.strongCl === strength;
}
}
});
}
这里的问题是,当我过滤circleMarker的边框消失但标记仍然可见时,特别是填充颜色。
答案 0 :(得分:0)
所以我最终为每种条件(弱和强)创建了LayerGroups,然后根据过滤器清除并添加了相应的组。
public Output getClaimsFromAPI(@NonNull final Input xyzInput)
throws PermanentException, TransientException {
final Response res = fetchHealBeamServiceResponse(webTarget, xyzInput);
Object respondentMapObject;
Map<String, Map> mapEntityFromResponse = res.readEntity(Map.class);
if (mapEntityFromResponse != null) {
respondentMapObject = mapEntityFromResponse.get(ServiceConstants.MAP_KEY);
return getOutputFromResponseMap(respondentMapObject, xyzInput);
} else {
throw new RuntimeException("The response returned does not contain map");
}
}
private Response fetchHealBeamServiceResponse(WebTarget healBeamTarget,
Input xyzInput)
throws PermanentException, TransientException {
Response res = null;
try {
res = healBeamTarget
.path(HealBeamServiceConstants.GET_CUSTOMER_PATH)
.register(Configurator.getSoaOpNameFeatureForCustomerResource())
.resolveTemplate(ServiceConstants.ID, xyzInput.getId())
.request(MediaType.APPLICATION_JSON_TYPE)
.property(HealBeamServiceConstants.SERVICE_KEY, SOA_SERVICE_NAME)
.property(HealBeamServiceConstants.OPERATION_KEY, SOA_OP_NAME_GET_CUSTOMER)
.acceptLanguage(java.util.Locale.getDefault())
.get();
if (Response.Status.REQUEST_TIMEOUT.getStatusCode() == res.getStatusInfo().getStatusCode()) {
throw new TransientException("Request timed out with status" + res.getStatusInfo().getStatusCode());
} else if (Response.Status.OK.getStatusCode() != res.getStatusInfo().getStatusCode()) {
log.error("Some Error"):
}
return res;
} catch (RuntimeException e) {
throw new PermanentException("Unexpected Exception Occured, Exception Message " + e.getMessage());
} finally {
if (res != null) {
res.close();
}
}
}
答案 1 :(得分:-1)
您的fillColor
和color
具有相同的值#CC0000
。可能边界就在那里。它与填充颜色相同。