本文整理汇总了Java中edu.uci.ics.jung.algorithms.layout.GraphElementAccessor类的典型用法代码示例。如果您正苦于以下问题:Java GraphElementAccessor类的具体用法?Java GraphElementAccessor怎么用?Java GraphElementAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphElementAccessor类属于edu.uci.ics.jung.algorithms.layout包,在下文中一共展示了GraphElementAccessor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handlePopup
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* Implementation of the AbstractPopupGraphMousePlugin method. This is where the
* work gets done. You shouldn't have to modify unless you really want to...
* @param me the MousEvent
*/
protected void handlePopup(MouseEvent me) {
Point2D p = me.getPoint();
VisualizationViewer<GraphNode,GraphEdge> visView = this.basicGraphGui.getVisualizationViewer();
GraphElementAccessor<GraphNode,GraphEdge> pickSupport = visView.getPickSupport();
if(pickSupport != null) {
GraphNode vertex = (GraphNode) pickSupport.getVertex(visView.getGraphLayout(), p.getX(), p.getY());
if(vertex != null) {
//System.out.println("Vertex " + v + " was right clicked");
this.updateVertexMenu(vertex);
vertexPopup.show(visView, me.getX(), me.getY());
basicGraphGui.handleObjectRightClick(vertex);
} else {
GraphEdge edge = (GraphEdge) pickSupport.getEdge(visView.getGraphLayout(), p.getX(), p.getY());
if(edge != null) {
//System.out.println("Edge " + edge + " was right clicked");
this.updateEdgeMenu(edge);
edgePopup.show(visView, me.getX(), me.getY());
basicGraphGui.handleObjectRightClick(edge);
}
}
}
}
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:31,代码来源:GraphEnvironmentPopupPlugin.java
示例2: pickContainedVertices
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* pick the vertices inside the rectangle created from points
* 'down' and 'out'
*/
protected void pickContainedVertices( VisualizationViewer<Room, Exit> vv, Point2D down, Point2D out, boolean clear ) {
Layout<Room, Exit> layout = vv.getGraphLayout();
PickedState<Room> pickedVertexState = vv.getPickedVertexState();
Rectangle2D pickRectangle = new Rectangle2D.Double();
pickRectangle.setFrameFromDiagonal( down, out );
if (pickedVertexState != null) {
if (clear) {
pickedVertexState.clear();
}
GraphElementAccessor<Room, Exit> pickSupport = vv.getPickSupport();
Collection<Room> picked = pickSupport.getVertices( layout, pickRectangle );
for (Room v : picked) {
pickedVertexState.pick( v, true );
}
}
}
开发者ID:lauriholmas,项目名称:batmapper,代码行数:25,代码来源:MapperPickingGraphMousePlugin.java
示例3: handlePopup
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void handlePopup(MouseEvent e) {
final VisualizationViewer<V,E> vv =
(VisualizationViewer<V,E>)e.getSource();
Point2D p = e.getPoint();
GraphElementAccessor<V,E> pickSupport = vv.getPickSupport();
if(pickSupport != null) {
final V v = pickSupport.getVertex(vv.getGraphLayout(), p.getX(), p.getY());
if(v != null) {
updateVertexMenu(v, networkPanel, p);
vertexPopup.show(vv, e.getX(), e.getY());
} else {
final E edge = pickSupport.getEdge(vv.getGraphLayout(), p.getX(), p.getY());
if(edge != null) {
updateEdgeMenu(edge, networkPanel, p);
edgePopup.show(vv, e.getX(), e.getY());
}
}
}
}
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:22,代码来源:PopupMousePlugin.java
示例4: getClickedElement
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
private GraphElement getClickedElement( VisualizationViewer<SEMOSSVertex, SEMOSSEdge> viewer,
double x, double y ) {
GraphElementAccessor<SEMOSSVertex, SEMOSSEdge> pickSupport
= viewer.getPickSupport();
SEMOSSVertex vert = pickSupport.getVertex( viewer.getGraphLayout(), x, y );
if ( null != vert ) {
return vert;
}
SEMOSSEdge edge = pickSupport.getEdge( viewer.getGraphLayout(), x, y );
if ( null != edge ) {
return edge;
}
return null;
}
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:18,代码来源:GraphNodeListener.java
示例5: mousePressed
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* If the mouse is pressed in an empty area, create a new vertex there.
* If the mouse is pressed on an existing vertex, prepare to create
* an edge from that vertex to another
*/
@SuppressWarnings("unchecked")
public void mousePressed(MouseEvent e) {
if(checkModifiers(e)) {
final VisualizationViewer<String,String> vv =
(VisualizationViewer<String,String>)e.getSource();
final Point2D p = e.getPoint();
GraphElementAccessor<String,String> pickSupport = vv.getPickSupport();
if(pickSupport != null) {
final String vertex = pickSupport.getVertex(vv.getModel().getGraphLayout(), p.getX(), p.getY());
if(vertex != null) { // get ready to make an edge
startVertex = vertex;
down = e.getPoint();
transformEdgeShape(down, down);
vv.addPostRenderPaintable(edgePaintable);
transformArrowShape(down, e.getPoint());
vv.addPostRenderPaintable(arrowPaintable);
}
}
vv.repaint();
}
}
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:28,代码来源:RoleGraphEditingPlugin.java
示例6: mouseClicked
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void mouseClicked(MouseEvent paramMouseEvent) {
if (paramMouseEvent.getClickCount() == 2) {
VisualizationViewer localVisualizationViewer = (VisualizationViewer) paramMouseEvent.getSource();
Point localPoint = paramMouseEvent.getPoint();
GraphElementAccessor localGraphElementAccessor = localVisualizationViewer.getPickSupport();
if (localGraphElementAccessor != null) {
AbstractEntity localAbstractEntity = (AbstractEntity) localGraphElementAccessor.getVertex(localVisualizationViewer.getGraphLayout(), localPoint.getX(), localPoint.getY());
if (localAbstractEntity != null) {
this.parent.refresh(localAbstractEntity);
}
}
}
super.mouseClicked(paramMouseEvent);
}
开发者ID:markkohdev,项目名称:oStorybook,代码行数:17,代码来源:MemoriaGraphMouse.java
示例7: handlePopup
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* If this event is over a node, pop up a menu to
* allow the user to center view to the node
*
* @param e
*/
protected void handlePopup(MouseEvent e)
{
final VisualizationViewer<Node,String> vv = (VisualizationViewer<Node,String>)e.getSource();
final Point p = e.getPoint();
GraphElementAccessor<Node,String> pickSupport = vv.getPickSupport();
if(pickSupport != null)
{
final Node station = pickSupport.getVertex(vv.getGraphLayout(), p.getX(), p.getY());
if (station != null)
{
currentGraphLayout = GraphLayouts.KK;
visualizeNode(station, currentGraphLayout);
}
else
{
currentGraphLayout = currentGraphLayout.next();
visualizeNode(currentVisualNode, currentGraphLayout);
}
}
}
开发者ID:darrudi,项目名称:HPR,代码行数:30,代码来源:KnowledgeExplorer.java
示例8: handlePopup
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* Implementation of the AbstractPopupGraphMousePlugin method. This is where the
* work gets done. You shouldn't have to modify unless you really want to...
* @param e
*/
protected void handlePopup(MouseEvent e) {
final VisualizationViewer<V,E> vv =
(VisualizationViewer<V,E>)e.getSource();
Point2D p = e.getPoint();
GraphElementAccessor<V,E> pickSupport = vv.getPickSupport();
if(pickSupport != null) {
final V v = pickSupport.getVertex(vv.getGraphLayout(), p.getX(), p.getY());
if(v != null) {
// System.out.println("Vertex " + v + " was right clicked");
updateVertexMenu(v, vv, p);
vertexPopup.show(vv, e.getX(), e.getY());
} else {
final E edge = pickSupport.getEdge(vv.getGraphLayout(), p.getX(), p.getY());
if(edge != null) {
// System.out.println("Edge " + edge + " was right clicked");
updateEdgeMenu(edge, vv, p);
edgePopup.show(vv, e.getX(), e.getY());
}
}
}
}
开发者ID:ksotala,项目名称:BayesGame,代码行数:29,代码来源:PopupVertexEdgeMenuMousePlugin.java
示例9: mousePressed
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* If the event occurs on a Vertex, pick that single Vertex
* @param e the event
*/
@SuppressWarnings("unchecked")
public void mousePressed(MouseEvent e) {
if (e.getModifiers() == modifiers) {
VisualizationViewer<V,E> vv = (VisualizationViewer) e.getSource();
GraphElementAccessor<V, E> pickSupport = vv.getPickSupport();
PickedState<V> pickedVertexState = vv.getPickedVertexState();
Layout<V,E> layout = vv.getGraphLayout();
if (pickSupport != null && pickedVertexState != null) {
// p is the screen point for the mouse event
Point2D p = e.getPoint();
vertex = pickSupport.getVertex(layout, p.getX(), p.getY());
if (vertex != null) {
if (pickedVertexState.isPicked(vertex) == false) {
pickedVertexState.clear();
pickedVertexState.pick(vertex, true);
}
}
}
e.consume();
}
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:26,代码来源:AnimatedPickingGraphMousePlugin.java
示例10: mouseReleased
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* If startVertex is non-null, and the mouse is released over an
* existing vertex, create an undirected edge from startVertex to
* the vertex under the mouse pointer. If shift was also pressed,
* create a directed edge instead.
*/
@SuppressWarnings("unchecked")
public void mouseReleased(MouseEvent e) {
if(checkModifiers(e)) {
final VisualizationViewer<V,E> vv =
(VisualizationViewer<V,E>)e.getSource();
final Point2D p = e.getPoint();
Layout<V,E> layout = vv.getModel().getGraphLayout();
GraphElementAccessor<V,E> pickSupport = vv.getPickSupport();
if(pickSupport != null) {
final V vertex = pickSupport.getVertex(layout, p.getX(), p.getY());
if(vertex != null && startVertex != null) {
Graph<V,E> graph =
vv.getGraphLayout().getGraph();
graph.addEdge(edgeFactory.create(),
startVertex, vertex, edgeIsDirected);
vv.repaint();
}
}
startVertex = null;
down = null;
edgeIsDirected = EdgeType.UNDIRECTED;
vv.removePostRenderPaintable(edgePaintable);
vv.removePostRenderPaintable(arrowPaintable);
}
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:32,代码来源:EditingGraphMousePlugin.java
示例11: pickContainedVertices
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* pick the vertices inside the rectangle created from points
* 'down' and 'out'
*
*/
protected void pickContainedVertices(VisualizationViewer<V,E> vv, Point2D down, Point2D out, boolean clear) {
Layout<V,E> layout = vv.getGraphLayout();
PickedState<V> pickedVertexState = vv.getPickedVertexState();
Rectangle2D pickRectangle = new Rectangle2D.Double();
pickRectangle.setFrameFromDiagonal(down,out);
if(pickedVertexState != null) {
if(clear) {
pickedVertexState.clear();
}
GraphElementAccessor<V,E> pickSupport = vv.getPickSupport();
Collection<V> picked = pickSupport.getVertices(layout, pickRectangle);
for(V v : picked) {
pickedVertexState.pick(v, true);
}
}
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:26,代码来源:PickingGraphMousePlugin.java
示例12: pickContainedVertices
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
protected void pickContainedVertices(VisualizationViewer<VisualNode, VisualEdge> vv,Point2D down, Point2D out, boolean clear) {
Layout<VisualNode, VisualEdge> layout = vv.getGraphLayout();
PickedState<VisualNode> pickedVertexState = vv.getPickedVertexState();
Rectangle2D pickRectangle = new Rectangle2D.Double();
pickRectangle.setFrameFromDiagonal(down,out);
if(pickedVertexState != null) {
if(clear) {
pickedVertexState.clear();
}
GraphElementAccessor<VisualNode,VisualEdge> pickSupport = vv.getPickSupport();
Collection<VisualNode> picked = pickSupport.getVertices(layout, pickRectangle);
for(VisualNode v : picked) {
if (v.getVisible())
{
pickedVertexState.pick(v, true);
}
}
}
}
开发者ID:pmanousis,项目名称:Hecataeus,代码行数:23,代码来源:HecataeusPickingGraphMousePlugin.java
示例13: mouseReleased
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
public void mouseReleased(MouseEvent e) {
if(checkModifiers(e)) {
final VisualizationViewer<Node,Edge> vv =
(VisualizationViewer<Node,Edge>)e.getSource();
final Point2D p = e.getPoint();
Layout<Node, Edge> layout = vv.getModel().getGraphLayout();
GraphElementAccessor<Node,Edge> pickSupport = vv.getPickSupport();
if(pickSupport != null) {
final Node vertex = pickSupport.getVertex(layout, p.getX(), p.getY());
if(vertex != null && startVertex != null) {
JungGraph graph =
(JungGraph) vv.getGraphLayout().getGraph();
Edge newEdge = new SimpleEdge(startVertex, vertex, "edge");
graph.addEdgeWithHistory(newEdge);
vv.repaint();
}
}
startVertex = null;
down = null;
edgeIsDirected = EdgeType.UNDIRECTED;
vv.removePostRenderPaintable(edgePaintable);
vv.removePostRenderPaintable(arrowPaintable);
}
}
开发者ID:andreiolaru-ro,项目名称:AmIciTy-Grph,代码行数:25,代码来源:EditingPlugin.java
示例14: mouseReleased
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* If startVertex is non-null, and the mouse is released over an existing
* vertex, create an undirected edge from startVertex to the vertex under
* the mouse pointer. If shift was also pressed, create a directed edge
* instead.
*/
@SuppressWarnings("unchecked")
public void mouseReleased(MouseEvent e) {
if (checkModifiers(e)) {
final VisualizationViewer<NubiSaveVertex, NubiSaveEdge> vv = (VisualizationViewer<NubiSaveVertex, NubiSaveEdge>) e.getSource();
final Point2D p = e.getPoint();
Layout<NubiSaveVertex, NubiSaveEdge> layout = vv.getModel().getGraphLayout();
GraphElementAccessor<NubiSaveVertex, NubiSaveEdge> pickSupport = vv.getPickSupport();
if (pickSupport != null) {
NubiSaveVertex vertex = pickSupport.getVertex(layout, p.getX(),
p.getY());
if (vertex != null && startVertex != null) {
for(NubisaveGraphEventListener l: eventListeners){
l.processCreateNubisaveEdge(startVertex, vertex, e);
}
}
}
vv.repaint();
startVertex = null;
down = null;
edgeIsDirected = EdgeType.UNDIRECTED;
vv.removePostRenderPaintable(edgePaintable);
vv.removePostRenderPaintable(arrowPaintable);
}
}
开发者ID:joe42,项目名称:nubisave,代码行数:31,代码来源:ExtensibleNubisaveComponentMousePlugin.java
示例15: handlePopup
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* Reduced functionality of super class method and extended by own
* content-aware editing.
*/
@SuppressWarnings("unchecked")
@Override
protected final void handlePopup(final MouseEvent e) {
if (checkModifiers(e)) {
final LV vv = (LV) e.getSource();
final Layout<V, E> layout = vv.getGraphLayout();
final L graph = (L) layout.getGraph();
final Point p = e.getPoint();
final List<V> sel_vertices = getSelectedVertices();
final List<E> sel_edges = getSelectedEdges();
GraphElementAccessor<V, E> pickSupport = vv.getPickSupport();
if (pickSupport != null) {
V vertex = pickSupport.getVertex(layout, p.getX(), p.getY());
E edge = pickSupport.getEdge(layout, p.getX(), p.getY());
if (vertex != null && !sel_vertices.contains(vertex))
sel_vertices.add(vertex);
if (edge != null && !sel_edges.contains(edge))
sel_edges.add(edge);
}
popup.removeAll();
if (sel_vertices.size() > 0)
createVertexMenuEntries(p, graph, vv, sel_vertices);
else if (sel_edges.size() > 0)
createEdgeMenuEntries(p, graph, vv, sel_edges);
else
createGeneralMenuEntries(p, graph, vv);
if (popup.getComponentCount() > 0)
popup.show(vv, e.getX(), e.getY());
}
}
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:40,代码来源:AbstractPopupMousePlugin.java
示例16: mousePressedOrClicked
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* Acts on the mouse pressed and mouse clicked action.
* @param me the {@link MouseEvent}
*/
private void mousePressedOrClicked(MouseEvent me) {
// --- Left click ---------------------------------
if(SwingUtilities.isLeftMouseButton(me) || SwingUtilities.isRightMouseButton(me)){
// --- Check if an object was selected --------
Object pickedObject = null;
Point point = me.getPoint();
GraphElementAccessor<GraphNode, GraphEdge> ps = this.getVisViewer().getPickSupport();
GraphNode pickedNode = ps.getVertex(this.getVisViewer().getGraphLayout(), point.getX(), point.getY());
if(pickedNode != null) {
pickedObject = pickedNode;
} else {
GraphEdge pickedEdge = ps.getEdge(this.getVisViewer().getGraphLayout(), point.getX(), point.getY());
if(pickedEdge != null) {
pickedObject = pickedEdge;
}
}
// --- Only when node or edge is clicked -----------
if(pickedObject != null) {
if (me.getClickCount()==2){
// --- Double click ---------
this.basicGraphGUI.handleObjectDoubleClick(pickedObject);
} else {
if(me.isShiftDown()==false) {
// --- Left click -----------
this.basicGraphGUI.handleObjectLeftClick(pickedObject);
}
}
}
}
}
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:39,代码来源:GraphEnvironmentMousePlugin.java
示例17: mousePressed
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
@Override
public void mousePressed(MouseEvent me) {
if (this.isPasteAction==true) {
if (SwingUtilities.isLeftMouseButton(me)) {
// --- Finalise paste action --------------
this.setPasteAction(false, true);
} else if (SwingUtilities.isRightMouseButton(me)) {
// --- Cancel paste action ----------------
this.setPasteAction(false, false);
}
}
super.mousePressed(me);
Point position = me.getPoint();
GraphElementAccessor<GraphNode, GraphEdge> ps = this.getVisViewer().getPickSupport();
GraphNode pickedNode = ps.getVertex(this.getVisViewer().getGraphLayout(), position.getX(), position.getY());
GraphEdge pickedEdge = ps.getEdge(this.getVisViewer().getGraphLayout(), position.getX(), position.getY());
if (SwingUtilities.isRightMouseButton(me)) {
if(pickedNode==null && pickedEdge==null){
this.movePanelWithRightAction = true;
this.getVisViewer().setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
}
} else if (SwingUtilities.isLeftMouseButton(me)) {
if (pickedNode!=null) {
this.moveNodeWithLeftAction = true;
this.remindOldPositions();
} else {
this.mousePressedOrClicked(me);
}
}
}
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:37,代码来源:GraphEnvironmentMousePlugin.java
示例18: getValidLocation
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
public Point2D getValidLocation( Point2D checkThisLocation ) {
GraphElementAccessor<Room, Exit> pickSupport = new RadiusPickSupport<Room, Exit>( 60 );
Room room = pickSupport.getVertex( this, checkThisLocation.getX(), checkThisLocation.getY() );
if (room != null) {
checkThisLocation.setLocation( checkThisLocation.getX() - 20, checkThisLocation.getY() - 20 );
return getValidLocation( checkThisLocation );
}
return checkThisLocation;
}
开发者ID:lauriholmas,项目名称:batmapper,代码行数:10,代码来源:MapperLayout.java
示例19: mousePressed
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* If the mouse is pressed in an empty area, create a new vertex there.
* If the mouse is pressed on an existing vertex, prepare to create
* an edge from that vertex to another
*/
@SuppressWarnings("unchecked")
@Override
public void mousePressed(MouseEvent e) {
if (checkModifiers(e)) {
final VisualizationViewer<Vertex, Edge> vv = (VisualizationViewer<Vertex, Edge>) e.getSource();
final Point2D p = e.getPoint();
GraphElementAccessor<Vertex, Edge> pickSupport = vv.getPickSupport();
if (pickSupport != null) {
final Vertex vertex = pickSupport.getVertex(vv.getModel().getGraphLayout(), p.getX(), p.getY());
if (vertex != null) { // get ready to make an edge
creatingAnEdge = true;
Graph<Vertex, Edge> graph = vv.getModel().getGraphLayout().getGraph();
edgeType = (graph instanceof DirectedGraph) ? EdgeType.DIRECTED : EdgeType.UNDIRECTED;
if ((e.getModifiers() & MouseEvent.SHIFT_MASK) != 0 && graph instanceof UndirectedGraph == false) {
edgeType = EdgeType.DIRECTED;
}
super.mousePressed(e);
} else { // make a new vertex
creatingAnEdge = false;
Vertex newVertex = (Vertex) vertexFactory.create();
action = new CreateVertexUndoableAction(vv.getGraphLayout(), newVertex, vv.getRenderContext().getMultiLayerTransformer().inverseTransform(p));
action.execute();
UndoableControl.getController().actionExecuted(action);
}
}
}
}
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:38,代码来源:UndoableEditingGraphMousePlugin.java
示例20: mouseReleased
import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入依赖的package包/类
/**
* If startVertex is non-null, and the mouse is released over an
* existing vertex, create an undirected edge from startVertex to
* the vertex under the mouse pointer. If shift was also pressed,
* create a directed edge instead.
*/
@SuppressWarnings("unchecked")
@Override
public void mouseReleased(MouseEvent e) {
if (checkModifiers(e)) {
final VisualizationViewer<Vertex, Edge> vv = (VisualizationViewer<Vertex, Edge>) e.getSource();
final Point2D p = e.getPoint();
Layout<Vertex, Edge> layout = vv.getGraphLayout();
GraphElementAccessor<Vertex, Edge> pickSupport = vv.getPickSupport();
if (pickSupport != null) {
if (creatingAnEdge) {
if (startVertex != null) {
Vertex from = (Vertex) startVertex;
Vertex to = pickSupport.getVertex(layout, p.getX(), p.getY());
// Create the new edge
super.mouseReleased(e);
// Find the new edge and wrap it in an UndoableAction
Edge newEdge = layout.getGraph().findEdge(from, to);
action = new CreateEdgeUndoableAction(layout.getGraph(), newEdge, from, to, edgeType);
UndoableControl.getController().actionExecuted(action);
}
}
}
}
}
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:35,代码来源:UndoableEditingGraphMousePlugin.java
注:本文中的edu.uci.ics.jung.algorithms.layout.GraphElementAccessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论