當前位置: 首頁>>代碼示例>>Java>>正文


Java VisualizationViewer.removePostRenderPaintable方法代碼示例

本文整理匯總了Java中edu.uci.ics.jung.visualization.VisualizationViewer.removePostRenderPaintable方法的典型用法代碼示例。如果您正苦於以下問題:Java VisualizationViewer.removePostRenderPaintable方法的具體用法?Java VisualizationViewer.removePostRenderPaintable怎麽用?Java VisualizationViewer.removePostRenderPaintable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.uci.ics.jung.visualization.VisualizationViewer的用法示例。


在下文中一共展示了VisualizationViewer.removePostRenderPaintable方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mouseReleased

import edu.uci.ics.jung.visualization.VisualizationViewer; //導入方法依賴的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

示例2: mouseReleased

import edu.uci.ics.jung.visualization.VisualizationViewer; //導入方法依賴的package包/類
@Override
public void mouseReleased(MouseEvent e) 
{
	if (startVertex != null) 
    {
        final VisualizationViewer<GUINode, GUILink> vv = (VisualizationViewer<GUINode, GUILink>) e.getSource();
        vv.removePostRenderPaintable(edgePaintable);
        vv.removePostRenderPaintable(arrowPaintable);

        final GUINode guiNode = canvas.getVertex(e);
        final Node node = guiNode == null? null : guiNode.getAssociatedNode();
        if (node != null && startVertex.getAssociatedNode() != node)
        {
        	if (guiNode.getLayer() == startVertex.getLayer ())
			{
    			boolean bidirectional = (e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) == MouseEvent.SHIFT_DOWN_MASK;
                if (bidirectional) node.getNetPlan().addLinkBidirectional(startVertex.getAssociatedNode(), node,0,0,200000,null);
                else node.getNetPlan().addLink(startVertex.getAssociatedNode(), node,0,0,200000,null);
                callback.getVisualizationState().recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals(); // implies a reset picked
                callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.LINK));
                callback.addNetPlanChange();
			}
            //if (node == startVertex.getAssociatedNode()) callback.resetPickedStateAndUpdateView();
        }

        startVertex = null;
        down = null;
        //callback.resetPickedStateAndUpdateView();
        vv.repaint();
    }
}
 
開發者ID:girtel,項目名稱:Net2Plan,代碼行數:32,代碼來源:AddLinkGraphPlugin.java

示例3: mouseReleased

import edu.uci.ics.jung.visualization.VisualizationViewer; //導入方法依賴的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<String,String> vv = (VisualizationViewer<String,String>)e.getSource();
        final Point2D p = e.getPoint();
        Layout<String,String> layout = vv.getModel().getGraphLayout();
        GraphElementAccessor<String,String> pickSupport = vv.getPickSupport();
        if(pickSupport != null) {
            final String vertex = pickSupport.getVertex(layout, p.getX(), p.getY());
            if(vertex != null && startVertex != null) {
                Graph<String,String> graph = vv.getGraphLayout().getGraph();
                try{
                	if(graph.addEdge(startVertex+"-"+vertex, startVertex, vertex, EdgeType.DIRECTED)){
                		notifyListeners(startVertex, vertex);
                	}
                } catch(Exception ex){
                	ex.printStackTrace();
                }
            }
            vv.repaint();
        }
        startVertex = null;
        down = null;
        vv.removePostRenderPaintable(edgePaintable);
        vv.removePostRenderPaintable(arrowPaintable);
    }
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:34,代碼來源:RoleGraphEditingPlugin.java

示例4: mouseReleased

import edu.uci.ics.jung.visualization.VisualizationViewer; //導入方法依賴的package包/類
public void mouseReleased( MouseEvent e ) {
        if (checkModifiers( e )) {
            @SuppressWarnings("unchecked")            final VisualizationViewer<Room, Exit> vv =
                    (VisualizationViewer<Room, Exit>) e.getSource();
            final Point2D p = e.getPoint();
            Layout<Room, Exit> layout = vv.getModel().getGraphLayout();
            GraphElementAccessor<Room, Exit> pickSupport = vv.getPickSupport();
            if (pickSupport != null) {
                final Room room = pickSupport.getVertex( layout, p.getX(), p.getY() );
                if (room != null && startVertex != null) {
//                    Graph<Room,Exit> graph = vv.getGraphLayout().getGraph();
                    String proposition = getExitDir( layout.transform( startVertex ), layout.transform( room ) );

                    String exitDir = (String) JOptionPane.showInputDialog(
                            null,
                            "What direction for the exit?",
                            "Customized Dialog",
                            JOptionPane.PLAIN_MESSAGE,
                            null,
                            null,
                            proposition );
                    if (exitDir != null) {
                        if (GraphUtils.canAddExit( this.engine.getGraph().getOutEdges( startVertex ), exitDir )) {
                            startVertex.addExit( exitDir );
//                    		Exit exit = new Exit(exitDir);
                            this.engine.getGraph().addEdge( new Exit( exitDir ), startVertex, room, edgeIsDirected );
                            vv.getRenderer().renderVertex( vv.getRenderContext(), vv.getGraphLayout(), startVertex );
                        }


                    }

                    vv.repaint();
                }
            }
            startVertex = null;
            down = null;
            edgeIsDirected = EdgeType.UNDIRECTED;
            vv.removePostRenderPaintable( edgePaintable );
            vv.removePostRenderPaintable( arrowPaintable );
        }
    }
 
開發者ID:lauriholmas,項目名稱:batmapper,代碼行數:43,代碼來源:MapperEditingGraphMousePlugin.java


注:本文中的edu.uci.ics.jung.visualization.VisualizationViewer.removePostRenderPaintable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。