Class VertexLabelAsShapeRenderer<V,E>
- java.lang.Object
-
- org.jungrapht.visualization.renderers.VertexLabelAsShapeRenderer<V,E>
-
- Type Parameters:
V
- the vertex typeE
- the edge type
- All Implemented Interfaces:
Function<V,Shape>
,Renderer.VertexLabel<V,E>
public class VertexLabelAsShapeRenderer<V,E> extends Object implements Renderer.VertexLabel<V,E>, Function<V,Shape>
Renders Vertex Labels, but can also supply Shapes for vertices. This has the effect of making the vertex label the actual vertex shape. The user will probably want to center the vertex label on the vertex location.- Author:
- Tom Nelson
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.renderers.Renderer.VertexLabel
Renderer.VertexLabel.NOOP<V,E>, Renderer.VertexLabel.Position, Renderer.VertexLabel.Positioner
-
-
Field Summary
Fields Modifier and Type Field Description protected LayoutModel<V>
layoutModel
protected RenderContext<V,E>
renderContext
protected Map<V,Shape>
shapes
-
Constructor Summary
Constructors Constructor Description VertexLabelAsShapeRenderer(LayoutModel<V> layoutModel, RenderContext<V,E> rc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Shape
apply(V v)
Renderer.VertexLabel.Position
getPosition()
Renderer.VertexLabel.Positioner
getPositioner()
void
labelVertex(RenderContext<V,E> renderContext, LayoutModel<V> layoutModel, V v, String label)
Labels the specified vertex with the specified label.Component
prepareRenderer(RenderContext<V,E> rc, Object value, boolean isSelected, V vertex)
void
setPosition(Renderer.VertexLabel.Position position)
void
setPositioner(Renderer.VertexLabel.Positioner positioner)
-
-
-
Field Detail
-
layoutModel
protected final LayoutModel<V> layoutModel
-
renderContext
protected final RenderContext<V,E> renderContext
-
-
Constructor Detail
-
VertexLabelAsShapeRenderer
public VertexLabelAsShapeRenderer(LayoutModel<V> layoutModel, RenderContext<V,E> rc)
-
-
Method Detail
-
prepareRenderer
public Component prepareRenderer(RenderContext<V,E> rc, Object value, boolean isSelected, V vertex)
-
labelVertex
public void labelVertex(RenderContext<V,E> renderContext, LayoutModel<V> layoutModel, V v, String label)
Labels the specified vertex with the specified label. Uses the font specified by this instance'sVertexFontFunction
. (If the font is unspecified, the existing font for the graphics context is used.) If vertex label centering is active, the label is centered on the position of the vertex; otherwise the label is offset slightly.- Specified by:
labelVertex
in interfaceRenderer.VertexLabel<V,E>
-
getPosition
public Renderer.VertexLabel.Position getPosition()
-
getPositioner
public Renderer.VertexLabel.Positioner getPositioner()
- Specified by:
getPositioner
in interfaceRenderer.VertexLabel<V,E>
-
setPosition
public void setPosition(Renderer.VertexLabel.Position position)
-
setPositioner
public void setPositioner(Renderer.VertexLabel.Positioner positioner)
- Specified by:
setPositioner
in interfaceRenderer.VertexLabel<V,E>
-
-