use of org.activityinfo.legacy.shared.reports.model.clustering.AdministrativeLevelClustering 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.AdministrativeLevelClustering in project activityinfo by bedatadriven.
the class MapGeneratorTest method adminMapBubbles.
@Test
public void adminMapBubbles() {
AdministrativeLevelClustering clustering = new AdministrativeLevelClustering();
clustering.getAdminLevels().add(1);
BubbleMapLayer layer = new BubbleMapLayer();
layer.setClustering(clustering);
layer.addIndicator(1);
Filter filter = new Filter();
filter.addRestriction(DimensionType.Site, 3);
MapReportElement map = new MapReportElement();
map.addLayer(layer);
map.setFilter(filter);
MapContent result = (MapContent) execute(new GenerateElement(map));
System.out.println(result.getMarkers());
BubbleMapMarker marker = (BubbleMapMarker) result.getMarkers().get(0);
assertThat(marker.getSiteIds().size(), equalTo(1));
assertThat(marker.getSiteIds().get(0), equalTo(3));
assertThat(marker.getValue(), equalTo(10000d));
assertThat(result.getUnmappedSites().size(), equalTo(0));
System.out.println(marker.getTitle());
}
use of org.activityinfo.legacy.shared.reports.model.clustering.AdministrativeLevelClustering in project activityinfo by bedatadriven.
the class MapGeneratorTest method adminMapIcon.
@Test
public void adminMapIcon() {
AdministrativeLevelClustering clustering = new AdministrativeLevelClustering();
clustering.getAdminLevels().add(1);
IconMapLayer layer = new IconMapLayer();
layer.setClustering(clustering);
layer.getIndicatorIds().add(1);
Filter filter = new Filter();
filter.addRestriction(DimensionType.Site, 3);
MapReportElement map = new MapReportElement();
map.addLayer(layer);
map.setFilter(filter);
MapContent result = (MapContent) execute(new GenerateElement(map));
System.out.println(result.getMarkers());
IconMapMarker marker = (IconMapMarker) result.getMarkers().get(0);
assertThat(marker.getSiteIds().size(), equalTo(1));
assertThat(marker.getSiteIds().get(0), equalTo(3));
System.out.println(marker.getTitle());
// assertThat(marker., equalTo(10000d));
assertThat(result.getUnmappedSites().size(), equalTo(0));
}
use of org.activityinfo.legacy.shared.reports.model.clustering.AdministrativeLevelClustering in project activityinfo by bedatadriven.
the class MgMapIntegrationTest method clusterByFokotany.
private AdministrativeLevelClustering clusterByFokotany() {
AdministrativeLevelClustering clustering = new AdministrativeLevelClustering();
clustering.getAdminLevels().add(FOKOTANY_LEVEL_ID);
return clustering;
}
Aggregations