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


Java LayoutTransition类代码示例

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


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

示例1: doGraphLayout

import edu.uci.ics.jung.visualization.layout.LayoutTransition; //导入依赖的package包/类
@Override
public void doGraphLayout() {
	layout.setSize(vv.getSize());
	layout.initialize();
	Relaxer relaxer = new VisRunner((IterativeContext) layout);
	relaxer.stop();
	relaxer.prerelax();
	
	StaticLayout<Node, Edge> staticLayout = new StaticLayout<Node,Edge>(graph, layout, vv.getSize());
	LayoutTransition<Node,Edge> lt = new LayoutTransition<Node,Edge>(vv, vv.getGraphLayout(),
										staticLayout);
	Animator animator = new Animator(lt);
	animator.start();
	vv.repaint();
	
	FeatureMask mask = new FeatureMask(FeatureMask.TRANSLATE_SUPPORT | FeatureMask.SCALING_SUPPORT);
	GraphEditorEventHandler eventHandler = new GraphEditorEventHandler(vv.getRenderContext(),
												null, null, mask);
	vv.setGraphMouse(eventHandler);
}
 
开发者ID:andreiolaru-ro,项目名称:AmIciTy-Grph,代码行数:21,代码来源:AnimatedJungGraphViewer.java

示例2: actionPerformed

import edu.uci.ics.jung.visualization.layout.LayoutTransition; //导入依赖的package包/类
public void actionPerformed(ActionEvent arg0)
        {
            Object[] constructorArgs =
                { collapsedGraph };

            Class<? extends Layout> layoutC = 
                (Class<? extends Layout>) jcb.getSelectedItem();
//            Class lay = layoutC;
            try
            {
                Constructor<? extends Layout> constructor = layoutC
                        .getConstructor(new Class[] {Graph.class});
                Object o = constructor.newInstance(constructorArgs);
                Layout l = (Layout) o;
                l.setInitializer(vv.getGraphLayout());
                l.setSize(vv.getSize());
                layout = l;
				LayoutTransition lt =
					new LayoutTransition(vv, vv.getGraphLayout(), l);
				Animator animator = new Animator(lt);
				animator.start();
				vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
				vv.repaint();
                
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:31,代码来源:VertexCollapseDemoWithLayouts.java

示例3: actionPerformed

import edu.uci.ics.jung.visualization.layout.LayoutTransition; //导入依赖的package包/类
public void actionPerformed(ActionEvent arg0)
        {
            Object[] constructorArgs =
                { g_array[graph_index]};

            Class<? extends Layout<Integer,Number>> layoutC = 
                (Class<? extends Layout<Integer,Number>>) jcb.getSelectedItem();
//            Class lay = layoutC;
            try
            {
                Constructor<? extends Layout<Integer, Number>> constructor = layoutC
                        .getConstructor(new Class[] {Graph.class});
                Object o = constructor.newInstance(constructorArgs);
                Layout<Integer,Number> l = (Layout<Integer,Number>) o;
                l.setInitializer(vv.getGraphLayout());
                l.setSize(vv.getSize());
                
				LayoutTransition<Integer,Number> lt =
					new LayoutTransition<Integer,Number>(vv, vv.getGraphLayout(), l);
				Animator animator = new Animator(lt);
				animator.start();
				vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
				vv.repaint();
                
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:31,代码来源:ShowLayouts.java

示例4: animate

import edu.uci.ics.jung.visualization.layout.LayoutTransition; //导入依赖的package包/类
private void animate()
  {
  	// while we are animating, the task scheduler is not allowed to modify the graph
  	// otherwise we will have a ConcurrentModificationException, because this animation iterates
  	// over the vertices and edges, while the task scheduler thread modifies them.
  	
  	layout.initialize();

  	if (GeneralMDPSettings.ANIMATE) {
   	Relaxer relaxer = new VisRunner((IterativeContext)layout);
	relaxer.stop();
	relaxer.prerelax();
	
	StaticLayout<Vertex<?>,Edge<?,?>> staticLayout =
		new StaticLayout<Vertex<?>,Edge<?,?>>(g, layout);
	LayoutTransition<Vertex<?>,Edge<?,?>> lt =
		new LayoutTransition<Vertex<?>,Edge<?,?>>(vv, vv.getGraphLayout(),
				staticLayout);

	Animator animator = new Animator(lt);
	animator.start();
  	}
  	
vv.repaint();
  	repaint();
  	
  	// resume scheduling after 200ms, give the visualization some time to draw before editing the graph again
  	resumeTaskScheduler(GeneralMDPSettings.REPAINT_DELAY-100); 
  }
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:30,代码来源:MDPDrawer.java

示例5: updateLayoutGraph

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

示例6: process

import edu.uci.ics.jung.visualization.layout.LayoutTransition; //导入依赖的package包/类
public void process() {

    	vv.getRenderContext().getPickedVertexState().clear();
    	vv.getRenderContext().getPickedEdgeState().clear();
        try {

            if (g.getVertexCount() < 100) {
                //add a vertex
                Integer v1 = new Integer(g.getVertexCount());

                g.addVertex(v1);
                vv.getRenderContext().getPickedVertexState().pick(v1, true);

                // wire it to some edges
                if (v_prev != null) {
                	Integer edge = g.getEdgeCount();
                	vv.getRenderContext().getPickedEdgeState().pick(edge, true);
                    g.addEdge(edge, v_prev, v1);
                    // let's connect to a random vertex, too!
                    int rand = (int) (Math.random() * g.getVertexCount());
                    edge = g.getEdgeCount();
                	vv.getRenderContext().getPickedEdgeState().pick(edge, true);
                   g.addEdge(edge, v1, rand);
                }

                v_prev = v1;

                layout.initialize();

        		Relaxer relaxer = new VisRunner((IterativeContext)layout);
        		relaxer.stop();
        		relaxer.prerelax();
        		StaticLayout<Number,Number> staticLayout =
        			new StaticLayout<Number,Number>(g, layout);
				LayoutTransition<Number,Number> lt =
					new LayoutTransition<Number,Number>(vv, vv.getGraphLayout(),
							staticLayout);
				Animator animator = new Animator(lt);
				animator.start();
//				vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
				vv.repaint();

            } else {
            	done = true;
            }

        } catch (Exception e) {
            System.out.println(e);

        }
    }
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:52,代码来源:AnimatingAddNodeDemo.java

示例7: switchLayout

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

示例8: refreshLayout

import edu.uci.ics.jung.visualization.layout.LayoutTransition; //导入依赖的package包/类
private void refreshLayout() {
	if (active) {
		taskManager.cancelAllWaitingTasks();
		taskManager.addTask(new ICTask() {
			public void doTask() {
				StaticLayout<V, E> toLayout;
				Layout<V, E> currentLayout;
				synchronized (getTreeLock()) {
					currentLayout = viewer.getGraphLayout(); // StaticLayout
					layout.setSize(viewer.getSize());
					if (layout instanceof IterativeContext) { // 最後まで進める
						// layout.setInitializer(currentLayout);
						Relaxer relaxer = new VisRunner(
								(IterativeContext) layout);
						relaxer.prerelax();
					} else {// CircleLayoutの場合
						layout.initialize();
					}
					toLayout = new StaticLayout<V, E>(getGraph(), layout);
				}
				if (isAnimation()) {
					LayoutTransition<V, E> layoutTransition = new LayoutTransition<V, E>(
							viewer, currentLayout, toLayout);

					Animator animator = new Animator(layoutTransition);
					// animator.setSleepTime(100);						
					animator.run(); // animator.start();

					//						while (!layoutTransition.done()) {
					//							viewer.requestRefresh();
					//							layoutTransition.step();
					//							CThread.sleep(10L);
					//						}
				} else {
					viewer.setGraphLayout(toLayout);
					// while (!layoutTransition.done()) {
					// layoutTransition.step();
					// }
				}

				// viewer.getRenderContext().getMultiLayerTransformer()
				// .setToIdentity();
				viewer.requestRefresh();
				viewer.repaint();
			}
		});
	}
}
 
开发者ID:macc704,项目名称:KBDeX,代码行数:49,代码来源:KNetworkPanel.java


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