use of org.graphstream.ui.graphicGraph.GraphicSprite in project gs-ui-javafx by graphstream.
the class SpriteRenderer method renderShadow.
@Override
public void renderShadow(Backend bck, DefaultCamera2D camera, GraphicElement element) {
GraphicSprite sprite = (GraphicSprite) element;
Point3 pos = camera.getSpritePosition(sprite, new Point3(), StyleConstants.Units.GU);
AreaSkeleton skel = getOrSetAreaSkeleton(element);
shape.configureForElement(bck, element, skel, camera);
shape.renderShadow(bck, camera, element, skel);
}
use of org.graphstream.ui.graphicGraph.GraphicSprite in project gs-ui-javafx by graphstream.
the class SpriteFlowShape method configureForElement.
@Override
public void configureForElement(Backend bck, GraphicElement element, Skeleton skel, DefaultCamera2D camera) {
GraphicSprite sprite = (GraphicSprite) element;
if (sprite.isAttachedToEdge()) {
GraphicEdge edge = sprite.getEdgeAttachment();
fillableLine.configureFillableLineForElement(element.getStyle(), camera, element);
decorable.configureDecorableForElement(bck, camera, element, skel);
if (element.hasAttribute("ui.size"))
theSize = camera.getMetrics().lengthToGu(StyleConstants.convertValue(element.getAttribute("ui.size")));
along = element.getX();
offset = camera.getMetrics().lengthToGu(element.getY(), sprite.getUnits());
connectorSkel = (ConnectorSkeleton) edge.getAttribute(Skeleton.attributeName);
} else {
connectorSkel = null;
}
}
use of org.graphstream.ui.graphicGraph.GraphicSprite 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());
}
use of org.graphstream.ui.graphicGraph.GraphicSprite in project gs-ui-javafx by graphstream.
the class SpriteRenderer method renderElement.
@Override
public void renderElement(Backend bck, DefaultCamera2D camera, GraphicElement element) {
GraphicSprite sprite = (GraphicSprite) element;
AreaSkeleton skel = getOrSetAreaSkeleton(element);
shape.configureForElement(bck, element, skel, camera);
shape.render(bck, camera, element, skel);
}
Aggregations