Search in sources :

Example 6 with MapPosition

use of de.fhpotsdam.unfolding.utils.MapPosition 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)

Aggregations

MapPosition (de.fhpotsdam.unfolding.utils.MapPosition)6 MarkerUtilities (au.gov.asd.tac.constellation.views.mapview.utilities.MarkerUtilities)4 Location (de.fhpotsdam.unfolding.geo.Location)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 PGraphics (processing.core.PGraphics)4 PConstants (processing.core.PConstants)3 UnfoldingMap (de.fhpotsdam.unfolding.UnfoldingMap)2 Marker (de.fhpotsdam.unfolding.marker.Marker)2 ScreenPosition (de.fhpotsdam.unfolding.utils.ScreenPosition)2 ArrayList (java.util.ArrayList)2 ServiceProvider (org.openide.util.lookup.ServiceProvider)2 PImage (processing.core.PImage)2 Graph (au.gov.asd.tac.constellation.graph.Graph)1 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)1 SpatialConcept (au.gov.asd.tac.constellation.graph.schema.analytic.concept.SpatialConcept)1 Distance (au.gov.asd.tac.constellation.utilities.geospatial.Distance)1 Haversine (au.gov.asd.tac.constellation.utilities.geospatial.Distance.Haversine)1 ConstellationAbstractMarker (au.gov.asd.tac.constellation.views.mapview.markers.ConstellationAbstractMarker)1 ConstellationPointMarker (au.gov.asd.tac.constellation.views.mapview.markers.ConstellationPointMarker)1