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


Java DefaultEdgeLabelRenderer类代码示例

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


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

示例1: applyStyles

import edu.uci.ics.jung.visualization.renderers.DefaultEdgeLabelRenderer; //导入依赖的package包/类
public static <V, E> void applyStyles(final VisualizationViewer<V, E> visualizationViewer) {
    final RenderContext<V, E> renderContext = visualizationViewer.getRenderContext();

    renderContext.setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(WidgetUtils.BG_COLOR_BLUE_MEDIUM, false));
    renderContext.setEdgeStrokeTransformer(input -> stroke);
    renderContext.setEdgeDrawPaintTransformer(input -> WidgetUtils.BG_COLOR_LESS_BRIGHT);
    renderContext.setVertexLabelRenderer(new DefaultVertexLabelRenderer(WidgetUtils.BG_COLOR_BLUE_MEDIUM));
    renderContext.setEdgeFontTransformer(GraphUtils.createFontTransformer());
    renderContext.setVertexFontTransformer(GraphUtils.createFontTransformer());

    final DefaultModalGraphMouse<Object, Integer> graphMouse = new DefaultModalGraphMouse<Object, Integer>() {
        @Override
        public void mouseWheelMoved(final MouseWheelEvent e) {
            // avoid zooming
            return;
        }
    };
    graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
    graphMouse.setZoomAtMouse(false);

    visualizationViewer.setGraphMouse(graphMouse);
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:23,代码来源:GraphUtils.java

示例2: DrawnIconVertexDemo

import edu.uci.ics.jung.visualization.renderers.DefaultEdgeLabelRenderer; //导入依赖的package包/类
public DrawnIconVertexDemo(final Deployment dm) {
    this.dmodel = dm;
    // create a simple graph for the demo
    graph = new DirectedSparseGraph<Vertex, Edge>();
    vv = new VisualizationViewer<Vertex, Edge>(new SpringLayout2<Vertex, Edge>(graph));

    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan));
    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan));

    vv.getRenderContext().setVertexIconTransformer(vertexColor);


    vv.getRenderContext().setVertexFillPaintTransformer(new PickableVertexPaintTransformer<Vertex>(vv.getPickedVertexState(), Color.white, Color.yellow));
    vv.getRenderContext().setEdgeDrawPaintTransformer(edgeColor);

    vv.setBackground(Color.white);

    // add my listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Vertex>());
}
 
开发者ID:SINTEF-9012,项目名称:cloudml,代码行数:21,代码来源:DrawnIconVertexDemo.java

示例3: createGraphViewer

import edu.uci.ics.jung.visualization.renderers.DefaultEdgeLabelRenderer; //导入依赖的package包/类
private void createGraphViewer() {
        MyVisualizationViewer vv = this;
        vv.addGraphMouseListener(new TestGraphMouseListener<String>());
        // add my listeners for ToolTips
        vv.setVertexToolTipTransformer(createNodeTooltipTransformer());
        final VertexIconShapeTransformer<String> vertexImageShapeFunction =
            new VertexIconShapeTransformer<String>(new EllipseVertexShapeTransformer<String>());
        vv.getRenderContext().setVertexShapeTransformer(vertexImageShapeFunction);
        final DefaultVertexIconTransformer<String> vertexIconFunction =
        	new DefaultVertexIconTransformer<String>();
        vv.getRenderContext().setVertexIconTransformer(vertexIconFunction);
        vertexImageShapeFunction.setIconMap(iconMap);
        vertexIconFunction.setIconMap(iconMap);

        vv.setEdgeToolTipTransformer(createEdgeToolTipTransformer());

        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>());
        vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO);

        // 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);
//        Transformer<String, Stroke> edgeStrokeTransformer =
//              new Transformer<String, Stroke>() {
//                    public Stroke transform(String s) {
//                        return edgeStroke;
//                    }
//        };
//        vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer);
        vv.getRenderContext().setEdgeStrokeTransformer(createEdgeStrokeTransformer());
        vv.getRenderContext().setEdgeLabelTransformer(createEdgeLabelTransformer());
        vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan));
        vv.getRenderContext().setEdgeDrawPaintTransformer(createEdgeDrawPaintTransformer());
    }
 
开发者ID:iTransformers,项目名称:netTransformer,代码行数:36,代码来源:MyVisualizationViewer.java

示例4: JungGraphViewer

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

示例5: JungVisualizationViewer

import edu.uci.ics.jung.visualization.renderers.DefaultEdgeLabelRenderer; //导入依赖的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);
	}
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:61,代码来源:JungVisualizationViewer.java


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