use of org.activityinfo.legacy.shared.reports.model.clustering.NoClustering in project activityinfo by bedatadriven.
the class LayersWidget method addLayer.
public void addLayer(MapLayer layer) {
if (layer instanceof PointMapLayer) {
((PointMapLayer) layer).setClustering(new NoClustering());
}
mapElement.getLayers().add(layer);
reportEventBus.fireChange();
updateStore();
}
use of org.activityinfo.legacy.shared.reports.model.clustering.NoClustering 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.NoClustering in project activityinfo by bedatadriven.
the class PiechartMapLayerGeneratorTest method testSomething.
@Test
public void testSomething() {
SiteDTO siteData = new SiteDTO();
siteData.setId(42);
siteData.setX(15.0);
siteData.setY(0.0);
siteData.setIndicatorValue(1, 50.0);
siteData.setIndicatorValue(2, 10.0);
siteData.setIndicatorValue(3, 20.0);
siteData.setIndicatorValue(4, 40.0);
PiechartMapLayer pcml = new PiechartMapLayer();
pcml.setMinRadius(10);
pcml.setMaxRadius(50);
pcml.addIndicatorId(1);
pcml.addIndicatorId(2);
pcml.addIndicatorId(3);
pcml.addIndicatorId(4);
pcml.setClustering(new NoClustering());
TiledMap map = new TiledMap(500, 600, new AiLatLng(15.0, 0.0), 6);
Map<Integer, Indicator> indicators = Maps.newHashMap();
indicators.put(1, new Indicator());
indicators.put(2, new Indicator());
indicators.put(3, new Indicator());
indicators.put(4, new Indicator());
PiechartLayerGenerator gen = new PiechartLayerGenerator(pcml, indicators);
gen.setSites(Arrays.asList(siteData));
MapContent mc = new MapContent();
gen.generate(map, mc);
assertThat(mc.getMarkers().size(), equalTo(1));
assertThat(((PieMapMarker) mc.getMarkers().get(0)).getSlices().size(), equalTo(4));
}
Aggregations