首页 > 代码库 > World Wind Java开发之一

World Wind Java开发之一

参照《World wind Java三维地理信息系统开发指南随书光盘》以及官网论坛,开始学习World Wind Java开发。

第一个demo

//基础类
public class VGE_GFBasicClass extends JFrame
{
	protected WorldWindowGLCanvas worldWindowGLCanvas; //WorldWind 画布
	protected StatusBar statusBar;					//状态栏
	protected Model modelEarth;
	protected LayerPanel layerPanel;     			//图层面板
	
	public VGE_GFBasicClass ()
	{
		//按指定尺寸创建画布
		Dimension canvasSize = new Dimension(800, 600);
		this.worldWindowGLCanvas = new WorldWindowGLCanvas();
		this.worldWindowGLCanvas.setPreferredSize(canvasSize);

		// 创建Earth模型,并与画面绑定
		modelEarth = (Model) WorldWind
				.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
		this.worldWindowGLCanvas.setModel(modelEarth);
		this.add(this.worldWindowGLCanvas, BorderLayout.CENTER);

		// 增加状态栏
		this.statusBar = new StatusBar();
		this.add(statusBar, BorderLayout.PAGE_END);
		this.statusBar.setEventSource(worldWindowGLCanvas);

		// 显示图层面板
		layerPanel = new LayerPanel(worldWindowGLCanvas);
		this.add(layerPanel, BorderLayout.WEST);

		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
		this.setSize(canvasSize);
	}
	public static void main(String[] args)
	{
		String strTitle = "…………子系统";
		VGE_GFBasicClass WWRun = new VGE_GFBasicClass();  
		WWRun.setTitle( strTitle + ":" + WWRun.getClass().getName());  	
	}
}

直接运行即可,效果图如下:



World Wind Java开发之一