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

找到源代码下的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开发之三 显示状态栏信息的更多相关文章

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

    http://blog.csdn.net/giser_whu/article/details/40920315 先来看下本篇博客索要达到的效果: 找到源码下的gov.nasa.worldwind.ut ...

  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. 【计算机网络】wireshark抓包分析1

    学习计算机网络很久了,但总是局限于书本知识,感觉get不到重点.经师兄建议用wireshark抓包分析看看. 我自己以前并没有做过抓包分析,所以这篇博文可能会有很多错误,只是我自己的一个记录,路过的亲 ...

  2. pipreqs------查找python项目依赖并生成requirements.txt

    项目开发的时候,总是要搭建和部署环境,这时,就需要一个python第三方包的list,一般叫做requirements.txt.如果项目使用virtualenv环境,直接使用pip freeze即可, ...

  3. 更改yum源为网易的

    更改yum源为网易的. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup cd /etc/yu ...

  4. 【转】Python模块subprocess

    subprocess 早期的Python版本中,我们主要是通过os.system().os.popen().read()等函数.commands模块来执行命令行指令的,从Python 2.4开始官方文 ...

  5. 洛谷 - Sdchr 的邀请赛 T4 信息传递

    (乱搞艹爆正解系列) 对不起,由于博主太弱了,并不会正解的多项式exp(甚至多项式exp我都不会2333). 只能来说一说我是怎么乱搞的啦QWQ 首先这个题最关键的性质是: 一个在原置换 g 中长度为 ...

  6. Java高级架构师(一)第15节:带查询的分页、修改和删除页面

    @RequestMapping(value="toList",method=RequestMethod.GET) public String toList(@ModelAttrib ...

  7. Scala实战高手****第11课:Scala面向接口彻底实战和Spark源码鉴赏

    第一点: scala的接口trait中所有方法可以都被实现!! 这种情况一般会是一种工具方法的集合,例如接口 Logging! scala 多种继承用extends ... with  .... 在老 ...

  8. 杂谈PID控制算法——第一篇:三个量

    电赛训练了大半个暑假,人渐渐开始进入到了疲倦期.既然这样那就好好休息下自己也好吧. 休息也不能光休息,乘机把平常写过的一些东西好好整理也好. 从第一次训练开始我们就接触到了一个新的名词——PID控制理 ...

  9. 如何使用 vimdiff 来 git diff

    git config --global diff.tool vimdiffgit config --global difftool.prompt falsegit config --global al ...

  10. <command-line>:0: error: macro names must be identifiers

    编译时的出错信息:<command-line>:0: error: macro names must be identifiers 原因: You have a -D flag with ...