use of org.activityinfo.legacy.shared.reports.model.clustering.AutomaticClustering in project activityinfo by bedatadriven.
the class ClusteringOptionsWidget method buildForm.
private void buildForm(Collection<AdminLevelDTO> adminLevels) {
radios = Lists.newArrayList();
radios.add(new ClusteringRadio(I18N.CONSTANTS.none(), new NoClustering()));
radios.add(new ClusteringRadio(I18N.CONSTANTS.automatic(), new AutomaticClustering()));
for (AdminLevelDTO level : adminLevels) {
AdministrativeLevelClustering clustering = new AdministrativeLevelClustering();
clustering.getAdminLevels().add(level.getId());
radios.add(new ClusteringRadio(level.getName(), clustering));
}
radioGroup = new RadioGroup();
radioGroup.setOrientation(Orientation.VERTICAL);
radioGroup.setStyleAttribute("padding", "5px");
for (ClusteringRadio radio : radios) {
radioGroup.add(radio);
if (radio.getClustering().equals(value)) {
radioGroup.setValue(radio);
}
}
add(radioGroup);
radioGroup.addListener(Events.Change, new Listener<FieldEvent>() {
@Override
public void handleEvent(FieldEvent be) {
ClusteringRadio radio = (ClusteringRadio) radioGroup.getValue();
setValue(radio.getClustering(), true);
}
});
layout();
// unmask();
}
use of org.activityinfo.legacy.shared.reports.model.clustering.AutomaticClustering in project activityinfo by bedatadriven.
the class GeoDigestModelBuilder method createLayer.
private BubbleMapLayer createLayer(List<Integer> siteIds) {
Filter filter = new Filter();
filter.addRestriction(DimensionType.Site, siteIds);
BubbleMapLayer layer = new BubbleMapLayer(filter);
layer.setLabelSequence(new ArabicNumberSequence());
layer.setClustering(new AutomaticClustering());
layer.setMinRadius(BUBBLE_SIZE);
layer.setMaxRadius(BUBBLE_SIZE);
layer.setBubbleColor(BUBBLE_COLOR);
return layer;
}
use of org.activityinfo.legacy.shared.reports.model.clustering.AutomaticClustering in project activityinfo by bedatadriven.
the class MgMapIntegrationTest method sitesBoundToAdminLevelsAreAutoClusteredProperly.
@Test
public void sitesBoundToAdminLevelsAreAutoClusteredProperly() throws IOException {
BubbleMapLayer layer = new BubbleMapLayer();
layer.addIndicator(NUMBER_OF_BENE_INDICATOR_ID);
layer.setClustering(new AutomaticClustering());
generateMap(layer, "mg-auto-cluster");
assertThat(content.getMarkers().size(), equalTo(4));
assertThat(content.getUnmappedSites().size(), equalTo(0));
}
use of org.activityinfo.legacy.shared.reports.model.clustering.AutomaticClustering in project activityinfo by bedatadriven.
the class MgMapIntegrationTest method siteBoundsToAdminLevelsMappedAsIconsAutoClustered.
@Test
public void siteBoundsToAdminLevelsMappedAsIconsAutoClustered() throws IOException {
IconMapLayer layer = new IconMapLayer();
layer.setIcon("educ");
layer.getIndicatorIds().add(NUMBER_OF_BENE_INDICATOR_ID);
layer.setClustering(new AutomaticClustering());
generateMap(layer, "mg-icons-auto");
assertTrue(content.getMarkers().size() > 0);
assertTrue(content.getUnmappedSites().isEmpty());
}
Aggregations