当前位置: 首页>>代码示例>>Java>>正文


Java Position类代码示例

本文整理汇总了Java中edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position的典型用法代码示例。如果您正苦于以下问题:Java Position类的具体用法?Java Position怎么用?Java Position使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Position类属于edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel包,在下文中一共展示了Position类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getServer

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的package包/类
/**
 * @param args the command line arguments
 * @return
 */
public VisualizationImageServer<Integer, String> getServer() {
    // Layout<V, E>, VisualizationComponent<V,E>
    Layout<Integer, String> layout = new CircleLayout<>(
            this);
    layout.setSize(new Dimension(300, 300));
    VisualizationImageServer<Integer, String> vv = new VisualizationImageServer<>(
            layout, new Dimension(350, 350));
    // Setup up a new vertex to paint transformer...
    // Set up a new stroke Transformer for the edges
    float dash[] = {10.0f};
    final Stroke edgeStroke = new BasicStroke(1.0f,
            BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash,
            0.0f);
    vv.getRenderContext().setVertexFillPaintTransformer(i -> Color.GREEN);
    vv.getRenderContext().setEdgeStrokeTransformer(
            s -> edgeStroke);
    vv.getRenderContext().setVertexLabelTransformer(
            new ToStringLabeller());
    vv.getRenderContext().setEdgeLabelTransformer(
            new ToStringLabeller());
    vv.getRenderer().getVertexLabelRenderer()
            .setPosition(Position.CNTR);

    return vv;
}
 
开发者ID:mstahv,项目名称:svgexamples,代码行数:30,代码来源:JungExample.java

示例2: configVisualizationViewer

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的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()));
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:25,代码来源:MyGraphPanel.java

示例3: DerivationViewer

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的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: setUpView

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的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);
    }
 
开发者ID:sinantie,项目名称:Generator,代码行数:22,代码来源:VisualiseHypergraph.java

示例5: StateVisualizer

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的package包/类
public StateVisualizer() {
    super("Model Visualizer");
    graph = new DirectedSparseMultigraph<>();
    graph.addVertex(current);
//    Layout<FSMTransition, String> layout = new CircleLayout<FSMTransition, String>(graph);
    layout = new KKLayout<>(graph);
    layout.setSize(new Dimension(800, 600)); // sets the initial size of the space
    vv = new VisualizationViewer<>(layout);
    vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
    VertexLabelAsShapeRenderer<String, StepCounter> vlasr = new VertexLabelAsShapeRenderer<>(vv.getRenderContext());
//    vv.getRenderContext().setVertexShapeTransformer(vlasr);
    vv.getRenderContext().setVertexShapeTransformer(new EllipseVertexTransformer());
//    vv.getRenderContext().setVertexLabelRenderer(new TransitionVertextLabelRenderer(Color.GREEN));
    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    vv.addKeyListener(gm.getModeKeyListener());
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
    vv.setGraphMouse(gm);
    getContentPane().add(vv);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(1024, 768);
    pack();
    setVisible(true);
  }
 
开发者ID:mukatee,项目名称:osmo,代码行数:27,代码来源:StateVisualizer.java

示例6: FSMBuildVisualizer

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的package包/类
public FSMBuildVisualizer() {
    super("Model Visualizer");
    graph = new DirectedSparseMultigraph<>();
    graph.addVertex(current);
//    Layout<FSMTransition, String> layout = new CircleLayout<FSMTransition, String>(graph);
    layout = new KKLayout<>(graph);
    layout.setSize(new Dimension(800, 600)); // sets the initial size of the space
    vv = new VisualizationViewer<>(layout);
    vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
    VertexLabelAsShapeRenderer<String, StepCounter> vlasr = new VertexLabelAsShapeRenderer<>(vv.getRenderContext());
//    vv.getRenderContext().setVertexShapeTransformer(vlasr);
    vv.getRenderContext().setVertexShapeTransformer(new EllipseVertexTransformer());
//    vv.getRenderContext().setVertexLabelRenderer(new TransitionVertextLabelRenderer(Color.GREEN));
    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    vv.addKeyListener(gm.getModeKeyListener());
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
    vv.setGraphMouse(gm);
    getContentPane().add(vv);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(1024, 768);
    pack();
    setVisible(true);
  }
 
开发者ID:mukatee,项目名称:osmo,代码行数:27,代码来源:FSMBuildVisualizer.java

示例7: getGraphPanel

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的package包/类
private JComponent getGraphPanel() {
    if (vv == null) {
        layout = new RoleGraphLayout(graph);
        layout.setSize(new Dimension(300, 300));
        vv = new VisualizationViewer<String, String>(layout);
        vv.setBorder(new LineBorder(new Color(0, 0, 0)));
        vv.getRenderContext().setVertexFillPaintTransformer(new RoleVertexColorTransformer());
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>());
        vv.getRenderContext().setVertexShapeTransformer(new RoleVertexSizeTransformer());
        vv.getRenderContext().setEdgeLabelTransformer(new RoleEdgeLabeller());
        vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
        vv.setPreferredSize(new Dimension(350, 350));
        gm = new RoleGraphMouse(vv.getRenderContext());
        vv.setGraphMouse(gm);
        gm.setPickingMode();
        gm.addEdgeAddedListener(this);

        vv.setFocusable(true);
        vv.addKeyListener(new GraphKeyListener());
    }
    return vv;
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:23,代码来源:RoleLatticeDialog.java

示例8: run

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的package包/类
/**
 * This method runs the necessary calls to generate a JUNG visualizer with a GEXF file.
 * Uses a graph from <code>GexfReader(String filename)</code> and Transformers from <code>org.iqt.gexf2jung.transformers</code> to make a <code>BasicVisualizationServer</code>.
 * @param filename This must be acceptable by the constructor <code>File(filename)</code>
 * @param width The width of the window
 * @param height The height of the window
 * @param x the X coordinate of the window's position
 * @param y the Y coordinate of the window's position
 * @throws ParserConfigurationException see <code>GexfReader.read(String filename)</code>
 * @throws SAXException see <code>GexfReader.read(String filename)</code>
 * @throws IOException Called if the filename is not valid.
 * @see GexfReader
 */
public static void run(String filename, int width, int height, int x, int y) throws ParserConfigurationException, SAXException, IOException{
    Graph<Node, Edge> g = GexfReader.read(filename);
    Layout<Node, Edge> layout = new CircleLayout<Node, Edge>(g);
    layout.setSize(new Dimension(width, height)); // sets the initial size of the space
    // The BasicVisualizationServer<V,E> is parameterized by the edge types
    BasicVisualizationServer<Node, Edge> vv
            = new BasicVisualizationServer<Node, Edge>(layout);
    vv.setPreferredSize(new Dimension(width, height)); //Sets the viewing area size
    vv.getRenderContext().setVertexFillPaintTransformer(new GexfNodePaintTransformer());
    vv.getRenderContext().setVertexShapeTransformer(new GexfNodeShapeTransformer());
    vv.getRenderContext().setEdgeStrokeTransformer(new GexfEdgeStrokeTransformer());
    vv.getRenderContext().setVertexLabelTransformer(new GexfNodeLabelTransformer());
    vv.getRenderContext().setEdgeLabelTransformer(new GexfEdgeLabelTransformer());
    vv.getRenderContext().setEdgeDrawPaintTransformer(new GexfEdgePaintTransformer());
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.AUTO);

    JFrame frame = new JFrame("Graph View");
    frame.setLocation(x, y);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(vv);
    frame.pack();
    frame.setVisible(true);
}
 
开发者ID:ave4224,项目名称:gexf2jung,代码行数:37,代码来源:App.java

示例9: configVisualizationViewer

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的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()));
}
 
开发者ID:liruixpc11,项目名称:crucian,代码行数:25,代码来源:MyGraphPanel.java

示例10: initialize

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的package包/类
protected void initialize() {
	networkPanel.getViewer().getRenderContext()
			.setVertexFillPaintTransformer(paintTransformer);
	networkPanel.getViewer().getRenderer().getVertexLabelRenderer()
			.setPosition(Position.CNTR);
	networkPanel.getViewer().getRenderContext()
			.setVertexDrawPaintTransformer(new Transformer<V, Paint>() {
				public Paint transform(V v) {
					return Color.BLACK;
				};
			});

	toggleLabelCheckBox.setSelected(true);
	toggleLabelCheckBox
			.setAction(createToggleLabelAction(toggleLabelCheckBox));
	setToggleLabelStatus(true);
	toggleIconCheckBox.setSelected(false);
	toggleIconCheckBox
			.setAction(createToggleIconAction(toggleIconCheckBox));
	setToggleIconStatus(false);
}
 
开发者ID:macc704,项目名称:KBDeX,代码行数:22,代码来源:KNetworkVertexDecorationController.java

示例11: init

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的package包/类
private void init() {
    this.vizPanel = GraphVisualizationPanel.factory(this.graph);
    RenderContext<ConflictVertex, ConflictEdge> rc = this.vizPanel.getRenderContext(); 
    rc.setEdgeDrawPaintTransformer(this.edgeColor);
    rc.setEdgeStrokeTransformer(this.edgeStroke);
    rc.setArrowDrawPaintTransformer(this.edgeColor);
    rc.setArrowFillPaintTransformer(this.edgeColor);
    rc.setVertexFillPaintTransformer(this.vertexColor);
    rc.setVertexDrawPaintTransformer(this.vertexLine);
    rc.setVertexShapeTransformer(this.vertexShape);
    rc.setVertexLabelTransformer(this.vertexLabel);
    rc.setVertexFontTransformer(new GraphVisualizationPanel.VertexFontTransformer<ConflictVertex>(true));
    this.vizPanel.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:ProcedureConflictGraphNode.java

示例12: writeGraph

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的package包/类
/**
 * Writes a graph as a PNG image.
 * @param outputFile the output file
 * @param selectedComponent the component to highlight
 * @param layout the layout
 * @param graph the graph
 * @param edgeShapeTransformer the transformer for edge shapes (straight line, curved line, etc)
 * @throws IOException if something went wrong
 */
public static void writeGraph(
		File outputFile,
		Component selectedComponent,
		Layout<AbstractType,String> layout,
		Graph<AbstractType,String> graph ,
		AbstractEdgeShapeTransformer<AbstractType,String> edgeShapeTransformer,
		Map<String,String> options )
throws IOException {

	VisualizationImageServer<AbstractType,String> vis =
			new VisualizationImageServer<AbstractType,String>( layout, layout.getSize());

	vis.setBackground( Color.WHITE );
	vis.getRenderContext().setEdgeLabelTransformer( new NoStringLabeller ());
	vis.getRenderContext().setEdgeShapeTransformer( edgeShapeTransformer );

	vis.getRenderContext().setVertexLabelTransformer( new ToStringLabeller<AbstractType> ());
	vis.getRenderContext().setVertexShapeTransformer( new VertexShape());
	vis.getRenderContext().setVertexFontTransformer( new VertexFont());

	Color defaultBgColor = decode( options.get( DocConstants.OPTION_IMG_BACKGROUND_COLOR ), DocConstants.DEFAULT_BACKGROUND_COLOR );
	Color highlightBgcolor = decode( options.get( DocConstants.OPTION_IMG_HIGHLIGHT_BG_COLOR ), DocConstants.DEFAULT_HIGHLIGHT_BG_COLOR );
	vis.getRenderContext().setVertexFillPaintTransformer( new VertexColor( selectedComponent, defaultBgColor, highlightBgcolor ));

	Color defaultFgColor = decode( options.get( DocConstants.OPTION_IMG_FOREGROUND_COLOR ), DocConstants.DEFAULT_FOREGROUND_COLOR );
	vis.getRenderContext().setVertexLabelRenderer( new MyVertexLabelRenderer( selectedComponent, defaultFgColor ));
	vis.getRenderer().getVertexLabelRenderer().setPosition( Position.CNTR );

	BufferedImage image = (BufferedImage) vis.getImage(
			new Point2D.Double(
					layout.getSize().getWidth() / 2,
					layout.getSize().getHeight() / 2),
			new Dimension( layout.getSize()));

	ImageIO.write( image, "png", outputFile );
}
 
开发者ID:roboconf,项目名称:roboconf-platform,代码行数:46,代码来源:GraphUtils.java

示例13: JungGraphViewer

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的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

示例14: InitiateGraph

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的package包/类
public void InitiateGraph(Character[] cs, Template[] templates, Color[] colors, String[] picture_keys,
                          String[] extra_keys) {

    Map<CharacterNode, Icon> iconMap = new HashMap<CharacterNode, Icon>();

    characters = new CharacterNode[cs.length];
    for (int x = 0; x < cs.length; x++) {

        characters[x] = new CharacterNode(cs[x]);

        for (int y = 0; y < templates.length; y++) {

            if (cs[x].templateIdentifier.equals(templates[y].GetTemplateID())) {

                characters[x].color = colors[y];
                characters[x].extra_key = extra_keys[y];

                ImageIcon img = XEED.RescaleImageIcon((ImageIcon) cs[x].imgData.get(picture_keys[y]), ImageMaxSize,
                        ImageMaxSize);

                if (img != null) {
                    iconMap.put(characters[x], new LayeredIcon(img.getImage()));
                }

            }

        }
    }

    // creates the graph
    graph = new DelegateForest<CharacterNode, Integer>();

    //Loads the tree data
    createTree();

    //Sets up the transformer that paints the node.
    Transformer<CharacterNode, Paint> vertexPaint = new Transformer<CharacterNode, Paint>() {

        @Override
        public Paint transform(CharacterNode cn) {
            ;
            return cn.color;
        }
    };

    final DefaultVertexIconTransformer<CharacterNode> vertexIconFunction = new DefaultVertexIconTransformer<CharacterNode>();
    vertexIconFunction.setIconMap(iconMap);

    final VertexIconShapeTransformer<CharacterNode> vertexImageShapeFunction = new VertexIconShapeTransformer<CharacterNode>(
            new EllipseVertexShapeTransformer<CharacterNode>());
    vertexImageShapeFunction.setIconMap(iconMap);

    treeLayout = new TreeLayout<CharacterNode, Integer>(graph, TreeLayout.DEFAULT_DISTX * 3);

    //Skriva en anpassad metod för att bestämma platser.
    //använd treeLayout.setLocation();

    vv = new VisualizationViewer<CharacterNode, Integer>(treeLayout);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv.getRenderContext().setVertexShapeTransformer(vertexImageShapeFunction);
    vv.getRenderContext().setVertexIconTransformer(vertexIconFunction);
    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());
    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.AUTO);

    Container content = this;
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);
    panel.setVisible(true);
    content.validate();

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
    vv.setGraphMouse(graphMouse);

    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

}
 
开发者ID:ErikGartner,项目名称:xeed,代码行数:81,代码来源:GenealogyGraphPanel.java

示例15: visualize

import edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void visualize(JungNetwork graph, String title, int type)
{
	// The Layout<V, E> is parameterized by the vertex and edge types 
	Layout<JungVertex, JungEdge> layout	= null;
	
	switch (type)
	{
		case CIRCLE:
			layout = new CircleLayout<JungVertex, JungEdge>(graph); 
			break;
			
		case SPRING:
			layout = new SpringLayout<JungVertex, JungEdge>(graph); 
			break;
			
		case FR:
			layout = new FRLayout<JungVertex, JungEdge>(graph); 
			break;
			
		case ISOM:
			layout = new ISOMLayout<JungVertex, JungEdge>(graph); 
			break;
			
		case DAG:
			layout = new DAGLayout<JungVertex, JungEdge>(graph);
			break;

		case SPRING2:
			layout = new SpringLayout2<JungVertex, JungEdge>(graph);
			break;
			
		default:
			layout = new KKLayout<JungVertex, JungEdge>(graph); 
	}
	
	layout.setSize(new Dimension(800,800)); // sets the initial size of the space 
	
	// The BasicVisualizationServer<V,E> is parameterized by the edge types 
	BasicVisualizationServer<JungVertex,JungEdge> vv = 
		new BasicVisualizationServer<JungVertex,JungEdge>(layout);
	
	vv.setPreferredSize(new Dimension(900,900)); //Sets the viewing area size  
	vv.scaleToLayout(new LayoutScalingControl() );
       vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); 
       vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());        
       vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR); 
       
	JFrame frame = new JFrame(title); 
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
	frame.getContentPane().add(vv); 
	frame.pack(); 
	frame.setVisible(true); 
}
 
开发者ID:Rees-Brad,项目名称:FastEgoClustering,代码行数:55,代码来源:Visualize.java


注:本文中的edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。