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


Java FRLayout2类代码示例

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


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

示例1: getLayout

import edu.uci.ics.jung.algorithms.layout.FRLayout2; //导入依赖的package包/类
private static AbstractLayout<Vertex, Edge> getLayout(GraphJung<Graph> graph, String layoutName) {
  switch (layoutName) {
    case "KKLayout":
      return new KKLayout<>(graph);
    case "CircleLayout":
      return new CircleLayout<>(graph);
    case "FRLayout":
      return new FRLayout<>(graph);
    case "FRLayout2":
      return new FRLayout2<>(graph);
    case "ISOMLayout":
      return new ISOMLayout<>(graph);
    case "SpringLayout":
      return new SpringLayout<>(graph);
    default:
      return new KKLayout<>(graph);
  }
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:19,代码来源:ImageWriter.java

示例2: LayoutSelection

import edu.uci.ics.jung.algorithms.layout.FRLayout2; //导入依赖的package包/类
public LayoutSelection(GraphViewer<V, E> graphViewer, Graph<V, E> graph) {
	super();
	this.graphViewer = graphViewer;
	this.graph = graph;
	this.layout = new ISOMLayout<V, E>(graph);

	layoutMap = new java.util.LinkedHashMap<String, Class>();

	if (graph instanceof Forest) {
		layoutMap.put("Tree", ShapeBasedTreeLayout.class);
		layoutMap.put("Tree (Tight)", TreeLayout.class);
		layoutMap.put("Radial", RadialTreeLayout.class);
		layoutMap.put("Balloon", BalloonLayout.class);
	}

	layoutMap.put("ISOM", ISOMLayout.class);
	layoutMap.put("KKLayout", KKLayout.class);
	layoutMap.put("FRLayout", FRLayout2.class);
	layoutMap.put("Circle", CircleLayout.class);
	layoutMap.put("Spring", SpringLayout2.class);

	Iterator<String> it = layoutMap.keySet().iterator();
	while (it.hasNext()) {
		addItem(it.next());
	}

	addActionListener(this);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:LayoutSelection.java

示例3: LayoutSelection

import edu.uci.ics.jung.algorithms.layout.FRLayout2; //导入依赖的package包/类
public LayoutSelection(GraphViewer<V, E> graphViewer, Graph<V, E> graph) {
	super();
	this.graphViewer = graphViewer;
	this.graph = graph;
	this.layout = new ISOMLayout<V, E>(graph);

	layoutMap = new LinkedHashMap<>();

	if (graph instanceof Forest) {
		layoutMap.put("Tree", ShapeBasedTreeLayout.class);
		layoutMap.put("Tree (Tight)", TreeLayout.class);
		layoutMap.put("Radial", RadialTreeLayout.class);
		layoutMap.put("Balloon", BalloonLayout.class);
	}

	layoutMap.put("ISOM", ISOMLayout.class);
	layoutMap.put("KKLayout", KKLayout.class);
	layoutMap.put("FRLayout", FRLayout2.class);
	layoutMap.put("Circle", CircleLayout.class);
	layoutMap.put("Spring", SpringLayout2.class);

	Iterator<String> it = layoutMap.keySet().iterator();
	while (it.hasNext()) {
		addItem(it.next());
	}

	addActionListener(this);
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:29,代码来源:LayoutSelection.java

示例4: buildJungLayout

import edu.uci.ics.jung.algorithms.layout.FRLayout2; //导入依赖的package包/类
@Override
protected Layout<GraphNode,GraphEdge> buildJungLayout(
        DirectedGraph<GraphNode, GraphEdge> jungGraph,
        Dimension layoutSize) {
  FRLayout2<GraphNode, GraphEdge> result =
      new FRLayout2<GraphNode, GraphEdge>(jungGraph, layoutSize);
  if (attractMultiplier.isSet()) {
    result.setAttractionMultiplier(attractMultiplier.getValue());
  }
  if (repulsionMultiplier.isSet()) {
    result.setAttractionMultiplier(repulsionMultiplier.getValue());
  }

  return result;
}
 
开发者ID:google,项目名称:depan,代码行数:16,代码来源:JungLayoutPlan.java

示例5: LayoutSelection

import edu.uci.ics.jung.algorithms.layout.FRLayout2; //导入依赖的package包/类
public LayoutSelection(GraphViewer<V, E> graphViewer, Graph<V,E> graph) {
    super();
    this.graphViewer = graphViewer;
    this.graph = graph;
    this.layout = new ISOMLayout<V, E>(graph);
    
    layoutMap = new java.util.LinkedHashMap<String, Class>();

    if (graph instanceof Forest) {
    	layoutMap.put("Tree", ShapeBasedTreeLayout.class);
        layoutMap.put("Tree (Tight)", TreeLayout.class);
        layoutMap.put("Radial", RadialTreeLayout.class);
        layoutMap.put("Balloon", BalloonLayout.class);
    }

    layoutMap.put("ISOM", ISOMLayout.class);
    layoutMap.put("KKLayout", KKLayout.class);
    layoutMap.put("FRLayout", FRLayout2.class);
    layoutMap.put("Circle", CircleLayout.class);
    layoutMap.put("Spring", SpringLayout2.class);

    Iterator<String> it = layoutMap.keySet().iterator();
    while (it.hasNext())
        addItem(it.next());
    
    addActionListener(this);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:28,代码来源:LayoutSelection.java

示例6: DependencyGraphScene

import edu.uci.ics.jung.algorithms.layout.FRLayout2; //导入依赖的package包/类
DependencyGraphScene(ObservableGraph<ArtifactGraphNode, ArtifactGraphEdge> graph, DelegateForest<ArtifactGraphNode, ArtifactGraphEdge> forest, MavenProject prj, Project nbProj, DependencyGraphTopComponent tc,
            POMModel model) {
        super(graph, new FRLayout<>(forest));
        layoutModel = new DefaultComboBoxModel<>();
        layoutModel.addElement(layout());
        // These rarely work but look nice when they do
//        layoutModel.addElement(new BalloonLayout<>(forest));
//        layoutModel.addElement(new RadialTreeLayout<>(forest));
        layoutModel.addElement(new CircleLayout<>(graph));
        layoutModel.addElement(new FRLayout<>(graph));
        layoutModel.addElement(new FRLayout2<>(graph));
        layoutModel.addElement(new KKLayout<>(graph));
        TreeLayout<ArtifactGraphNode, ArtifactGraphEdge> treeLayout = new TreeLayout<>(forest, 200, 90);
        layoutModel.addElement(treeLayout);
        layoutModel.addElement(new ISOMLayout<>(graph));
        layoutModel.addElement(new SpringLayout<>(graph));
        layoutModel.addElement(new SpringLayout2<>(graph));
        layoutModel.setSelectedItem(layout());

        moveAction = ActionFactory.createMoveAction(null, new MP());

        this.forest = forest;
        project = prj;
        nbProject = nbProj;
        this.tc = tc;
        this.model = model;
        mainLayer = new LayerWidget(this);
        addChild(mainLayer);
        connectionLayer = new LayerWidget(this);
        addChild(connectionLayer);
        //getActions().addAction(this.createObjectHoverAction());
        getActions().addAction(hoverAction);
        getActions().addAction(ActionFactory.createSelectAction(allActionsP));
        getActions().addAction(zoomAction);
        getActions().addAction(panAction);
        getActions().addAction(editAction);
        getActions().addAction(popupMenuAction);
        
        getActions().addAction(new ScrollWheelZoomAction());
    }
 
开发者ID:timboudreau,项目名称:vl-jung,代码行数:41,代码来源:DependencyGraphScene.java

示例7: transform

import edu.uci.ics.jung.algorithms.layout.FRLayout2; //导入依赖的package包/类
@Override
public Layout<INode, IConnection> transform(Graph<INode, IConnection> networkGraph) {

    // TODO change to concurrent FRLAyout2
    return new FRLayout2<>(networkGraph);
}
 
开发者ID:truffle-hog,项目名称:truffle-hog,代码行数:7,代码来源:FRLayout2Factory.java

示例8: init

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

        //create a graph
    	Graph<Number,Number> ig = Graphs.<Number,Number>synchronizedDirectedGraph(new DirectedSparseMultigraph<Number,Number>());

        ObservableGraph<Number,Number> og = new ObservableGraph<Number,Number>(ig);
        og.addGraphEventListener(new GraphEventListener<Number,Number>() {

			public void handleGraphEvent(GraphEvent<Number, Number> evt) {
				System.err.println("got "+evt);

			}});
        
        this.g = og;
        //create a graphdraw
        layout = new FRLayout2<Number,Number>(g);
//        ((FRLayout)layout).setMaxIterations(200);

        vv = new VisualizationViewer<Number,Number>(layout, new Dimension(600,600));

        JRootPane rp = this.getRootPane();
        rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

        getContentPane().setLayout(new BorderLayout());
        getContentPane().setBackground(java.awt.Color.lightGray);
        getContentPane().setFont(new Font("Serif", Font.PLAIN, 12));

        vv.getModel().getRelaxer().setSleepTime(500);
        vv.setGraphMouse(new DefaultModalGraphMouse<Number,Number>());

        vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>());
        vv.setForeground(Color.white);
        getContentPane().add(vv);
        switchLayout = new JButton("Switch to SpringLayout");
        switchLayout.addActionListener(new ActionListener() {

            @SuppressWarnings("unchecked")
            public void actionPerformed(ActionEvent ae) {
            	Dimension d = new Dimension(600,600);
                if (switchLayout.getText().indexOf("Spring") > 0) {
                    switchLayout.setText("Switch to FRLayout");
                    layout = new SpringLayout<Number,Number>(g,
                        new ConstantTransformer(EDGE_LENGTH));
                    layout.setSize(d);
                    vv.getModel().setGraphLayout(layout, d);
                } else {
                    switchLayout.setText("Switch to SpringLayout");
                    layout = new FRLayout<Number,Number>(g, d);
                    vv.getModel().setGraphLayout(layout, d);
                }
            }
        });

        getContentPane().add(switchLayout, BorderLayout.SOUTH);

        timer = new Timer();
    }
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:60,代码来源:AddNodeDemo.java

示例9: switchLayout

import edu.uci.ics.jung.algorithms.layout.FRLayout2; //导入依赖的package包/类
public void switchLayout(GraphLayout type) {
	Layout<N, EdgeWrapper<E>> layout = null;

	switch (type) {
	case KKLayout:
		layout = new KKLayout<N, EdgeWrapper<E>>(graph);
		break;
	case FRLayout:
		layout = new FRLayout<N, EdgeWrapper<E>>(graph);
		break;
	case ISOMLayout:
		layout = new ISOMLayout<N, EdgeWrapper<E>>(graph);
		break;
	case SpringLayout:
		layout = new SpringLayout<N, EdgeWrapper<E>>(graph);
		break;
	case CircleLayout:
		layout = new CircleLayout<N, EdgeWrapper<E>>(graph);
		break;
	case FRLayout2:
		layout = new FRLayout2<N, EdgeWrapper<E>>(graph);
		break;
	case SpringLayout2:
		layout = new SpringLayout2<N, EdgeWrapper<E>>(graph);
		break;
	default:
		break;
	}

	if (graph.getVertexCount() < 100) {
		layout.setInitializer(vv.getGraphLayout());
		layout.setSize(getSize());
		LayoutTransition<N, EdgeWrapper<E>> lt = new LayoutTransition<N, EdgeWrapper<E>>(vv, vv.getGraphLayout(),
				layout);
		Animator animator = new Animator(lt);
		animator.start();
		vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
		repaint(500);
	} else {
		vv.setModel(new DefaultVisualizationModel<N, EdgeWrapper<E>>(layout));
		repaint(500);
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:44,代码来源:JungVisualizationViewer.java

示例10: init

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

        //create a graph
    	Graph<Number,Number> ig = Graphs.<Number,Number>synchronizedDirectedGraph(new DirectedSparseMultigraph<Number,Number>());

        ObservableGraph<Number,Number> og = new ObservableGraph<Number,Number>(ig);
        og.addGraphEventListener(new GraphEventListener<Number,Number>() {

			public void handleGraphEvent(GraphEvent<Number, Number> evt) {
				System.err.println("got "+evt);

			}});
        this.g = og;
        //create a graphdraw
        layout = new FRLayout2<Number,Number>(g);
//        ((FRLayout)layout).setMaxIterations(200);

        vv = new VisualizationViewer<Number,Number>(layout, new Dimension(600,600));

        JRootPane rp = this.getRootPane();
        rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

        getContentPane().setLayout(new BorderLayout());
        getContentPane().setBackground(java.awt.Color.lightGray);
        getContentPane().setFont(new Font("Serif", Font.PLAIN, 12));

        vv.getModel().getRelaxer().setSleepTime(500);
        vv.setGraphMouse(new DefaultModalGraphMouse<Number,Number>());

        vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>());
        vv.setForeground(Color.white);
        getContentPane().add(vv);
        switchLayout = new JButton("Switch to SpringLayout");
        switchLayout.addActionListener(new ActionListener() {

            @SuppressWarnings("unchecked")
            public void actionPerformed(ActionEvent ae) {
            	Dimension d = new Dimension(600,600);
                if (switchLayout.getText().indexOf("Spring") > 0) {
                    switchLayout.setText("Switch to FRLayout");
                    layout = new SpringLayout<Number,Number>(g,
                        new ConstantTransformer(EDGE_LENGTH));
                    layout.setSize(d);
                    vv.getModel().setGraphLayout(layout, d);
                } else {
                    switchLayout.setText("Switch to SpringLayout");
                    layout = new FRLayout<Number,Number>(g, d);
                    vv.getModel().setGraphLayout(layout, d);
                }
            }
        });

        getContentPane().add(switchLayout, BorderLayout.SOUTH);

        timer = new Timer();
    }
 
开发者ID:macc704,项目名称:KBDeX,代码行数:59,代码来源:AddNodeDemo.java

示例11: refreshLayout

import edu.uci.ics.jung.algorithms.layout.FRLayout2; //导入依赖的package包/类
synchronized
public void refreshLayout() {

  //  logger.debug("refresh");
    final FRLayout2<INode, IConnection> l = new FRLayout2<>(this.layout.getObservableGraph());
        l.setMaxIterations(layout.getGraph().getEdgeCount() * (int) (this.getWidth() / canvas.getScale()));
       // l.setMaxIterations(700);
    this.layout = new ObservableLayout<>(l);
           //TODO make the dimension changeable from settings menu?

       // logger.debug(canvas.getScale() + " " + this.getWidth() + " " + this.getHeight());
    layout.setSize(new Dimension((int) (this.getWidth() / (2 * canvas.getScale())), (int) (this.getHeight() / (2 * canvas.getScale()))));

        //layout.set

    final Executor layouter = Executors.newSingleThreadExecutor();

    layouter.execute(() -> {

        while (!layout.done()) {
            layout.step();
            Platform.runLater(this::repaint);
        }

    });



}
 
开发者ID:truffle-hog,项目名称:truffle-hog,代码行数:30,代码来源:FXVisualizationViewer.java


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