use of org.activityinfo.legacy.shared.reports.content.AdminMarker in project activityinfo by bedatadriven.
the class PolygonLayerGenerator method queryBuckets.
private void queryBuckets(DispatcherSync dispatcher, Filter layerFilter) {
PivotSites query = new PivotSites();
query.setFilter(layerFilter);
AdminDimension adminDimension = new AdminDimension(layer.getAdminLevelId());
query.setDimensions(adminDimension);
MagnitudeScaleBuilder scaleBuilder = new MagnitudeScaleBuilder(layer);
this.pivotResult = query.isTooBroad() ? new PivotResult() : dispatcher.execute(query);
for (Bucket bucket : pivotResult.getBuckets()) {
EntityCategory category = (EntityCategory) bucket.getCategory(adminDimension);
if (category != null) {
int adminEntityId = category.getId();
AdminMarker polygon = overlay.getPolygon(adminEntityId);
if (polygon != null) {
polygon.setValue(bucket.doubleValue());
scaleBuilder.addValue(bucket.doubleValue());
}
}
}
colorScale = scaleBuilder.build();
}
use of org.activityinfo.legacy.shared.reports.content.AdminMarker in project activityinfo by bedatadriven.
the class PolygonLayerGenerator method queryBounds.
private void queryBounds(DispatcherSync dispatcher, Filter layerFilter) {
GetAdminEntities query = new GetAdminEntities();
query.setLevelId(layer.getAdminLevelId());
AdminEntityResult entities = dispatcher.execute(query);
for (AdminEntityDTO entity : entities.getData()) {
if (entity.hasBounds()) {
AdminMarker marker = new AdminMarker(entity);
overlay.addPolygon(marker);
}
}
}
use of org.activityinfo.legacy.shared.reports.content.AdminMarker in project activityinfo by bedatadriven.
the class AdminChloroplethFeatures method style.
@Override
public JSObject style(JSObject feature) {
int adminEntityId = feature.getPropertyAsInt("id");
AdminMarker polygon = overlay.getPolygon(adminEntityId);
JSObject style = JSObject.createJSObject();
style.setProperty("fillColor", LeafletUtil.color(polygon.getColor()));
style.setProperty("fillOpacity", 0.5);
style.setProperty("stroke", true);
style.setProperty("weight", 2);
style.setProperty("color", LeafletUtil.color(overlay.getOutlineColor()));
return style;
}
Aggregations