World Wind Java开发之三 显示状态栏信息
先来看下本篇博客索要达到的效果:
找到源代码下的gov.nasa.worldwind.util下的StatusBar.java文件,能够看到状态栏显示的信息主要包含视点高度以及相应空间点三维坐标以及是否使用网络等信息。在兴许的开发中採用离线模式,因此不须要联网,也不显示网络状态信息。代码依次如以下几幅图所看到的:
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZ2lzZXJfd2h1/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
改动完源码后,将源码文件导出为jar包,在我们的project下引用就可以。后面假设须要改动源码,都按这样的方式操作。详细操作过程例如以下:
须要说明的是导出的时候能够仅仅勾选src文件夹也能够默认。导出后将worldWind2.0.jar文件复制到我们的project文件夹下。加入应用就可以。以下是全部源代码:
package cn.whu.vge; import gov.nasa.worldwind.Model;
import gov.nasa.worldwind.WorldWind;
import gov.nasa.worldwind.WorldWindow;
import gov.nasa.worldwind.avlist.AVKey;
import gov.nasa.worldwind.awt.WorldWindowGLCanvas;
import gov.nasa.worldwind.util.StatusBar; import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit; import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JToolBar; /**
* @author Administrator
*
*/ public class GFScope
{ private JFrame GFScopeMainFrame; // 主窗口
private WorldWindowGLCanvas worldWindowGLCanvas; // 声明WWJ画布
private JPanel WorldWindPanel; //三维视图面板
private JPanel Layerpanel; //图层管理面板
private JPanel StatusBarpanel; //状态栏面板 private StatusBar statusBar; //状态栏
// private WorldWindow wwd; /**
* Launch the application.
*/
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
GFScope window = new GFScope();
window.GFScopeMainFrame.setVisible(true);
window.GFScopeMainFrame.setTitle("XXXXX子系统");
WorldWind.setOfflineMode(true); // 设置离线执行模式 }
catch (Exception e)
{
e.printStackTrace();
}
}
});
} /**
* Create the application.
*/
public GFScope()
{
initialize(); InitializeEarth(WorldWindPanel,StatusBarpanel);
} /**
* Initialize the contents of the frame.
*/
/**
*
*/
private void initialize()
{
// 主窗口
GFScopeMainFrame = new JFrame();
GFScopeMainFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(
GFScope.class.getResource("/images/32x32-icon-earth.png")));
GFScopeMainFrame.setBounds(100, 100, 1000, 800);
GFScopeMainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GFScopeMainFrame.getContentPane().setLayout(null); /**
* 菜单项
*/
JMenuBar menuBar = new JMenuBar();
menuBar.setBounds(0, 0, 984, 30);
GFScopeMainFrame.getContentPane().add(menuBar); JMenu mnf = new JMenu("\u6587\u4EF6(F)");
menuBar.add(mnf); JMenu mnv = new JMenu("\u89C6\u56FE(V)");
menuBar.add(mnv); JMenu mnNewMenu = new JMenu("\u5DE5\u5177(T)");
menuBar.add(mnNewMenu); JMenu mnNewMenu_1 = new JMenu("\u5206\u6790(A)");
menuBar.add(mnNewMenu_1); JMenu mnh = new JMenu("\u5E2E\u52A9(H)");
menuBar.add(mnh); /**
* 工具条
*/ JToolBar toolBar = new JToolBar();
toolBar.setBounds(0, 28, 984, 30);
GFScopeMainFrame.getContentPane().add(toolBar); JButton btnNewButton = new JButton("");
btnNewButton.setIcon(new ImageIcon(GFScope.class
.getResource("/newt/data/cross-grey-alpha-16x16.png")));
toolBar.add(btnNewButton); /**
* 面板(图层面板、三维视图面板)
*
* @author
*/
Layerpanel = new JPanel();
Layerpanel.setBounds(0, 60, 194, 702);
GFScopeMainFrame.getContentPane().add(Layerpanel); WorldWindPanel = new JPanel();
WorldWindPanel.setBounds(194, 60, 790, 673);
GFScopeMainFrame.getContentPane().add(WorldWindPanel); StatusBarpanel = new JPanel();
StatusBarpanel.setBounds(194, 732, 790, 30);
GFScopeMainFrame.getContentPane().add(StatusBarpanel); } private void InitializeEarth(JPanel panel1,JPanel panel2)
{
// 按指定尺寸创建画布
Dimension canvasSize = new Dimension(790, 688);
this.worldWindowGLCanvas = new WorldWindowGLCanvas();
this.worldWindowGLCanvas.setPreferredSize(canvasSize); // 创建Earth模型,并与画布绑定
Model model = (Model) WorldWind
.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
this.worldWindowGLCanvas.setModel(model);
panel1.add(worldWindowGLCanvas); /**
*初始化状态栏信息
* */
this.statusBar=new StatusBar();
this.statusBar.setEventSource(worldWindowGLCanvas);
panel2.add(statusBar); }
}
欢迎大家留言交流!
World Wind Java开发之三 显示状态栏信息的更多相关文章
- World Wind Java开发之三 显示状态栏信息(转)
http://blog.csdn.net/giser_whu/article/details/40920315 先来看下本篇博客索要达到的效果: 找到源码下的gov.nasa.worldwind.ut ...
- World Wind Java开发之一(转)
http://blog.csdn.net/giser_whu/article/details/40477235 参照<World wind Java三维地理信息系统开发指南随书光盘>以及官 ...
- [转]World Wind Java开发之四——搭建本地WMS服务器
在提供地理信息系统客户端时,NASA还为用户提供了开源的WMS Server 服务器应用:World Wind WMS Server.利用这个应用,我们可以架设自己的WMS服务并使用自己的数据(也支持 ...
- World Wind Java开发之六——解析shape文件(转)
http://blog.csdn.net/giser_whu/article/details/41647117 最近一直忙于导师项目的事情了,几天没更新了,昨天和今天研究了下WWJ解析shp文件的源代 ...
- SpringBoot开发十一-显示登录信息
需求介绍-显示登录信息 我们需要在每个页面的头部都要把登录用户的头像显示出来,另外在详细信息里面你需要显示用户的名字,除此之外如果登录了,我们显示首页 信息 头像 三个功能的链接,否则显示首页 登录两 ...
- World Wind Java开发之八——加载本地缓存文件构建大范围三维场景(
http://blog.csdn.net/giser_whu/article/details/42044599 上一篇博客主要是针对小文件直接导入WW中显示,然而当文件特别大时,这种方式就不太可行.因 ...
- [转]World Wind Java开发之五——读取本地shp文件
World Wind Java 使用IconLayer图层类表现点和多点数据,使用RenderableLayer图层表现线和面数据,一个图层只能对应一组shape文件.World Wind Java首 ...
- World Wind Java开发之五——读取本地shp文件(转)
http://blog.csdn.net/giser_whu/article/details/41484433 World Wind Java 使用IconLayer图层类表现点和多点数据,使用Ren ...
- World Wind Java开发之十一——加载热点信息(仿Google Earth)(转)
在GE的图层中有一个照片图层,在浏览时可以看到各地的一些图片,我们称之为热点信息,如下图所示: 再来看下本文的实现效果: 效果是不是很像呢,其实实现这个很简单,参照examples中的Balloons ...
随机推荐
- python算法:约瑟夫问题
据说著名犹太历史学家 Josephus有过以下的故事:在罗马人占领乔塔帕特後,39 个犹太人与Josephus及他的朋友躲到一个洞中,39个犹太人决定宁愿死也不要被人抓到,于是决定了一个自杀方式,41 ...
- 关于Promise 简单使用理解
在学一个新的知识的时候,我的总结是首先要具备相关的基础知识,其次就是可以静下心来能看进去去理解,看一两遍不懂,就看四五遍,甚至六七遍,每一遍都认真努力理解,总会学会的. Promise是一个构造函数, ...
- (13)python 正则表达式
匹配单个字符 f. o f和o之间是任意字符 例如:fbo123 .. 任意两个字符 \.用来匹配. 边界匹配 the 表示包含the的任何字符串 ^from 表示以from开头的所 ...
- HDU 4528 小明系列故事――捉迷藏
广搜. 根据题意,可以知道状态总共有$4*n*m$种.每一个位置四种状态:两个都没有发现:发现$E$没发现$D$:发现$D$没发现$E$:两个都发现. 每次移动的花费都是$1$,队列里面状态的费用是单 ...
- error和exception的区别
------解决方法--------------------------------------------------------了解异常与错误的区别,并且知道当你截获一个异常时,应该怎么办. ...
- luogu P1107 最大整数
题目描述 设有n个正整数 (n<=20), 将它们连接成一排, 组成一个最大的多位整数. 例如: n=3时, 3个整数13, 312, 343连接成的最大整数为: 34331213 又如: n= ...
- [Contest20180122]超级绵羊异或
题意:求$a\ xor\left(a+b\right)xor\cdots xor\left(a+b\left(n-1\right)\right)$ 对每一位求答案,第$k$的答案是$\sum\limi ...
- 【树上莫队】【带修莫队】bzoj3052 [wc2013]糖果公园
#include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using ...
- Exercise03_03
import java.util.Scanner; public class LinearEquation { public static void main(String[] args){ doub ...
- js 鼠标左键拖动滚动
鼠标左键拖动滚动 原作者: http://blog.csdn.net/lisatisfy/article/details/6606026 本文在源代码的基础上 增加支持水平滚动 的功能 html &l ...