Search in sources :

Example 1 with AdministrativeLevelClustering

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();
}
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 AdministrativeLevelClustering

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

Example 3 with AdministrativeLevelClustering

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

Example 4 with AdministrativeLevelClustering

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;
}
Also used : AdministrativeLevelClustering(org.activityinfo.legacy.shared.reports.model.clustering.AdministrativeLevelClustering)

Aggregations

AdministrativeLevelClustering (org.activityinfo.legacy.shared.reports.model.clustering.AdministrativeLevelClustering)4 MapContent (org.activityinfo.legacy.shared.reports.content.MapContent)2 MapReportElement (org.activityinfo.legacy.shared.reports.model.MapReportElement)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 AdminLevelDTO (org.activityinfo.legacy.shared.model.AdminLevelDTO)1 BubbleMapMarker (org.activityinfo.legacy.shared.reports.content.BubbleMapMarker)1 IconMapMarker (org.activityinfo.legacy.shared.reports.content.IconMapMarker)1 AutomaticClustering (org.activityinfo.legacy.shared.reports.model.clustering.AutomaticClustering)1 NoClustering (org.activityinfo.legacy.shared.reports.model.clustering.NoClustering)1 BubbleMapLayer (org.activityinfo.legacy.shared.reports.model.layers.BubbleMapLayer)1 IconMapLayer (org.activityinfo.legacy.shared.reports.model.layers.IconMapLayer)1