Java Gis 拓撲圖(Google 地圖)

public class GoogleDemo extends GisDemoPane {

	public GoogleDemo() {
		init();

	}

	void init() {

		Node node1 = createNode("Manchester", 53.488046, -2.241211);
		
		Node node2 = createNode("Paris", 48.893615, 2.329102);

		Node node3 = createNode("Berlin", 52.522906, 13.403320);

		Node node4 = createNode("Praha", 50.092393, 14.414063);
	
		box.addElement(node1);
		box.addElement(node2);
		box.addElement(node3);
		box.addElement(node4);
		
		box.addElement(createLink(node1, node2));
		box.addElement(createLink(node2, node3));
		box.addElement(createLink(node3, node4));

		this.network.setTileSource(new GoogleTileSource());
	}

	private static Node createNode(String displayName, double lat, double lon) {
		Node node2 = new Node();
		node2.setDisplayName(displayName);
		node2.putCustomDraw(true);
		node2.putCustomDrawFillColor(BladeUtil.getRandomColor());
		node2.putCustomDrawOutline(false);
		node2.setGeoPosition(new Point3D(lat, lon));
		return node2;
	}
	
	private static Link createLink(Node from, Node to){
		Link link = new Link(from, to);
		link.putLink3D(true);
		link.putLinkColor(BladeUtil.getRandomColor());
		link.putLinkFlowingColor(BladeUtil.getRandomColor());
		link.putLinkFlowing(true);
		link.putLinkWidth(8);
		link.putLinkFlowingWidth(4);
		return link;
	}

	public static void main(String argv[]) {
		GisDemoUtil.show(new GoogleDemo());
	}

}




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章