World Wind Java开发之三 显示状态栏信息(转)
http://blog.csdn.net/giser_whu/article/details/40920315
先来看下本篇博客索要达到的效果:
找到源码下的gov.nasa.worldwind.util下的StatusBar.java文件,可以看到状态栏显示的信息主要包括视点高度以及对应空间点三维坐标以及是否使用网络等信息。在后续的开发中采用离线模式,因此不需要联网,也不显示网络状态信息。代码依次如下面几幅图所示:
修改完源代码后,将源代码文件导出为jar包,在我们的工程下引用即可。后面如果需要修改源代码,都按这种方式操作;具体操作步骤如下:
需要说明的是导出的时候可以只勾选src文件夹也可以默认。导出后将worldWind2.0.jar文件拷贝到我们的工程目录下,添加应用即可。下面是所有源码:
- 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开发之三 显示状态栏信息
先来看下本篇博客索要达到的效果: 找到源代码下的gov.nasa.worldwind.util下的StatusBar.java文件,能够看到状态栏显示的信息主要包含视点高度以及相应空间点三维坐标以及是 ...
- 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 ...
随机推荐
- elasticsearch 聚合查询
1. 按照 tags 字段 进行分组 GET /ecommerce/product/_search{ "size": 0, "aggs": { &quo ...
- HBase 命令简介
1. 进入HBase 的控制端(可以在任意一台机器上启动,只要其配置和HMaster 的配置一样): hbase shell 进入后,出现类似下面的提示符: hbase(main):002:0&g ...
- cf837D(01背包)
题目链接: http://codeforces.com/contest/837/problem/D 题意: 给出 n 个数, 从中选出 k 个数使得这 k 个数的乘积末尾 0 最多 . 思路: 先记录 ...
- Mac安装vue
Mac安装vue 一.安装brew 打开终端运行以下命令: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com ...
- docker-compose搭建wordpress[转]
1.安装docker-compose apt-get install docker-compose 发现下载的是旧版本,不支持2.0的配置文件 还是下载新版本吧,去github查看最新版本https: ...
- python数据类型基本操作
目录 1.字符串.... 1 2.列表[ ] 3 3.元组 ( ) 4 4.字典 { } 4 5.SET集合... 7 1.字符串 1.1查找字符串 find查找 >>> msg = ...
- CF447B DZY Loves Strings 贪心
DZY loves collecting special strings which only contain lowercase letters. For each lowercase letter ...
- centos7安装配置docker
1. 安装/升级Docker客户端 Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker . uname -r 从 ...
- 离散数学——python实现真值表和打印主范式
最近用python实现了真值表,经过有点儿曲折,刚开始没考虑优先级,直到前天才发现这个问题(离散数学没学好啊),用栈改了一下.话说python就是强,把列表类型当栈用,直接调用列表的pop()和app ...
- linux下find查找与批量替换文件中指定内容
经常在部署tomcat时需要替换配置文件中的ip,find命令批量替换还是很方便的 查找需要替换的ip,看看哪些文件有配置这个ip,执行下面命令: find ./ -type f -regex &qu ...