Embed the nasa world wind java sdk in eclipse

2,199 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,199
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Embed the nasa world wind java sdk in eclipse

  1. 1. Embed the NASA World Wind Java SDK in Eclipse<br />Develop GIS applications with this open source SDK<br />Vladimir Silva (vladimir_silva@hotmail.com), Consultant<br />Vladimir Silva is a former IBM software engineer who worked for the IBM WebAhead technology think tank on projects such as the IBM Grid Toolbox. Some of his work on server-side security has been incorporated into Globus Toolkit. He is the author of Grid Computing for Developers (Charles River Media, 2005). His other interests include neural nets and artificial intelligence. Vladimir holds numerous IT certifications.<br />Summary:  The open source World Wind Java (WWJ) SDK by NASA creates new possibilities for the open Geographic Information Systems (GIS) community. World Wind, a 3D interactive world viewer written in the Java™ language and OpenGL, lets users zoom from outer space into any place on Earth. This article explains how GIS developers who want to enhance their Eclipse-based applications can embed the WWJ SDK as an Eclipse plug-in.<br />Tag this!<br />Update My dW interests (Log in | What's this?) Skip to help for Update My dW interests<br />Date:  03 Jun 2008 Level:  Intermediate PDF:  A4 and Letter (224KB)Get Adobe® Reader® Also available in:   Chinese  Japanese  Vietnamese Activity:  12234 views Comments:   0 (Add comments) <br />Average rating (based on 16 votes)<br />The WWJ SDK is a 3D graphics globe built on top of the Java OpenGL (JOGL) extensions. At the core of the WWJ class hierarchy is the WorldWindowGLCanvas, which is a subclass of GLCanvas. GLCanvas is in turn an Abstract Window Toolkit (AWT) component. <br />WWJ's dependence on AWT is an obstacle for GIS developers who want to use WWJ in their Eclipse applications. As you probably know, Eclipse uses the Standard Widget Toolkit (SWT), which is incompatible with AWT. Furthermore, AWT and JOGL are tightly integrated, making a port of the AWT interfaces to SWT difficult. This article presents a solution that enables you to use the WWJ SDK with your Eclipse applications. <br />Datasets bundled with WWJ<br />WWJ bundles the following low-, medium-, and high-resolution datasets (see Resources for links to them):<br />Blue Marble (1-km/pixel resolution)<br />i-cubed Landsat 7 (15-meter/pixel resolution) from the Global Land Cover Facility of the University of Maryland Institute for Advanced Computer Studies<br />Elevation data (SRTM30Plus/SRTMv2/USGS NED derived dataset) from the NASA Jet Propulsion Laboratory<br />USGS Topographic, B&W Ortho, and Color Urban Area USGS and Microsoft® Research<br />U.S. placenames from the USGS Geographic Names Information System<br />World placenames from the National Geospatial-Intelligence Agency<br />Enter the SWT/AWT bridge<br />The SWT is rapidly becoming a top-tier windowing toolkit for quickly building scalable and powerful client applications. Both SWT and AWT/Swing are battling for supremacy of Java user interface development. Given the fact that both have advantages and disadvantages, the Eclipse Foundation recognized the need to build a SWT/AWT bridge that allows you to embed AWT/Swing components into SWT. The bridge has been part of SWT since Eclipse version 3.0. This simple API is located in the org.eclipse.swt.awt package (see Resources). <br />The SWT/AWT bridge is the key component you need to embed the AWT-based World Wind 3D Globe into an Eclipse application via SWT. <br />Eclipse view for WWJ 3D Earth<br />With the SWT/AWT bridge already in SWT, embedding a WWJ 3D Earth within your view is a snap. Listing 1 demonstrates a basic Eclipse view that performs this task: <br />Listing 1. Basic Eclipse view for the WWJ 3D Earth<br /> package org.eclipse.plugin.worldwind.views;_/** * World Wind Eclipse RCP Earth View * @author Vladimir Silva * */public class EarthView extends ViewPart{ private static final Logger logger = Logger.getLogger(EarthView.class); public static final String ID = EarthView.class.getName(); final WorldWindowGLCanvas world = new WorldWindowGLCanvas(); /** * Initialize the default WW layers */ static { initWorldWindLayerModel(); } public EarthView() { } /** * This is a callback that will allow us to create the viewer and initialize * it. */ public void createPartControl(Composite parent) { // GUI: an SWT composite on top Composite top = new Composite(parent, SWT.EMBEDDED); top.setLayoutData(new GridData(GridData.FILL_BOTH)); // Swing Frame and Panel java.awt.Frame worldFrame = SWT_AWT.new_Frame(top); java.awt.Panel panel = new java.awt.Panel(new java.awt.BorderLayout()); worldFrame.add(panel); // Add the WWJ 3D OpenGL Canvas to the Swing Panel panel.add(world, BorderLayout.CENTER); parent.setLayoutData(new GridData(GridData.FILL_BOTH)); } /* * Initialize WW model with default layers */ static void initWorldWindLayerModel () { Model m = (Model) WorldWind.createConfigurationComponent( AVKey.MODEL_CLASS_NAME); world.setModel(m); } /** * Passing the focus request to the viewer's control. */ public void setFocus() { } public static void repaint() { world.repaint(); } @Override public void dispose() { super.dispose(); } }<br />Listing 1 starts by creating a top SWT component that uses the bridge to embed the WWJ swing OpenGL canvas: <br />Composite top = new Composite(parent, SWT.EMBEDDED);top.setLayoutData(new GridData(GridData.FILL_BOTH));<br />Next, a child AWT frame is created within the top SWT component, using the bridge, to host the Swing panel required by the WWJ OpenGL canvas: <br />java.awt.Frame worldFrame = SWT_AWT.new_Frame(top);java.awt.Panel panel = new java.awt.Panel(new java.awt.BorderLayout());<br />Finally, the WWJ GL canvas is added to the Swing panel:<br />WorldWindowGLCanvas world = new WorldWindowGLCanvas();panel.add(world, BorderLayout.CENTER);<br />Figure 1 shows Earth embedded within an Eclipse view as part of a Rich Client Platform (RCP) application:<br />Figure 1. WWJ Earth as an Eclipse view<br />WWJ vs. Google Earth and Virtual Earth<br />Google Earth and Virtual Earth are popular 3D globes that are also available. They too are 3D Earths that let users zoom in and view locations. But despite their similarities to WWJ, these tools have fundamentally different philosophies. Google Earth and Virtual Earth are commercial products, not SDKs, so developers cannot enhance the client to fit their needs. For example, scientists can't add support for scientific data formats or interfaces to mapping services such as OpenGIS Web Map Services (WMS) or Web Feature Services (WFS). WWJ's open source nature allows you to embed the globe in virtually any type of client, as you've seen in this article. WWJ can also be modified to access any type of data service. This is a huge advantage over its commercial counterparts. <br />Flying to a location within a globe<br />If you want your application to fly to a specific latitude/longitude in a Google Earth style, three objects are required: <br />A View that provides a coordinate transformation from model coordinates to eye coordinates, following the OpenGL convention of a left-handed coordinate system<br />A Globe representing the 3D ellipsoidal sphere of the world you are looking at<br />The latitude/longitude coordinates of the point you wish to fly to<br />Optional information includes angles for heading and pitch and altitude in meters.<br />Listing 2 demonstrates how to fly to a location: <br />Listing 2. Flying to given latitude/longitude coordinates<br /> public void flyTo (LatLon latlon) { View view = world.getView(); Globe globe = world.getModel().getGlobe(); view.applyStateIterator(FlyToOrbitViewStateIterator.createPanToIterator( (OrbitView)view , globe , latlon // bbox , Angle.ZERO // Heading , Angle.ZERO // Pitch , 3e3 ) // Altitude/Zoom (m) );}<br />The applyStateIterator() method of the View class pans or zooms the globe, producing a smooth fly-to or an instantaneous zoom effect on the globe's target coordinates.<br />WWJ bundles other globes besides Earth; 3D worlds available as of WWJ version 0.4.1 are:<br />Earth (see Resources for the included datasets).<br />Moon: 40xx/30xx color/grayscale layers, created using a combination of several spectral bands from the Clementine mission.<br />Mars: Including high-resolution imagery from missions such as Mars Orbital Camera (MOC), Elevation Maps created using data from the NASA Jet Propulsion Laboratory, and data from NASA Mars Odyssey/THEMIS.<br />Figure 2 shows the Earth, moon, and Mars as three distinct Eclipse views: <br />Figure 2. Earth, moon, and Mars views within a RCP application<br />Back to top<br />Conclusion<br />The World Wind Java SDK is a 3D interactive world viewer written in Java and OpenGL that allows any user to zoom from outer space into any place on Earth. This article gives you the foundation for embedding the WWJ SDK as an Eclipse view to gain a new set of powerful tools for GIS development within Eclipse. <br />Resources<br />Learn<br />World Wind Central: Official knowledge base and support site for NASA World Wind SDK. <br />WWJ bundles these low-, medium-, and high-resolution datasets: <br />Blue Marble (1-km/pixel resolution).<br />i-cubed Landsat 7 (15-meter/pixel resolution) from the Global Land Cover Facility of the University of Maryland Institute for Advanced Computer Studies.<br />Elevation data (SRTM30Plus/SRTMv2/USGS NED derived dataset) from the NASA Jet Propulsion Laboratory's SRTM Project.<br />USGS Topographic, B&W Ortho, and Color Urban Area USGS and Microsoft Research, available from TerraServer.<br />U.S. placenames from the USGS Geographic Names Information System.<br />World placenames from the National Geospatial-Intelligence Agency. <br />SWT/AWT bridge: Javadoc for the SWT_AWT class. <br />"Swing/SWT Integration" (Gordon Hirsch, eclipse.org, 2007): This article focuses on using the SWT/AWT bridge to embed existing Swing components into an SWT-based RCP application. <br />"Find your way around open source GIS" (Frank Pohlmann, developerWorks, May 2005): Read about some GIS tools for UNIX® and Linux® users. <br />Eclipse project resources: Resources galore for Eclipse developers. <br />Browse the technology bookstore for books on these and other technical topics. <br />developerWorks Java technology zone: Find hundreds of articles about every aspect of Java programming. <br />Get products and technologies<br />NASA World Wind SDK: Download the World Wind Java SDK. <br />Europa Simultaneous Release project: Download free Eclipse Europa bundles.<br />Discuss<br />Check out developerWorks blogs and get involved in the developerWorks community. <br />About the author<br />Vladimir Silva is a former IBM software engineer who worked for the IBM WebAhead technology think tank on projects such as the IBM Grid Toolbox. Some of his work on server-side security has been incorporated into Globus Toolkit. He is the author of Grid Computing for Developers (Charles River Media, 2005). His other interests include neural nets and artificial intelligence. Vladimir holds numerous IT certifications.<br />Comments<br />0 comments | Sign inAdd commentReport inappropriate content<br />Add a comment<br />The field indicated with an asterisk (*) is required to complete this transaction.<br />Top of Form<br />Comment:*<br />  <br />Bottom of Form<br />Be the first to add a comment<br />Show 5 most recent comments | Show next 5 comments | Show all comments<br />Sign inAdd comment<br />Back to top<br />Trademarks  |  HYPERLINK "https://www.ibm.com/developerworks/mydeveloperworks/terms/" My developerWorks terms and conditions<br />Close [x]<br />Help: Update or add to My dW interests <br />What's this?<br />This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.<br />And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.<br />View your My developerWorks profile<br />Return from help<br />Close [x]<br />Help: Remove from My dW interests <br />What's this?<br />Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.<br />View your My developerWorks profile<br />Return from help<br />static.content.url=http://www.ibm.com/developerworks/js/artrating/<br />SITE_ID=1<br />Zone=Java technology, Open source<br />ArticleID=311635<br />ArticleTitle=Embed the NASA World Wind Java SDK in Eclipse<br />publish-date=06032008<br />author1-email=vladimir_silva@hotmail.com<br />author1-email-cc=<br />url=http://www.ibm.com/developerworks/java/library/j-wwj/?ca=dgr-lnxw9dwwjsdkeclipse&S_TACT=105AGX59&S_CMP=GR<br />Table of contents<br />Enter the SWT/AWT bridge<br />Eclipse view for WWJ 3D Earth<br />Flying to a location within a globe<br />Conclusion<br />Resources<br />About the author<br />Comments<br />Next steps from IBM<br />Spring, JRuby, and Ajax development is easier with WebSphere Application Server - a smart Java 5 and J2EE Web services-based application server.<br />Try: The no-charge WebSphere Application Server Community Edition is a pre-integrated, lightweight Java 5 application server built on Apache Tomcat and other best-of-breed open source software such as OpenEJB, Apache Axis, and Apache Derby.<br />Article: The article leverage the Spring Framework and the WebSphere Application Server to improve your J2EE project productivity.<br />Tutorial: See how the free WebSphere Application Server and XML can improve the efficiency of your JRuby on Rails and Ajax development.<br />Buy: WebSphere Application Server - Express<br />My developerWorks community<br />Interact, share, and communicate with developers worldwide.<br />My Home<br />Profiles<br />Groups<br />Blogs<br />Bookmarks<br />Activities<br />Spaces<br />Forums<br />Wikis<br />Podcasts<br />Exchange<br />My developerWorks overview<br />Tags<br />Use the search field to find all types of content in My developerWorks with that tag.<br />Use the slider bar to see more or fewer tags.<br />Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).<br />My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).<br />Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).<br />Top of Form<br />Search all tags <br />Bottom of Form<br />Popular article tags | My article tagsSkip to tags list<br />Popular article tags | My article tags<br />Skip to tags list<br />Popular tags<br />2 (2)   <br />ajax (12)   <br />amazon (3)   <br />andrew_glover (3)   <br />andrew_hall (2)   <br />apache (12)   <br />api (3)   <br />architecture (5)   <br />articles (10)   <br />aws (4)   <br />caching (3)   <br />cloud (6)   <br />clustering (2)   <br />concurrency (2)   <br />crud (2)   <br />css (2)   <br />custom_plug_in (2)   <br />david_geary (2)   <br />dennis_sosnoski (4)   <br />design (5)   <br />developerworks (17)   <br />diagnostic (3)   <br />drools (2)   <br />ec2 (5)   <br />eclipse (6)   <br />eclipse_plug_in (2)   <br />ejb (2)   <br />event (2)   <br />facelet (3)   <br />fork (2)   <br />frameworks (3)   <br />gaej (2)   <br />generics (3)   <br />google (2)   <br />google_app_engine (4)   <br />grails (11)   <br />grant_ingersoll (2)   <br />groovlet (2)   <br />groovy (19)   <br />gwt (6)   <br />handling (3)   <br />health_center (3)   <br />hibernate (2)   <br />holly_cummins (3)   <br />ibm_style (3)   <br />james_goodwill (3)   <br />java (72)   <br />java_web_services (3)   <br />java7 (2)   <br />javascript (4)   <br />jaxb (3)   <br />jpa (9)   <br />jpql (3)   <br />jsf (14)   <br />machine_learning (3)   <br />mahout (5)   <br />metamodel_api (3)   <br />metro (3)   <br />mock (3)   <br />monitoring (5)   <br />open_source (4)   <br />optimization (3)   <br />performance (4)   <br />pinaki_poddar (3)   <br />practically_groovy (3)   <br />programming (15)   <br />scott_davis (7)   <br />swing (3)   <br />test (3)   <br />testing (5)   <br />threads (3)   <br />toby_corbin (3)   <br />twitter (3)   <br />typesafe (3)   <br />typesafe_queries (3)   <br />web_development (4)   <br />web_programming (3)   <br />web_services (3)   <br />webservices (3)   <br />xml (6)   <br />End of Popular tags<br />My tags<br />To access My Tags, please sign in<br />Read Popular tags<br />End of My tags<br />MoreLess<br />2 (2)   <br />ajax (12)   <br />amazon (3)   <br />andrew_glover (3)   <br />andrew_hall (2)   <br />apache (12)   <br />api (3)   <br />architecture (5)   <br />articles (10)   <br />aws (4)   <br />caching (3)   <br />cloud (6)   <br />clustering (2)   <br />concurrency (2)   <br />crud (2)   <br />css (2)   <br />custom_plug_in (2)   <br />david_geary (2)   <br />dennis_sosnoski (4)   <br />design (5)   <br />developerworks (17)   <br />diagnostic (3)   <br />drools (2)   <br />ec2 (5)   <br />eclipse (6)   <br />eclipse_plug_in (2)   <br />ejb (2)   <br />event (2)   <br />facelet (3)   <br />fork (2)   <br />frameworks (3)   <br />gaej (2)   <br />generics (3)   <br />google (2)   <br />google_app_engine (4)   <br />grails (11)   <br />grant_ingersoll (2)   <br />groovlet (2)   <br />groovy (19)   <br />gwt (6)   <br />handling (3)   <br />health_center (3)   <br />hibernate (2)   <br />holly_cummins (3)   <br />ibm_style (3)   <br />james_goodwill (3)   <br />java (72)   <br />java_web_services (3)   <br />java7 (2)   <br />javascript (4)   <br />jaxb (3)   <br />jpa (9)   <br />jpql (3)   <br />jsf (14)   <br />machine_learning (3)   <br />mahout (5)   <br />metamodel_api (3)   <br />metro (3)   <br />mock (3)   <br />monitoring (5)   <br />open_source (4)   <br />optimization (3)   <br />performance (4)   <br />pinaki_poddar (3)   <br />practically_groovy (3)   <br />programming (15)   <br />scott_davis (7)   <br />swing (3)   <br />test (3)   <br />testing (5)   <br />threads (3)   <br />toby_corbin (3)   <br />twitter (3)   <br />typesafe (3)   <br />typesafe_queries (3)   <br />web_development (4)   <br />web_programming (3)   <br />web_services (3)   <br />webservices (3)   <br />xml (6)   <br />View as cloud | list<br />2 2 <br />ajax 12 <br />amazon 3 <br />andrew_glover 3 <br />andrew_hall 2 <br />apache 12 <br />api 3 <br />architecture 5 <br />articles 10 <br />aws 4 <br />View as cloud | list<br />Dig deeper into Java on developerWorks<br />Overview<br />New to Java programming<br />Downloads and products<br />Open source projects<br />Standards<br />Technical library (articles, tutorials, and more)<br />Training<br />Forums<br />Events<br />Newsletter<br />IBM Innovate 2010<br />A smarter conference for a smarter planet. June 6-10 Orlando, FL<br />Special offers<br />Trial software offers<br />About IBM<br />Privacy<br />Contact<br />Terms of use<br />IBM Feeds<br />Jobs<br />

×