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

Java Viewer类代码示例

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

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



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

示例1: display

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
/**
 * display() displays the graph by rendering the UI with the graph from the
 * graphstream library
 */
public void display() {
	Viewer vwr = graph.display();

	// Set it so program doesnt abort when close window 
	vwr.setCloseFramePolicy(Viewer.CloseFramePolicy.CLOSE_VIEWER);

}
 
开发者ID:TeamCohen,项目名称:VisualGraph,代码行数:12,代码来源:GraphSim.java


示例2: GraphView

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
/**
 * Konstruktor
 * Erstellt die Anzeige
 */
public GraphView(FacePath fp) {
	this.fp = fp;
	this.initialize();
	if (fs == null) {
		this.fs = fp.getFS();
	}
	Viewer viewer = new Viewer(fs.getGraph(), Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
	fs.getFbNetwork().setGraphViewer(viewer);
	View view = viewer.addDefaultView(false);
	
	GridBagConstraints gbc_view = new GridBagConstraints();
	gbc_view.fill = GridBagConstraints.BOTH;
	gbc_view.insets = new Insets(10, 30, 5, 30);
	gbc_view.gridx = 0;
	gbc_view.gridy = 0;
	resultPanel.add(view, gbc_view);
}
 
开发者ID:fabiogermann,项目名称:zhaw-facepath,代码行数:22,代码来源:GraphView.java


示例3: Clicks

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
public Clicks(BTSim bt) {
    this.bt = bt;
    if (bt != null && bt.getSpreadModel().getGraph() != null) {//example to test view with main (without bt objsect)
        graph = bt.getSpreadModel().getGraph();

    } else {
        graph = GraphTools.getExample();
    }
    Viewer viewer = graph.display();
    viewer.setCloseFramePolicy(Viewer.CloseFramePolicy.HIDE_ONLY);
    fromViewer = viewer.newViewerPipe();
    fromViewer.addViewerListener(this);
    fromViewer.addSink(graph);
  
}
 
开发者ID:gsi-upm,项目名称:BigTweet,代码行数:16,代码来源:Clicks.java


示例4: get_display

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
public Viewer get_display()
{	

	Viewer viewer = new Viewer(graph,Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
	viewer.enableAutoLayout();
	//return null;
	return viewer;
	//graph.display(); 
}
 
开发者ID:TeamCohen,项目名称:VisualGraph,代码行数:10,代码来源:GraphSim.java


示例5: execute

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
public void execute() {
		// Toolkit.c
		final Graph graph = new SingleGraph("roberto");
		graph.setStrict(false);
		graph.addAttribute("ui.stylesheet", "node.important {fill-color: red;}");
		graph.addAttribute("ui.quality");
		graph.addAttribute("ui.antialias");

		BaseGenerator gen = null;

		// Between 1 and 3 new links per node added.
		// gen = new BarabasiAlbertGenerator(1);//talvez
		// gen = new DorogovtsevMendesGenerator();//talvez

		// gen = new PointsOfInterestGenerator();//gera desconexo
		// gen = new PreferentialAttachmentGenerator();//parece com lobster
		// gen = new RandomEuclideanGenerator(2);//+-
		// gen = new RandomFixedDegreeDynamicGraphGenerator(200, 9.0,
		// 0.5);//acho que não
		// gen = new WattsStrogatzGenerator(200, 4, 0.1);//+-

		// gen = new ClusterGeneratorOld(200);

		int n = 100;
		// gen = new LobsterGenerator(5, 5);// sim
		// gen = new CustomLobsterGenerator(500, 3, 5);// sim
		// gen = new CustomFlowerSnarkGenerator(100);//sim
//		 gen = new ClusterGenerator(n, 3, 3); //sim
		// gen = new CustomGridGenerator(110, true, 0.9F, 15, 5);//usado para
		// gen = new WattsStrogatzGenerator(20, 10, 0.1);//pode ser mas tem que
		// rodar 2 vezes

		// gen = new BarabasiAlbertGenerator(1);//talvez - parecido com lobster
		// gen = new DorogovtsevMendesGenerator();//talvez

		gen.setRandomSeed(12345);
		gen.addSink(graph);
		gen.begin();
		while (gen.nextEvents())
			;
		gen.end();
		System.out.println("" + graph.getNodeCount() + " " + graph.getEdgeCount());

		// gen.configureNodes(graph);
		// System.out.println("Amount of important: " + gen.countImportant);

		Viewer viewer = graph.display(true);
		// Layout layoutAlgorithm = new SpringBox();
		// viewer.enableAutoLayout(layoutAlgorithm);
		viewer.setCloseFramePolicy(Viewer.CloseFramePolicy.HIDE_ONLY);

		ViewerListener vl = new MyViewListener(graph, n, 2, gen);
		ViewerPipe fromViewer = viewer.newViewerPipe();
		fromViewer.addViewerListener(vl);
		fromViewer.addSink(graph);

		while (loop) {
			fromViewer.pump(); // or fromViewer.blockingPump();

			try {
				Thread.sleep(100);
			} catch (InterruptedException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		}

		// try {
		// Thread.sleep(10000);
		// } catch (InterruptedException e1) {
		// // TODO Auto-generated catch block
		// e1.printStackTrace();
		// }
	}
 
开发者ID:rrocharoberto,项目名称:GraphPartitionFramework,代码行数:75,代码来源:CopyOfGeneratorTestOld.java


示例6: execute

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
public void execute(int k, int n) {
	// Toolkit.c
	final Graph graph = new SingleGraph("roberto");
	graph.setStrict(false);
	graph.addAttribute("ui.stylesheet", "node.important {fill-color: red;}");
	graph.addAttribute("ui.quality");
	graph.addAttribute("ui.antialias");

	BaseGenerator gen = null;

	// Between 1 and 3 new links per node added.
	// gen = new BarabasiAlbertGenerator(1);//talvez
	// gen = new DorogovtsevMendesGenerator();//talvez

	// gen = new PointsOfInterestGenerator();//gera desconexo
	// gen = new PreferentialAttachmentGenerator();//parece com lobster
	// gen = new RandomEuclideanGenerator(2);//+-
	// gen = new RandomFixedDegreeDynamicGraphGenerator(200, 9.0,
	// 0.5);//acho que não
	// gen = new WattsStrogatzGenerator(200, 4, 0.1);//+-

	// gen = new ClusterGeneratorOld(200);

	int minDegree = 3;
	int maxDegree = 6;
	// gen = new ClusterGenerator(n, minDegree, maxDegree, k); // sim
	// gen = new CustomGridGenerator(n, true, 0.9F, 15, 5);//usado para

	// gen = new LobsterGenerator(5, 5);// sim
	// gen = new CustomLobsterGenerator(n, 3, 5);// sim
	gen = new CustomFlowerSnarkGenerator(n);// sim
	// gen = new WattsStrogatzGenerator(20, 10, 0.1);//pode ser mas tem que
	// rodar 2 vezes

	// gen = new BarabasiAlbertGenerator(1);//talvez - parecido com lobster
	// gen = new DorogovtsevMendesGenerator();//talvez

	gen.setRandomSeed(12345);
	gen.addSink(graph);
	gen.begin();
	while (gen.nextEvents())
		;
	gen.end();
	System.out.println("" + graph.getNodeCount() + " " + graph.getEdgeCount());

	// gen.configureNodes(graph);
	// System.out.println("Amount of important: " + gen.countImportant);

	// Layout layoutAlgorithm = new SpringBox();
	// viewer.enableAutoLayout(layoutAlgorithm);

	ViewerListener vl = new MyViewListener(graph, n, k, gen);
	// vl.viewClosed("any");

	Viewer viewer = graph.display(true);
	viewer.setCloseFramePolicy(Viewer.CloseFramePolicy.HIDE_ONLY);

	ViewerPipe fromViewer = viewer.newViewerPipe();
	fromViewer.addViewerListener(vl);
	fromViewer.addSink(graph);

	while (true) {
		fromViewer.pump(); // or fromViewer.blockingPump();

		try {
			Thread.sleep(200);
		} catch (InterruptedException e1) {
			e1.printStackTrace();
		}
	}

}
 
开发者ID:rrocharoberto,项目名称:GraphPartitionFramework,代码行数:73,代码来源:GeneratorMain.java


示例7: createNetworkVisualization

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
public final VBox createNetworkVisualization(){
    System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
    Viewer viewer = new Viewer(AppParameters.authorNetwork, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
    view = viewer.addDefaultView(false); 
    viewer.enableAutoLayout();
    view.resizeFrame(Main.columnWidthLEFT, 290);
    swingNode = new CustomSwingNode();
    swingNode.setContent(view);
    swingNode.resize(Main.columnWidthLEFT, 290);
    EventHandler<MouseEvent> mouseHandlerGraphClick = new EventHandler<MouseEvent>() { 
        @Override 
        public void handle(MouseEvent mouseEvent) { 
            if (mouseEvent.getEventType() == MouseEvent.MOUSE_PRESSED) {
                if(mouseEvent.getButton() == MouseButton.SECONDARY){
                    Node node = (Node) view.findNodeOrSpriteAt(mouseEvent.getX(), mouseEvent.getY());
                    if(node != null){
                        userMessages(node.getId());
                    }
                }
                if(mouseEvent.getButton() == MouseButton.PRIMARY){
                    double translateCoeff = view.getCamera().getViewPercent();
                    Point3 center = view.getCamera().getViewCenter();
                    if(mouseEvent.getY()>175){
                        view.getCamera().setViewCenter(center.x, center.y-5*translateCoeff, center.z);
                    }else{
                        view.getCamera().setViewCenter(center.x, center.y+5*translateCoeff, center.z);
                    }
                    if(mouseEvent.getX()>275){
                        view.getCamera().setViewCenter(center.x+5*translateCoeff, center.y, center.z);
                    }else{
                        view.getCamera().setViewCenter(center.x-5*translateCoeff, center.y, center.z);
                    }
                }
                if(mouseEvent.getButton() == MouseButton.MIDDLE){
                    view.getCamera().setViewPercent(view.getCamera().getViewPercent()/2);
                }
            }
        }
    };   
    EventHandler<ScrollEvent> mouseHandlerGraphScroll = new EventHandler<ScrollEvent>() { 
        @Override
        public void handle(ScrollEvent event) {
            if(event.getDeltaY() < 0){
                view.getCamera().setViewPercent(view.getCamera().getViewPercent()*2);
            }else{
                view.getCamera().setViewPercent(view.getCamera().getViewPercent()/2);
            }
        }
    };   
    swingNode.setOnMousePressed(mouseHandlerGraphClick);
    swingNode.setOnScroll(mouseHandlerGraphScroll);
    VBox graphBox = new VBox();
    graphBox.getChildren().addAll(new Rectangle(Main.columnWidthLEFT,0),swingNode);
    initializeNetworkVisualizationStyle();
    return graphBox;
}
 
开发者ID:AdrienGuille,项目名称:SONDY,代码行数:57,代码来源:InfluenceAnalysisUI.java


示例8: createGraphViewer

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
/**
 * Create the graph viewer inside the view.
 *
 * @param graph
 *            The graph to show.
 */
private void createGraphViewer(VPMGraph graph) {

    // setting to enable an improved graph renderer
    // java.lang.System.setProperty("org.graphstream.ui.renderer",
    // "org.graphstream.ui.j2dviewer.J2DGraphRenderer");

    this.vpmGraph = graph;

    setTitleToolTip("Graph: " + graph.getId());

    // create the graph viewer
    CustomEdgeLabelAttributeProxy proxy = new CustomEdgeLabelAttributeProxy(vpmGraph,
            RelationshipEdge.RELATIONSHIP_LABEL);
    Viewer v = new Viewer(proxy);

    SpringBox layout = new SpringBox(false, new Random(0));
    v.enableAutoLayout(layout);
    v.setCloseFramePolicy(CloseFramePolicy.HIDE_ONLY);
    View view = v.addDefaultView(false);
    view.setFocusTraversalKeysEnabled(true);

    Panel panel = new Panel(new BorderLayout()) {

        private static final long serialVersionUID = 1L;

        public void update(java.awt.Graphics g) {
            /* Do not erase the background */
            paint(g);
        }
    };
    JRootPane root = new JRootPane();
    panel.add(root);

    root.getContentPane().add(view);

    frame.add(panel);
    frame.setVisible(true);

    setFocus();
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:47,代码来源:VPMGraphView.java


示例9: simulate_graph

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
public Viewer simulate_graph(File graph_file)
{
	gs = new GraphSim("PageRankGraph");

	// Import vertices/edges to start and init/display graph
	gs.importGraph(graph_file);

	gs.initSim();



	//Comment out these 2 lines for no animate
	gs.process();

	return gs.get_display();


}
 
开发者ID:TeamCohen,项目名称:VisualGraph,代码行数:19,代码来源:MainLogic.java


示例10: loadGraph

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
public void loadGraph()
{
	if (graph_file != null)
	{
		// close event listener for mouse first before removing view 
		// in next step
		if (clisten!=null)
		{
			clisten.viewClosed(null);
		}
		// Remove view if exists
		if (vw!=null)
		{
			jfrm.remove(vw);
		}

		//This is a sort of wrapper class which calls all 
		//the other methods in GraphSims and GraphSimsAlgorithm
		//the actually creates the graph and animates it
		Viewer vwr = MLogic.simulate_graph(graph_file);

		vw = vwr.addDefaultView(false);


		vw.setSize(gUIProp.width,gUIProp.height);
		vw.setLocation(gUIProp.posx, gUIProp.posy);



		// We connect back the viewer to the graph,
		// the graph becomes a sink for the viewer.
		// We also install us as a viewer listener to
		// intercept the graphic events.
		ViewerPipe fromViewer = vwr.newViewerPipe();
		clisten = new NodeClickListener(fromViewer, vw, MLogic.getGraph());
		fromViewer.addViewerListener((ViewerListener) clisten);
		vw.addMouseWheelListener(this);
		vw.addMouseMotionListener(this);


		// Add in frame
		jfrm.add(vw,BorderLayout.LINE_START);


	} 
	else
	{
		JOptionPane.showMessageDialog(jfrm,
				"Please select a graph!",
				"No graph selected!",
				JOptionPane.WARNING_MESSAGE);
	}
}
 
开发者ID:TeamCohen,项目名称:VisualGraph,代码行数:54,代码来源:ControlUI.java


示例11: getGraphViewer

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
public Viewer getGraphViewer() {
	return graphViewer;
}
 
开发者ID:fabiogermann,项目名称:zhaw-facepath,代码行数:4,代码来源:FacebookNetwork.java


示例12: setGraphViewer

import org.graphstream.ui.swingViewer.Viewer; //导入依赖的package包/类
public void setGraphViewer(Viewer graphViewer) {
	this.graphViewer = graphViewer;
	graphViewer.enableAutoLayout();
}
 
开发者ID:fabiogermann,项目名称:zhaw-facepath,代码行数:5,代码来源:FacebookNetwork.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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