/** * Recalculates and reapplies all of the node appearances. The visual attributes are calculated by * delegating to the NodePainter member of the current visual style. */ public void applyNodeAppearances() { for (PNodeView nodeView : nodeViewMap.values()) { FNode node = nodeView.getNode(); HGHandle h = node.getHandle(); NodePainter p = getPainter(h, false); p.paintNode(nodeView); } }
/** * Recalculates and reapplies all of the edge appearances. The visual attributes are calculated by * delegating to the EdgePainter member of the current visual style. */ public void applyEdgeAppearances() { for (PEdgeView edgeView : edgeViewMap.values()) { FNode node = edgeView.getEdge().getSource(); HGHandle h = graph.getTypeSystem().getTypeHandle(node.getHandle()); EdgePainter p = getVisualStyle(true).getEdgePainter(h); if (p == null) p = def_edge_painter; p.paintEdge(edgeView); } }
/** * Returns an array with the adjacent edges of a given nodes * * @param node The node * @param incoming if true, includes all incoming edges * @param outgoing if true, includes all outgoing edges * @return */ public FEdge[] getAdjacentEdges(FNode node, boolean incoming, boolean outgoing) { if (node == null || !nodeViewMap.containsKey(node)) return new FEdge[0]; HGHandle nH = node.getHandle(); IncidenceSet handles = graph.getIncidenceSet(nH); Set<FEdge> res = new HashSet<FEdge>(); for (HGHandle h : handles) { FNode incNode = new FNode(h); if (!nodeViewMap.containsKey(incNode)) continue; if (outgoing) { FEdge e = new FEdge(node, incNode); if (edgeViewMap.containsKey(e)) res.add(e); } if (incoming) { FEdge e = new FEdge(incNode, node); if (edgeViewMap.containsKey(e)) res.add(e); } } Object o = graph.get(nH); if (o instanceof HGLink) { HGLink link = ((HGLink) o); for (int i = 0; i < link.getArity(); i++) { FNode incNode = new FNode(link.getTargetAt(i)); if (!nodeViewMap.containsKey(incNode)) continue; if (outgoing) { FEdge e = new FEdge(incNode, node); if (edgeViewMap.containsKey(e)) res.add(e); } if (incoming) { FEdge e = new FEdge(node, incNode); if (edgeViewMap.containsKey(e)) res.add(e); } } } return res.toArray(new FEdge[res.size()]); }