本文整理汇总了Java中edu.uci.ics.jung.algorithms.layout.ISOMLayout类的典型用法代码示例。如果您正苦于以下问题:Java ISOMLayout类的具体用法?Java ISOMLayout怎么用?Java ISOMLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISOMLayout类属于edu.uci.ics.jung.algorithms.layout包,在下文中一共展示了ISOMLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLayout
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
private static AbstractLayout<Vertex, Edge> getLayout(GraphJung<Graph> graph, String layoutName) {
switch (layoutName) {
case "KKLayout":
return new KKLayout<>(graph);
case "CircleLayout":
return new CircleLayout<>(graph);
case "FRLayout":
return new FRLayout<>(graph);
case "FRLayout2":
return new FRLayout2<>(graph);
case "ISOMLayout":
return new ISOMLayout<>(graph);
case "SpringLayout":
return new SpringLayout<>(graph);
default:
return new KKLayout<>(graph);
}
}
示例2: initLayoutBox
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
/**
* Initializes combobox for layout
*/
private void initLayoutBox(){
layoutBox.addItem("CircleLayout");
layoutBox.addItem("FRLayout");
layoutBox.addItem("FRLayout2");
layoutBox.addItem("ISOMLayout");
layoutBox.addItem("KKLayout");
layoutBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent a) {
JComboBox<String> lBox = (JComboBox<String>) a.getSource();
String name = (String) lBox.getSelectedItem();
for (EGPanel e : egPanels){
ExplanationGraph eg = e.getEG();
switch(name){
case "CircleLayout": layout = new CircleLayout<EGVertex, EGEdge>(eg); break;
case "FRLayout": layout = new FRLayout<EGVertex, EGEdge>(eg); break;
case "FRLayout2": layout = new FRLayout<EGVertex, EGEdge>(eg); break;
case "KKLayout": layout = new KKLayout<EGVertex, EGEdge>(eg); break;
default : layout = new ISOMLayout<EGVertex, EGEdge>(eg); break;
}
e.setLayout(layout);
}
}});
}
示例3: initLayoutBox
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
private void initLayoutBox(){
layoutBox.addItem("CircleLayout");
layoutBox.addItem("FRLayout");
layoutBox.addItem("FRLayout2");
layoutBox.addItem("ISOMLayout");
layoutBox.addItem("KKLayout");
layoutBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent a) {
JComboBox<String> lBox = (JComboBox<String>) a.getSource();
String name = (String) lBox.getSelectedItem();
switch(name){
case "CircleLayout": l = new CircleLayout<EDGVertex, EDGEdge>(edg); break;
case "FRLayout": l = new FRLayout<EDGVertex, EDGEdge>(edg); break;
case "FRLayout2": l = new FRLayout<EDGVertex, EDGEdge>(edg); break;
case "KKLayout": l = new KKLayout<EDGVertex, EDGEdge>(edg); break;
default : l = new ISOMLayout<EDGVertex, EDGEdge>(edg); break;
}
l.setSize(new Dimension(780,400));
visServer.setGraphLayout(l);
visServer.doLayout();
}
});
}
示例4: LayoutSelection
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
public LayoutSelection(GraphViewer<V, E> graphViewer, Graph<V, E> graph) {
super();
this.graphViewer = graphViewer;
this.graph = graph;
this.layout = new ISOMLayout<V, E>(graph);
layoutMap = new java.util.LinkedHashMap<String, Class>();
if (graph instanceof Forest) {
layoutMap.put("Tree", ShapeBasedTreeLayout.class);
layoutMap.put("Tree (Tight)", TreeLayout.class);
layoutMap.put("Radial", RadialTreeLayout.class);
layoutMap.put("Balloon", BalloonLayout.class);
}
layoutMap.put("ISOM", ISOMLayout.class);
layoutMap.put("KKLayout", KKLayout.class);
layoutMap.put("FRLayout", FRLayout2.class);
layoutMap.put("Circle", CircleLayout.class);
layoutMap.put("Spring", SpringLayout2.class);
Iterator<String> it = layoutMap.keySet().iterator();
while (it.hasNext()) {
addItem(it.next());
}
addActionListener(this);
}
示例5: LayoutSelection
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
public LayoutSelection(GraphViewer<V, E> graphViewer, Graph<V, E> graph) {
super();
this.graphViewer = graphViewer;
this.graph = graph;
this.layout = new ISOMLayout<V, E>(graph);
layoutMap = new LinkedHashMap<>();
if (graph instanceof Forest) {
layoutMap.put("Tree", ShapeBasedTreeLayout.class);
layoutMap.put("Tree (Tight)", TreeLayout.class);
layoutMap.put("Radial", RadialTreeLayout.class);
layoutMap.put("Balloon", BalloonLayout.class);
}
layoutMap.put("ISOM", ISOMLayout.class);
layoutMap.put("KKLayout", KKLayout.class);
layoutMap.put("FRLayout", FRLayout2.class);
layoutMap.put("Circle", CircleLayout.class);
layoutMap.put("Spring", SpringLayout2.class);
Iterator<String> it = layoutMap.keySet().iterator();
while (it.hasNext()) {
addItem(it.next());
}
addActionListener(this);
}
示例6: getCombos
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
/**
* @return
*/
@SuppressWarnings("unchecked")
private Class<? extends Layout>[] getCombos()
{
List<Class<? extends Layout>> layouts = new ArrayList<Class<? extends Layout>>();
layouts.add(KKLayout.class);
layouts.add(FRLayout.class);
layouts.add(CircleLayout.class);
layouts.add(SpringLayout.class);
layouts.add(SpringLayout2.class);
layouts.add(ISOMLayout.class);
return layouts.toArray(new Class[0]);
}
示例7: getCombos
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
/**
* @return
*/
@SuppressWarnings("unchecked")
private static Class<? extends Layout>[] getCombos()
{
List<Class<? extends Layout>> layouts = new ArrayList<Class<? extends Layout>>();
layouts.add(KKLayout.class);
layouts.add(FRLayout.class);
layouts.add(CircleLayout.class);
layouts.add(SpringLayout.class);
layouts.add(SpringLayout2.class);
layouts.add(ISOMLayout.class);
return layouts.toArray(new Class[0]);
}
示例8: buildJungLayout
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
@Override
protected Layout<GraphNode,GraphEdge> buildJungLayout(
DirectedGraph<GraphNode, GraphEdge> jungGraph,
Dimension layoutSize) {
ISOMLayout<GraphNode, GraphEdge> result =
new ISOMLayout<GraphNode, GraphEdge>(jungGraph);
result.setSize(layoutSize);
return result;
}
示例9: updateLayoutGraph
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
private void updateLayoutGraph()
{
Layout<Vertex,Edge> newlayout = null;
if(((String)layoutChoiceComboBox.getSelectedItem()).equals("FRLayout"))
{
newlayout = new FRLayout<Vertex,Edge>(sequenceGraph);
((FRLayout<Vertex,Edge>)newlayout).setMaxIterations(200);
}
else if(((String)layoutChoiceComboBox.getSelectedItem()).equals("KKLayout"))
{
newlayout = new KKLayout<Vertex,Edge>(sequenceGraph);
((KKLayout<Vertex,Edge>)newlayout).setMaxIterations(200);
}
else if(((String)layoutChoiceComboBox.getSelectedItem()).equals("SpringLayout"))
{
newlayout = new SpringLayout<Vertex,Edge>(sequenceGraph);
}
else if(((String)layoutChoiceComboBox.getSelectedItem()).equals("ISOMLayout"))
{
newlayout = new ISOMLayout<Vertex,Edge>(sequenceGraph);
}
else
{
throw new Error("Error choice: wrong layout name");
}
newlayout.setInitializer(networkCanvas.getGraphLayout());
newlayout.setSize(networkCanvas.getSize());
LayoutTransition<Vertex,Edge> transition =
new LayoutTransition<Vertex,Edge>(networkCanvas, networkCanvas.getGraphLayout(), newlayout);
Animator animator = new Animator(transition);
animator.start();
networkCanvas.getRenderContext().getMultiLayerTransformer().setToIdentity(); // What is the use of those lines ?
networkCanvas.repaint();
}
示例10: doISOMLayout
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
private void doISOMLayout(final Layout graphLayout, SparseGraph<VertexRef, EdgeRef> jungGraph, Dimension size) {
ISOMLayout<VertexRef, EdgeRef> layout = new ISOMLayout<VertexRef, EdgeRef>(jungGraph);
layout.setInitializer(initializer(graphLayout));
layout.setSize(size);
while(!layout.done()) {
layout.step();
}
for(VertexRef v : jungGraph.getVertices()) {
graphLayout.setLocation(v, (int)layout.getX(v), (int)layout.getY(v));
}
}
示例11: visualizeNetworkGraph
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
public static JFrame visualizeNetworkGraph(Graph<NetworkVertex, NetworkEdge> graph) {
Layout<NetworkVertex, NetworkEdge> layout = new ISOMLayout<>(graph);
layout.setSize(new Dimension(600, 600));
BasicVisualizationServer<NetworkVertex, NetworkEdge> vv = new BasicVisualizationServer<>(layout);
vv.setPreferredSize(new Dimension(700, 700));
Transformer<NetworkVertex, Paint> vertexPaint = v -> {
if (v instanceof Host) {
Host host = (Host) v;
return host.isFree() ? Color.GREEN : Color.RED;
} else {
return Color.GRAY;
}
};
vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
Transformer<NetworkVertex, String> vertexLabel = v -> v.getId();
vv.getRenderContext().setVertexLabelTransformer(vertexLabel);
vv.getRenderer().getVertexLabelRenderer().setPosition(edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position.AUTO);
Transformer<NetworkEdge, String> edgeLabel = networkEdge -> networkEdge.getTailPort() + "->" + networkEdge.getHeadPort();
vv.getRenderContext().setEdgeLabelTransformer(edgeLabel);
JFrame frame = new JFrame("Simple Graph View 2");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(vv);
frame.pack();
return frame;
}
示例12: LayoutSelection
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
public LayoutSelection(GraphViewer<V, E> graphViewer, Graph<V,E> graph) {
super();
this.graphViewer = graphViewer;
this.graph = graph;
this.layout = new ISOMLayout<V, E>(graph);
layoutMap = new java.util.LinkedHashMap<String, Class>();
if (graph instanceof Forest) {
layoutMap.put("Tree", ShapeBasedTreeLayout.class);
layoutMap.put("Tree (Tight)", TreeLayout.class);
layoutMap.put("Radial", RadialTreeLayout.class);
layoutMap.put("Balloon", BalloonLayout.class);
}
layoutMap.put("ISOM", ISOMLayout.class);
layoutMap.put("KKLayout", KKLayout.class);
layoutMap.put("FRLayout", FRLayout2.class);
layoutMap.put("Circle", CircleLayout.class);
layoutMap.put("Spring", SpringLayout2.class);
Iterator<String> it = layoutMap.keySet().iterator();
while (it.hasNext())
addItem(it.next());
addActionListener(this);
}
示例13: DependencyGraphScene
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
DependencyGraphScene(ObservableGraph<ArtifactGraphNode, ArtifactGraphEdge> graph, DelegateForest<ArtifactGraphNode, ArtifactGraphEdge> forest, MavenProject prj, Project nbProj, DependencyGraphTopComponent tc,
POMModel model) {
super(graph, new FRLayout<>(forest));
layoutModel = new DefaultComboBoxModel<>();
layoutModel.addElement(layout());
// These rarely work but look nice when they do
// layoutModel.addElement(new BalloonLayout<>(forest));
// layoutModel.addElement(new RadialTreeLayout<>(forest));
layoutModel.addElement(new CircleLayout<>(graph));
layoutModel.addElement(new FRLayout<>(graph));
layoutModel.addElement(new FRLayout2<>(graph));
layoutModel.addElement(new KKLayout<>(graph));
TreeLayout<ArtifactGraphNode, ArtifactGraphEdge> treeLayout = new TreeLayout<>(forest, 200, 90);
layoutModel.addElement(treeLayout);
layoutModel.addElement(new ISOMLayout<>(graph));
layoutModel.addElement(new SpringLayout<>(graph));
layoutModel.addElement(new SpringLayout2<>(graph));
layoutModel.setSelectedItem(layout());
moveAction = ActionFactory.createMoveAction(null, new MP());
this.forest = forest;
project = prj;
nbProject = nbProj;
this.tc = tc;
this.model = model;
mainLayer = new LayerWidget(this);
addChild(mainLayer);
connectionLayer = new LayerWidget(this);
addChild(connectionLayer);
//getActions().addAction(this.createObjectHoverAction());
getActions().addAction(hoverAction);
getActions().addAction(ActionFactory.createSelectAction(allActionsP));
getActions().addAction(zoomAction);
getActions().addAction(panAction);
getActions().addAction(editAction);
getActions().addAction(popupMenuAction);
getActions().addAction(new ScrollWheelZoomAction());
}
示例14: JungVisualizationViewer
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的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);
}
}
示例15: switchLayout
import edu.uci.ics.jung.algorithms.layout.ISOMLayout; //导入依赖的package包/类
public void switchLayout(GraphLayout type) {
Layout<N, EdgeWrapper<E>> layout = null;
switch (type) {
case KKLayout:
layout = new KKLayout<N, EdgeWrapper<E>>(graph);
break;
case FRLayout:
layout = new FRLayout<N, EdgeWrapper<E>>(graph);
break;
case ISOMLayout:
layout = new ISOMLayout<N, EdgeWrapper<E>>(graph);
break;
case SpringLayout:
layout = new SpringLayout<N, EdgeWrapper<E>>(graph);
break;
case CircleLayout:
layout = new CircleLayout<N, EdgeWrapper<E>>(graph);
break;
case FRLayout2:
layout = new FRLayout2<N, EdgeWrapper<E>>(graph);
break;
case SpringLayout2:
layout = new SpringLayout2<N, EdgeWrapper<E>>(graph);
break;
default:
break;
}
if (graph.getVertexCount() < 100) {
layout.setInitializer(vv.getGraphLayout());
layout.setSize(getSize());
LayoutTransition<N, EdgeWrapper<E>> lt = new LayoutTransition<N, EdgeWrapper<E>>(vv, vv.getGraphLayout(),
layout);
Animator animator = new Animator(lt);
animator.start();
vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
repaint(500);
} else {
vv.setModel(new DefaultVisualizationModel<N, EdgeWrapper<E>>(layout));
repaint(500);
}
}