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


Java SpringLayout2类代码示例

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


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

示例1: buildJungLayout

import edu.uci.ics.jung.algorithms.layout.SpringLayout2; //导入依赖的package包/类
@Override
protected Layout<GraphNode,GraphEdge> buildJungLayout(
        DirectedGraph<GraphNode, GraphEdge> jungGraph,
        Dimension layoutSize) {
  SpringLayout2<GraphNode, GraphEdge> result =
          new SpringLayout2<GraphNode, GraphEdge>(jungGraph);
  result.setSize(layoutSize);
  if (force.isSet()) {
    result.setForceMultiplier(force.getValue());
  }
  if (range.isSet()) {
    result.setRepulsionRange(range.getValue());
  }
  if (stretch.isSet()) {
    result.setStretch(stretch.getValue());
  }
  return result;
}
 
开发者ID:google,项目名称:depan,代码行数:19,代码来源:JungLayoutPlan.java

示例2: DrawnIconVertexDemo

import edu.uci.ics.jung.algorithms.layout.SpringLayout2; //导入依赖的package包/类
public DrawnIconVertexDemo(final Deployment dm) {
    this.dmodel = dm;
    // create a simple graph for the demo
    graph = new DirectedSparseGraph<Vertex, Edge>();
    vv = new VisualizationViewer<Vertex, Edge>(new SpringLayout2<Vertex, Edge>(graph));

    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan));
    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan));

    vv.getRenderContext().setVertexIconTransformer(vertexColor);


    vv.getRenderContext().setVertexFillPaintTransformer(new PickableVertexPaintTransformer<Vertex>(vv.getPickedVertexState(), Color.white, Color.yellow));
    vv.getRenderContext().setEdgeDrawPaintTransformer(edgeColor);

    vv.setBackground(Color.white);

    // add my listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Vertex>());
}
 
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:21,代码来源:DrawnIconVertexDemo.java

示例3: LayoutSelection

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

示例4: LayoutSelection

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

示例5: getCombos

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

示例6: getCombos

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

示例7: LayoutSelection

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

示例8: DependencyGraphScene

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

示例9: switchLayout

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

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


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