• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LayoutScalingControl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: DerivationViewer

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


示例2: mouseWheelMoved

import edu.uci.ics.jung.visualization.control.LayoutScalingControl; //导入依赖的package包/类
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
	if (e.getWheelRotation() == 0) {
		return;
	}

	VisualizationViewer<?, ?> vv = (VisualizationViewer<?, ?>) e.getSource();

	new LayoutScalingControl().scale(vv, e.getWheelRotation() > 0 ? in : out, e.getPoint());
	vv.repaint();

	if (lastTask != null) {
		lastTask.cancel(false);
	}

	lastTask = scheduler.schedule(
			() -> Stream.of(listeners.getListeners(JungListener.class)).forEach(l -> l.transformFinished()), 200,
			TimeUnit.MILLISECONDS);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:20,代码来源:BetterScalingGraphMousePlugin.java


示例3: fillVV

import edu.uci.ics.jung.visualization.control.LayoutScalingControl; //导入依赖的package包/类
/**
 * scale visualisation to fill full visualization viewer space
 *
 * @author amusial
 */
protected void fillVV() {
    // scale
    // if layout was scaled, scale it to it original size
    if (vv.getRenderContext().getMultiLayerTransformer()
            .getTransformer(Layer.LAYOUT).getScaleX() > 1D) {
        (new LayoutScalingControl()).scale(vv, (1f / (float) vv
                        .getRenderContext().getMultiLayerTransformer()
                        .getTransformer(Layer.LAYOUT).getScaleX()),
                new Point2D.Double());
    }
    // get view bounds
    Dimension vd = vv.getPreferredSize();
    if (vv.isShowing()) {
        vd = vv.getSize();
    }
    // get visualisation layout size
    Dimension ld = vv.getGraphLayout().getSize();
    // finally scale it if view bounds are different than visualisation layer bounds
    if (vd.equals(ld) == false) {
        float heightRatio = (float) (vd.getWidth() / ld.getWidth());
        float widthRatio = (float) (vd
                .getHeight() / ld.getHeight());

        scaler.scale(vv, (heightRatio < widthRatio ? heightRatio
                : widthRatio), new Point2D.Double());
    }
}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:33,代码来源:ViwnGraphViewUI.java


示例4: refreshViewUI

import edu.uci.ics.jung.visualization.control.LayoutScalingControl; //导入依赖的package包/类
/**
 * refresh satellite view
 * <p>
 * TODO: do it better than recreating satellite, probably wont fix TODO:
 * visualisation should be centered in the view, centered at the center of the view
 * not at the root or selected node, probably done, need testing TODO: visualisation
 * should be resized to fill full size of view, something is wrong when
 * visualisation scale is >1, fixed by double scaling
 */
public void refreshViewUI() {
    // System.out.println("refresh satellite view UI");
    // remove old satellite panel
    rootPanel.removeAll();
    // to get dimension of parent
    rootPanel.repaint();

    // refresh satellite
    refreshSatellite();

    // scale
    // if layout was scaled, scale it to it original size
    if (vv.getRenderContext().getMultiLayerTransformer().getTransformer(
            Layer.LAYOUT).getScaleX() > 1D) {
        (new LayoutScalingControl()).scale(satellite,
                (1f / (float) satellite.getRenderContext()
                        .getMultiLayerTransformer().getTransformer(
                                Layer.LAYOUT).getScaleX()),
                new Point2D.Double());
    }
    // get view bounds
    Dimension vd = satellite.getPreferredSize();
    if (satellite.isShowing()) {
        vd = satellite.getSize();
    }
    // get visualisation layout size
    Dimension ld = satellite.getGraphLayout().getSize();
    // finally scale it if view bounds are different than visualisation layer bounds
    if (vd.equals(ld) == false) {
        float heightRatio = (float) (vd.getWidth() / ld.getWidth()), widthRatio = (float) (vd
                .getHeight() / ld.getHeight());

        satelliteScaler.scale(satellite,
                (heightRatio < widthRatio ? heightRatio : widthRatio),
                new Point2D.Double());
    }

    // center
    Point2D q = new Point2D.Double(satellite.getGraphLayout().getSize()
            .getWidth() / 2, satellite.getGraphLayout().getSize()
            .getHeight() / 2);
    Point2D lvc = satellite.getRenderContext().getMultiLayerTransformer()
            .inverseTransform(satellite.getCenter());
    // vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW).translate(lvc.getX()
    // - q.getX(), lvc.getY() - q.getY());
    satellite.getRenderContext().getMultiLayerTransformer().getTransformer(
            Layer.LAYOUT).translate(lvc.getX() - q.getX(),
            lvc.getY() - q.getY());

    // Create and add a panel for visualisation visualization.
    rootPanel.add(getSatelliteGraphViewer(), "hfill vfill");

    // force repaint of the view
    rootPanel.getParent().repaint();
}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:65,代码来源:ViwnSatelliteGraphViewUI.java


示例5: visualize

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


示例6: ZoomPanGraphMouse

import edu.uci.ics.jung.visualization.control.LayoutScalingControl; //导入依赖的package包/类
public ZoomPanGraphMouse(float in, float out) {
    translatingPlugin = new TranslatingGraphMousePlugin();
    scalingPlugin = new ScalingGraphMousePlugin(new LayoutScalingControl(), 0, in, out);
    add(translatingPlugin);
    add(scalingPlugin);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:7,代码来源:ZoomPanGraphMouse.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BufferManagerReadGrow类代码示例发布时间:2022-05-22
下一篇:
Java CounterGroupProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap