本文整理汇总了Java中edu.uci.ics.jung.algorithms.layout.StaticLayout类的典型用法代码示例。如果您正苦于以下问题:Java StaticLayout类的具体用法?Java StaticLayout怎么用?Java StaticLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StaticLayout类属于edu.uci.ics.jung.algorithms.layout包,在下文中一共展示了StaticLayout类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setPrototypePreview
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
/**
* This method takes the GraphPrototype class name as string and creates a graph of the prototype and shows a preview in the visualizationViewer
* @param graphPrototype
*/
private void setPrototypePreview() {
String componentName = this.localComponentTypeListElement.getComponentName();
// --- Create the graph of the NetworkComponent -------------
this.localNetworkModel = NetworkComponentFactory.getNetworkModel4NetworkComponent(this.graphController.getNetworkModel().getGeneralGraphSettings4MAS(), componentName, this.getVisualizationViewer().getSize());
this.localGraphElementPrototype = NetworkComponentFactory.getGraphElementPrototypeOfLastNetworkComponent();
if (this.localNetworkModel!=null && this.localGraphElementPrototype!=null) {
// --- Set the graph to the layout ----------------------
Layout<GraphNode, GraphEdge> layout = new StaticLayout<GraphNode, GraphEdge>(this.localNetworkModel.getGraph());
layout.setInitializer(new Transformer<GraphNode, Point2D>() {
public Point2D transform(GraphNode node) {
return node.getPosition();
}
});
this.getVisualizationViewer().setGraphLayout(layout);
this.getVisualizationViewer().repaint();
// --- Pick first GraphNode --------------------
this.pickFirstGraphNode();
this.setSelectedGraphNode();
}
}
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:30,代码来源:AddComponentDialog.java
示例2: renderElement
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
@Override
public void renderElement(JPanel jp, Object elem) {
if (elem instanceof ViwnNode) {
ViwnNode vn = (ViwnNode) elem;
// one node visualisation
Graph<ViwnNode, ViwnEdge> g = new DirectedSparseGraph<>();
g.addVertex(vn);
VisualizationViewer<ViwnNode, ViwnEdge> vv = new VisualizationViewer<>(new StaticLayout<>(g));
vv.getRenderer().setVertexRenderer(new ViwnVertexRenderer(vv.getRenderer().getVertexRenderer()));
vv.getRenderContext().setVertexShapeTransformer((ViwnNode v) -> v.getShape());
vv.getRenderContext().setVertexFillPaintTransformer(new ViwnVertexFillColor(vv.getPickedVertexState(), null));
vv.setVertexToolTipTransformer(new ViwnVertexToolTipTransformer());
vv.setPreferredSize(new Dimension(110, 50));
Point2D q = vv.getGraphLayout().transform(vn);
Point2D lvc = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(vv.getCenter());
vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).translate(lvc.getX() - q.getX(), lvc.getY() - q.getY());
jp.add(vv, "vfill br");
}
}
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:23,代码来源:ViwnLockerViewUI.java
示例3: DerivationViewer
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
public DerivationViewer(DerivationTree g, Dimension d, Color targetColor, AnchorType anchor) {
super(new CircleLayout<>(g));
anchorStyle = anchor;
DerivationTreeTransformer dtt = new DerivationTreeTransformer(g, d, false);
StaticLayout<Node, DerivationTreeEdge> derivationLayout = new StaticLayout<>(g, dtt);
// derivationLayout.setSize(dtt.getSize());
setGraphLayout(derivationLayout);
scaleToLayout(new LayoutScalingControl());
// g.addCorrespondences();
setPreferredSize(new Dimension(DEFAULT_HEIGHT, DEFAULT_WIDTH));
getRenderContext().setVertexLabelTransformer(new ToStringLabeller<>());
DefaultModalGraphMouse<Node, DerivationTreeEdge> graphMouse = new DefaultModalGraphMouse<>();
graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);
setGraphMouse(graphMouse);
addKeyListener(graphMouse.getModeKeyListener());
// this.setPickedVertexState(new DerivationTreePickedState(g));
getRenderContext().setVertexFillPaintTransformer(vp);
getRenderContext().setEdgeStrokeTransformer(es);
getRenderContext().setVertexShapeTransformer(ns);
getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
TGT = targetColor;
anchorPoint = dtt.getAnchorPosition(anchorStyle);
}
开发者ID:apache,项目名称:incubator-joshua,代码行数:27,代码来源:DerivationViewer.java
示例4: DefaultInstanceViewer
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
/**
* Instantiates a new default instance viewer.
*
* @param graph
* the graph
* @param preferredSize
* the preferred size
* @param bounds
* bounds for the nodes coordinates
*/
public DefaultInstanceViewer(Graph<INodeVisit, IArc> graph, Dimension preferredSize,
double[] bounds) {
super(new StaticLayout<INodeVisit, IArc>(graph), preferredSize);
mGraph = graph;
mTransformer = new NodeVisitTransformer(Math.ceil(Math.max(bounds[1] - bounds[0], bounds[3]
- bounds[2])), 14, -bounds[0], -bounds[2]);
getGraphLayout().setInitializer(mTransformer);
addComponentListener(mTransformer);
mVertexSize = UIManager.getFont("Label.font").getSize() + 4;
setDefaultVertexShapeTransformer();
setDefaultVertexFillPaintTransformer();
setDefaultVertexLabelTransformer();
getRenderContext().setVertexFontTransformer(new Transformer<INodeVisit, Font>() {
@Override
public Font transform(INodeVisit arg0) {
return UIManager.getFont("Label.font");
}
});
addComponentListener(this);
}
开发者ID:vpillac,项目名称:vroom,代码行数:34,代码来源:DefaultInstanceViewer.java
示例5: doGraphLayout
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
@Override
public void doGraphLayout() {
layout.setSize(vv.getSize());
layout.initialize();
Relaxer relaxer = new VisRunner((IterativeContext) layout);
relaxer.stop();
relaxer.prerelax();
StaticLayout<Node, Edge> staticLayout = new StaticLayout<Node,Edge>(graph, layout, vv.getSize());
LayoutTransition<Node,Edge> lt = new LayoutTransition<Node,Edge>(vv, vv.getGraphLayout(),
staticLayout);
Animator animator = new Animator(lt);
animator.start();
vv.repaint();
FeatureMask mask = new FeatureMask(FeatureMask.TRANSLATE_SUPPORT | FeatureMask.SCALING_SUPPORT);
GraphEditorEventHandler eventHandler = new GraphEditorEventHandler(vv.getRenderContext(),
null, null, mask);
vv.setGraphMouse(eventHandler);
}
开发者ID:andreiolaru-ro,项目名称:AmIciTy-Grph,代码行数:21,代码来源:AnimatedJungGraphViewer.java
示例6: updateGraph
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
public void updateGraph() {
if (graphService == null || graphService.getReachabilityGraph() == null)
return;
Graph<State, TransitionEdge> graph = graphService.getReachabilityGraph();
visualizationViewer.setGraphLayout(new StaticLayout<>(graph, new ReachGraphInitializer(graph.getVertices())));
bfsDistanceLabeler.labelDistances(graph, ReachabilityGraphGenerator.findRoot(graph));
visualizationViewer.getPickedVertexState().clear();
visualizationViewer.repaint();
}
开发者ID:tomaszi1,项目名称:petri-nets-simulator,代码行数:10,代码来源:ReachabilityGraphPanel.java
示例7: animate
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
private void animate()
{
// while we are animating, the task scheduler is not allowed to modify the graph
// otherwise we will have a ConcurrentModificationException, because this animation iterates
// over the vertices and edges, while the task scheduler thread modifies them.
layout.initialize();
if (GeneralMDPSettings.ANIMATE) {
Relaxer relaxer = new VisRunner((IterativeContext)layout);
relaxer.stop();
relaxer.prerelax();
StaticLayout<Vertex<?>,Edge<?,?>> staticLayout =
new StaticLayout<Vertex<?>,Edge<?,?>>(g, layout);
LayoutTransition<Vertex<?>,Edge<?,?>> lt =
new LayoutTransition<Vertex<?>,Edge<?,?>>(vv, vv.getGraphLayout(),
staticLayout);
Animator animator = new Animator(lt);
animator.start();
}
vv.repaint();
repaint();
// resume scheduling after 200ms, give the visualization some time to draw before editing the graph again
resumeTaskScheduler(GeneralMDPSettings.REPAINT_DELAY-100);
}
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:30,代码来源:MDPDrawer.java
示例8: paintGraph
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的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();
}
开发者ID:burningrain,项目名称:planetBot,代码行数:39,代码来源:GraphWidget.java
示例9: BetterVisualizationViewer
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
public BetterVisualizationViewer() {
super(new ChangeSupportLayout<>(new StaticLayout<>(new DirectedSparseMultigraph<>())));
getRenderer().setEdgeRenderer(new BetterEdgeRenderer<>());
getRenderer().setEdgeLabelRenderer(new BetterEdgeLabelRenderer<>());
getRenderer().setVertexLabelRenderer(new BetterVertexLabelRenderer<>(LabelPosition.BOTTOM_RIGHT));
setPickSupport(new BetterShapePickSupport<>(this));
getGraphLayout().setGraph(new BetterDirectedSparseMultigraph<>(this));
setDoubleBuffered(true);
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:10,代码来源:BetterVisualizationViewer.java
示例10: LayoutTransition
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
/**
* @param startLayout
* @param endLayout
*/
public LayoutTransition(VisualizationViewer<V,E> vv, Layout<V, E> startLayout, Layout<V, E> endLayout) {
this.vv = vv;
this.startLayout = startLayout;
this.endLayout = endLayout;
if(endLayout instanceof IterativeContext) {
Relaxer relaxer = new VisRunner((IterativeContext)endLayout);
relaxer.prerelax();
}
this.transitionLayout =
new StaticLayout<V,E>(startLayout.getGraph(), startLayout);
vv.setGraphLayout(transitionLayout);
}
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:17,代码来源:LayoutTransition.java
示例11: JungGraphViewer
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
public JungGraphViewer(JungGraph aGraph) {
this.graph = aGraph;
this.setLayout(new BorderLayout());
layout = new StaticLayout<Node, Edge>(graph);
vv = new VisualizationViewer<Node, Edge>(layout);
vv.setBackground(Color.white);
vv.getRenderContext().setVertexLabelTransformer(new NodeTransformer());
vv.getRenderContext().setEdgeLabelTransformer(new EdgeTransformer());
vv.getRenderContext().setVertexStrokeTransformer(new NodeStrokeTransformer(vv));
vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.YELLOW));
vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
Transformer<Node, Shape> vertexSize = new Transformer<Node, Shape>() {
public Shape transform(Node i) {
int length = i.getLabel().length() * 10;
length = length > 30 ? length : 30;
return new Rectangle(-20, -10, length, 30);
}
};
vv.getRenderContext().setVertexShapeTransformer(vertexSize);
final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
panel.setPreferredSize(new Dimension(400, 400));
add(panel, BorderLayout.CENTER);
}
开发者ID:andreiolaru-ro,项目名称:AmIciTy-Grph,代码行数:29,代码来源:JungGraphViewer.java
示例12: rotateGraph
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
/**
* Rotates the current graph around itself.
* @param rotateAngle the angle on which the graph should rotate
*/
private void rotateGraph(double rotateAngle) {
if (this.localNetworkModel!=null) {
Graph<GraphNode, GraphEdge> graph = this.localNetworkModel.getGraph();
if (graph!=null) {
Vector<GraphNode> graphNodes = new Vector<GraphNode>(graph.getVertices());
if (graphNodes.size()>1) {
double centerX = this.getVisualizationViewer().getCenter().getX();
double centerY = this.getVisualizationViewer().getCenter().getY();
// --- Get all GraphNodes and rotate then around the center ---
for (GraphNode graphNode : graphNodes) {
double newX = 0;
double newY = 0;
double oldX = graphNode.getPosition().getX() - centerX;
double oldY = graphNode.getPosition().getY() - centerY;
double hypotenuse = Math.pow((Math.pow(oldX, 2) + Math.pow(oldY, 2)), 0.5);
hypotenuse = Math.round(hypotenuse*10)/10;
double oldAngle = Math.atan(oldY / oldX);
if (Double.isNaN(oldAngle)==false) {
if (oldX < 0 && oldY >= 0) {
oldAngle += Math.PI;
} else if (oldX < 0 && oldY < 0){
oldAngle += Math.PI;
}else if (oldX >= 0 && oldY < 0){
oldAngle += 2*Math.PI;
}
double newAngle = oldAngle + rotateAngle;
newX = Math.cos(newAngle) * hypotenuse;
newY = Math.sin(newAngle) * hypotenuse;
}
Point2D newPosition = new Point2D.Double(centerX+newX, centerY+newY);
graphNode.setPosition(newPosition);
}
Layout<GraphNode, GraphEdge> layout = new StaticLayout<GraphNode, GraphEdge>(graph);
layout.setInitializer(new Transformer<GraphNode, Point2D>() {
public Point2D transform(GraphNode node) {
return node.getPosition(); // The position is specified in the GraphNode instance
}
});
this.getVisualizationViewer().setGraphLayout(layout);
this.getVisualizationViewer().repaint();
}
}
}
}
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:58,代码来源:AddComponentDialog.java
示例13: setGraph
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
public void setGraph(DerivationTree tree) {
DerivationTreeTransformer dtt = new DerivationTreeTransformer(tree, getSize(), true);
dtt.setAnchorPoint(anchorStyle, anchorPoint);
setGraphLayout(new StaticLayout<>(tree, dtt));
}
开发者ID:apache,项目名称:incubator-joshua,代码行数:6,代码来源:DerivationViewer.java
示例14: createGraphComponent
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的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
示例15: process
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
public void process() {
vv.getRenderContext().getPickedVertexState().clear();
vv.getRenderContext().getPickedEdgeState().clear();
try {
if (g.getVertexCount() < 100) {
//add a vertex
Integer v1 = new Integer(g.getVertexCount());
g.addVertex(v1);
vv.getRenderContext().getPickedVertexState().pick(v1, true);
// wire it to some edges
if (v_prev != null) {
Integer edge = g.getEdgeCount();
vv.getRenderContext().getPickedEdgeState().pick(edge, true);
g.addEdge(edge, v_prev, v1);
// let's connect to a random vertex, too!
int rand = (int) (Math.random() * g.getVertexCount());
edge = g.getEdgeCount();
vv.getRenderContext().getPickedEdgeState().pick(edge, true);
g.addEdge(edge, v1, rand);
}
v_prev = v1;
layout.initialize();
Relaxer relaxer = new VisRunner((IterativeContext)layout);
relaxer.stop();
relaxer.prerelax();
StaticLayout<Number,Number> staticLayout =
new StaticLayout<Number,Number>(g, layout);
LayoutTransition<Number,Number> lt =
new LayoutTransition<Number,Number>(vv, vv.getGraphLayout(),
staticLayout);
Animator animator = new Animator(lt);
animator.start();
// vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
vv.repaint();
} else {
done = true;
}
} catch (Exception e) {
System.out.println(e);
}
}
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:52,代码来源:AnimatingAddNodeDemo.java
示例16: main
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
JFrame frame = new JFrame("Editing and Mouse Menu Demo");
SparseMultigraph<GraphElements.MyVertex, GraphElements.MyEdge> g =
new SparseMultigraph<GraphElements.MyVertex, GraphElements.MyEdge>();
// Layout<V, E>, VisualizationViewer<V,E>
// Map<GraphElements.MyVertex,Point2D> vertexLocations = new HashMap<GraphElements.MyVertex, Point2D>();
Layout<GraphElements.MyVertex, GraphElements.MyEdge> layout = new StaticLayout(g);
layout.setSize(new Dimension(300,300));
VisualizationViewer<GraphElements.MyVertex,GraphElements.MyEdge> vv =
new VisualizationViewer<GraphElements.MyVertex,GraphElements.MyEdge>(layout);
vv.setPreferredSize(new Dimension(350,350));
// Show vertex and edge labels
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
// Create a graph mouse and add it to the visualization viewer
EditingModalGraphMouse gm = new EditingModalGraphMouse(vv.getRenderContext(),
GraphElements.MyVertexFactory.getInstance(),
GraphElements.MyEdgeFactory.getInstance());
// Set some defaults for the Edges...
GraphElements.MyEdgeFactory.setDefaultCapacity(192.0);
GraphElements.MyEdgeFactory.setDefaultWeight(5.0);
// Trying out our new popup menu mouse plugin...
PopupVertexEdgeMenuMousePlugin myPlugin = new PopupVertexEdgeMenuMousePlugin();
// Add some popup menus for the edges and vertices to our mouse plugin.
JPopupMenu edgeMenu = new MyMouseMenus.EdgeMenu(frame);
JPopupMenu vertexMenu = new MyMouseMenus.VertexMenu();
myPlugin.setEdgePopup(edgeMenu);
myPlugin.setVertexPopup(vertexMenu);
gm.remove(gm.getPopupEditingPlugin()); // Removes the existing popup editing plugin
gm.add(myPlugin); // Add our new plugin to the mouse
vv.setGraphMouse(gm);
//JFrame frame = new JFrame("Editing and Mouse Menu Demo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(vv);
// Let's add a menu for changing mouse modes
JMenuBar menuBar = new JMenuBar();
JMenu modeMenu = gm.getModeMenu();
modeMenu.setText("Mouse Mode");
modeMenu.setIcon(null); // I'm using this in a main menu
modeMenu.setPreferredSize(new Dimension(80,20)); // Change the size so I can see the text
menuBar.add(modeMenu);
frame.setJMenuBar(menuBar);
gm.setMode(ModalGraphMouse.Mode.EDITING); // Start off in editing mode
frame.pack();
frame.setVisible(true);
}
开发者ID:ksotala,项目名称:BayesGame,代码行数:56,代码来源:EditorMouseMenu.java
示例17: getConfiguredLayout
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
@Override
public Layout<AbstractType,String> getConfiguredLayout() {
return new StaticLayout<AbstractType,String>( this.graph, this, getGraphDimension());
}
开发者ID:roboconf,项目名称:roboconf-platform,代码行数:5,代码来源:RuntimeTransformer.java
示例18: getConfiguredLayout
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
/**
* @return a layout that use the computed positions
*/
public Layout<AbstractType,String> getConfiguredLayout() {
return new StaticLayout<AbstractType,String>( getGraph(), this, getGraphDimension());
}
开发者ID:roboconf,项目名称:roboconf-platform,代码行数:7,代码来源:AbstractRoboconfTransformer.java
示例19: refreshLayout
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
private void refreshLayout() {
if (active) {
taskManager.cancelAllWaitingTasks();
taskManager.addTask(new ICTask() {
public void doTask() {
StaticLayout<V, E> toLayout;
Layout<V, E> currentLayout;
synchronized (getTreeLock()) {
currentLayout = viewer.getGraphLayout(); // StaticLayout
layout.setSize(viewer.getSize());
if (layout instanceof IterativeContext) { // 最後まで進める
// layout.setInitializer(currentLayout);
Relaxer relaxer = new VisRunner(
(IterativeContext) layout);
relaxer.prerelax();
} else {// CircleLayoutの場合
layout.initialize();
}
toLayout = new StaticLayout<V, E>(getGraph(), layout);
}
if (isAnimation()) {
LayoutTransition<V, E> layoutTransition = new LayoutTransition<V, E>(
viewer, currentLayout, toLayout);
Animator animator = new Animator(layoutTransition);
// animator.setSleepTime(100);
animator.run(); // animator.start();
// while (!layoutTransition.done()) {
// viewer.requestRefresh();
// layoutTransition.step();
// CThread.sleep(10L);
// }
} else {
viewer.setGraphLayout(toLayout);
// while (!layoutTransition.done()) {
// layoutTransition.step();
// }
}
// viewer.getRenderContext().getMultiLayerTransformer()
// .setToIdentity();
viewer.requestRefresh();
viewer.repaint();
}
});
}
}
开发者ID:macc704,项目名称:KBDeX,代码行数:49,代码来源:KNetworkPanel.java
示例20: createLayout
import edu.uci.ics.jung.algorithms.layout.StaticLayout; //导入依赖的package包/类
/**
* Create the petersen graph layout
*
* @param g
* The graph to create the layout for
* @return The created layout
*/
public StaticLayout<String, String> createLayout(Graph<String, String> g) {
StaticLayout<String, String> layout = new StaticLayout<String, String>(
g, new PetersenCoordinateTransformer());
return layout;
}
开发者ID:markuskorbel,项目名称:adt.reference,代码行数:13,代码来源:PetersenGraphLayoutFactory.java
注:本文中的edu.uci.ics.jung.algorithms.layout.StaticLayout类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论