当前位置: 首页>>代码示例>>Java>>正文


Java Edge类代码示例

本文整理汇总了Java中com.touchgraph.graphlayout.Edge的典型用法代码示例。如果您正苦于以下问题:Java Edge类的具体用法?Java Edge怎么用?Java Edge使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Edge类属于com.touchgraph.graphlayout包,在下文中一共展示了Edge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paintAfterEdges

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * @see com.touchgraph.graphlayout.TGPaintListener#paintAfterEdges(java.awt.Graphics)
 */
public void paintAfterEdges(Graphics g) {

    if (mousePos == null) {
        return;
    }

    Node mouseOverN = tgPanel.getMouseOverN();

    if (mouseOverN == null) {
        // g.setColor(Node.BACK_DEFAULT_COLOR);
        g.drawRect(mousePos.x - 7, mousePos.y - 7, 14, 14);
    }

    Color c;
    if (mouseOverN == dragAddNode) {
        c = Color.darkGray;
    } else {
        c = Color.blue;
    }
    Edge.paintArrow(g, (int) dragAddNode.drawx, (int) dragAddNode.drawy,
            mousePos.x, mousePos.y, c);
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:26,代码来源:DragAddUI.java

示例2: addEdge

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/** Add the Edge <tt>edge</tt> to the graph. */
public void addEdge(Edge edge)
{
    if (edge == null)
    {
        return;
    }
    if (!contains(edge))
    {
        edges.addElement(edge);

        Node from = edge.getFrom();
        from.addEdge(edge);
        edge.setFrom(from);

        Node to = edge.getTo();
        to.addEdge(edge);
        edge.setTo(to);
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:21,代码来源:GraphEltSet.java

示例3: deleteEdge

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/** Delete the Edge <tt>edge</tt>. */
public boolean deleteEdge(Edge edge)
{
    synchronized (edges)
    {
        if (edge == null)
        {
            return false;
        }
        if (!edges.removeElement(edge))
        {
            return false;
        }

        Node from = edge.getFrom();
        from.removeEdge(edge);
        edge.setFrom(from);

        Node to = edge.getTo();
        to.removeEdge(edge);
        edge.setTo(to);
        return true;
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:25,代码来源:GraphEltSet.java

示例4: headedDebug

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
public void headedDebug(String header, Object object) {
  if (!VizDebugUtils.isDebugEnabled())
    return;
  
  VizDebugUtils.debug("=====================" + header + "=====================");
  VizDebugUtils.debug("---- (focusNode: " + fullName(getFocusNode()) + " ---)");
  
  if (object != null) {
    VizDebugUtils.debug("---- (Object class: " + object.getClass().getName() + ")");
    if (object instanceof Node)
      VizDebugUtils.debug("---- (node fulltext: " + fullName((Node)object)
          + " ---)");
    else if (object instanceof Edge)
      VizDebugUtils.debug("---- (edge id: " + ((Edge)object).getID()
          + " ---)");
    else
      VizDebugUtils.debug(" ---- (Object stringified: " + controller.getStringifier()
          .toString(object) + " ---)");
  }
  
  outputDebugInfo("count");
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:23,代码来源:TopicMapView.java

示例5: deleteNode

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/** Delete the Node <tt>node</tt>, returning true if successful. */
public boolean deleteNode( Node node ) {
    synchronized (nodes) {
        if ( node == null ) return false;
        if ( !nodes.removeElement(node) ) return false;
    
        String id = node.getID();
        if ( id != null ) nodeIDRegistry.remove(id); // remove from registry

        for ( int i = 0 ; i < node.edgeCount(); i++ ) {
            Edge e = node.edgeAt(i);
            if ( e.from == node ) {
                edges.removeElement(e); // Delete edge not used, because it would change the node's edges
                e.to.removeEdge(e);     // vector which is being iterated on.
            } else if ( e.to == node ) {
                edges.removeElement(e);
                e.from.removeEdge(e);
            }
            //No edges are deleted from node.  Hopefully garbage collection will pick them up.
        }
     }
     return true;
}
 
开发者ID:componavt,项目名称:wikokit,代码行数:24,代码来源:GraphEltSet.java

示例6: createPredicate2ObjectEdgePredicateHidden

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * Create predicate to object edge when predicates are hidden
 *
 * @param predicateNode
 *            the predicate node
 * @param objectNode
 *            the node object
 */
public void createPredicate2ObjectEdgePredicateHidden(Node predicateNode, Node objectNode, String predicateUri) {
    Edge edge=tgPanel.addEdge(predicateNode, objectNode, Edge.DEFAULT_LENGTH);
    
    if(predicateUri!=null && !predicateUri.startsWith(MindRaiderConstants.RDF_NS)) {
        // non-standard predicate
        edge.setColor(render.getEdgeExtraColor());
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:17,代码来源:SpidersGraph.java

示例7: deleteStatement

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * Delete statement.
 */
public void deleteStatement() {
    StatusBar.show("Deleting statement...");

    Node predicate = getSelectedNode();

    if (predicate.edgeCount() < 2) {
        StatusBar.show("Error: Uncomplete statement (missing either subject or object)!");
        return;
    }

    if (predicate.getType() != render.getPredicateNodeType()) {
        JOptionPane.showMessageDialog(MindRaider.mainJFrame, "To delete statement, predicate must be selected!",
                "Triplet Delete Error", JOptionPane.ERROR_MESSAGE);
        return;
    }

    Node subject, object;
    Edge e = predicate.edgeAt(0);

    if (predicate == e.getTo()) {
        subject = e.getFrom();
        object = predicate.edgeAt(1).getTo();
    } else {
        subject = e.getTo();
        object = predicate.edgeAt(1).getFrom();
    }

    rdfModel.deleteStatement(subject.rdfNode, (Property) predicate.rdfNode, object.rdfNode);
    save();
    renderModel();
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:35,代码来源:SpidersGraph.java

示例8: mouseReleased

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * @see com.touchgraph.graphlayout.interaction.TGAbstractDragUI#mouseReleased(java.awt.event.MouseEvent)
 */
public void mouseReleased(MouseEvent e) {
    Node mouseOverN = tgPanel.getMouseOverN();

    if (mouseOverN != null && dragAddNode != null
            && mouseOverN != dragAddNode) {
        Edge ed = tgPanel.findEdge(dragAddNode, mouseOverN);
        if (ed == null) {
            tgPanel.addEdge(dragAddNode, mouseOverN, Edge.DEFAULT_LENGTH);
        } else {
            tgPanel.deleteEdge(ed);
        }

    } else if (mouseOverN == null && dragAddNode != null) {
        try {
            Node n = tgPanel.addNode();
            tgPanel.addEdge(dragAddNode, n, Edge.DEFAULT_LENGTH);
            n.drawx = tgPanel.getMousePos().x;
            n.drawy = tgPanel.getMousePos().y;
            tgPanel.updatePosFromDraw(n);
        } catch (TGException tge) {
            System.err.println(tge.getMessage());
            tge.printStackTrace(System.err);
        }
    }

    if (mouseWasDragged) { // Don't reset the damper on a mouseClicked
        tgPanel.resetDamper();
        tgPanel.startDamper();
    }
    dragAddNode = null;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:35,代码来源:DragAddUI.java

示例9: randomGraph

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * Random graph.
 * 
 * @throws TGException
 *             the TG exception.
 */
public void randomGraph() throws TGException {
    Node n1 = tgPanel.addNode();
    n1.setType(0);
    for (int i = 0; i < 249; i++) {
        tgPanel.addNode();
    }

    TGForEachNode fen = new TGForEachNode() {

        public void forEachNode(Node n) {
            for (int i = 0; i < 5; i++) {
                Node r = tgPanel.getGES().getRandomNode();
                if (r != n && tgPanel.findEdge(r, n) == null) {
                    tgPanel.addEdge(r, n, Edge.DEFAULT_LENGTH);
                }
            }
        }
    };
    tgPanel.getGES().forAllNodes(fen);

    tgPanel.setLocale(n1, 1);
    tgPanel.setSelect(n1);
    try {
        Thread.sleep(2000);
    } catch (InterruptedException ex) {
        //
    }

    getHVScroll().slowScrollToCenter(n1);
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:37,代码来源:GLPanel.java

示例10: addEdge

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * @see com.touchgraph.graphlayout.graphelements.GraphEltSet#addEdge(com.touchgraph.graphlayout.Edge)
 */
public void addEdge(Edge edge) {
    if (!contains(edge)) {
        super.addEdge(edge);
        Node from = edge.getFrom();
        edge.setFrom(from);
        from.visibleEdgeCnt++;

        Node to = edge.getTo();
        to.visibleEdgeCnt++;
        edge.setTo(to);
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:16,代码来源:VisibleLocality.java

示例11: removeEdge

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * @see com.touchgraph.graphlayout.graphelements.Locality#removeEdge(com.touchgraph.graphlayout.Edge)
 */
public boolean removeEdge(Edge edge) {
    boolean removed = super.removeEdge(edge);
    if (removed) {
        edge.setVisible(false);
        Node from = edge.getFrom();
        from.visibleEdgeCnt--;
        edge.setFrom(from);

        Node to = edge.getTo();
        to.visibleEdgeCnt--;
        edge.setTo(to);
    }
    return removed;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:18,代码来源:VisibleLocality.java

示例12: updateLocalityFromVisibility

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * Update locality from visibility.
 * 
 * @throws TGException
 *             the a TG Exception
 */
public void updateLocalityFromVisibility() throws TGException {
    // for (int i = 0 ; i < completeEltSet.nodeCount(); i++) {
    // Node n = nodeAt(i);
    TGForEachNode fen = new TGForEachNode() {

        public void forEachNode(Node node) {
            try {
                if (node.isVisible() && !contains(node)) {
                    addNode(node);
                } else if (!node.isVisible() && contains(node)) {
                    removeNode(node);
                }
            } catch (TGException ex) {
                logger.error("forEachNode(Node)", ex);
            }
        }
    };
    completeEltSet.forAllNodes(fen);

    // for (int i = 0 ; i < edgeCount(); i++) {
    // Edge e = edgeAt(i);
    TGForEachEdge fee = new TGForEachEdge() {

        public void forEachEdge(Edge edge) {
            if (edge.isVisible() && !contains(edge)) {
                addEdge(edge);
            } else if (!edge.isVisible() && contains(edge)) {
                removeEdge(edge);
            }
        }
    };
    completeEltSet.forAllEdges(fee);
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:40,代码来源:VisibleLocality.java

示例13: addEdge

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * @see com.touchgraph.graphlayout.graphelements.GraphEltSet#addEdge(com.touchgraph.graphlayout.Edge)
 */
public void addEdge(Edge e) {
    if (!contains(e)) {
        edges.addElement(e);
        // If a new Edge is created, and then added to Locality, then add
        // the new edge
        // to completeEltSet as well.
        if (!completeEltSet.contains(e)) {
            completeEltSet.addEdge(e);
        }
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:15,代码来源:Locality.java

示例14: addNodeWithEdges

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * Add a node with edges.
 * 
 * @param n
 *            the node to add.
 * @throws TGException
 *             a TG exception.
 */
public synchronized void addNodeWithEdges(Node n) throws TGException {
    addNode(n);
    for (int i = 0; i < n.edgeCount(); i++) {
        Edge e = n.edgeAt(i);
        if (contains(e.getOtherEndpt(n))) {
            addEdge(e);
        }
    }

}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:19,代码来源:Locality.java

示例15: findEdge

import com.touchgraph.graphlayout.Edge; //导入依赖的package包/类
/**
 * @see com.touchgraph.graphlayout.graphelements.ImmutableGraphEltSet#findEdge(com.touchgraph.graphlayout.Node,
 *      com.touchgraph.graphlayout.Node)
 */
public Edge findEdge(Node from, Node to) {
    Edge foundEdge = super.findEdge(from, to);
    if (foundEdge != null && edges.contains(foundEdge)) {
        return foundEdge;
    }
    return null;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:12,代码来源:Locality.java


注:本文中的com.touchgraph.graphlayout.Edge类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。