本文整理汇总了Java中edu.uci.ics.jung.visualization.VisualizationModel类的典型用法代码示例。如果您正苦于以下问题:Java VisualizationModel类的具体用法?Java VisualizationModel怎么用?Java VisualizationModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisualizationModel类属于edu.uci.ics.jung.visualization包,在下文中一共展示了VisualizationModel类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SatelliteVisualizationViewer
import edu.uci.ics.jung.visualization.VisualizationModel; //导入依赖的package包/类
/**
* Used internally, as the satellite should always share the model of the master
* @param master the master view
* @param model
* @param renderer
* @param preferredSize
*/
protected SatelliteVisualizationViewer(VisualizationViewer<V,E> master, VisualizationModel<V,E> model,
Dimension preferredSize) {
super(model, preferredSize);
this.master = master;
// create a graph mouse with custom plugins to affect the master view
ModalGraphMouse gm = new ModalSatelliteGraphMouse();
setGraphMouse(gm);
// this adds the Lens to the satellite view
addPreRenderPaintable(new ViewLens<V,E>(this, master));
// get a copy of the current layout transform
// it may have been scaled to fit the graph
AffineTransform modelLayoutTransform =
new AffineTransform(master.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).getTransform());
// I want no layout transformations in the satellite view
// this resets the auto-scaling that occurs in the super constructor
getRenderContext().getMultiLayerTransformer().setTransformer(Layer.LAYOUT, new MutableAffineTransformer(modelLayoutTransform));
// make sure the satellite listens for changes in the master
master.addChangeListener(this);
// share the picked state of the master
setPickedVertexState(master.getPickedVertexState());
setPickedEdgeState(master.getPickedEdgeState());
}
示例2: SatelliteVisualizationViewer
import edu.uci.ics.jung.visualization.VisualizationModel; //导入依赖的package包/类
/**
* @param master the master view
* @param model
* @param renderer
* @param preferredSize
*/
public SatelliteVisualizationViewer(VisualizationViewer master, VisualizationModel model,
Renderer renderer, Dimension preferredSize) {
super(model, renderer, preferredSize);
this.master = master;
// create a graph mouse with custom plugins to affect the master view
ModalGraphMouse gm = new ModalSatelliteGraphMouse();
setGraphMouse(gm);
// this adds the Lens to the satellite view
addPreRenderPaintable(new ViewLens(this, master));
// get a copy of the current layout transform
// it may have been scaled to fit the graph
AffineTransform modelLayoutTransform =
new AffineTransform(master.getLayoutTransformer().getTransform());
// I want no layout transformations in the satellite view
// this resets the auto-scaling that occurs in the super constructor
setLayoutTransformer(new MutableAffineTransformer(modelLayoutTransform));
// make sure the satellite listens for changes in the master
master.addChangeListener(this);
// share the picked state of the master
setPickedState(master.getPickedState());
setPickSupport(new ShapePickSupport());
}
示例3: BasicGraphGuiVisViewer
import edu.uci.ics.jung.visualization.VisualizationModel; //导入依赖的package包/类
/**
* Instantiates a new VisualizationViewer for the BasicGraphGui.
* @param model the model
*/
public BasicGraphGuiVisViewer(VisualizationModel<V,E>model) {
super(model);
this.initialize();
}
示例4: AddComponentVisViewer
import edu.uci.ics.jung.visualization.VisualizationModel; //导入依赖的package包/类
/**
* Instantiates a new VisualizationViewer for the AddComponentDialog.
* @param model the model
*/
public AddComponentVisViewer(VisualizationModel<GraphNode, GraphEdge> model) {
super(model);
this.initialize();
}
示例5: getModel
import edu.uci.ics.jung.visualization.VisualizationModel; //导入依赖的package包/类
@Override
public VisualizationModel<INode, IConnection> getModel() {
throw new UnsupportedOperationException("Operation not implemented yet");
}
示例6: setModel
import edu.uci.ics.jung.visualization.VisualizationModel; //导入依赖的package包/类
@Override
public void setModel(VisualizationModel<INode, IConnection> visualizationModel) {
throw new UnsupportedOperationException("Operation not implemented yet");
}
示例7: JungVisualizationViewer
import edu.uci.ics.jung.visualization.VisualizationModel; //导入依赖的package包/类
public JungVisualizationViewer(GraphMatrixWrapper<N, E> graph, boolean showNodeLabels, boolean showEdgeLabels) {
super(graph.getGraphMatrix().getGUIObject());
this.graph = graph;
this.graphMatrix = graph.getGraphMatrix();
this.matrixGUIObject = (MatrixGUIObject) graphMatrix.getGUIObject();
this.showNodeLabels = showNodeLabels;
this.showEdgeLabels = showEdgeLabels;
if (graph.getVertexCount() < 1000) {
layout = new FRLayout<N, EdgeWrapper<E>>(graph);
} else {
layout = new ISOMLayout<N, EdgeWrapper<E>>(graph);
}
VisualizationModel<N, EdgeWrapper<E>> visualizationModel = new DefaultVisualizationModel<N, EdgeWrapper<E>>(
layout);
vv = new VisualizationViewer<N, EdgeWrapper<E>>(visualizationModel);
vv.setForeground(new Color(0, 0, 0, 150));
vv.setBackground(Color.WHITE);
DefaultModalGraphMouse<N, E> graphMouse = new DefaultModalGraphMouse<N, E>();
vv.setGraphMouse(graphMouse);
graphMouse.setMode(Mode.PICKING);
RenderContext<N, EdgeWrapper<E>> rc = vv.getRenderContext();
emptyNodeLabelTransformer = rc.getVertexLabelTransformer();
emptyEdgeLabelTransformer = rc.getEdgeLabelTransformer();
rc.setVertexIconTransformer(new VertexIconTransformer<N>(vv.getPickedVertexState()));
rc.setVertexFillPaintTransformer(new ColorTransformer<N>(vv.getPickedVertexState()));
rc.setVertexLabelRenderer(new DefaultVertexLabelRenderer(UIDefaults.SELECTEDCOLOR));
rc.setEdgeDrawPaintTransformer(new ColorTransformer<EdgeWrapper<E>>(vv.getPickedEdgeState()));
rc.setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(UIDefaults.SELECTEDCOLOR));
rc.setArrowFillPaintTransformer(new ColorTransformer<EdgeWrapper<E>>(vv.getPickedEdgeState()));
rc.setArrowDrawPaintTransformer(new ColorTransformer<EdgeWrapper<E>>(vv.getPickedEdgeState()));
vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner());
vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);
if (showNodeLabels) {
rc.setVertexLabelTransformer(new ToStringLabeller<N>());
}
if (showEdgeLabels) {
rc.setEdgeLabelTransformer(new ToStringLabeller<EdgeWrapper<E>>());
}
vv.setVertexToolTipTransformer(new ToStringLabeller<N>());
setLayout(new BorderLayout());
add(vv, BorderLayout.CENTER);
vv.addMouseListener(this);
addComponentListener(this);
vv.addGraphMouseListener(this);
if (graph instanceof GraphMatrixWrapper) {
((MatrixGUIObject) ((GraphMatrixWrapper<N, E>) graph).getGraphMatrix().getGUIObject())
.addTableModelListener(this);
}
}
示例8: start
import edu.uci.ics.jung.visualization.VisualizationModel; //导入依赖的package包/类
@Override
public void start(Stage stage) {
// setup up the scene.
Group root = new Group();
Scene scene = new Scene(root, 800, 400, Color.WHITE);
// create two groups, one for each visualization
Group viz1 = new Group();
Group viz2 = new Group();
// create a sample graph using JUNG's TestGraphs class.
Graph<String, Number> graph1 = TestGraphs.getOneComponentGraph();
// define the layout we want to use for the graph
// The layout will be modified by the VisualizationModel
Layout<String, Number> circleLayout = new CircleLayout<>(graph1);
/*
* Define the visualization model. This is how JUNG calculates the layout
* for the graph. It updates the layout object passed in.
*/
VisualizationModel<String, Number> vm1 = new DefaultVisualizationModel<>(circleLayout, new Dimension(400, 400));
// draw the graph
renderGraph(graph1, circleLayout, viz1);
// Generate a second JUNG sample graph
Graph<String, Number> graph2 = TestGraphs.getOneComponentGraph();
// This time use an Isometric layout.
Layout<String, Number> lay2 = new ISOMLayout<>(graph2);
// Generate the actual layout
VisualizationModel<String, Number> vm2 = new DefaultVisualizationModel<>(lay2, new Dimension(400, 400));
// draw the graph
renderGraph(graph2, lay2, viz2);
// move the second viz to beside the first.
viz2.translateXProperty().set(400);
root.getChildren().add(viz1);
root.getChildren().add(viz2);
stage.setTitle("Displaying Two JUNG Graphs");
stage.setScene(scene);
stage.show();
}