Search in sources :

Example 1 with UnfoldingMap

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);
}
Also used : Objects(java.util.Objects) PConstants(processing.core.PConstants) List(java.util.List) MarkerUtilities(au.gov.asd.tac.constellation.views.mapview.utilities.MarkerUtilities) Location(de.fhpotsdam.unfolding.geo.Location) UnfoldingMap(de.fhpotsdam.unfolding.UnfoldingMap) PGraphics(processing.core.PGraphics) Marker(de.fhpotsdam.unfolding.marker.Marker) MapPosition(de.fhpotsdam.unfolding.utils.MapPosition) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) PGraphics(processing.core.PGraphics) MapPosition(de.fhpotsdam.unfolding.utils.MapPosition)

Example 2 with UnfoldingMap

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;
                            }
                        }
                    }
                });
            }
        });
    }
}
Also used : ScopedListeners(de.fhpotsdam.unfolding.events.ScopedListeners) UnfoldingMap(de.fhpotsdam.unfolding.UnfoldingMap)

Example 3 with UnfoldingMap

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));
}
Also used : UnfoldingMap(de.fhpotsdam.unfolding.UnfoldingMap)

Example 4 with UnfoldingMap

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));
    }
}
Also used : Arrays(java.util.Arrays) List(java.util.List) MarkerUtilities(au.gov.asd.tac.constellation.views.mapview.utilities.MarkerUtilities) Location(de.fhpotsdam.unfolding.geo.Location) UnfoldingMap(de.fhpotsdam.unfolding.UnfoldingMap) HashMap(java.util.HashMap) PGraphics(processing.core.PGraphics) Marker(de.fhpotsdam.unfolding.marker.Marker) MapPosition(de.fhpotsdam.unfolding.utils.MapPosition) PVector(processing.core.PVector) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) PGraphics(processing.core.PGraphics) MapPosition(de.fhpotsdam.unfolding.utils.MapPosition)

Example 5 with UnfoldingMap

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);
}
Also used : ConstellationMarkerFactory(au.gov.asd.tac.constellation.views.mapview.markers.ConstellationMarkerFactory) MapOverlay(au.gov.asd.tac.constellation.views.mapview.overlays.MapOverlay) MapLayer(au.gov.asd.tac.constellation.views.mapview.layers.MapLayer) BarScaleUI(de.fhpotsdam.unfolding.ui.BarScaleUI) UnfoldingMap(de.fhpotsdam.unfolding.UnfoldingMap) MarkerState(au.gov.asd.tac.constellation.views.mapview.utilities.MarkerState)

Aggregations

UnfoldingMap (de.fhpotsdam.unfolding.UnfoldingMap)5 MarkerUtilities (au.gov.asd.tac.constellation.views.mapview.utilities.MarkerUtilities)2 Location (de.fhpotsdam.unfolding.geo.Location)2 Marker (de.fhpotsdam.unfolding.marker.Marker)2 MapPosition (de.fhpotsdam.unfolding.utils.MapPosition)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 PGraphics (processing.core.PGraphics)2 MapLayer (au.gov.asd.tac.constellation.views.mapview.layers.MapLayer)1 ConstellationMarkerFactory (au.gov.asd.tac.constellation.views.mapview.markers.ConstellationMarkerFactory)1 MapOverlay (au.gov.asd.tac.constellation.views.mapview.overlays.MapOverlay)1 MarkerState (au.gov.asd.tac.constellation.views.mapview.utilities.MarkerState)1 ScopedListeners (de.fhpotsdam.unfolding.events.ScopedListeners)1 BarScaleUI (de.fhpotsdam.unfolding.ui.BarScaleUI)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 Objects (java.util.Objects)1 PConstants (processing.core.PConstants)1 PVector (processing.core.PVector)1