use of org.graphstream.graph.Node in project fmv by f-agu.
the class FilterGraphUI method createOrGetEdge.
/**
* @param label
* @param labeledFC
* @param node
* @return
*/
private Edge createOrGetEdge(Label label, FilterComplex labeledFC, Node node) {
String edgeKey = getEdgeKey(label, labeledFC);
Edge edge = graph.getEdge(edgeKey);
if (edge == null) {
Node inNode = createOrGetNode(labeledFC);
edge = graph.addEdge(edgeKey, inNode, node);
edge.addAttribute("ui.label", edgeKey);
}
return edge;
}
use of org.graphstream.graph.Node in project fmv by f-agu.
the class FilterGraphUI method addRoot.
// **************************************************
/**
*/
private void addRoot() {
Map<InputProcessor, Node> inputProcessorNodeMap = new HashMap<>();
operation.getInputProcessorStream().forEach(ip -> {
for (OutputKey outputKey : ip.getOutputKeys()) {
Node node = createRootNode(ip, outputKey);
inputProcessorNodeMap.put(ip, node);
}
});
for (FilterComplex rootFC : filterGraph.getRoots()) {
Map<IOKey, In> inputMap = rootFC.getInputMap();
if (!inputMap.isEmpty()) {
for (Entry<IOKey, In> entry : inputMap.entrySet()) {
FilterInput filterInput = entry.getValue().getFilterInput();
if (filterInput instanceof InputProcessor) {
Node node = inputProcessorNodeMap.get(filterInput);
Edge edge = graph.addEdge(node.getId() + "-" + rootFC.toString(), createOrGetNode(rootFC), node);
// edge.addAttribute("ui.label", values);
}
}
}
}
}
use of org.graphstream.graph.Node in project fmv by f-agu.
the class FilterGraphUI method createOrGetNode.
/**
* @param filterComplex
* @return
*/
private Node createOrGetNode(FilterComplex filterComplex) {
String nodeKey = getNodeKey(filterComplex);
Node node = graph.getNode(nodeKey);
if (node == null) {
node = graph.addNode(nodeKey);
node.addAttribute("ui.label", nodeKey);
Collection<Type> types = filterComplex.getTypes();
String ccsStyle = null;
if (types.contains(Type.AUDIO) && !types.contains(Type.VIDEO)) {
ccsStyle = "audio";
} else if (!types.contains(Type.AUDIO) && types.contains(Type.VIDEO)) {
ccsStyle = "video";
}
if (ccsStyle != null) {
node.setAttribute("ui.class", ccsStyle);
}
}
return node;
}
Aggregations