use of org.graphstream.ui.view.util.InteractiveElement in project gs-ui-javafx by graphstream.
the class DefaultCamera method allGraphicElementsIn.
@Override
public Collection<GraphicElement> allGraphicElementsIn(GraphicGraph graph, EnumSet<InteractiveElement> types, double x1, double y1, double x2, double y2) {
List<GraphicElement> elts = new ArrayList<GraphicElement>();
Stream nodeStream = null;
Stream edgeStream = null;
Stream spriteStream = null;
if (types.contains(InteractiveElement.NODE)) {
nodeStream = graph.nodes().filter(n -> isNodeIn((GraphicNode) n, x1, y1, x2, y2));
} else {
nodeStream = Stream.empty();
}
if (types.contains(InteractiveElement.EDGE)) {
edgeStream = graph.edges().filter(e -> isEdgeIn((GraphicEdge) e, x1, y1, x2, y2));
} else {
edgeStream = Stream.empty();
}
if (types.contains(InteractiveElement.SPRITE)) {
spriteStream = graph.sprites().filter(e -> isSpriteIn((GraphicSprite) e, x1, y1, x2, y2));
} else {
spriteStream = Stream.empty();
}
Stream<GraphicElement> s = Stream.concat(nodeStream, Stream.concat(edgeStream, spriteStream));
return s.collect(Collectors.toList());
}
Aggregations