`

Draw2d 连线六 路由 Router

 
阅读更多

关键字:Draw2d 连线 路由 Router ManhattanConnectionRouter

 

NullConnectionRouter : 直接的直线连接。

FanRouter : 防治连线重叠的连接。

BendpointConnectionRouter : 允许用户任意拖动连线中的部分的方式增加节点。

ShortestPathConnectionRouter : 最短路径的连接。

ManhattanConnectionRouter : 都以垂直和水平的方式来连接,同时回避线条重叠。

 

ManhattanConnectionRouter  效果:

 

public class HelloWorld2 {
	public static void main(String args[]) {
		Shell shell = new Shell();
		shell.setText("Draw2d Hello World");
		shell.setSize(300, 300);
		shell.open();

		// create content 4 shell.
		createContent4Shell(shell);

		while (!shell.isDisposed ()) {
			if (!Display.getDefault().readAndDispatch ())
				Display.getDefault().sleep ();
		}
	}

	private static void createContent4Shell(Shell shell) {
		Panel rootFigure = new Panel();
		rootFigure.setLayoutManager(new XYLayout());

		IFigure figure1 = new Ellipse();
		Ellipse figure2 = new Ellipse();

		// --------------------------------------------------------
		// add connection
		PolylineConnection connection = new PolylineConnection();
		connection.setSourceAnchor(new ChopboxAnchor(figure1));
		connection.setTargetAnchor(new EllipseAnchor(figure2));

		// --------------------------------------------------------
		// add Decoration to Connection
		connection.setSourceDecoration(new PolygonDecoration());

		// --------------------------------------------------------
		// add Labels to Connection
		ConnectionEndpointLocator Locator1 = new ConnectionEndpointLocator(connection, true);
		Locator1.setVDistance(30);
		connection.add(new Label("1..*"), Locator1);
		
		ConnectionEndpointLocator Locator2 = new ConnectionEndpointLocator(connection, false);
		Locator2.setVDistance(15);
		connection.add(new Label("22..*"), Locator2);

		ConnectionEndpointLocator Locator3 = new ConnectionEndpointLocator(connection,true);
		Locator3.setUDistance(80);
		Locator3.setVDistance(-20);
		connection.add(new Label("3333..*"),Locator3);
		
		// --------------------------------------------------------
		// add Router to Connection
		connection.setConnectionRouter(new ManhattanConnectionRouter());



		rootFigure.add(figure1,new Rectangle(10,10,60,30));
		rootFigure.add(figure2,new Rectangle(170,170,90,90));
		rootFigure.add(connection);

		LightweightSystem lws = new LightweightSystem(shell);
		lws.setContents(rootFigure);
	}
}

 


 
 
 

 

  • 大小: 7.1 KB
  • 大小: 6.7 KB
分享到:
评论

相关推荐

    软路由RouterOS-5.22.hnt.1G

    软路由 RouterOS-5.22.hnt.1G(亲测:已完美激活、最高级L6级授权ROS).zip

    vue动态路由router.txt

    vue动态路由router.txt

    vue 项目初识 路由 router.md

    vue 项目初识 路由 router 并进行初步配置以及简单的组件实现,初学vue router可以参考

    深入Vue-Router路由嵌套理解

    首先假设项目中有两个路由Profile和Posts,按写法把他们定义为一层路由,是Root的子路由,因此Root中要有router-view组件去承载子路由,才能实现子路由切换展示 一层路由 Root容器 <h1>Ro

    ROS LCD 20X2 RouterOS LCD 软路由 Router OS

    少的朋友喜爱自制PC状态监测/RouterOS并口液晶屏用来实时显示CPU占用率、内存剩余、网络流量和C 息等,很常见的选用字符型液晶屏,其优点有:规格众多,字符数从8×2到20×4;结构简单,采用8位并行数据总线;技术...

    uni-simple-router实现简单的路由守卫

    这是一个使用uni-simple-router实现简单的路由守卫

    软路由RouterOS设置实战篇

    RouterOS设置实战篇(ADSL拨号和固定IP设置) Router OS 设置 实战篇 RouteOS可以将一台普通的PC机变成一台专业的路由器,高到ISP的核心路器/认证网关—因为它功能强大稳定, 低到家庭网关防火墙—因为它免费。它...

    React-router4路由监听的实现

    主要介绍了React-router4路由监听的实现,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    vue3+webpack+vue-router封装路由

    vue3+webpack+vue-router封装路由,资源内容包含了vue3+webpack+vue-router,并且代码对vue-router路由进行了封装,资源下载下来之后项目代码需要先:npm install,之后就可以运行启动项目了,代码结构清晰,没有...

    RouterOS软路由中文编码转换,RouterOS使用中文备注

    ROS软路由中不能直接使用中文,本工具可以将中文转换成RouterOS可识别的编码 本人将源码开放出来,供大家学习参考

    AngularJS ui-router(嵌套路由)

    AngularJS 嵌套路由:这是我针对同一个主题(ui-router)的第二篇文章. 如果你对第一篇文章感兴趣的话,可以访问 这里. 好了,让我们继续吧,来看看嵌套的ui-router状态是怎么回事. ui-router和同属AngularJS框架一...

    RouterOS 路由软件IPv6 功能初探

    摘 要:RouterOS 是一种路由操作系统,通过该软件可以将普通的PC 电脑变成专业路由器,该软件经历了多次更新和改进,其功能在不断增强和完善。特别在无线、认证、策略路由、带宽控制和防火墙过滤等方面有着非常突出...

    API来控制RouterOS软路由系统

    通过API来控制RouterOS软路由系统,实例给出列出在线用记和所有用户的操作。RouterOS需3.0以上版本,且要打开API功能!

    router-view复用路由的抽离

    路由的注意事项,二级三级路由的引用和路由的抽离,以及router-view的复用

    vue3+webpack+vue-router路由封装+axios封装+vuex封装

    vue3+webpack+vue-router路由封装+axios封装+vuex封装,下载资源中包括了vue3+webpack+vue-router路由封装+axios封装+vuex封装的相关代码,分别对vue-router路由进行了封装,对axios进行了封装,对vuex进行了封装,...

    解决vue更新路由router-view复用组件内容不刷新的问题

    今天小编就为大家分享一篇解决vue更新路由router-view复用组件内容不刷新的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧

    ROUTEROS 路由操作系统

    该路由操作系统广泛应用于网吧软路器的制作,具有大型网路由的功能,且可以全DIY制作路由器,仅需一台好一点的电脑就可以了,但不是太好的那种,内存大一点,,不会超过3000元人民币的

    angularjs ui.router嵌套路由demo

    本解决方案下的ui.router项目是针对angularjs ui.router嵌套路由做的一个demo,程序代码采用VS2013开发,代码齐全,可直接运行。有需要的带走吧~v~v~

    软路由的备份routeros

    这是一个别人做好的软路由的备份包 router os

    华为路由模拟器 Router Huawei Cisco

    华为路由模拟器3.0 华为路由模拟器 Router Huawei Cisc

Global site tag (gtag.js) - Google Analytics