private void realizeChemEdge( Graph2D graph, Edge newEdge, Attachment sourceAttachment, Attachment targetAttachment) { EdgeMap edgeTypeMap = (EdgeMap) graph.getDataProvider(EdgeMapKeys.EDGE_INFO); EdgeRealizer er = graph.getRealizer(newEdge); er.setLineColor(Color.BLACK); er.setLineType(LineType.LINE_1); edgeTypeMap.set(newEdge, new SViewEdgeInfo(EdgeType.CHEM, sourceAttachment, targetAttachment)); }
private void addBranchToBranchEdge( Edge currentEdge, Attachment sourceAttachment, Attachment targetAttachment) { EdgeMap edgeTypeMap = (EdgeMap) _graph.getDataProvider(EdgeMapKeys.EDGE_INFO); Node sourceNode = _viewModel.getViewNode(currentEdge.source()); Node targetNode = _viewModel.getViewNode(currentEdge.target()); Edge newEdge = _graph.createEdge(sourceNode, targetNode); edgeTypeMap.set( newEdge, new SViewEdgeInfo(EdgeType.BRANCH_BRANCH, sourceAttachment, targetAttachment)); sourceNode = getViewStartingNode(newEdge.source(), _graph); targetNode = getViewStartingNode(newEdge.target(), _graph); _viewModel.addComplentaryViewNodes(sourceNode, targetNode); }
/** * get the starting node of the sequence in where the current node is sitting in * * @deprecated use getViewStartingNode * @param node * @param graph * @return */ @Deprecated private Node getStartingNode(Node node, Graph2D graph) { if (_viewModel.getStartingViewNodeList().contains(node)) { return node; } else { NodeCursor pres = node.predecessors(); Edge edge; Node currentNode = node; EdgeMap edgeMap = (EdgeMap) graph.getDataProvider(EdgeMapKeys.EDGE_INFO); Node preNode = currentNode; while (pres.ok()) { for (; pres.ok(); pres.next()) { edge = currentNode.getEdge(pres.node()); EdgeType edgeType = ((SViewEdgeInfo) edgeMap.get(edge)).getType(); if ((edgeType == EdgeType.REGULAR) || (edgeType == EdgeType.MODIFIED_P)) { currentNode = pres.node(); break; } } if (currentNode != preNode) { pres = currentNode.predecessors(); preNode = currentNode; } else { break; } } if (_viewModel.getStartingViewNodeList().contains(currentNode)) { return currentNode; } else { return null; } } }
public static String getNotation(Node node) { Graph2D graph = (Graph2D) node.getGraph(); NodeMap nodeMap = (NodeMap) graph.getDataProvider(NodeMapKeys.FOLDER_NODE_NOTATION); return (String) nodeMap.get(node); }
private Node getViewStartingNode(Node node, Graph2D view) { NodeMap startingNodeMap = (NodeMap) _graph.getDataProvider(NodeMapKeys.NODE2STARTING_NODE); return (Node) startingNodeMap.get(node); }