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


Java VisualizationImageServer.setBackground方法代码示例

本文整理汇总了Java中edu.uci.ics.jung.visualization.VisualizationImageServer.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java VisualizationImageServer.setBackground方法的具体用法?Java VisualizationImageServer.setBackground怎么用?Java VisualizationImageServer.setBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.uci.ics.jung.visualization.VisualizationImageServer的用法示例。


在下文中一共展示了VisualizationImageServer.setBackground方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visualizeGraphAndDumpToFile

import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入方法依赖的package包/类
void visualizeGraphAndDumpToFile(String fileName){
	Layout<Integer,Integer> l = new KKLayout<Integer,Integer>( assocG);
	VisualizationImageServer<Integer, Integer> vis =
		    new VisualizationImageServer<Integer, Integer>(l, new Dimension(1200,1200));
	vis.setBackground(Color.WHITE);
	
	// Create the buffered image
	BufferedImage image = (BufferedImage) vis.getImage (
	    new Point2D.Double(l.getSize().getWidth() / 2,
	    l.getSize().getHeight() / 2),
	    new Dimension(l.getSize()));

	// Write image to a png file
	File outputfile = new File(fileName);

	try {
	    ImageIO.write(image, "png", outputfile);
	
	} catch (IOException e) {
	    // Exception handling
		e.printStackTrace();
		System.exit(1);
	}

}
 
开发者ID:sriram0339,项目名称:FixrAssociationRuleMining,代码行数:26,代码来源:AssociationRuleGraph.java

示例2: writeServerJPEGImage

import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入方法依赖的package包/类
public void writeServerJPEGImage(File file) {
    VisualizationImageServer<Vertex, Edge> vis = new VisualizationImageServer<Vertex, Edge>(vv.getGraphLayout(), vv.getGraphLayout().getSize());
    vis.setBackground(Color.WHITE);
    vis.getRenderContext().setEdgeDrawPaintTransformer(edgeColor);
    vis.getRenderContext().setVertexIconTransformer(vertexColor);

    BufferedImage image = (BufferedImage) vis.getImage(
            new Point2D.Double(vis.getWidth(), vis.getHeight()),
            new Dimension(vv.getGraphLayout().getSize()));

    try {
        ImageIO.write(image, "jpeg", file);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:17,代码来源:DrawnIconVertexDemo.java

示例3: getExportImage

import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入方法依赖的package包/类
@Override
protected BufferedImage getExportImage() {

	Dimension d = view.getGraphLayout().getSize();
	d.setSize( d.getWidth() * 1.2, d.getHeight() * 1.2 );

	VisualizationImageServer<SEMOSSVertex, SEMOSSEdge> vis
			= new VisualizationImageServer<>( view.getGraphLayout(), d );

	vis.setBackground( view.getBackground() );
	vis.setRenderContext( view.getRenderContext() );

	try {
		// the visualization server seems to take a little time to render
		// correctly. Wait a little before processing the image
		// (this is really just voodoo...I don't know if/why it works)
		Thread.sleep( 500 );
	}
	catch ( Exception e ) {
		log.error( e, e );
	}

	BufferedImage image = (BufferedImage) vis.getImage(
			new Point2D.Double( view.getGraphLayout().getSize().getWidth(),
					view.getGraphLayout().getSize().getHeight() ),
			new Dimension( view.getGraphLayout().getSize() ) );
	return image;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:29,代码来源:GraphPlaySheet.java

示例4: writeGraph

import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入方法依赖的package包/类
/**
 * Writes a graph as a PNG image.
 * @param outputFile the output file
 * @param selectedComponent the component to highlight
 * @param layout the layout
 * @param graph the graph
 * @param edgeShapeTransformer the transformer for edge shapes (straight line, curved line, etc)
 * @throws IOException if something went wrong
 */
public static void writeGraph(
		File outputFile,
		Component selectedComponent,
		Layout<AbstractType,String> layout,
		Graph<AbstractType,String> graph ,
		AbstractEdgeShapeTransformer<AbstractType,String> edgeShapeTransformer,
		Map<String,String> options )
throws IOException {

	VisualizationImageServer<AbstractType,String> vis =
			new VisualizationImageServer<AbstractType,String>( layout, layout.getSize());

	vis.setBackground( Color.WHITE );
	vis.getRenderContext().setEdgeLabelTransformer( new NoStringLabeller ());
	vis.getRenderContext().setEdgeShapeTransformer( edgeShapeTransformer );

	vis.getRenderContext().setVertexLabelTransformer( new ToStringLabeller<AbstractType> ());
	vis.getRenderContext().setVertexShapeTransformer( new VertexShape());
	vis.getRenderContext().setVertexFontTransformer( new VertexFont());

	Color defaultBgColor = decode( options.get( DocConstants.OPTION_IMG_BACKGROUND_COLOR ), DocConstants.DEFAULT_BACKGROUND_COLOR );
	Color highlightBgcolor = decode( options.get( DocConstants.OPTION_IMG_HIGHLIGHT_BG_COLOR ), DocConstants.DEFAULT_HIGHLIGHT_BG_COLOR );
	vis.getRenderContext().setVertexFillPaintTransformer( new VertexColor( selectedComponent, defaultBgColor, highlightBgcolor ));

	Color defaultFgColor = decode( options.get( DocConstants.OPTION_IMG_FOREGROUND_COLOR ), DocConstants.DEFAULT_FOREGROUND_COLOR );
	vis.getRenderContext().setVertexLabelRenderer( new MyVertexLabelRenderer( selectedComponent, defaultFgColor ));
	vis.getRenderer().getVertexLabelRenderer().setPosition( Position.CNTR );

	BufferedImage image = (BufferedImage) vis.getImage(
			new Point2D.Double(
					layout.getSize().getWidth() / 2,
					layout.getSize().getHeight() / 2),
			new Dimension( layout.getSize()));

	ImageIO.write( image, "png", outputFile );
}
 
开发者ID:roboconf,项目名称:roboconf-platform,代码行数:46,代码来源:GraphUtils.java

示例5: getVisualizationServer

import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入方法依赖的package包/类
@Override
public VisualizationImageServer<V, Edge<V>> getVisualizationServer(boolean toSvg) {
	VisualizationImageServer<V, Edge<V>> server = new VisualizationImageServer<>(viewer.getGraphLayout(),
			viewer.getSize());

	server.setBackground(Color.WHITE);
	server.setRenderContext(viewer.getRenderContext());
	server.setRenderer(viewer.getRenderer());
	server.addPostRenderPaintable(new PostPaintable());

	return server;
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:13,代码来源:Canvas.java


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