本文整理汇总了Java中edu.uci.ics.jung.visualization.VisualizationImageServer类的典型用法代码示例。如果您正苦于以下问题:Java VisualizationImageServer类的具体用法?Java VisualizationImageServer怎么用?Java VisualizationImageServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisualizationImageServer类属于edu.uci.ics.jung.visualization包,在下文中一共展示了VisualizationImageServer类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getServer
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
/**
* @param args the command line arguments
* @return
*/
public VisualizationImageServer<Integer, String> getServer() {
// Layout<V, E>, VisualizationComponent<V,E>
Layout<Integer, String> layout = new CircleLayout<>(
this);
layout.setSize(new Dimension(300, 300));
VisualizationImageServer<Integer, String> vv = new VisualizationImageServer<>(
layout, new Dimension(350, 350));
// Setup up a new vertex to paint transformer...
// Set up a new stroke Transformer for the edges
float dash[] = {10.0f};
final Stroke edgeStroke = new BasicStroke(1.0f,
BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash,
0.0f);
vv.getRenderContext().setVertexFillPaintTransformer(i -> Color.GREEN);
vv.getRenderContext().setEdgeStrokeTransformer(
s -> edgeStroke);
vv.getRenderContext().setVertexLabelTransformer(
new ToStringLabeller());
vv.getRenderContext().setEdgeLabelTransformer(
new ToStringLabeller());
vv.getRenderer().getVertexLabelRenderer()
.setPosition(Position.CNTR);
return vv;
}
开发者ID:mstahv,项目名称:svgexamples,代码行数:30,代码来源:JungExample.java
示例2: 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
示例3: 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
示例4: getImage
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
private static BufferedImage getImage(VisualizationImageServer<Integer, Edge> vv, Point2D center, Dimension d) {
int width = vv.getWidth();
int height = vv.getHeight();
float scalex = (float) width / d.width;
float scaley = (float) height / d.height;
try {
vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW).scale(scalex, scaley, center);
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = bi.createGraphics();
graphics.setRenderingHints(vv.getRenderingHints());
vv.paint(graphics);
graphics.dispose();
return bi;
} finally {
vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW).setToIdentity();
}
}
开发者ID:dmyersturnbull,项目名称:network_merge,代码行数:20,代码来源:GraphImageWriter.java
示例5: 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
示例6: VisualizationImageServerDemo
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
/**
*
*/
public VisualizationImageServerDemo() {
// create a simple graph for the demo
graph = new DirectedSparseMultigraph<String, Number>();
String[] v = createVertices(10);
createEdges(v);
vv = new VisualizationImageServer<String,Number>(new KKLayout<String,Number>(graph), new Dimension(600,600));
vv.getRenderer().setVertexRenderer(
new GradientVertexRenderer<String,Number>(
Color.white, Color.red,
Color.white, Color.blue,
vv.getPickedVertexState(),
false));
vv.getRenderContext().setEdgeDrawPaintTransformer(new ConstantTransformer(Color.lightGray));
vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
vv.getRenderContext().setArrowDrawPaintTransformer(new ConstantTransformer(Color.lightGray));
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner());
vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);
// create a frome to hold the graph
final JFrame frame = new JFrame();
Container content = frame.getContentPane();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Image im = vv.getImage(new Point2D.Double(300,300), new Dimension(600,600));
Icon icon = new ImageIcon(im);
JLabel label = new JLabel(icon);
content.add(label);
frame.pack();
frame.setVisible(true);
}
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:40,代码来源:VisualizationImageServerDemo.java
示例7: 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
示例8: getVisualizationServer
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
@Override
public VisualizationImageServer<V, Edge<V>> getVisualizationServer(boolean toSvg) {
VisualizationImageServer<V, Edge<V>> server = super.getVisualizationServer(toSvg);
server.addPostRenderPaintable(new PostPaintable());
return server;
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:9,代码来源:OsmCanvas.java
示例9: 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
示例10: getVisualizationServer
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
@Override
public VisualizationImageServer<V, Edge<V>> getVisualizationServer(boolean toSvg) {
VisualizationImageServer<V, Edge<V>> server = super.getVisualizationServer(toSvg);
server.addPreRenderPaintable(new PrePaintable(toSvg));
return server;
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:9,代码来源:GisCanvas.java
示例11: getVisualizationServer
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
@Override
public VisualizationImageServer<GraphNode, Edge<GraphNode>> getVisualizationServer(boolean toSvg) {
VisualizationImageServer<GraphNode, Edge<GraphNode>> server = super.getVisualizationServer(toSvg);
server.addPostRenderPaintable(new TracingDelegate.PostPaintable(this));
return server;
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:9,代码来源:TracingGraphCanvas.java
示例12: getVisualizationServer
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
@Override
public VisualizationImageServer<LocationNode, Edge<LocationNode>> getVisualizationServer(boolean toSvg) {
VisualizationImageServer<LocationNode, Edge<LocationNode>> server = super.getVisualizationServer(toSvg);
server.addPostRenderPaintable(new ExplosionCanvasUtils.LabelPaintable(this.getViewer(),this.metaNodeId));
return server;
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:8,代码来源:ExplosionTracingShapefileCanvas.java
示例13: getVisualizationServer
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
@Override
public VisualizationImageServer<LocationNode, Edge<LocationNode>> getVisualizationServer(boolean toSvg) {
VisualizationImageServer<LocationNode, Edge<LocationNode>> server = super.getVisualizationServer(toSvg);
server.addPostRenderPaintable(new TracingDelegate.PostPaintable(this));
return server;
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:9,代码来源:TracingShapefileCanvas.java
示例14: getVisualizationServer
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
@Override
public VisualizationImageServer<GraphNode, Edge<GraphNode>> getVisualizationServer(boolean toSvg) {
VisualizationImageServer<GraphNode, Edge<GraphNode>> server = super.getVisualizationServer(toSvg);
server.addPreRenderPaintable(new PrePaintable(toSvg));
server.addPostRenderPaintable(new ExplosionCanvasUtils.LabelPaintable(this.getViewer(),this.metaNodeId));
return server;
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:9,代码来源:ExplosionTracingGraphCanvas.java
示例15: JungExample
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
public JungExample() {
setCaption("Graph using JUNG");
addComponent(new Label(
"This graphic is created with JUNG and made to SVG with Batik."));
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docBuilder = null;
docBuilder = docBuilderFactory.newDocumentBuilder();
Document document = docBuilder.newDocument();
Element svgelem = document.createElement("svg");
document.appendChild(svgelem);
// Create an instance of the SVG Generator
SVGGraphics2D graphic2d = new SVGGraphics2D(document);
VisualizationImageServer<Integer, String> server = new SimpleGraphView2()
.getServer();
server.printAll(graphic2d);
// svgweb (IE fallback) needs size somehow defined
Element el = graphic2d.getRoot();
el.setAttributeNS(null, "viewBox", "0 0 350 350");
el.setAttributeNS(null, "style", "width:100%;height:100%;");
// Finally, stream out SVG to the standard output using
// UTF-8 encoding.
boolean useCSS = true; // we want to use CSS style attributes
ByteArrayOutputStream bout = new ByteArrayOutputStream();
Writer out = new OutputStreamWriter(bout, "UTF-8");
graphic2d.stream(el, out, useCSS, false);
Embedded svgComponent = new Embedded();
svgComponent.setWidth(350, Unit.PIXELS);
svgComponent.setHeight(350, Unit.PIXELS);
Resource svg = new StreamResource(() -> new ByteArrayInputStream(bout.toByteArray()), "graphics.svg");
svgComponent.setSource(svg);
addComponent(svgComponent);
} catch (Exception e1) {
throw new RuntimeException(e1);
}
}
开发者ID:mstahv,项目名称:svgexamples,代码行数:47,代码来源:JungExample.java
示例16: writeImage
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
private void writeImage(VisualizationImageServer<Integer, Edge> vv, File file) throws IOException {
Dimension dim = new Dimension(width, height);
Point2D center = new Point2D.Double(width / 2.0 - xMargin / 2.0, height / 2.0 - yMargin / 2.0);
BufferedImage image = getImage(vv, center, dim);
ImageIO.write(image, "png", file);
}
开发者ID:dmyersturnbull,项目名称:network_merge,代码行数:7,代码来源:GraphImageWriter.java
示例17: getVisualizationServer
import edu.uci.ics.jung.visualization.VisualizationImageServer; //导入依赖的package包/类
VisualizationImageServer<V, Edge<V>> getVisualizationServer(boolean toSvg);
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:2,代码来源:ICanvas.java
注:本文中的edu.uci.ics.jung.visualization.VisualizationImageServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论