http://blog.csdn.net/giser_whu/article/details/40920315

先来看下本篇博客索要达到的效果:

找到源码下的gov.nasa.worldwind.util下的StatusBar.java文件,可以看到状态栏显示的信息主要包括视点高度以及对应空间点三维坐标以及是否使用网络等信息。在后续的开发中采用离线模式,因此不需要联网,也不显示网络状态信息。代码依次如下面几幅图所示:

修改完源代码后,将源代码文件导出为jar包,在我们的工程下引用即可。后面如果需要修改源代码,都按这种方式操作;具体操作步骤如下:

需要说明的是导出的时候可以只勾选src文件夹也可以默认。导出后将worldWind2.0.jar文件拷贝到我们的工程目录下,添加应用即可。下面是所有源码:

  1. package cn.whu.vge;
  2. import gov.nasa.worldwind.Model;
  3. import gov.nasa.worldwind.WorldWind;
  4. import gov.nasa.worldwind.WorldWindow;
  5. import gov.nasa.worldwind.avlist.AVKey;
  6. import gov.nasa.worldwind.awt.WorldWindowGLCanvas;
  7. import gov.nasa.worldwind.util.StatusBar;
  8. import java.awt.Dimension;
  9. import java.awt.EventQueue;
  10. import java.awt.Toolkit;
  11. import javax.swing.ImageIcon;
  12. import javax.swing.JButton;
  13. import javax.swing.JFrame;
  14. import javax.swing.JMenu;
  15. import javax.swing.JMenuBar;
  16. import javax.swing.JPanel;
  17. import javax.swing.JToolBar;
  18. /**
  19. * @author Administrator
  20. *
  21. */
  22. public class GFScope
  23. {
  24. private JFrame GFScopeMainFrame; // 主窗体
  25. private WorldWindowGLCanvas worldWindowGLCanvas; // 声明WWJ画布
  26. private JPanel WorldWindPanel;  //三维视图面板
  27. private JPanel Layerpanel;      //图层管理面板
  28. private JPanel StatusBarpanel;  //状态栏面板
  29. private StatusBar statusBar;    //状态栏
  30. //  private WorldWindow wwd;
  31. /**
  32. * Launch the application.
  33. */
  34. public static void main(String[] args)
  35. {
  36. EventQueue.invokeLater(new Runnable()
  37. {
  38. public void run()
  39. {
  40. try
  41. {
  42. GFScope window = new GFScope();
  43. window.GFScopeMainFrame.setVisible(true);
  44. window.GFScopeMainFrame.setTitle("XXXXX子系统");
  45. WorldWind.setOfflineMode(true); // 设置离线运行模式
  46. }
  47. catch (Exception e)
  48. {
  49. e.printStackTrace();
  50. }
  51. }
  52. });
  53. }
  54. /**
  55. * Create the application.
  56. */
  57. public GFScope()
  58. {
  59. initialize();
  60. InitializeEarth(WorldWindPanel,StatusBarpanel);
  61. }
  62. /**
  63. * Initialize the contents of the frame.
  64. */
  65. /**
  66. *
  67. */
  68. private void initialize()
  69. {
  70. // 主窗体
  71. GFScopeMainFrame = new JFrame();
  72. GFScopeMainFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(
  73. GFScope.class.getResource("/images/32x32-icon-earth.png")));
  74. GFScopeMainFrame.setBounds(100, 100, 1000, 800);
  75. GFScopeMainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  76. GFScopeMainFrame.getContentPane().setLayout(null);
  77. /**
  78. * 菜单项
  79. */
  80. JMenuBar menuBar = new JMenuBar();
  81. menuBar.setBounds(0, 0, 984, 30);
  82. GFScopeMainFrame.getContentPane().add(menuBar);
  83. JMenu mnf = new JMenu("\u6587\u4EF6(F)");
  84. menuBar.add(mnf);
  85. JMenu mnv = new JMenu("\u89C6\u56FE(V)");
  86. menuBar.add(mnv);
  87. JMenu mnNewMenu = new JMenu("\u5DE5\u5177(T)");
  88. menuBar.add(mnNewMenu);
  89. JMenu mnNewMenu_1 = new JMenu("\u5206\u6790(A)");
  90. menuBar.add(mnNewMenu_1);
  91. JMenu mnh = new JMenu("\u5E2E\u52A9(H)");
  92. menuBar.add(mnh);
  93. /**
  94. * 工具条
  95. */
  96. JToolBar toolBar = new JToolBar();
  97. toolBar.setBounds(0, 28, 984, 30);
  98. GFScopeMainFrame.getContentPane().add(toolBar);
  99. JButton btnNewButton = new JButton("");
  100. btnNewButton.setIcon(new ImageIcon(GFScope.class
  101. .getResource("/newt/data/cross-grey-alpha-16x16.png")));
  102. toolBar.add(btnNewButton);
  103. /**
  104. * 面板(图层面板、三维视图面板)
  105. *
  106. * @author
  107. */
  108. Layerpanel = new JPanel();
  109. Layerpanel.setBounds(0, 60, 194, 702);
  110. GFScopeMainFrame.getContentPane().add(Layerpanel);
  111. WorldWindPanel = new JPanel();
  112. WorldWindPanel.setBounds(194, 60, 790, 673);
  113. GFScopeMainFrame.getContentPane().add(WorldWindPanel);
  114. StatusBarpanel = new JPanel();
  115. StatusBarpanel.setBounds(194, 732, 790, 30);
  116. GFScopeMainFrame.getContentPane().add(StatusBarpanel);
  117. }
  118. private void InitializeEarth(JPanel panel1,JPanel panel2)
  119. {
  120. // 按指定尺寸创建画布
  121. Dimension canvasSize = new Dimension(790, 688);
  122. this.worldWindowGLCanvas = new WorldWindowGLCanvas();
  123. this.worldWindowGLCanvas.setPreferredSize(canvasSize);
  124. // 创建Earth模型,并与画布绑定
  125. Model model = (Model) WorldWind
  126. .createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
  127. this.worldWindowGLCanvas.setModel(model);
  128. panel1.add(worldWindowGLCanvas);
  129. /**
  130. *初始化状态栏信息
  131. * */
  132. this.statusBar=new StatusBar();
  133. this.statusBar.setEventSource(worldWindowGLCanvas);
  134. panel2.add(statusBar);
  135. }
  136. }

欢迎大家留言交流!

World Wind Java开发之三 显示状态栏信息(转)的更多相关文章

  1. World Wind Java开发之三 显示状态栏信息

    先来看下本篇博客索要达到的效果: 找到源代码下的gov.nasa.worldwind.util下的StatusBar.java文件,能够看到状态栏显示的信息主要包含视点高度以及相应空间点三维坐标以及是 ...

  2. World Wind Java开发之一(转)

    http://blog.csdn.net/giser_whu/article/details/40477235 参照<World wind Java三维地理信息系统开发指南随书光盘>以及官 ...

  3. [转]World Wind Java开发之四——搭建本地WMS服务器

    在提供地理信息系统客户端时,NASA还为用户提供了开源的WMS Server 服务器应用:World Wind WMS Server.利用这个应用,我们可以架设自己的WMS服务并使用自己的数据(也支持 ...

  4. World Wind Java开发之六——解析shape文件(转)

    http://blog.csdn.net/giser_whu/article/details/41647117 最近一直忙于导师项目的事情了,几天没更新了,昨天和今天研究了下WWJ解析shp文件的源代 ...

  5. SpringBoot开发十一-显示登录信息

    需求介绍-显示登录信息 我们需要在每个页面的头部都要把登录用户的头像显示出来,另外在详细信息里面你需要显示用户的名字,除此之外如果登录了,我们显示首页 信息 头像 三个功能的链接,否则显示首页 登录两 ...

  6. World Wind Java开发之八——加载本地缓存文件构建大范围三维场景(

    http://blog.csdn.net/giser_whu/article/details/42044599 上一篇博客主要是针对小文件直接导入WW中显示,然而当文件特别大时,这种方式就不太可行.因 ...

  7. [转]World Wind Java开发之五——读取本地shp文件

    World Wind Java 使用IconLayer图层类表现点和多点数据,使用RenderableLayer图层表现线和面数据,一个图层只能对应一组shape文件.World Wind Java首 ...

  8. World Wind Java开发之五——读取本地shp文件(转)

    http://blog.csdn.net/giser_whu/article/details/41484433 World Wind Java 使用IconLayer图层类表现点和多点数据,使用Ren ...

  9. World Wind Java开发之十一——加载热点信息(仿Google Earth)(转)

    在GE的图层中有一个照片图层,在浏览时可以看到各地的一些图片,我们称之为热点信息,如下图所示: 再来看下本文的实现效果: 效果是不是很像呢,其实实现这个很简单,参照examples中的Balloons ...

随机推荐

  1. elasticsearch 聚合查询

    1. 按照 tags 字段 进行分组 GET /ecommerce/product/_search{ "size": 0,  "aggs": {    &quo ...

  2. HBase 命令简介

    1. 进入HBase 的控制端(可以在任意一台机器上启动,只要其配置和HMaster 的配置一样): hbase shell 进入后,出现类似下面的提示符:   hbase(main):002:0&g ...

  3. cf837D(01背包)

    题目链接: http://codeforces.com/contest/837/problem/D 题意: 给出 n 个数, 从中选出 k 个数使得这 k 个数的乘积末尾 0 最多 . 思路: 先记录 ...

  4. Mac安装vue

     Mac安装vue 一.安装brew 打开终端运行以下命令: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com ...

  5. docker-compose搭建wordpress[转]

    1.安装docker-compose apt-get install docker-compose 发现下载的是旧版本,不支持2.0的配置文件 还是下载新版本吧,去github查看最新版本https: ...

  6. python数据类型基本操作

    目录 1.字符串.... 1 2.列表[ ] 3 3.元组 ( ) 4 4.字典 { } 4 5.SET集合... 7 1.字符串 1.1查找字符串 find查找 >>> msg = ...

  7. CF447B DZY Loves Strings 贪心

    DZY loves collecting special strings which only contain lowercase letters. For each lowercase letter ...

  8. centos7安装配置docker

    1. 安装/升级Docker客户端 Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker . uname -r 从 ...

  9. 离散数学——python实现真值表和打印主范式

    最近用python实现了真值表,经过有点儿曲折,刚开始没考虑优先级,直到前天才发现这个问题(离散数学没学好啊),用栈改了一下.话说python就是强,把列表类型当栈用,直接调用列表的pop()和app ...

  10. linux下find查找与批量替换文件中指定内容

    经常在部署tomcat时需要替换配置文件中的ip,find命令批量替换还是很方便的 查找需要替换的ip,看看哪些文件有配置这个ip,执行下面命令: find ./ -type f -regex &qu ...