edu.uci.ics.jung.visualization.renderers.Renderer类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(12.6k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中edu.uci.ics.jung.visualization.renderers.Renderer类的一些代码示例,展示了Renderer类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Renderer类的具体详情如下:
包路径:edu.uci.ics.jung.visualization.renderers.Renderer
类名称:Renderer

Renderer介绍

[英]The interface for drawing nodes, edges, and their labels. Implementations of this class can set specific renderers for each element, allowing custom control of each.
[中]用于绘制节点、边及其标签的界面。这个类的实现可以为每个元素设置特定的渲染器,允许对每个元素进行自定义控制。

代码示例

代码示例来源:origin: net.automatalib/automata-jung-visualizer

public static void setupRenderer(Renderer<NodeVisualization, EdgeVisualization> renderer) {
  renderer.getVertexLabelRenderer().setPosition(Position.AUTO);
}

代码示例来源:origin: net.sf.jung/jung-samples

vv.getRenderer().setVertexRenderer(new GradientVertexRenderer<String,Number>(Color.gray, Color.white, true));
vv.getRenderer().setVertexLabelRenderer(vlasr);

代码示例来源:origin: net.sf.jung/jung-jai

/**
   * create the base class, setting common members and creating
   * a custom GraphMouse
   * @param vv the VisualizationViewer to work on
   */
  public HyperbolicImageLensSupport(VisualizationViewer<V,E> vv, LensTransformer lensTransformer,
      ModalGraphMouse lensGraphMouse) {
    super(vv, lensGraphMouse);
    this.renderContext = vv.getRenderContext();
    this.pickSupport = renderContext.getPickSupport();
    this.renderer = vv.getRenderer();
    this.transformingRenderer = new BasicRenderer<V,E>();
    this.transformingRenderer.setVertexRenderer(new TransformingImageVertexIconRenderer<V,E>());
    
    this.savedGraphicsDecorator = renderContext.getGraphicsContext();
    this.lensTransformer = lensTransformer;
    this.savedEdgeRenderer = vv.getRenderer().getEdgeRenderer();
    this.reshapingEdgeRenderer = new ReshapingEdgeRenderer<V,E>();
    this.reshapingEdgeRenderer.setEdgeArrowRenderingSupport(savedEdgeRenderer.getEdgeArrowRenderingSupport());

    Dimension d = vv.getSize();
//        if(d.width == 0 || d.height == 0) {
//            d = vv.getPreferredSize();
//        }
    lensTransformer.setViewRadius(d.width/5);
    this.lensGraphicsDecorator = new TransformingFlatnessGraphics(lensTransformer);

  }

代码示例来源:origin: net.sf.jung/jung-samples

vv.getRenderer().setVertexRenderer(
    new GradientVertexRenderer<String,Number>(
        Color.white, Color.red, 
vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner());
vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);

代码示例来源:origin: com.github.davidmoten/state-diagram-viewer

vv.getRenderContext().setVertexDrawPaintTransformer(vertex -> Color.black);
vv.getRenderContext().setVertexShapeTransformer(createVertexShapeTransformer(layout));
vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
vv.getRenderContext().setEdgeLabelTransformer(edge -> " " + edge.name + " ");
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<String, Edge>());
vv.getRenderer().setEdgeLabelRenderer(new MyEdgeLabelRenderer<>(-10, Color.white));

代码示例来源:origin: girtel/Net2Plan

vv.getRenderer().setVertexLabelRenderer(new NodeLabelRenderer());
vv.setVertexToolTipTransformer(node -> node.getToolTip());
vv.getRenderer().setEdgeLabelRenderer(new BasicEdgeLabelRenderer<GUINode, GUILink>()

代码示例来源:origin: org.pitest/highwheel-core

public void export(final DirectedGraph<ElementName, Dependency> g)
  throws IOException {
 final Dimension d = new Dimension(this.width, this.height);
 final Layout<ElementName, Dependency> layout = pickLayout(g, d);
 final VisualizationImageServer<ElementName, Dependency> viz = new VisualizationImageServer<ElementName, Dependency>(
   layout, d);
 final RenderContext<ElementName, Dependency> context = viz
   .getRenderContext();
 context.setEdgeLabelTransformer(new EdgeLabeller());
 context.setVertexLabelTransformer(new VertexLabeller());
 final VertexRenderer vertexRenderer = new VertexRenderer(
   viz.getRenderContext());
 viz.getRenderContext().setVertexShapeTransformer(vertexRenderer);
 viz.getRenderer().setVertexLabelRenderer(vertexRenderer);
 context.setVertexFillPaintTransformer(fillVertex());
 context.setEdgeDrawPaintTransformer(fillEdge(g));
 context.setEdgeLabelClosenessTransformer(closenessTransformer());
 context.setEdgeStrokeTransformer(edgeWeight());
 context.setEdgeArrowStrokeTransformer(edgeWeight());
 context.setArrowFillPaintTransformer(fillEdge(g));
 context.setArrowDrawPaintTransformer(fillEdge(g));
 viz.setPreferredSize(new Dimension(this.width, this.height));
 viz.setBackground(new Color(1, 1, 1, 0));
 final SVGGraphics2D svgGenerator = new SVGGraphics2D(this.out, d);
 svgGenerator.writeHeader();
 viz.paintAll(svgGenerator);
 svgGenerator.writeTrailer();
 svgGenerator.dispose();
}

代码示例来源:origin: net.sf.jung/jung-visualization

public void deactivate() {
    renderContext.setPickSupport(pickSupport);
    vv.getRenderContext().getMultiLayerTransformer().setTransformer(Layer.VIEW, lensTransformer.getDelegate());
    vv.removePreRenderPaintable(lens);
    vv.removePostRenderPaintable(lensControls);
    this.renderContext.setGraphicsContext(savedGraphicsDecorator);
    vv.getRenderer().setEdgeRenderer(savedEdgeRenderer);
    vv.setToolTipText(defaultToolTipText);
    vv.setGraphMouse(graphMouse);
    vv.repaint();
  }
}

代码示例来源:origin: jrtom/jung

public ViewLensSupport(
  VisualizationViewer<N, E> vv,
  LensTransformer lensTransformer,
  ModalGraphMouse lensGraphMouse) {
 super(vv, lensGraphMouse);
 this.renderContext = vv.getRenderContext();
 this.pickSupport = renderContext.getPickSupport();
 this.savedGraphicsDecorator = renderContext.getGraphicsContext();
 this.lensTransformer = lensTransformer;
 LayoutModel layoutModel = vv.getModel().getLayoutModel();
 Dimension d = new Dimension(layoutModel.getWidth(), layoutModel.getHeight());
 lensTransformer.getLens().setSize(d);
 this.lensGraphicsDecorator = new TransformingFlatnessGraphics(lensTransformer);
 this.savedEdgeRenderer = vv.getRenderer().getEdgeRenderer();
}

代码示例来源:origin: net.sf.jung/jung-samples

vv = new VisualizationViewer<Integer,Number>(layout);
vv.getRenderer().setVertexRenderer(new CachingVertexRenderer<Integer,Number>(vv));
vv.getRenderer().setEdgeRenderer(new CachingEdgeRenderer<Integer,Number>(vv));

代码示例来源:origin: net.sf.jung/jung-samples

vv.getRenderer().setVertexRenderer(new DemoRenderer<Number,Number>());

代码示例来源:origin: net.sf.jung/jung-samples

vv.getRenderer().setVertexRenderer(
    new GradientVertexRenderer<String,Number>(
        Color.white, Color.red, 
vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner());
vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);

代码示例来源:origin: org.apache.batchee/batchee-maven-plugin

private void init() {
    setOpaque(true);
    setBackground(new Color(255, 255, 255, 0));
    final RenderContext<Node, Edge> context = getRenderContext();
    context.setVertexFillPaintTransformer(new VertexFillPaintTransformer());
    context.setVertexShapeTransformer(new VertexShapeTransformer(getFontMetrics(getFont())));
    context.setVertexLabelTransformer(new VertexLabelTransformer());
    getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    context.setEdgeLabelTransformer(new EdgeLabelTransformer());
    context.setEdgeShapeTransformer(new EdgeShape.Line<Node, Edge>());
    context.setEdgeLabelClosenessTransformer(new EdgeLabelClosenessTransformer());
    context.getEdgeLabelRenderer().setRotateEdgeLabels(rotateEdges);
    getRenderer().setEdgeLabelRenderer(new EdgeLabelRenderer());
  }
}

代码示例来源:origin: com.github.fburato/highwheel-core

public void export(final DirectedGraph<ElementName, Dependency> g)
  throws IOException {
 final Dimension d = new Dimension(this.width, this.height);
 final Layout<ElementName, Dependency> layout = pickLayout(g, d);
 final VisualizationImageServer<ElementName, Dependency> viz = new VisualizationImageServer<ElementName, Dependency>(
   layout, d);
 final RenderContext<ElementName, Dependency> context = viz
   .getRenderContext();
 context.setEdgeLabelTransformer(new EdgeLabeller());
 context.setVertexLabelTransformer(new VertexLabeller());
 final VertexRenderer vertexRenderer = new VertexRenderer(
   viz.getRenderContext());
 viz.getRenderContext().setVertexShapeTransformer(vertexRenderer);
 viz.getRenderer().setVertexLabelRenderer(vertexRenderer);
 context.setVertexFillPaintTransformer(fillVertex());
 context.setEdgeDrawPaintTransformer(fillEdge(g));
 context.setEdgeLabelClosenessTransformer(closenessTransformer());
 context.setEdgeStrokeTransformer(edgeWeight());
 context.setEdgeArrowStrokeTransformer(edgeWeight());
 context.setArrowFillPaintTransformer(fillEdge(g));
 context.setArrowDrawPaintTransformer(fillEdge(g));
 viz.setPreferredSize(new Dimension(this.width, this.height));
 viz.setBackground(new Color(1, 1, 1, 0));
 final SVGGraphics2D svgGenerator = new SVGGraphics2D(this.out, d);
 svgGenerator.writeHeader();
 viz.paintAll(svgGenerator);
 svgGenerator.writeTrailer();
 svgGenerator.dispose();
}

代码示例来源:origin: net.sf.jung/jung-visualization

public void deactivate() {
//        savedViewTransformer.setTransform(lensTransformer.getDelegate().getTransform());
//        vv.setViewTransformer(savedViewTransformer);
    renderContext.setPickSupport(pickSupport);
    vv.getRenderContext().getMultiLayerTransformer().setTransformer(Layer.VIEW, lensTransformer.getDelegate());
    vv.removePreRenderPaintable(lens);
    vv.removePostRenderPaintable(lensControls);
    this.renderContext.setGraphicsContext(savedGraphicsDecorator);
    vv.setRenderContext(renderContext);
    vv.setToolTipText(defaultToolTipText);
    vv.setGraphMouse(graphMouse);
    vv.getRenderer().setEdgeRenderer(savedEdgeRenderer);
    vv.repaint();
  }
}

代码示例来源:origin: net.sf.jung/jung-visualization

public ViewLensSupport(VisualizationViewer<V,E> vv, 
    LensTransformer lensTransformer,
    ModalGraphMouse lensGraphMouse) {
  super(vv, lensGraphMouse);
  this.renderContext = vv.getRenderContext();
  this.pickSupport = renderContext.getPickSupport();
  this.savedGraphicsDecorator = renderContext.getGraphicsContext();
  this.lensTransformer = lensTransformer;
  Dimension d = vv.getSize();
  lensTransformer.setViewRadius(d.width/5);
  this.lensGraphicsDecorator = new TransformingFlatnessGraphics(lensTransformer);
  this.savedEdgeRenderer = vv.getRenderer().getEdgeRenderer();
  this.reshapingEdgeRenderer = new ReshapingEdgeRenderer<V,E>();
  this.reshapingEdgeRenderer.setEdgeArrowRenderingSupport(savedEdgeRenderer.getEdgeArrowRenderingSupport());
}
public void activate() {

代码示例来源:origin: net.sf.jung/jung-jai

/**
 * @param vv the VisualizationViewer to work on
 */
public PerspectiveImageLensSupport(VisualizationViewer<V,E> vv) {
  super(vv);
  this.renderContext = vv.getRenderContext();
  this.pickSupport = renderContext.getPickSupport();
  this.renderer = vv.getRenderer();
  this.transformingRenderer = new BasicRenderer<V,E>();
  this.perspectiveTransformer = 
    new PerspectiveShapeTransformer(new PerspectiveTransform(), vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW));
  this.transformingRenderer.setVertexRenderer(new TransformingImageVertexIconRenderer<V,E>());
  this.lensGraphicsDecorator = new TransformingGraphics(perspectiveTransformer);
  this.savedGraphicsDecorator = renderContext.getGraphicsContext();
  this.renderer = vv.getRenderer();
}

代码示例来源:origin: LearnLib/automatalib

public static void setupRenderer(Renderer<NodeVisualization, EdgeVisualization> renderer) {
  renderer.getVertexLabelRenderer().setPosition(Position.AUTO);
}

代码示例来源:origin: net.sf.jung/jung-samples

vv.getRenderer().setVertexRenderer(
    new GradientVertexRenderer<Number,Number>(
        Color.white, Color.red, 
vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner());
vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);

代码示例来源:origin: hcoles/highwheel

public void export(final DirectedGraph<ElementName, Dependency> g)
  throws IOException {
 final Dimension d = new Dimension(this.width, this.height);
 final Layout<ElementName, Dependency> layout = pickLayout(g, d);
 final VisualizationImageServer<ElementName, Dependency> viz = new VisualizationImageServer<ElementName, Dependency>(
   layout, d);
 final RenderContext<ElementName, Dependency> context = viz
   .getRenderContext();
 context.setEdgeLabelTransformer(new EdgeLabeller());
 context.setVertexLabelTransformer(new VertexLabeller());
 final VertexRenderer vertexRenderer = new VertexRenderer(
   viz.getRenderContext());
 viz.getRenderContext().setVertexShapeTransformer(vertexRenderer);
 viz.getRenderer().setVertexLabelRenderer(vertexRenderer);
 context.setVertexFillPaintTransformer(fillVertex());
 context.setEdgeDrawPaintTransformer(fillEdge(g));
 context.setEdgeLabelClosenessTransformer(closenessTransformer());
 context.setEdgeStrokeTransformer(edgeWeight());
 context.setEdgeArrowStrokeTransformer(edgeWeight());
 context.setArrowFillPaintTransformer(fillEdge(g));
 context.setArrowDrawPaintTransformer(fillEdge(g));
 viz.setPreferredSize(new Dimension(this.width, this.height));
 viz.setBackground(new Color(1, 1, 1, 0));
 final SVGGraphics2D svgGenerator = new SVGGraphics2D(this.out, d);
 svgGenerator.writeHeader();
 viz.paintAll(svgGenerator);
 svgGenerator.writeTrailer();
 svgGenerator.dispose();
}

相关文章