Search in sources :

Example 1 with AdminMarker

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();
}
Also used : PivotSites(org.activityinfo.legacy.shared.command.PivotSites) PivotResult(org.activityinfo.legacy.shared.command.PivotSites.PivotResult) Bucket(org.activityinfo.legacy.shared.command.result.Bucket) AdminMarker(org.activityinfo.legacy.shared.reports.content.AdminMarker) AdminDimension(org.activityinfo.legacy.shared.reports.model.AdminDimension) EntityCategory(org.activityinfo.legacy.shared.reports.content.EntityCategory)

Example 2 with AdminMarker

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);
        }
    }
}
Also used : AdminEntityDTO(org.activityinfo.legacy.shared.model.AdminEntityDTO) AdminMarker(org.activityinfo.legacy.shared.reports.content.AdminMarker) AdminEntityResult(org.activityinfo.legacy.shared.command.result.AdminEntityResult) GetAdminEntities(org.activityinfo.legacy.shared.command.GetAdminEntities)

Example 3 with AdminMarker

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;
}
Also used : AdminMarker(org.activityinfo.legacy.shared.reports.content.AdminMarker) JSObject(org.discotools.gwt.leaflet.client.jsobject.JSObject)

Aggregations

AdminMarker (org.activityinfo.legacy.shared.reports.content.AdminMarker)3 GetAdminEntities (org.activityinfo.legacy.shared.command.GetAdminEntities)1 PivotSites (org.activityinfo.legacy.shared.command.PivotSites)1 PivotResult (org.activityinfo.legacy.shared.command.PivotSites.PivotResult)1 AdminEntityResult (org.activityinfo.legacy.shared.command.result.AdminEntityResult)1 Bucket (org.activityinfo.legacy.shared.command.result.Bucket)1 AdminEntityDTO (org.activityinfo.legacy.shared.model.AdminEntityDTO)1 EntityCategory (org.activityinfo.legacy.shared.reports.content.EntityCategory)1 AdminDimension (org.activityinfo.legacy.shared.reports.model.AdminDimension)1 JSObject (org.discotools.gwt.leaflet.client.jsobject.JSObject)1