public void setTransform(AffineTransform at) { //node.setTransform(at); node.setLocation(startX + at.getTranslateX(), startY + at.getTranslateY()); }
/** * Adds a GraphArc to the model if it doesn't already exist. * * @return The created or found GraphArc. */ protected GraphArc addArc(OWLEntity srcEntity, OWLEntity destEntity, String relType, Icon icon) { if (!relType.contains(restrictToArcType)) { return null; } boolean newNode = true; if (getNode(destEntity) != null) { newNode = false; } GraphNode srcNode = addNode(srcEntity); GraphNode destNode = addNode(destEntity); if (newNode) { destNode.setLocation(srcNode.getBounds().getX(), srcNode.getBounds().getY()); } String key = srcEntity.toString() + relType + destEntity.toString(); DefaultGraphArc arc = (DefaultGraphArc) addArc(key, srcNode, destNode, relType, icon); //arc.setType(relType); // for this sample the arc types work backworks (is_a, etc) arc.setInverted(true); return arc; }
node.setLocation(node.getXInLayout(), node.getYInLayout());
@Override protected void drag(PInputEvent e) { //super.drag(e); PNode pnode = getDraggedNode(); if (pnode instanceof GraphNode) { // MOVE node GraphNode graphNode = (GraphNode) pnode; PDimension d = e.getDeltaRelativeTo(pnode); pnode.localToParent(d); double dx = d.getWidth(); double dy = d.getHeight(); graphNode.setLocation(pnode.getX() + dx, pnode.getY() + dy); } }