本文整理汇总了Java中edu.uci.ics.jung.visualization.control.PluggableGraphMouse.add方法的典型用法代码示例。如果您正苦于以下问题:Java PluggableGraphMouse.add方法的具体用法?Java PluggableGraphMouse.add怎么用?Java PluggableGraphMouse.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uci.ics.jung.visualization.control.PluggableGraphMouse
的用法示例。
在下文中一共展示了PluggableGraphMouse.add方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configVisualizationViewer
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
@Override
public void configVisualizationViewer(final LayerViewer<V, E> vv) {
PluggableGraphMouse mouse = new PluggableGraphMouse();
mouse.add(new ScalingGraphMousePlugin(
new CrossoverScalingControl(), Event.CTRL_MASK, 1 / 1.1f,
1.1f));
mouse.add(new PickingGraphMousePlugin<V, E>());
mouse.add(new MyEditingPopupGraphMousePlugin<T, V, E, N>(vv, scenario));
vv.setGraphMouse(mouse);
vv.getRenderContext().setVertexFillPaintTransformer(
new NodeFillPaintTransformer<V>(vv.getPickedVertexState()));
vv.setVertexToolTipTransformer(nodeTTT);
vv.getRenderContext().setVertexLabelTransformer(nodeLT);
vv.getRenderer().getVertexLabelRenderer()
.setPosition(Position.AUTO);
vv.setEdgeToolTipTransformer(linkTTT);
vv.getRenderContext().setEdgeLabelTransformer(linkLT);
vv.getRenderContext().getEdgeLabelRenderer()
.setRotateEdgeLabels(true);
vv.getRenderContext().setEdgeDrawPaintTransformer(
new LinkDrawPaintTransformer<E>(vv.getPickedEdgeState()));
}
示例2: getPanel
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
public static GraphVisualizationPanel<MarkovVertex, MarkovEdge> getPanel(
Graph<MarkovVertex, MarkovEdge> test_graph) {
GraphVisualizationPanel<MarkovVertex, MarkovEdge> graph_panel = GraphVisualizationPanel
.factory(test_graph);
Transformer<MarkovVertex, Paint> transformer = new VertexTransformer<MarkovVertex, Paint>();
graph_panel.getRenderContext().setVertexFillPaintTransformer(
transformer);
graph_panel.getRenderContext().setEdgeLabelTransformer(
new ToStringLabeller<MarkovEdge>());
PluggableGraphMouse gm = new PluggableGraphMouse();
gm.add(new PopupMousePlugin<MarkovVertex, MarkovEdge>());
gm.add(new TranslatingGraphMousePlugin(MouseEvent.BUTTON1_MASK));
graph_panel.setGraphMouse(gm);
Transformer<MarkovVertex, String> labelTransform = new VertexLabelTransformer<MarkovVertex, String>();
graph_panel.getRenderContext()
.setVertexLabelTransformer(labelTransform);
return graph_panel;
}
示例3: setUpView
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
private void setUpView(Graph graph)
{
// layout = new SpringLayout2(graph);
layout = new KKLayout(graph);
//layout.setSize(new Dimension(700,700));
vv = new VisualizationViewer(layout);
vv.setPreferredSize(new Dimension(900,900));
vv.setBackground( Color.white );
// Tell the renderer to use our own customized label rendering
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
getContentPane().add(new GraphZoomScrollPane(vv), BorderLayout.CENTER);
/*Mouse controller plugins*/
PluggableGraphMouse gm = new PluggableGraphMouse();
gm.add(new TranslatingGraphMousePlugin(MouseEvent.BUTTON3_MASK));
gm.add(new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, 1.1f, 0.9f));
gm.add(new PickingGraphMousePlugin());
vv.setGraphMouse(gm);
}
示例4: configVisualizationViewer
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
@Override
public void configVisualizationViewer(final LayerViewer<V, E> vv) {
PluggableGraphMouse mouse = new PluggableGraphMouse();
mouse.add(new ScalingGraphMousePlugin(
new CrossoverScalingControl(), Event.CTRL_MASK, 1 / 1.1f,
1.1f));
mouse.add(new PickingGraphMousePlugin<V, E>());
mouse.add(new MyEditingPopupGraphMousePlugin<T, V, E, N>(vv));
vv.setGraphMouse(mouse);
vv.getRenderContext().setVertexFillPaintTransformer(
new NodeFillPaintTransformer<V>(vv.getPickedVertexState()));
vv.setVertexToolTipTransformer(nodeTTT);
vv.getRenderContext().setVertexLabelTransformer(nodeLT);
vv.getRenderer().getVertexLabelRenderer()
.setPosition(Position.AUTO);
vv.setEdgeToolTipTransformer(linkTTT);
vv.getRenderContext().setEdgeLabelTransformer(linkLT);
vv.getRenderContext().getEdgeLabelRenderer().setRotateEdgeLabels(
true);
vv.getRenderContext().setEdgeDrawPaintTransformer(
new LinkDrawPaintTransformer<E>(vv.getPickedEdgeState()));
}
示例5: createPluggableGraphMouse
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
protected PluggableGraphMouse createPluggableGraphMouse(RenderContext<NubiSaveVertex,NubiSaveEdge> rc,
Factory<AbstractNubisaveComponent> vertexFactory, Factory<? extends NubiSaveEdge> edgeFactory, DataVertexEdgeFactory dataVertexEdgeFactory) {
PluggableGraphMouse graphMouse = new PluggableGraphMouse();
VertexPicker<NubiSaveVertex, NubiSaveEdge> pickingPlugin = new VertexPicker<NubiSaveVertex, NubiSaveEdge>();
TranslatingGraphMousePlugin translatingPlugin = new TranslatingGraphMousePlugin(InputEvent.BUTTON1_MASK);
ScalingGraphMousePlugin scalingPlugin = new ScalingGraphMousePlugin(new ViewScalingControl(), 0, 1.1f, 1/1.1f);
PopupEditor popupEditingPlugin = new PopupEditor(edgeFactory);
StorageServicePicker<NubiSaveVertex, NubiSaveEdge> storageServicePickingPlugin = new StorageServicePicker<NubiSaveVertex, NubiSaveEdge>();
ExtensibleNubisaveComponentMousePlugin extendablePlugin = new ExtensibleNubisaveComponentMousePlugin(vertexFactory, edgeFactory);
extendablePlugin.addEventListener(new AbstractNubiSaveComponentCreator(vv, graph, vertexFactory));
extendablePlugin.addEventListener(new ToggleActivateNubisaveComponentOnDoubleClick(vv, graph));
extendablePlugin.addEventListener(new PreventEdgeCreationForRestrictedPorts(vv, graph));
extendablePlugin.addEventListener(new DataVertexEdgeCreator(vv, graph, dataVertexEdgeFactory));
extendablePlugin.addEventListener(new AbstractNubisaveComponentEdgeCreator(vv, graph, (WeightedNubisaveVertexEdgeFactory) edgeFactory));
graphMouse.add(scalingPlugin);
graphMouse.add(extendablePlugin);
graphMouse.add(storageServicePickingPlugin);
graphMouse.add(translatingPlugin);
graphMouse.add(popupEditingPlugin);
return graphMouse;
}
示例6: MyMouseContext
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
public MyMouseContext(GraphPanel<MyL, LayerViewer<MyV, MyE>> owner) {
super(owner);
mouse = new PluggableGraphMouse();
mouse.add(new ScalingGraphMousePlugin(
new CrossoverScalingControl(), Event.CTRL_MASK, 1 / 1.1f,
1.1f));
mouse.add(new PickingGraphMousePlugin<MyV, MyE>());
}
示例7: MapperEngine
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的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 );
}
示例8: MyMouseContext
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
public MyMouseContext(GraphPanel<MyL, LayerViewer<MyV, MyE>> owner) {
super(owner);
mouse = new PluggableGraphMouse();
mouse.add(new ScalingGraphMousePlugin(
new CrossoverScalingControl(), Event.CTRL_MASK, 1 / 1.1f,
1.1f));
mouse.add(new PickingGraphMousePlugin<MyV, MyE>());
}
示例9: setupGraph
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
public static void setupGraph(DirectedSparseGraph g){
bg = g;
Layout<BooleanNode, TravelEdge> layout = new DAGLayout(bg);
layout.setSize(new Dimension(300,300)); // sets the initial size of the layout space
VisualizationViewer<BooleanNode,TravelEdge> vv = new VisualizationViewer<BooleanNode,TravelEdge>(layout);
vv.setPreferredSize(new Dimension(500,500)); //Sets the viewing area size
Transformer<BooleanNode,Paint> vertexPaint = new Transformer<BooleanNode,Paint>() {
public Paint transform(BooleanNode i) {
if (i.isCurrentNode()){
return Color.RED;
} else if (i.getObserved()){
return Color.BLUE;
} else if (i.isStartNode()) {
return Color.GREEN;
} else if (i.isEndNode()){
return Color.BLACK;
} else {
return Color.WHITE;
}
}
};
vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
PluggableGraphMouse gm = new PluggableGraphMouse();
gm.add(new NetworkGameMousePlugin());
vv.setGraphMouse(gm);
frame = new JFrame("Simple Graph View");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(vv);
JMenuBar menuBar = new JMenuBar();
JMenu restartMenu = new JMenu();
restartMenu.setText("Restart");
menuBar.add(restartMenu);
JMenuItem restartItem = new JMenuItem("Restart level");
restartItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
restartLevel();
}
});
restartMenu.add(restartItem);
frame.setJMenuBar(menuBar);
frame.pack();
frame.setVisible(true);
}
示例10: InteractingVerb
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
public InteractingVerb(Controller controller, returnCall returnType, int button) {
super(controller, returnType);
pgm = new PluggableGraphMouse();
pgm.add(new InteractingMousePlugin(this, button));
}
示例11: AssumeVerb
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
public AssumeVerb(Controller controller, returnCall returnType) {
super(controller, returnType);
pgm = new PluggableGraphMouse();
pgm.add(new AssumingMousePlugin(this, MouseEvent.BUTTON1));
}
示例12: TutorialVerb
import edu.uci.ics.jung.visualization.control.PluggableGraphMouse; //导入方法依赖的package包/类
public TutorialVerb(Controller controller, returnCall returnType) {
super(controller, returnType);
pgm = new PluggableGraphMouse();
pgm.add(new TutorialMousePlugin(this, "Opin"));
}