edu.uci.ics.jung.visualization.renderers.Renderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jung-visualization Show documentation
Show all versions of jung-visualization Show documentation
Core visualization support for the JUNG project
The newest version!
/*
* Copyright (c) 2003, The JUNG Authors
*
* All rights reserved.
*
* This software is open-source under the BSD license; see either
* "license.txt" or
* https://github.com/jrtom/jung/blob/master/LICENSE for a description.
*/
package edu.uci.ics.jung.visualization.renderers;
import java.awt.Dimension;
import edu.uci.ics.jung.algorithms.layout.Layout;
import edu.uci.ics.jung.visualization.RenderContext;
/**
* The interface for drawing vertices, edges, and their labels.
* Implementations of this class can set specific renderers for
* each element, allowing custom control of each.
*/
public interface Renderer {
void render(RenderContext rc, Layout layout);
void renderVertex(RenderContext rc, Layout layout, V v);
void renderVertexLabel(RenderContext rc, Layout layout, V v);
void renderEdge(RenderContext rc, Layout layout, E e);
void renderEdgeLabel(RenderContext rc, Layout layout, E e);
void setVertexRenderer(Renderer.Vertex r);
void setEdgeRenderer(Renderer.Edge r);
void setVertexLabelRenderer(Renderer.VertexLabel r);
void setEdgeLabelRenderer(Renderer.EdgeLabel r);
Renderer.VertexLabel getVertexLabelRenderer();
Renderer.Vertex getVertexRenderer();
Renderer.Edge getEdgeRenderer();
Renderer.EdgeLabel getEdgeLabelRenderer();
interface Vertex {
void paintVertex(RenderContext rc, Layout layout, V v);
@SuppressWarnings("rawtypes")
class NOOP implements Vertex {
public void paintVertex(RenderContext rc, Layout layout, Object v) {}
};
}
interface Edge {
void paintEdge(RenderContext rc, Layout layout, E e);
EdgeArrowRenderingSupport getEdgeArrowRenderingSupport();
void setEdgeArrowRenderingSupport(EdgeArrowRenderingSupport edgeArrowRenderingSupport);
@SuppressWarnings("rawtypes")
class NOOP implements Edge {
public void paintEdge(RenderContext rc, Layout layout, Object e) {}
public EdgeArrowRenderingSupport getEdgeArrowRenderingSupport(){return null;}
public void setEdgeArrowRenderingSupport(EdgeArrowRenderingSupport edgeArrowRenderingSupport){}
}
}
interface VertexLabel {
void labelVertex(RenderContext rc, Layout layout, V v, String label);
Position getPosition();
void setPosition(Position position);
void setPositioner(Positioner positioner);
Positioner getPositioner();
@SuppressWarnings("rawtypes")
class NOOP implements VertexLabel {
public void labelVertex(RenderContext rc, Layout layout, Object v, String label) {}
public Position getPosition() { return Position.CNTR; }
public void setPosition(Position position) {}
public Positioner getPositioner() {
return new Positioner() {
public Position getPosition(float x, float y, Dimension d) {
return Position.CNTR;
}};
}
public void setPositioner(Positioner positioner) {
}
}
enum Position { N, NE, E, SE, S, SW, W, NW, CNTR, AUTO }
interface Positioner {
Position getPosition(float x, float y, Dimension d);
}
}
interface EdgeLabel {
void labelEdge(RenderContext rc, Layout layout, E e, String label);
@SuppressWarnings("rawtypes")
class NOOP implements EdgeLabel {
public void labelEdge(RenderContext rc, Layout layout, Object e, String label) {}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy