use of de.fhpotsdam.unfolding.UnfoldingMap in project constellation by constellation-app.
the class ConstellationClusterMarker method draw.
@Override
public void draw(final UnfoldingMap map) {
clusterSize = getCentroidLocations().size();
final PGraphics graphics = map.mapDisplay.getOuterPG();
final List<MapPosition> positions = getLocations().stream().map(location -> new MapPosition(map.mapDisplay.getObjectFromLocation(location))).collect(Collectors.toList());
draw(graphics, positions, map);
}
use of de.fhpotsdam.unfolding.UnfoldingMap in project constellation by constellation-app.
the class InfoOverlay method onManipulation.
@Override
public void onManipulation(final MapEvent mapEvent) {
if (map.getId().equals(mapEvent.getScopeId())) {
if (mapEvent.getSubType().equals(PanMapEvent.PAN_BY)) {
panByBroadcasted = 1;
}
if (mapEvent.getSubType().equals(PanMapEvent.PAN_TO)) {
panToBroadcasted = 1;
}
if (mapEvent.getSubType().equals(ZoomMapEvent.ZOOM_BY_LEVEL)) {
zoomByBroadcasted = 1;
}
if (mapEvent.getSubType().equals(ZoomMapEvent.ZOOM_TO_LEVEL)) {
zoomToBroadcasted = 1;
}
}
if (eventDispatcher != null) {
final List<ScopedListeners> scopedListenersList = eventDispatcher.typedScopedListeners.get(mapEvent.getType());
scopedListenersList.forEach(scopedListeners -> {
if (scopedListeners.isInScope(mapEvent)) {
scopedListeners.listeners.forEach(listener -> {
if (listener instanceof UnfoldingMap) {
final UnfoldingMap listeningMap = (UnfoldingMap) listener;
if (map.getId().equals(listeningMap.getId())) {
if (mapEvent.getSubType().equals(PanMapEvent.PAN_BY)) {
panByListened = 1;
}
if (mapEvent.getSubType().equals(PanMapEvent.PAN_TO)) {
panToListened = 1;
}
if (mapEvent.getSubType().equals(ZoomMapEvent.ZOOM_BY_LEVEL)) {
zoomByListened = 1;
}
if (mapEvent.getSubType().equals(ZoomMapEvent.ZOOM_TO_LEVEL)) {
zoomToListened = 1;
}
}
}
});
}
});
}
}
use of de.fhpotsdam.unfolding.UnfoldingMap in project constellation by constellation-app.
the class OverviewOverlay method initialise.
@Override
public void initialise(final MapViewTileRenderer renderer, final UnfoldingMap map, final EventDispatcher eventDispatcher) {
super.initialise(renderer, map, eventDispatcher);
this.overviewMap = new UnfoldingMap(renderer, x + PADDING, y + PADDING, width - (PADDING * 2), height - (PADDING * 2));
}
use of de.fhpotsdam.unfolding.UnfoldingMap in project constellation by constellation-app.
the class ConstellationAbstractMarker method draw.
@Override
public void draw(final UnfoldingMap map) {
final PGraphics graphics = map.mapDisplay.getOuterPG();
final List<MapPosition> positions = locations.stream().map(location -> new MapPosition(map.mapDisplay.getObjectFromLocation(location))).collect(Collectors.toList());
final boolean validMarker = draw(graphics, positions, map);
// draw label
if (validMarker && getId() != null) {
final MapPosition center = new MapPosition();
positions.forEach(center::add);
center.div(positions.size());
graphics.fill(FONT_COLOR);
graphics.textSize(FONT_SIZE);
graphics.text(id, center.x - (CHAR_WIDTH * id.length() * 0.6F), center.y + (FONT_SIZE * 0.35F));
}
}
use of de.fhpotsdam.unfolding.UnfoldingMap in project constellation by constellation-app.
the class MapViewTileRenderer method setup.
@Override
public void setup() {
assert !SwingUtilities.isEventDispatchThread();
markerFactory = new ConstellationMarkerFactory();
markerFactory.setDefaultColor(MarkerUtilities.DEFAULT_COLOR);
markerFactory.setDefaultCustomColor(MarkerUtilities.DEFAULT_CUSTOM_COLOR);
markerFactory.setDefaultHighlightColor(MarkerUtilities.DEFAULT_HIGHLIGHT_COLOR);
markerFactory.setDefaultSelectColor(MarkerUtilities.DEFAULT_SELECT_COLOR);
markerFactory.setDefaultStrokeColor(MarkerUtilities.DEFAULT_STROKE_COLOR);
markerFactory.setDefaultStrokeWeight(MarkerUtilities.DEFAULT_STROKE_WEIGHT);
map = new UnfoldingMap(this, "Map View", currentProvider);
map.setTweening(true);
dispatcher = MapUtils.createDefaultEventDispatcher(this, map);
// The map library, Unfolding Maps, defaults to a hard-coded left click pan
dispatcher.unregister(map, PanMapEvent.TYPE_PAN, map.getId());
dispatcher.unregister(map, ZoomMapEvent.TYPE_ZOOM, map.getId());
layers = Lookup.getDefault().lookupAll(MapLayer.class);
layers.forEach(layer -> layer.initialise(this, map));
overlays = Lookup.getDefault().lookupAll(MapOverlay.class);
overlays.forEach(overlay -> overlay.initialise(this, map, dispatcher));
barScale = new BarScaleUI(this, map, 10F, this.getComponent().getHeight() - 10F);
updateMarkers(parent.getCurrentGraph(), new MarkerState());
zoomToLocation(null);
}
Aggregations