Search in sources :

Example 1 with AutomaticClustering

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();
}
Also used : AdministrativeLevelClustering(org.activityinfo.legacy.shared.reports.model.clustering.AdministrativeLevelClustering) RadioGroup(com.extjs.gxt.ui.client.widget.form.RadioGroup) AdminLevelDTO(org.activityinfo.legacy.shared.model.AdminLevelDTO) FieldEvent(com.extjs.gxt.ui.client.event.FieldEvent) NoClustering(org.activityinfo.legacy.shared.reports.model.clustering.NoClustering) AutomaticClustering(org.activityinfo.legacy.shared.reports.model.clustering.AutomaticClustering)

Example 2 with AutomaticClustering

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;
}
Also used : ArabicNumberSequence(org.activityinfo.legacy.shared.reports.model.labeling.ArabicNumberSequence) Filter(org.activityinfo.legacy.shared.command.Filter) BubbleMapLayer(org.activityinfo.legacy.shared.reports.model.layers.BubbleMapLayer) AutomaticClustering(org.activityinfo.legacy.shared.reports.model.clustering.AutomaticClustering)

Example 3 with AutomaticClustering

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));
}
Also used : BubbleMapLayer(org.activityinfo.legacy.shared.reports.model.layers.BubbleMapLayer) AutomaticClustering(org.activityinfo.legacy.shared.reports.model.clustering.AutomaticClustering) Test(org.junit.Test)

Example 4 with AutomaticClustering

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());
}
Also used : IconMapLayer(org.activityinfo.legacy.shared.reports.model.layers.IconMapLayer) AutomaticClustering(org.activityinfo.legacy.shared.reports.model.clustering.AutomaticClustering) Test(org.junit.Test)

Aggregations

AutomaticClustering (org.activityinfo.legacy.shared.reports.model.clustering.AutomaticClustering)4 BubbleMapLayer (org.activityinfo.legacy.shared.reports.model.layers.BubbleMapLayer)2 Test (org.junit.Test)2 FieldEvent (com.extjs.gxt.ui.client.event.FieldEvent)1 RadioGroup (com.extjs.gxt.ui.client.widget.form.RadioGroup)1 Filter (org.activityinfo.legacy.shared.command.Filter)1 AdminLevelDTO (org.activityinfo.legacy.shared.model.AdminLevelDTO)1 AdministrativeLevelClustering (org.activityinfo.legacy.shared.reports.model.clustering.AdministrativeLevelClustering)1 NoClustering (org.activityinfo.legacy.shared.reports.model.clustering.NoClustering)1 ArabicNumberSequence (org.activityinfo.legacy.shared.reports.model.labeling.ArabicNumberSequence)1 IconMapLayer (org.activityinfo.legacy.shared.reports.model.layers.IconMapLayer)1