当前位置: 首页>>代码示例>>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;未经允许,请勿转载。