本文整理汇总了Java中edu.uci.ics.jung.visualization.renderers.VertexLabelAsShapeRenderer类的典型用法代码示例。如果您正苦于以下问题:Java VertexLabelAsShapeRenderer类的具体用法?Java VertexLabelAsShapeRenderer怎么用?Java VertexLabelAsShapeRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VertexLabelAsShapeRenderer类属于edu.uci.ics.jung.visualization.renderers包,在下文中一共展示了VertexLabelAsShapeRenderer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: StateVisualizer
import edu.uci.ics.jung.visualization.renderers.VertexLabelAsShapeRenderer; //导入依赖的package包/类
public StateVisualizer() {
super("Model Visualizer");
graph = new DirectedSparseMultigraph<>();
graph.addVertex(current);
// Layout<FSMTransition, String> layout = new CircleLayout<FSMTransition, String>(graph);
layout = new KKLayout<>(graph);
layout.setSize(new Dimension(800, 600)); // sets the initial size of the space
vv = new VisualizationViewer<>(layout);
vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
VertexLabelAsShapeRenderer<String, StepCounter> vlasr = new VertexLabelAsShapeRenderer<>(vv.getRenderContext());
// vv.getRenderContext().setVertexShapeTransformer(vlasr);
vv.getRenderContext().setVertexShapeTransformer(new EllipseVertexTransformer());
// vv.getRenderContext().setVertexLabelRenderer(new TransitionVertextLabelRenderer(Color.GREEN));
DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
vv.addKeyListener(gm.getModeKeyListener());
gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
vv.setGraphMouse(gm);
getContentPane().add(vv);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1024, 768);
pack();
setVisible(true);
}
开发者ID:mukatee,项目名称:osmo,代码行数:27,代码来源:StateVisualizer.java
示例2: FSMBuildVisualizer
import edu.uci.ics.jung.visualization.renderers.VertexLabelAsShapeRenderer; //导入依赖的package包/类
public FSMBuildVisualizer() {
super("Model Visualizer");
graph = new DirectedSparseMultigraph<>();
graph.addVertex(current);
// Layout<FSMTransition, String> layout = new CircleLayout<FSMTransition, String>(graph);
layout = new KKLayout<>(graph);
layout.setSize(new Dimension(800, 600)); // sets the initial size of the space
vv = new VisualizationViewer<>(layout);
vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
VertexLabelAsShapeRenderer<String, StepCounter> vlasr = new VertexLabelAsShapeRenderer<>(vv.getRenderContext());
// vv.getRenderContext().setVertexShapeTransformer(vlasr);
vv.getRenderContext().setVertexShapeTransformer(new EllipseVertexTransformer());
// vv.getRenderContext().setVertexLabelRenderer(new TransitionVertextLabelRenderer(Color.GREEN));
DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
vv.addKeyListener(gm.getModeKeyListener());
gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
vv.setGraphMouse(gm);
getContentPane().add(vv);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1024, 768);
pack();
setVisible(true);
}
开发者ID:mukatee,项目名称:osmo,代码行数:27,代码来源:FSMBuildVisualizer.java
示例3: createGraphComponent
import edu.uci.ics.jung.visualization.renderers.VertexLabelAsShapeRenderer; //导入依赖的package包/类
private JComponent createGraphComponent() {
Graph<State, TransitionEdge> graph = new DirectedSparseGraph<>();
Layout<State, TransitionEdge> layout = new StaticLayout<>(graph, new ReachGraphInitializer(graph.getVertices()));
visualizationViewer = new VisualizationViewer<>(layout);
DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
visualizationViewer.setGraphMouse(gm);
VertexLabelAsShapeRenderer<State, TransitionEdge> vertexRenderer = new VertexLabelAsShapeRenderer<>(visualizationViewer.getRenderContext());
// vertices
visualizationViewer.getRenderContext().setVertexLabelTransformer(state -> {
StringBuilder sb = new StringBuilder();
for (Integer token : state.getMarking().values()) {
sb.append(token == -1 ? "\u221E" : token).append(",");
}
if (sb.length() > 0) sb.setLength(sb.length() - 1);
return sb.toString();
});
visualizationViewer.getRenderContext().setVertexShapeTransformer(vertexRenderer);
visualizationViewer.getRenderContext().setVertexFillPaintTransformer(s -> {
if (!visualizationViewer.getPickedVertexState().getPicked().isEmpty())
return visualizationViewer.getPickedVertexState().isPicked(s) ? ACTIVE_VERTEX_FILL_COLOR : INACTIVE_VERTEX_FILL_COLOR;
return VERTEX_FILL_COLOR;
});
visualizationViewer.getRenderContext().setVertexFontTransformer(s -> FONT);
visualizationViewer.getRenderer().setVertexLabelRenderer(vertexRenderer);
// edges
visualizationViewer.getRenderContext().setEdgeLabelTransformer(transition -> "T" + transition.getTransition().getId());
visualizationViewer.getRenderContext().setEdgeShapeTransformer(new EdgeShape.CubicCurve<>());
visualizationViewer.getRenderContext().setEdgeDrawPaintTransformer(this::getEdgeColor);
visualizationViewer.getRenderContext().setArrowDrawPaintTransformer(this::getEdgeColor);
visualizationViewer.getRenderContext().setArrowFillPaintTransformer(this::getEdgeColor);
visualizationViewer.getRenderContext().setEdgeFontTransformer(s -> FONT);
visualizationViewer.getRenderContext().getEdgeLabelRenderer().setRotateEdgeLabels(false);
ReachGraphEdgeLabelRenderer<State, TransitionEdge> reachGraphEdgeLabelRenderer = new ReachGraphEdgeLabelRenderer<>(this::getEdgeColor);
visualizationViewer.getRenderer().setEdgeLabelRenderer(reachGraphEdgeLabelRenderer);
visualizationViewer.setBackground(GRAPH_BACKGROUND);
addComponentListener(new AbstractResizeComponentListener() {
@Override
public void componentResized(ComponentEvent e) {
Dimension size = e.getComponent().getSize();
layout.setSize(size);
}
});
ReachGraphMouseListener graphMouseListener = new ReachGraphMouseListener(visualizationViewer, new StatePickedListener(graphService), this);
visualizationViewer.addMouseListener(graphMouseListener);
visualizationViewer.addGraphMouseListener(graphMouseListener);
return visualizationViewer;
}
开发者ID:tomaszi1,项目名称:petri-nets-simulator,代码行数:59,代码来源:ReachabilityGraphPanel.java
示例4: CustomQueryView
import edu.uci.ics.jung.visualization.renderers.VertexLabelAsShapeRenderer; //导入依赖的package包/类
/**
* Initializer
*
* @param inVdat VarData Object
*/
public CustomQueryView(VarData inVdat, VarSifter inGui) {
vdat = inVdat;
gui = inGui;
String[] origSampleNames = vdat.returnSampleNames(); // The original names - DON'T CHANGE THIS!!
sampleNames = new String[origSampleNames.length];
annotNames = vdat.returnDataNames();
dataTypeAt = vdat.returnDataTypeAt();
sampleIndexOf = new HashMap<String,Integer>(origSampleNames.length);
annoSize = dataTypeAt.size();
annotMap = vdat.returnAnnotMap();
for (int i=0; i<origSampleNames.length; i++) {
String n = origSampleNames[i];
sampleIndexOf.put(n, i);
sampleNames[i] = n;
}
graph = new DelegateForest<CustomVertex,Integer>();
layout = new TreeLayout<CustomVertex,Integer>(graph);
vv = new VisualizationViewer<CustomVertex,Integer>(layout);
VertexLabelAsShapeRenderer<CustomVertex,Integer> vlasr = new
VertexLabelAsShapeRenderer<CustomVertex,Integer>(vv.getRenderContext());
vv.getRenderContext().setVertexLabelTransformer(
new ChainedTransformer<CustomVertex,String>(new Transformer[]{
new ToStringLabeller<String>(),
new Transformer<String,String>() {
public String transform(String input) {
return "<html><center>"+input;
}
}
}));
vv.getRenderContext().setVertexShapeTransformer(vlasr);
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
vv.getRenderer().setVertexLabelRenderer(vlasr);
final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
modeBox = graphMouse.getModeComboBox();
modeBox.setMaximumSize(modeBox.getPreferredSize());
modeBox.addItemListener(graphMouse.getModeListener());
graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
vv.setGraphMouse(graphMouse);
String out = "";
sampleList = new JList(sampleNames);
annotList = new JList(annotNames);
initQuery();
initTable();
}
开发者ID:teerjk,项目名称:VarSifter,代码行数:56,代码来源:CustomQueryView.java
示例5: render
import edu.uci.ics.jung.visualization.renderers.VertexLabelAsShapeRenderer; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void render(Node tree) {
// Grafo
Factory<DirectedGraph<Node, Integer>> factory = DirectedOrderedSparseMultigraph
.<Node, Integer> getFactory();
graph = new DelegateTree<Node, Integer>(factory);
// Adiciona os v�rtices ao grafo
graph.addVertex(tree);
build(tree);
// Layout
TreeLayout<Node, Integer> layout = new TreeLayout<Node, Integer>(graph,
75, 50);
// Visualiza��o
VisualizationViewer<Node, Integer> vv = new VisualizationViewer<Node, Integer>(
layout);
VertexLabelAsShapeRenderer<Node, Integer> vlasr = new VertexLabelAsShapeRenderer<Node, Integer>(
vv.getRenderContext());
/* V�rtices */
// Cor da borda
vv.getRenderContext().setVertexDrawPaintTransformer(
new ConstantTransformer(Color.black));
// Cor de fundo
vv.getRenderContext().setVertexFillPaintTransformer(
new ConstantTransformer(Color.lightGray));
// R�tulo como string
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
// Formato retangular
vv.getRenderContext().setVertexShapeTransformer(vlasr);
// Posiciona texto dentro
vv.getRenderer().setVertexLabelRenderer(vlasr);
/* Arestas */
// Remove a seta da aresta
vv.getRenderContext().setEdgeArrowPredicate(
new Predicate<Context<Graph<Node, Integer>, Integer>>() {
@Override
public boolean evaluate(
Context<Graph<Node, Integer>, Integer> arg0) {
return false;
}
});
// Formato da linha
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
// Habilita suporte ao mouse
final DefaultModalGraphMouse<Node, Integer> graphMouse = new DefaultModalGraphMouse<Node, Integer>();
vv.setGraphMouse(graphMouse);
// Cria a janela do JFrame
JFrame jf = new JFrame();
jf.getContentPane().add(vv);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setTitle("Abstract Syntax Tree");
jf.pack();
jf.setExtendedState(JFrame.MAXIMIZED_BOTH);
jf.setVisible(true);
}
开发者ID:navossoc,项目名称:minipascal,代码行数:62,代码来源:AST.java
注:本文中的edu.uci.ics.jung.visualization.renderers.VertexLabelAsShapeRenderer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论