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


Java GraphElementAccessor.getEdge方法代码示例

本文整理汇总了Java中edu.uci.ics.jung.algorithms.layout.GraphElementAccessor.getEdge方法的典型用法代码示例。如果您正苦于以下问题:Java GraphElementAccessor.getEdge方法的具体用法?Java GraphElementAccessor.getEdge怎么用?Java GraphElementAccessor.getEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.uci.ics.jung.algorithms.layout.GraphElementAccessor的用法示例。


在下文中一共展示了GraphElementAccessor.getEdge方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: handlePopup

import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入方法依赖的package包/类
@Override
protected void handlePopup( MouseEvent e ) {
	Point p = e.getPoint();

	GraphElementAccessor<QueryNode, QueryEdge> pickSupport = view.getPickSupport();
	if ( null != pickSupport ) {
		final QueryNode vertex
				= pickSupport.getVertex( view.getGraphLayout(), p.getX(), p.getY() );
		if ( null == vertex ) {
			final QueryEdge edge
					= pickSupport.getEdge( view.getGraphLayout(), p.getX(), p.getY() );
			if ( null == edge ) {
				new EmptySpacePopup( GraphicalQueryPanel.this ).show( view, p.x, p.y );
			}
			else {
				NodeEdgeBasePopup edgepop
						= NodeEdgeBasePopup.forEdge( edge, GraphicalQueryPanel.this );
				edgepop.show( view, p.x, p.y );
			}
		}
		else {
			NodeEdgeBasePopup vertpop
					= NodeEdgeBasePopup.forVertex( vertex, GraphicalQueryPanel.this );
			vertpop.show( view, p.x, p.y );
		}
	}
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:28,代码来源:GraphicalQueryPanel.java

示例9: getEdge

import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入方法依赖的package包/类
@Override
public GUILink getEdge(MouseEvent e)
{
    final VisualizationViewer<GUINode, GUILink> vv = (VisualizationViewer<GUINode, GUILink>) e.getSource();
    GraphElementAccessor<GUINode, GUILink> pickSupport = vv.getPickSupport();
    if (pickSupport != null)
    {
        final Point p = e.getPoint();
        return pickSupport.getEdge(vv.getModel().getGraphLayout(), p.getX(), p.getY());
    }

    return null;
}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:14,代码来源:JUNGCanvas.java

示例10: 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:liruixpc11,项目名称:crucian,代码行数:40,代码来源:AbstractPopupMousePlugin.java

示例11: handlePopup

import edu.uci.ics.jung.algorithms.layout.GraphElementAccessor; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected void handlePopup(MouseEvent e) {
	hpgmp = new HecataeusPopupGraphMousePlugin();
	vv = (VisualizationViewer<VisualNode,VisualEdge>)e.getSource();
	layout = vv.getGraphLayout();	
	pr = (PluggableRenderContext<VisualNode, VisualEdge>) vv.getRenderContext();
	graph = (VisualGraph) layout.getGraph();
	pointClicked = e.getPoint();
	viewer = HecataeusViewer.myViewer;
	GraphElementAccessor<VisualNode, VisualEdge> pickSupport = vv.getPickSupport();
	//if mouse clicked on a vertex or an edge
	if(pickSupport != null) {
		clickedVertex = pickSupport.getVertex(layout, pointClicked.getX(), pointClicked.getY());
		clickedEdge = pickSupport.getEdge(layout, pointClicked.getX(), pointClicked.getY());
		pickedNodeState = vv.getPickedVertexState();
		pickedEdgeState = vv.getPickedEdgeState();
		//if mouse click on vertex
		if(clickedVertex != null) {
			pickedNodeState.pick(clickedVertex, true);
			pickedNodes = pickedNodeState.getPicked();
			if (pickedNodes.size() == 1) {
				viewer.epilegmenosKombos = clickedVertex;
				menu.popZoom.addActionListener(zoomToNewModuleTab());
				menu.popSelect.addActionListener(selectNode());
			}
		}
	}
}
 
开发者ID:pmanousis,项目名称:Hecataeus,代码行数:29,代码来源:PopUpClickListener.java


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