當前位置: 首頁>>代碼示例>>Java>>正文


Java Layout.getSize方法代碼示例

本文整理匯總了Java中edu.uci.ics.jung.algorithms.layout.Layout.getSize方法的典型用法代碼示例。如果您正苦於以下問題:Java Layout.getSize方法的具體用法?Java Layout.getSize怎麽用?Java Layout.getSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.uci.ics.jung.algorithms.layout.Layout的用法示例。


在下文中一共展示了Layout.getSize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeGraph

import edu.uci.ics.jung.algorithms.layout.Layout; //導入方法依賴的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

示例2: setLtoR

import edu.uci.ics.jung.algorithms.layout.Layout; //導入方法依賴的package包/類
private void setLtoR(VisualizationViewer<String,Integer> vv) {
	Layout<String,Integer> layout = vv.getModel().getGraphLayout();
	Dimension d = layout.getSize();
	Point2D center = new Point2D.Double(d.width/2, d.height/2);
	vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).rotate(-Math.PI/2, center);
}
 
開發者ID:marcvanzee,項目名稱:mdp-plan-revision,代碼行數:7,代碼來源:L2RTreeLayoutDemo.java


注:本文中的edu.uci.ics.jung.algorithms.layout.Layout.getSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。