• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DAGLayout类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: factory

import edu.uci.ics.jung.algorithms.layout.DAGLayout; //导入依赖的package包/类
public static <V, E> GraphVisualizationPanel<V, E> factory(Graph<V, E> graph) {
    Layout<V, E> layout = null;
    if (graph instanceof DelegateForest) { 
        layout = new TreeLayout<V, E>((Forest<V, E>) graph);
    } else if (graph instanceof MarkovGraph){
        layout = new FRLayout<V,E>(graph);
    } else if (graph instanceof ConflictGraph){
        layout = new KKLayout<V, E>(graph);
    } else if (graph instanceof AbstractDirectedGraph) {
        layout = new DAGLayout<V, E>(graph);
    } else {
        layout = new CircleLayout<V, E>(graph);
    }
    return (new GraphVisualizationPanel<V, E>(layout, graph));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:16,代码来源:GraphVisualizationPanel.java


示例2: setupGraph

import edu.uci.ics.jung.algorithms.layout.DAGLayout; //导入依赖的package包/类
public static void setupGraph(DirectedSparseGraph g){
	
	bg = g;
	
	Layout<BooleanNode, TravelEdge> layout = new DAGLayout(bg);
       layout.setSize(new Dimension(300,300)); // sets the initial size of the layout space

       VisualizationViewer<BooleanNode,TravelEdge> vv = new VisualizationViewer<BooleanNode,TravelEdge>(layout);
       vv.setPreferredSize(new Dimension(500,500)); //Sets the viewing area size

       Transformer<BooleanNode,Paint> vertexPaint = new Transformer<BooleanNode,Paint>() {
       	public Paint transform(BooleanNode i) {
       		if (i.isCurrentNode()){
       			return Color.RED;
       		} else if (i.getObserved()){
       			return Color.BLUE;
       		} else if (i.isStartNode()) {
       			return Color.GREEN;
       		} else if (i.isEndNode()){
       			return Color.BLACK;
       		} else {
       			return Color.WHITE;
       		}
       	}
       	}; 
       	
       vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
       vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
	
       PluggableGraphMouse gm = new PluggableGraphMouse();
       gm.add(new NetworkGameMousePlugin());
       
       vv.setGraphMouse(gm); 
       
       frame = new JFrame("Simple Graph View");
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       frame.getContentPane().add(vv); 
       
       JMenuBar menuBar = new JMenuBar();
       
       JMenu restartMenu = new JMenu();
       restartMenu.setText("Restart");
       menuBar.add(restartMenu);
       JMenuItem restartItem = new JMenuItem("Restart level");
       
       restartItem.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent evt) {
               restartLevel();
           }
       });
       
       restartMenu.add(restartItem);
       
       
       
       frame.setJMenuBar(menuBar);
       
       
       frame.pack();
       frame.setVisible(true);  

       
       
}
 
开发者ID:ksotala,项目名称:BayesGame,代码行数:65,代码来源:SeparationGame.java


示例3: displayBayesGraph

import edu.uci.ics.jung.algorithms.layout.DAGLayout; //导入依赖的package包/类
private void displayBayesGraph(){
	Layout<BayesNode, Pair<Integer,Integer>> layout = new DAGLayout<BayesNode, Pair<Integer, Integer>>(graph);
       layout.setSize(new Dimension(700,700));
       
       vv = new VisualizationViewer<BayesNode, Pair<Integer,Integer>>(layout);
       
       
       Transformer<BayesNode,Paint> vertexPaint = new Transformer<BayesNode,Paint>() {
       	public Paint transform(BayesNode i) {
       		Boolean assumed = i.assumedValue();
       		if (i.isObserved()){
       			if (i.getProbability().doubleValue() == 1.0d){
       				return BayesGame.trueColor;
       			} else {
       				return BayesGame.falseColor;
       			}
       		}
       		
       		if (assumed == null){
       			return BayesGame.unknownColor;
       		} else {
       			if (assumed){
       				return BayesGame.trueColor;
       			} else {
       				return BayesGame.falseColor;
       			}
       		}
       	}
       	}; 
       	
       Transformer<BayesNode,Shape> vertexShape = new Transformer<BayesNode,Shape>(){
       	public Shape transform(BayesNode b){
       		if (!b.isObserved()){
       			return new Ellipse2D.Double(-16, -16, 32, 32);
       		} else {
       			return new RoundRectangle2D.Double(-16, -16, 32, 32, 16, 16);
       		}
       	}
       };
       	
       vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
       vv.getRenderContext().setVertexShapeTransformer(vertexShape);
       
       
       // vv.getRenderContext().setVertexIconTransformer(new BayesNodeProbabilityToGridTransformer());
       
       vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); 

       vv.setPreferredSize(new Dimension(800,800)); //Sets the viewing area size
       
       vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).rotate(-Math.PI, 350, 350);
       
       graphPanel.add(vv);
       frame.pack();
       graphPanel.setVisible(true);
}
 
开发者ID:ksotala,项目名称:BayesGame,代码行数:57,代码来源:TutorialInterfaceView.java


示例4: displayBayesGraph

import edu.uci.ics.jung.algorithms.layout.DAGLayout; //导入依赖的package包/类
public void displayBayesGraph(BayesNet bayesNet){
	DirectedSparseGraph<BayesNode, Pair<Integer,Integer>> graph = bayesNet.getGraph();
	
	Layout<BayesNode, Pair<Integer,Integer>> layout = new DAGLayout<BayesNode, Pair<Integer, Integer>>(graph);
	layout.setSize(BayesGame.getVVLayoutSize());

       vv = new VisualizationViewer<BayesNode, Pair<Integer,Integer>>(layout);
       
       Transformer<BayesNode,Paint> vertexPaint = new Transformer<BayesNode,Paint>() {
       	public Paint transform(BayesNode i) {
       		Boolean assumed = i.assumedValue();
       		if (i.isObserved()){
       			if (i.getProbability().doubleValue() == 1.0d){
       				return BayesGame.trueColor;
       			} else {
       				return BayesGame.falseColor;
       			}
       		}
       		
       		if (assumed == null){
       			return BayesGame.unknownColor;
       		} else {
       			if (assumed){
       				return BayesGame.trueColor;
       			} else {
       				return BayesGame.falseColor;
       			}
       		}
       	}
       	}; 
       	
       Transformer<BayesNode,Shape> vertexShape = new Transformer<BayesNode,Shape>(){
       	public Shape transform(BayesNode b){
       		if (!b.isObserved()){
       			return new Ellipse2D.Double(-16, -16, 32, 32);
       		} else {
       			return new RoundRectangle2D.Double(-16, -16, 32, 32, 16, 16);
       		}
       	}
       };
       	
       vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
       vv.getRenderContext().setVertexShapeTransformer(vertexShape);
       
       
       vv.getRenderContext().setVertexIconTransformer(new BayesNodeProbabilityToGridTransformer(bayesNet));
       
       vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); 

       vv.setPreferredSize(new Dimension(BayesGame.getNewHeight(750),BayesGame.getNewWidth(750))); //Sets the viewing area size
       
       vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).rotate(-Math.PI, BayesGame.getNewHeight(350),BayesGame.getNewWidth(350));
       
       this.add(vv);
       this.setVisible(true);
}
 
开发者ID:ksotala,项目名称:BayesGame,代码行数:57,代码来源:GraphPanel.java


示例5: visualize

import edu.uci.ics.jung.algorithms.layout.DAGLayout; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void visualize(JungNetwork graph, String title, int type)
{
	// The Layout<V, E> is parameterized by the vertex and edge types 
	Layout<JungVertex, JungEdge> layout	= null;
	
	switch (type)
	{
		case CIRCLE:
			layout = new CircleLayout<JungVertex, JungEdge>(graph); 
			break;
			
		case SPRING:
			layout = new SpringLayout<JungVertex, JungEdge>(graph); 
			break;
			
		case FR:
			layout = new FRLayout<JungVertex, JungEdge>(graph); 
			break;
			
		case ISOM:
			layout = new ISOMLayout<JungVertex, JungEdge>(graph); 
			break;
			
		case DAG:
			layout = new DAGLayout<JungVertex, JungEdge>(graph);
			break;

		case SPRING2:
			layout = new SpringLayout2<JungVertex, JungEdge>(graph);
			break;
			
		default:
			layout = new KKLayout<JungVertex, JungEdge>(graph); 
	}
	
	layout.setSize(new Dimension(800,800)); // sets the initial size of the space 
	
	// The BasicVisualizationServer<V,E> is parameterized by the edge types 
	BasicVisualizationServer<JungVertex,JungEdge> vv = 
		new BasicVisualizationServer<JungVertex,JungEdge>(layout);
	
	vv.setPreferredSize(new Dimension(900,900)); //Sets the viewing area size  
	vv.scaleToLayout(new LayoutScalingControl() );
       vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); 
       vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());        
       vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR); 
       
	JFrame frame = new JFrame(title); 
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
	frame.getContentPane().add(vv); 
	frame.pack(); 
	frame.setVisible(true); 
}
 
开发者ID:Rees-Brad,项目名称:FastEgoClustering,代码行数:55,代码来源:Visualize.java


示例6: actionPerformed

import edu.uci.ics.jung.algorithms.layout.DAGLayout; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {


    final GraphViewerPanel viewerPanel = (GraphViewerPanel) frame.getTabbedPane().getSelectedComponent();

    DAGLayout dagLayout = new DAGLayout(viewerPanel.getCurrentGraph());


    MyVisualizationViewer vv = (MyVisualizationViewer) viewerPanel.getVisualizationViewer();

    vv.setGraphLayout(dagLayout);
    vv.repaint();

}
 
开发者ID:iTransformers,项目名称:netTransformer,代码行数:16,代码来源:DAGLayoutMenuHandler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PolicyModelTranslator类代码示例发布时间:2022-05-23
下一篇:
Java TObjectCharIterator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap