use of org.activityinfo.model.type.geo.AiLatLng in project activityinfo by bedatadriven.
the class TileMath method tileBounds.
public static Extents tileBounds(int zoom, int x, int y) {
Point upperLeft = pointForTile(new Tile(x, y));
Point lowerRight = pointForTile(new Tile(x + 1, y + 1));
AiLatLng northWest = inverse(upperLeft, zoom);
AiLatLng southEast = inverse(lowerRight, zoom);
return new Extents(southEast.getLat(), northWest.getLat(), northWest.getLng(), southEast.getLng());
}
use of org.activityinfo.model.type.geo.AiLatLng in project activityinfo by bedatadriven.
the class LocationForm method addCoordFields.
private void addCoordFields() {
coordinateFields = new CoordinateFields();
coordinateFields.setToolTip(I18N.CONSTANTS.coordinateToolTip());
add(coordinateFields.getLatitudeField());
add(coordinateFields.getLongitudeField());
newLocationPresenter.addListener(NewLocationPresenter.POSITION_CHANGED, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
if (!newLocationPresenter.isProvisional()) {
coordinateFields.setValue(newLocationPresenter.getLatLng());
}
}
});
coordinateFields.addChangeListener(new Listener<FieldEvent>() {
@Override
public void handleEvent(FieldEvent be) {
AiLatLng value = coordinateFields.getValue();
if (value != null) {
newLocationPresenter.setLatLng(value);
}
}
});
}
use of org.activityinfo.model.type.geo.AiLatLng in project activityinfo by bedatadriven.
the class TileMathTest method inverse.
@Test
public void inverse() {
AiLatLng latlng = new AiLatLng(15, 30);
Point px = TileMath.fromLatLngToPixel(latlng, 6);
AiLatLng inverse = TileMath.inverse(px, 6);
assertThat("longitude", inverse.getLng(), equalTo(latlng.getLng()));
assertThat("latitude", inverse.getLat(), closeTo(latlng.getLat(), 0.0001));
}
use of org.activityinfo.model.type.geo.AiLatLng in project activityinfo by bedatadriven.
the class BubbleLayerGenerator method generatePoints.
public void generatePoints(List<SiteDTO> sites, TiledMap map, BubbleMapLayer layer, Clusterer clusterer, List<PointValue> mapped, List<PointValue> unmapped) {
for (SiteDTO site : sites) {
if (hasValue(site, layer.getIndicatorIds())) {
Point px = null;
AiLatLng geoPoint = getPoint(site);
if (geoPoint != null) {
px = map.fromLatLngToPixel(geoPoint);
}
Double value = getValue(site, layer.getIndicatorIds());
if (value != null && value != 0) {
PointValue pv = new PointValue(site, createSymbol(site, layer.getColorDimensions()), value, px);
if (geoPoint != null || clusterer.isMapped(site)) {
mapped.add(pv);
} else {
unmapped.add(pv);
}
}
}
}
}
use of org.activityinfo.model.type.geo.AiLatLng in project activityinfo by bedatadriven.
the class ImageMapRenderer method createTileMap.
protected TiledMap createTileMap(MapReportElement element) {
AiLatLng center = element.getCenter() != null ? element.getCenter() : element.getContent().getCenter();
TiledMap map = new TiledMap(element.getWidth(), element.getHeight(), center, element.getContent().getZoomLevel());
return map;
}
Aggregations