本文整理汇总了Java中edu.uci.ics.jung.visualization.decorators.EdgeShape类的典型用法代码示例。如果您正苦于以下问题:Java EdgeShape类的具体用法?Java EdgeShape怎么用?Java EdgeShape使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EdgeShape类属于edu.uci.ics.jung.visualization.decorators包,在下文中一共展示了EdgeShape类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MDPDrawer
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
public MDPDrawer(MDPGUI mdpGUI)
{
this.mdpGUI = mdpGUI;
this.simulation = mdpGUI.getSimulation();
// set a preferred size for the custom panel.
setPreferredSize(new Dimension(400,250));
//create a graphdraw
layout.setSize(new Dimension(600,600));
setLayout(new BorderLayout());
setSize(new Dimension(600, 600));
add(vv);
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<Vertex<?>,Edge<?,?>>());
vv.repaint();
}
示例2: getEdgeShapeTransformer
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
public Transformer<Context<Graph<Object, JobGraphLink>, JobGraphLink>, Shape> getEdgeShapeTransformer() {
final String edgeStyle = _userPreferences.getAdditionalProperties().get(USER_PREFERENCES_PROPERTY_EDGE_STYLE);
final Transformer<Context<Graph<Object, JobGraphLink>, JobGraphLink>, Shape> baseTransformer =
getBaseEdgeShapeTransformer(edgeStyle);
return input -> {
final Shape result = baseTransformer.transform(input);
final JobGraphLink link = input.element;
if (isCompoundRequirementLink(link)) {
// make a double link (actually a wedge, but close
// enough) to show that there are more than one filter
// outcome coming from this source
return new EdgeShape.Wedge<Object, JobGraphLink>(10).transform(input);
}
return result;
};
}
示例3: getBaseEdgeShapeTransformer
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
private Transformer<Context<Graph<Object, JobGraphLink>, JobGraphLink>, Shape> getBaseEdgeShapeTransformer(
final String edgeStyle) {
if (edgeStyle == null) {
return new EdgeShape.QuadCurve<>();
}
switch (edgeStyle) {
case EDGE_STYLE_NAME_STRAIGHT:
return new EdgeShape.Line<>();
case EDGE_STYLE_NAME_CURVED:
return new EdgeShape.QuadCurve<>();
case EDGE_STYLE_NAME_ORTOGHONAL:
return new EdgeShape.Orthogonal<>();
default:
return new EdgeShape.QuadCurve<>();
}
}
示例4: init
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
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());
}
示例5: init
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
private void init() {
// GraphVisualization
RenderContext<AbstractPlanNode, PlanNodeGraph.Edge> context = this.visualizationPanel.getRenderContext();
context.setEdgeShapeTransformer(new EdgeShape.Line<AbstractPlanNode, PlanNodeGraph.Edge>());
context.setVertexFontTransformer(new GraphVisualizationPanel.VertexFontTransformer<AbstractPlanNode>(true));
// PlanFragmentBoundaries boundaryPainter = new PlanFragmentBoundaries();
// this.visualizationPanel.addPostRenderPaintable(boundaryPainter);
// Full Plan Tab
JPanel textInfoPanel = new JPanel();
textInfoPanel.setLayout(new BorderLayout());
JTextArea textInfoTextArea = new JTextArea();
textInfoTextArea.setEditable(false);
textInfoTextArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
textInfoTextArea.setText(PlanNodeUtil.debug(this.root));
textInfoPanel.add(new JScrollPane(textInfoTextArea), BorderLayout.CENTER);
// Node Field Tab
this.nodeField = new JTextArea();
this.nodeField.setEditable(false);
this.nodeField.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
this.nodeField.setText("");
JPanel textInfoPanel2 = new JPanel(new BorderLayout());
textInfoPanel2.add(new JScrollPane(this.nodeField), BorderLayout.CENTER);
this.tabbedPane = new JTabbedPane();
this.tabbedPane.add("Full Plan", textInfoPanel);
this.tabbedPane.add("Selected Node", textInfoPanel2);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, visualizationPanel, this.tabbedPane);
splitPane.setDividerLocation(AbstractViewer.DEFAULT_WINDOW_HEIGHT - 500);
this.mainPanel.add(splitPane, BorderLayout.CENTER);
}
示例6: MapperEngine
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
public MapperEngine() {
graph = new SparseMultigraph<Room, Exit>();
mapperLayout = new MapperLayout( graph );
mapperLayout.setSize( new Dimension( 500, 500 ) ); //????
vv = new VisualizationViewer<Room, Exit>( mapperLayout );
pickedState = vv.getPickedVertexState();
pickedState.addItemListener( this );
vv.setPreferredSize( new Dimension( 500, 500 ) ); //????
RenderContext<Room, Exit> rc = vv.getRenderContext();
rc.setEdgeLabelTransformer( new ToStringLabeller<Exit>() );
rc.setEdgeLabelRenderer( new ExitLabelRenderer() );
rc.setEdgeShapeTransformer( new EdgeShape.QuadCurve<Room, Exit>() );
rc.setEdgeShapeTransformer( new EdgeShape.Wedge<Room, Exit>( 30 ) );
rc.setEdgeFillPaintTransformer( new ExitPaintTransformer( vv ) );
rc.setVertexShapeTransformer( new RoomShape( graph ) );
rc.setVertexIconTransformer( new RoomIconTransformer() );
vv.getRenderContext().setLabelOffset( 5 );
PluggableGraphMouse pgm = new PluggableGraphMouse();
pgm.add( new MapperPickingGraphMousePlugin<Room, Exit>( MouseEvent.BUTTON1_MASK, MouseEvent.BUTTON3_MASK ) );
pgm.add( new TranslatingGraphMousePlugin( MouseEvent.BUTTON1_MASK ) );
scaler = new ScalingGraphMousePlugin( new CrossoverScalingControl(), 0, 1 / 1.1f, 1.1f );
pgm.add( scaler );
mousePlugin = new MapperEditingGraphMousePlugin( this );
pgm.add( mousePlugin );
vv.setGraphMouse( pgm );
panel = new MapperPanel( this );
}
示例7: setVisualizationViewer
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
private void setVisualizationViewer (VisualizationViewer vviewer) {
PortConnections pconns = PortConnections.getInstance();
// give other color
Transformer vertexPaint = new Transformer() {
public Paint transform (Object obj) {
if (obj instanceof ProcletBlock) {
if (((ProcletBlock) obj).getBlockID().equals("exception")) {
return Color.BLUE;
}
else {
return Color.RED;
}
}
else if (obj instanceof ProcletPort) {
return Color.GREEN;
}
return Color.RED;
}
};
this.vertexPaint = vertexPaint;
vv = vviewer;
//vv.setPickSupport(new edu.uci.ics.jung.visualization.picking.ShapePickSupport(vv));
vv.setPreferredSize(new Dimension(350,350));
vv.getRenderContext().setVertexFillPaintTransformer(this.vertexPaint);
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
vv.setGraphMouse(gm);
splitPanelLeft.setRightComponent(new GraphZoomScrollPane(vv));
// vv.validate();
// vv.repaint();
// splitPanelLeft.repaint();
// getContentPane().repaint();
// validate();
// repaint();
}
示例8: setVisualizationViewer
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
private void setVisualizationViewer (VisualizationViewer vviewer) {
if (vviewer != null) {
vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
vv = vviewer;
//vv.setPickSupport(new edu.uci.ics.jung.visualization.picking.ShapePickSupport(vv));
vv.setPreferredSize(new Dimension(350,350));
vv.getRenderContext().setVertexLabelTransformer(vertexLabelTransformer);
vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer);
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
vv.setGraphMouse(gm);
splitPanelLeft.setRightComponent(new GraphZoomScrollPane(vv));
}
}
示例9: initGraph
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void initGraph() {
try {
labelMap = new HashMap();
iconMap = new HashMap();
graph = new DelegateForest();
treeLayout = new TreeLayout(graph);
balloonLayout = new BalloonLayout(graph);
vv = new VisualizationViewer(balloonLayout);
vv.setSize(new Dimension(800, 800));
refreshGraph();
vv.setBackground(Color.white);
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.setVertexToolTipTransformer(new EntityTransformer());
graphPanel = new GraphZoomScrollPane(vv);
DefaultModalGraphMouse mouse = new DefaultModalGraphMouse();
vv.setGraphMouse(mouse);
mouse.add(new MemoriaGraphMouse(this));
// T O D O MemoriaPanel compile error suppress 2 lines
//VertexStringerImpl localVertexStringerImpl = new VertexStringerImpl(/*this.labelMap*/);
//this.vv.getRenderContext().setVertexLabelTransformer(new VertexStringerImpl(/*localVertexStringerImpl*/));
VertexIconShapeTransformer transformer = new VertexIconShapeTransformer(new EllipseVertexShapeTransformer());
DefaultVertexIconTransformer iconTransformer = new DefaultVertexIconTransformer();
transformer.setIconMap(iconMap);
iconTransformer.setIconMap(iconMap);
vv.getRenderContext().setVertexShapeTransformer(transformer);
vv.getRenderContext().setVertexIconTransformer(iconTransformer);
} catch (Exception exc) {
SbApp.error("MemoriaPanel.initGraph()",exc);
}
}
示例10: TreePane
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
public TreePane(Dominoes domino) {
// create a simple graph for the demo
graph = new DelegateForest<>();
graph.addVertex(domino.getHistoric());
this.createTree(domino.getHistoric());
treeLayout = new TreeLayout<>(graph);
final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
vv = new VisualizationViewer<>(treeLayout, new Dimension(600, 600));
vv.setBackground(Color.white);
vv.getRenderContext().setVertexFillPaintTransformer(new ConstantTransformer(Color.GRAY));
vv.getRenderContext().setEdgeFillPaintTransformer(new ConstantTransformer(Color.BLACK));
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.setGraphMouse(graphMouse);
// add a listener for ToolTips
vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.WHITE));
SwingNode s = new SwingNode();
s.setContent(vv);
this.getChildren().add(s);
}
示例11: paintGraph
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
private void paintGraph(Collection<Planet> planets) {
planetsInGraph = new HashMap<String, Planet>();
graph = new SparseMultigraph<Planet, String>();
for (Planet planet : planets) {
graph.addVertex(planet);
planetsInGraph.put(planet.getId(), planet);
}
paintEdges();
locationTransformer = new LocationTransformer(
Collections.unmodifiableCollection(planets), vm.getGameType());
final Layout<Planet, String> layout = new StaticLayout<Planet, String>(graph,
locationTransformer);
layout.setSize(new Dimension(View.START_WIDTH, View.START_HEIGHT));
vv = new VisualizationViewer<Planet, String>(layout);
vv.setPreferredSize(new Dimension(View.START_WIDTH, View.START_HEIGHT));
vv.setRenderer(new UglyHuckRenderer());
vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
vv.getRenderContext().setVertexShapeTransformer(vertexSize);
// vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer);
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeDrawPaintTransformer(edgePaint);
vv.getRenderContext().setArrowDrawPaintTransformer(edgePaint);
vv.getRenderContext().setEdgeLabelTransformer(edgeLabel);
vv.getRenderer().getVertexLabelRenderer()
.setPosition(Renderer.VertexLabel.Position.CNTR);
vv.getRenderContext().setEdgeShapeTransformer(
new EdgeShape.Line<Planet, String>());
this.add(vv);
updateUI();
// this.validate();
this.repaint();
}
示例12: setEdgeShapeTransformer
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
/**
* @see edu.uci.ics.jung.visualization.RenderContext#setEdgeShapeTransformer(edu.uci.ics.jung.visualization.decorators.EdgeShapeTransformer)
*/
public void setEdgeShapeTransformer(Transformer<Context<Graph<V,E>,E>,Shape> edgeShapeTransformer) {
this.edgeShapeTransformer = edgeShapeTransformer;
if(edgeShapeTransformer instanceof EdgeShape.Orthogonal) {
((EdgeShape.IndexedRendering<V, E>)edgeShapeTransformer).setEdgeIndexFunction(this.incidentEdgeIndexFunction);
} else
if(edgeShapeTransformer instanceof EdgeShape.IndexedRendering) {
((EdgeShape.IndexedRendering<V,E>)edgeShapeTransformer).setEdgeIndexFunction(this.parallelEdgeIndexFunction);
}
}
示例13: setEdgeShapeTransformer
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
/**
* Sets the edge shape transformer according to the {@link GeneralGraphSettings4MAS}.
* @see GeneralGraphSettings4MAS#getEdgeShape()
* @param visViewer the vis viewer
*/
public void setEdgeShapeTransformer(BasicGraphGuiVisViewer<GraphNode, GraphEdge> visViewer) {
// --- Use straight lines as edges ? ------------------------------
AbstractEdgeShapeTransformer<GraphNode, GraphEdge> edgeShapeTransformer = null;
switch (this.getGraphEnvironmentController().getNetworkModelAdapter().getGeneralGraphSettings4MAS().getEdgeShape()) {
case BentLine:
edgeShapeTransformer = new EdgeShape.BentLine<GraphNode, GraphEdge>();
break;
case Box:
edgeShapeTransformer = new EdgeShape.Box<GraphNode, GraphEdge>();
break;
case CubicCurve:
edgeShapeTransformer = new EdgeShape.CubicCurve<GraphNode, GraphEdge>();
break;
case Line:
edgeShapeTransformer = new EdgeShape.Line<GraphNode, GraphEdge>();
break;
case Polyline:
edgeShapeTransformer = new EdgeShapePolyline<GraphNode, GraphEdge>();
break;
case Loop:
edgeShapeTransformer = new EdgeShape.Loop<GraphNode, GraphEdge>();
break;
case Orthogonal:
edgeShapeTransformer = new EdgeShape.Orthogonal<GraphNode, GraphEdge>();
break;
case QuadCurve:
edgeShapeTransformer = new EdgeShape.QuadCurve<GraphNode, GraphEdge>();
break;
case SimpleLoop:
edgeShapeTransformer = new EdgeShape.SimpleLoop<GraphNode, GraphEdge>();
break;
case Wedge:
edgeShapeTransformer = new EdgeShape.Wedge<GraphNode, GraphEdge>(5);
break;
default:
edgeShapeTransformer = new EdgeShape.Line<GraphNode, GraphEdge>();
break;
}
visViewer.getRenderContext().setEdgeShapeTransformer(edgeShapeTransformer);
visViewer.repaint();
}
示例14: getSampleGraphViewer
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
public JPanel getSampleGraphViewer() throws IOException {
vv = new VisualizationViewer<>(layout);
vv.getRenderer().setVertexRenderer(
new ViwnVertexRenderer(vv.getRenderer().getVertexRenderer()));
HashMap<RenderingHints.Key, Object> hints = new HashMap<>();
hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
hints.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
hints.put(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
hints.put(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_PURE);
hints.put(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
hints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_SPEED);
vv.setRenderingHints(hints);
RenderContext<ViwnNode, ViwnEdge> rc = vv.getRenderContext();
rc.setVertexShapeTransformer((ViwnNode v) -> v.getShape());
rc.setVertexFillPaintTransformer(new ViwnVertexFillColor(vv
.getPickedVertexState(), rootNode));
rc.setEdgeLabelClosenessTransformer(new ConstantDirectionalEdgeValueTransformer<>(
0.5, 0.5));
rc.setEdgeIncludePredicate((Context<Graph<ViwnNode, ViwnEdge>, ViwnEdge> context) -> {
if (context.element instanceof ViwnEdgeCandidate) {
ViwnEdgeCandidate cand = (ViwnEdgeCandidate) context.element;
return !cand.isHidden();
}
return true;
});
Transformer<ViwnEdge, Paint> edgeDrawColor = (ViwnEdge e) -> e.getColor();
rc.setEdgeDrawPaintTransformer(edgeDrawColor);
rc.setArrowDrawPaintTransformer(edgeDrawColor);
rc.setArrowFillPaintTransformer(edgeDrawColor);
rc.setEdgeStrokeTransformer(new ViwnEdgeStrokeTransformer());
graphMouseListener = new ViwnGraphMouseListener(this);
vv.addGraphMouseListener(graphMouseListener);
Transformer<ViwnEdge, String> stringer = (ViwnEdge rel) -> rel.toString();
rc.setEdgeLabelTransformer(stringer);
rc.setEdgeShapeTransformer(new EdgeShape.Line<>());
ViwnGraphViewModalGraphMouse gm = new ViwnGraphViewModalGraphMouse(this);
vv.addKeyListener(gm.getModeKeyListener());
vv.getRenderer().setEdgeLabelRenderer(new AstrideLabelRenderer<>());
vv.setGraphMouse(gm);
GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
panel.add(vv);
((ShapePickSupport<ViwnNode, ViwnEdge>) rc.getPickSupport())
.setPickSize(EDGE_PICK_SIZE);
vv.setVertexToolTipTransformer(new ViwnVertexToolTipTransformer());
return panel;
}
示例15: set
import edu.uci.ics.jung.visualization.decorators.EdgeShape; //导入依赖的package包/类
/**
* @param vgvui ViwnGraphViewUI
*/
public void set(ViwnGraphViewUI vgvui) {
graphUI = vgvui;
vv = graphUI.getVisualizationViewer();
satellite = new SatelliteVisualizationViewer<>(vv,
new Dimension(WIDTH, HEIGHT));
satellite.getRenderContext().setEdgeDrawPaintTransformer(
new PickableEdgePaintTransformer<>(satellite.getPickedEdgeState(), Color.black, Color.cyan));
satellite.getRenderContext().setVertexFillPaintTransformer(new ViwnVertexFillColor(vv.getPickedVertexState(), graphUI.getRootNode()));
satellite.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<>());
satellite.scaleToLayout(satelliteScaler);
}