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


Java FRLayout类代码示例

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


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

示例1: MyVisualizationViewer

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
public MyVisualizationViewer(TopologyViewerConfType viewerConfig, Graph<String, String> graph,
                                 Map<String, GraphMLMetadata<String>> vertexMetadatas,
                                 Map<String, GraphMLMetadata<String>> edgeMetadatas,
                                 Map<String, Icon> iconMap,
                                 Map<String, Stroke> edgesStrokeMap,
                                 Map<String, Color> edgesColorMap) {
//        RadialTreeLayout<String,Integer> radialLayout;
        super(new MyPersistentLayoutImpl(new FRLayout<String,String>(graph)));
//        super(new PersistentLayoutImpl(new RadialTreeLayout(<String,Integer>(graph)));
        this.viewerConfig = viewerConfig;
        this.vertexMetadatas = vertexMetadatas;
        this.edgeMetadatas = edgeMetadatas;
        this.iconMap = iconMap;
        this.edgesStrokeMap = edgesStrokeMap;
        this.edgesColorMap = edgesColorMap;
        createGraphViewer();
    }
 
开发者ID:iTransformers,项目名称:netTransformer,代码行数:18,代码来源:MyVisualizationViewer.java

示例2: getLayout

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的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

示例3: initLayoutBox

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
/**
 * Initializes combobox for layout
 */
private void initLayoutBox(){
	layoutBox.addItem("CircleLayout");
	layoutBox.addItem("FRLayout");
	layoutBox.addItem("FRLayout2");
	layoutBox.addItem("ISOMLayout");
	layoutBox.addItem("KKLayout");
	
	layoutBox.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent a) {
			JComboBox<String> lBox = (JComboBox<String>) a.getSource();
			String name = (String) lBox.getSelectedItem();
			for (EGPanel e : egPanels){
				ExplanationGraph eg = e.getEG();
				switch(name){
				case "CircleLayout": layout = new CircleLayout<EGVertex, EGEdge>(eg); break;
				case "FRLayout": layout = new FRLayout<EGVertex, EGEdge>(eg); break;
				case "FRLayout2": layout = new FRLayout<EGVertex, EGEdge>(eg);  break;
				case "KKLayout": layout = new KKLayout<EGVertex, EGEdge>(eg); break;
				default : layout = new ISOMLayout<EGVertex, EGEdge>(eg); break;
				}
				e.setLayout(layout);
			}			
		}});
}
 
开发者ID:Angerona,项目名称:angerona-framework,代码行数:28,代码来源:EGView.java

示例4: initLayoutBox

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
private void initLayoutBox(){
	layoutBox.addItem("CircleLayout");
	layoutBox.addItem("FRLayout");
	layoutBox.addItem("FRLayout2");
	layoutBox.addItem("ISOMLayout");
	layoutBox.addItem("KKLayout");
	
	layoutBox.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent a) {
			JComboBox<String> lBox = (JComboBox<String>) a.getSource();
			String name = (String) lBox.getSelectedItem();
			switch(name){
			case "CircleLayout": l = new CircleLayout<EDGVertex, EDGEdge>(edg); break;
			case "FRLayout": l = new FRLayout<EDGVertex, EDGEdge>(edg); break;
			case "FRLayout2": l = new FRLayout<EDGVertex, EDGEdge>(edg);  break;
			case "KKLayout": l = new KKLayout<EDGVertex, EDGEdge>(edg); break;
			default : l = new ISOMLayout<EDGVertex, EDGEdge>(edg); break;
			}
			l.setSize(new Dimension(780,400));
			visServer.setGraphLayout(l);
			visServer.doLayout();
		}			
	});
}
 
开发者ID:Angerona,项目名称:angerona-framework,代码行数:25,代码来源:EDGView.java

示例5: newLayout

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
private Layout<Node, Edge> newLayout(final Diagram diagram) {
    final Layout<Node, Edge> diagramLayout;
    if (layout != null && layout.startsWith("spring")) {
        diagramLayout = new SpringLayout<Node, Edge>(diagram, new ConstantTransformer(Integer.parseInt(config("spring", "100"))));
    } else if (layout != null && layout.startsWith("kk")) {
        Distance<Node> distance = new DijkstraDistance<Node, Edge>(diagram);
        if (layout.endsWith("unweight")) {
            distance = new UnweightedShortestPath<Node, Edge>(diagram);
        }
        diagramLayout = new KKLayout<Node, Edge>(diagram, distance);
    } else if (layout != null && layout.equalsIgnoreCase("circle")) {
        diagramLayout = new CircleLayout<Node, Edge>(diagram);
    } else if (layout != null && layout.equalsIgnoreCase("fr")) {
        diagramLayout = new FRLayout<Node, Edge>(diagram);
    } else {
        final LevelLayout levelLayout = new LevelLayout(diagram);
        levelLayout.adjust = adjust;

        diagramLayout = levelLayout;
    }
    return diagramLayout;
}
 
开发者ID:apache,项目名称:incubator-batchee,代码行数:23,代码来源:DiagramGenerator.java

示例6: factory

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的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

示例7: ReplayNetwork

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
public ReplayNetwork(Graph<INode, IConnection> replayViewGraph) {

        this.delegate = new FRLayout<>(replayViewGraph);
        this.layoutFactory = new FRLayoutFactory();

        port = new ReplayWritingPort();
        viewPort = new ReplayViewPort();
    }
 
开发者ID:truffle-hog,项目名称:truffle-hog,代码行数:9,代码来源:ReplayNetwork.java

示例8: getCombos

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
/**
 * @return
 */
@SuppressWarnings("unchecked")
private Class<? extends Layout>[] getCombos()
{
    List<Class<? extends Layout>> layouts = new ArrayList<Class<? extends Layout>>();
    layouts.add(KKLayout.class);
    layouts.add(FRLayout.class);
    layouts.add(CircleLayout.class);
    layouts.add(SpringLayout.class);
    layouts.add(SpringLayout2.class);
    layouts.add(ISOMLayout.class);
    return layouts.toArray(new Class[0]);
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:16,代码来源:VertexCollapseDemoWithLayouts.java

示例9: main

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
public static void main(String[] args) {
  DirectedSparseGraph<String, String> g = new DirectedSparseGraph<String, String>();
  g.addVertex("Square");
  g.addVertex("Rectangle");
  g.addVertex("Circle");
  g.addEdge("Edge1", "Square", "Rectangle");
  g.addEdge("Edge2", "Square", "Circle");
  g.addEdge("Edge3", "Circle", "Square");
  
  VisualizationViewer<String, String> vv =
    new VisualizationViewer<String, String>(
      new FRLayout<String, String>(g), new Dimension(400,400));
  Transformer<String, String> transformer = new Transformer<String, String>() {
    @Override public String transform(String arg0) { return arg0; }
  };
  vv.getRenderContext().setVertexLabelTransformer(transformer);
  transformer = new Transformer<String, String>() {
    @Override public String transform(String arg0) { return arg0; }
  };
  vv.getRenderContext().setEdgeLabelTransformer(transformer);
  vv.getRenderer().setVertexRenderer(new MyRenderer());
 
  // The following code adds capability for mouse picking of vertices/edges. Vertices can even be moved!
  final DefaultModalGraphMouse<String,Number> graphMouse = new DefaultModalGraphMouse<String,Number>();
  vv.setGraphMouse(graphMouse);
  graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
 
  JFrame frame = new JFrame();
  frame.getContentPane().add(vv);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.pack();
  frame.setVisible(true);
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:34,代码来源:VertexShapes.java

示例10: getCombos

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
/**
 * @return
 */
@SuppressWarnings("unchecked")
private static Class<? extends Layout>[] getCombos()
{
    List<Class<? extends Layout>> layouts = new ArrayList<Class<? extends Layout>>();
    layouts.add(KKLayout.class);
    layouts.add(FRLayout.class);
    layouts.add(CircleLayout.class);
    layouts.add(SpringLayout.class);
    layouts.add(SpringLayout2.class);
    layouts.add(ISOMLayout.class);
    return layouts.toArray(new Class[0]);
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:16,代码来源:ShowLayouts.java

示例11: main

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
public static void main(String[] args) throws IOException 
{
    JFrame jf = new JFrame();
    Graph g = getGraph();
    VisualizationViewer vv = new VisualizationViewer(new FRLayout(g));
    jf.getContentPane().add(vv);
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jf.pack();
    jf.setVisible(true);
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:11,代码来源:SimpleGraphDraw.java

示例12: buildJungLayout

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
@Override
protected Layout<GraphNode, GraphEdge> buildJungLayout(
    DirectedGraph<GraphNode, GraphEdge> jungGraph, Dimension layoutSize) {

  FRLayout<GraphNode, GraphEdge> result =
      new FRLayout<GraphNode, GraphEdge>(jungGraph, layoutSize);
  if (attractMultiplier.isSet()) {
    result.setAttractionMultiplier(attractMultiplier.getValue());
  }
  if (repulsionMultiplier.isSet()) {
    result.setAttractionMultiplier(repulsionMultiplier.getValue());
  }
  return result;
}
 
开发者ID:google,项目名称:depan,代码行数:15,代码来源:JungLayoutPlan.java

示例13: updateLayoutGraph

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
private void updateLayoutGraph()
{
    Layout<Vertex,Edge> newlayout = null;
    if(((String)layoutChoiceComboBox.getSelectedItem()).equals("FRLayout"))
    {
        newlayout = new FRLayout<Vertex,Edge>(sequenceGraph);
        ((FRLayout<Vertex,Edge>)newlayout).setMaxIterations(200);
    }
    else if(((String)layoutChoiceComboBox.getSelectedItem()).equals("KKLayout"))
    {
        newlayout = new KKLayout<Vertex,Edge>(sequenceGraph);
        ((KKLayout<Vertex,Edge>)newlayout).setMaxIterations(200);
    }
    else if(((String)layoutChoiceComboBox.getSelectedItem()).equals("SpringLayout"))
    {
        newlayout = new SpringLayout<Vertex,Edge>(sequenceGraph);
    }
    else if(((String)layoutChoiceComboBox.getSelectedItem()).equals("ISOMLayout"))
    {
        newlayout = new ISOMLayout<Vertex,Edge>(sequenceGraph);
    }
    else
    {
        throw new Error("Error choice: wrong layout name");
    }
    newlayout.setInitializer(networkCanvas.getGraphLayout());
    newlayout.setSize(networkCanvas.getSize());
    
    LayoutTransition<Vertex,Edge> transition =
        new LayoutTransition<Vertex,Edge>(networkCanvas, networkCanvas.getGraphLayout(), newlayout);
    Animator animator = new Animator(transition);
    animator.start();
    
    networkCanvas.getRenderContext().getMultiLayerTransformer().setToIdentity(); // What is the use of those lines ?
    networkCanvas.repaint();
}
 
开发者ID:Conchylicultor,项目名称:NetworkVisualizer,代码行数:37,代码来源:VisualizerWindow.java

示例14: generateRandomGraph

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
/**
 * Generates a new random graph
 */
private void generateRandomGraph() {
	try {
		// Generate new random graph and renderer
		int vertexCount = Integer.parseInt(this.numberVerticesText
				.getText());
		this.g = GraphGenerator.generateRandomGraph(vertexCount,
				(int) (vertexCount * 1.5), true);
		Layout<String, Number> layout = vertexCount <= 100 ? new KKLayout<String, Number>(
				this.g) : new FRLayout<String, Number>(this.g);

		if (this.renderer != null) {
			// Remove existing renderer
			this.frame.getContentPane().remove(this.renderer);
		}
		this.renderer = new GraphRenderer<String, Number>(this.g, layout);
		this.frame.getContentPane().add(this.renderer, BorderLayout.CENTER);

		// Retrieve generated vertices and add them to the combo boxes
		this.startVertexComboBox.removeAllItems();
		this.targetVertexComboBox.removeAllItems();
		String[] sortedVertices = this.g.getVertices().toArray(
				new String[0]);
		Arrays.sort(sortedVertices);
		for (String vertex : sortedVertices) {
			this.startVertexComboBox.addItem(vertex);
			this.targetVertexComboBox.addItem(vertex);
		}
	} catch (NumberFormatException e) {
		JOptionPane.showMessageDialog(this.frame,
				"Random vertex count is invalid!", "Error!",
				JOptionPane.ERROR_MESSAGE);
	}
}
 
开发者ID:markuskorbel,项目名称:adt.reference,代码行数:37,代码来源:DijkstraShortestPath.java

示例15: doFRLayout

import edu.uci.ics.jung.algorithms.layout.FRLayout; //导入依赖的package包/类
private void doFRLayout(final Layout graphLayout, SparseGraph<VertexRef, EdgeRef> jungGraph, Dimension size, final int xOffset, final int yOffset) {
	FRLayout<VertexRef, EdgeRef> layout = new FRLayout<VertexRef, EdgeRef>(jungGraph);
	layout.setInitializer(initializer(graphLayout, xOffset, yOffset));
	layout.setSize(size);
	
	while(!layout.done()) {
		layout.step();
	}
	
	
	for(VertexRef v : jungGraph.getVertices()) {
		graphLayout.setLocation(v, (int)layout.getX(v)+xOffset, (int)layout.getY(v)+yOffset);
	}
	
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:16,代码来源:RealUltimateLayoutAlgorithm.java


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