![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
NASA World Wind Project Manager
Join Date: Sep 2004
Location: Sillycon Valley, California USA
Posts: 70
![]() |
There have been many requests by World Wind users for an easy way to setup World Wind with Eclipse. Since we know that plenty of you are already using this IDE, here is an opportunity for your contribution to help others make 'easy work' of setting up World Wind with Eclipse please.
Last edited by Patrick Hogan; 03-28-2013 at 06:20 PM. |
|
|
|
|
|
#2 |
|
Junior Member
Join Date: May 2011
Posts: 21
![]() |
We are using worldwind as a plugin within a RCP application. This requires to have worldwind available as a plugin.
With this post, I would like to share our knowledge about how to convert world wind to an eclipse / osgi bundle. Hope this helps. The following steps have been performed using the released version 1.2 of world wind. Most likely this should be compatible to the daily builds as well. As IDE, we are using eclipse 3.6 - the description should work for 3.7 as well (I don't know about e4) 1) Creating the plugins World Wind 1.2 comes with a couple of jars:
Based on our experience, it is recommended to create a plugin for each jar. In order to create a plugin from a jar in eclipse, select "File" / "New >" / "Project...". In the dialog, choose "Plug-in from Existing JAR Archives" under the "Plug-in Development"-section. In the next dialog, select the jar (e.g. the worldwind.jar) using the "Add External..." button and then "Next>". In the following "Plug-in Project Properties" dialog, provide a suitable name (e.g. "com.yourCompany.gov.nasa.worldwind" ), set "1.2.0" as plugin version (if you are using the 1.2 version ;-) and provide a name for "Plug-in Provider" As target platform, we are using "Eclipse version 3.6" and check the option "Unzip the JAR archives into the project", all other options are unchecked. The select "Finish" and you are done. Do so for every jar and now you have 5 plugins (com.yourCompany.gluegenrt, com.yourCompany.jogl, com.yourCompany.gdal, com.yourCompany.gov.nasa.worldwind, com.yourCompany.gov.nasa.worldwindx Further, it is good practice to add the licence agreements to the plugins. To do so, just copy the "NASA_Open_Source_Agreement.txt" to com.yourCompany.gov.nasa.worldwind. 2) Add the dependencies for the plugins To add the dependencies, open the MANIFEST.MF of the plugin and select the tab "Dependencies". Select "Add..." under the "Required Plug-ins"-tab and add the required plugins: For com.yourCompany.gov.nasa.worldwind:
For com.yourCompany.gov.nasa.worldwindx:
For com.yourCompany.jogl:
3) Setup support for native libs JOGL requires the usage of native libraries. To tell eclipse where to find these native libs, we need to add the native libs to the com.yourCompany.jogl plugin and tell eclipse the location of the libs in the MANIFEST.MF For com.yourCompany.jogl:
For com.yourCompany.gluegenrt:
4) Circumvent class loading issues If you like to e.g. implement your own layers in other plugins and provide those within a custom LayerList in your worldwind.xml file, you need to setup the com.yourCompany.gov.nasa.worldwind plugins classloader to find classes in other plugins. Therefore, add the following line to the MANIFEST.MF of com.yourCompany.gov.nasa.worldwind: Code:
DynamicImport-Package: * Now you have created all the necessary plugins to work with worldwind. 6) Using worldwind in a view In order to use worldwind in a view, you need to create a new plugin and add a dependency to com.yourCompany.gov.nasa.worldwind in the MANIFEST.MF of the new plugin. To use a a AWT element, the use of the SWT_AWT bridge is needed. Using the native SWT_AWT brigde requires a lot of additional work to get the whole thing running properly. Fortunately, there has been a project that had done all this work: com.eclipse.albireo (http://wiki.eclipse.org/Albireo_Documentation). Although the project is not active any more and claims to be in alpha-state, we have not found any issues yet and regard albireo as a pretty reliable implementation. To use it, download it and add it to your plugin as dependency. Then, create a new View and use the following code to use the WorldWindGLCanvas Code:
public class MapView extends ViewPart {
public static final String ID = "MapView";
private SwingControl swingControl = null;
private WorldWindowGLCanvas worldWindow;
public MapView() {
}
@Override
public void createPartControl(final Composite parent) {
worldWindow = new WorldWindowGLCanvas();
final Model m = (Model) WorldWind
.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
m.setShowWireframeExterior(false);
m.setShowWireframeInterior(false);
m.setShowTessellationBoundingVolumes(false);
worldWindow.setModel(m);
swingControl = new SwingControl(parent, SWT.NONE) {
@Override
public Composite getLayoutAncestor() {
return parent;
}
@Override
protected JComponent createSwingComponent() {
final JPanel panel = new JPanel(new BorderLayout());
panel.add(worldWindow, BorderLayout.CENTER);
return panel;
}
};
}
@Override
public void setFocus() {
if (null != swingControl) {
swingControl.setFocus();
}
}
@Override
public void dispose() {
if (null != swingControl) {
swingControl.dispose();
}
super.dispose();
}
}
In order to use a custom worldwind.xml configuration file, we do the setup in the Activator of the plugin: Code:
public class Activator extends AbstractUIPlugin {
:
@Override
public void start(final BundleContext context) throws Exception {
super.start(context);
final URL configFile = FileLocator.toFileURL(FileLocator.find(getDefault().getBundle(), new Path("<your path to the config file, e.g. config/myWorldwind.xml>"), null);
System.setProperty("gov.nasa.worldwind.config.document", configFile.toString());
}
}
If you have any suggestions or anything could be made better, please add them here :-). |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jan 2012
Location: Lorton,VA
Posts: 15
![]() |
I'll try this out later and let you know how it went compared to the Netbeans.
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jan 2012
Location: Lorton,VA
Posts: 15
![]() |
On January 21, 2012 what I did to get up and running in Eclipse: (This is Pulsar the Mobile Version) eclipse.org/pulsar
Pulsar for Mobile Developers. Version: Helios Service Release 1 Build id: 20100917-0705 Import Project with Existing ANT file Select the Build.xml in the root directory of where ever you unpacked worldwind in my case it's in /users/dave/ww120 That takes care of most everything except picking up the *.dll's on linking which you can add to the build config a linker using Add External Class Folder then point to same (/users/dave/ww120) which is the dir where you find the jogl.dll ... and such.. In addition, I made a new packages com.dlw.worldwindx.examples.dlwstreet and cut and pasted my Source working in Netbeans under that packages (It's accessing Postgres Database so I had to included it's jar) and it running now in Eclpise. Any of the Examples will run in Eclpise. |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jan 2012
Location: Lorton,VA
Posts: 15
![]() |
MrMAS,
Under the gov.nasa.worldwind.util.gdal There are (4) Java Classes On of the Supers is looking for a file in the path. "gdal_datum.csv" If this helps you out... package gov.nasa.worldwind.util.gdal; import java.io.File; /** * @author Lado Garakanidze * @version $Id: GDALDataFinder.java 1 2011-07-16 23:22:47Z dcollins $ */ class GDALDataFinder extends GDALAbstractFileFilter { public GDALDataFinder() { super("gdal_datum.csv"); } public boolean accept(File pathname) { String filename; String dir; if (null != pathname && !isHidden(pathname.getAbsolutePath()) && null != (dir = pathname.getParent()) && !this.listFolders.contains(dir) // skip already discovered && null != (filename = pathname.getName()) // get folder name && searchPattern.equalsIgnoreCase(filename) ) { this.listFolders.add(dir); return true; } Thread.yield(); return false; } } |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jan 2012
Location: Lorton,VA
Posts: 15
![]() |
MrMas,
Without looking too deep but from experience and looking at a few of those classes you we're failing on, I'd say it has to do with the Relative Path of the WebServer Path. I've run into this before when writing Servlet's and JSP in Netbeans using GlassFish as the Server where one of the reasons I like Netbeans for Web based stuff is that GlassFish is already integrated so you click and go and all is packaged (Web Archive) and installed in GlassFish for you. One Step Operation where when using Eclipse you have a choice of Tomcat, GlassFish, Jetty etc but they are plugins and not installed out of the box so now coming to the point, if WW is running as an Applet sorta speak in a WebServer and looking for Files of anykind, that path will be the Root of whatever Server you are using. So in these Java Classes using Java io and such, are looking for that path relative to the webserver. So like when you copy WW into Netbeans as instructed above, your ready to go all the way. In Eclipse lot's of extra work and additional due to no built in WebServer such as when I use Helious. Eclipse Should install a WebServer ready to go out of the Box and then let you back it out if you choose another such as TomCat, Jetty, or Whatever. I don't know if this helps but that's what usually confused Developers is in the PATH is that of the WebServer root. |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: May 2011
Posts: 21
![]() |
Just a short notice about how to import albireo.
As Albireo is already an archived project, you may download all the files (all versions, etc.) at http://archive.eclipse.org/technolog...es/albireo.tgz After unpacking this archive, you will endup with the following files: ./albireo - downloads - src - www There are two different approches how to make the albireo plugins available: 1) If you are not using a target platform (this is the default case) Please use the org.eclipse.albireo.rcp_v20081031.zip under ./albireo/downloads. This zip-archive contains the necessary features and plugins so just unpack the whole thing in the parent folder of your eclipse installations. I.e. all the contents from the zip-archive folder "eclipse/feature/" should go into "<your_eclipse_folder>/features" and the whole content of the zip folder "eclipse/plugins" should go into "your_eclipse_folder>/plugins". After that, restart eclipse. 2) If you are using a target platform (more advanced :-) Put all the content from the zip-archive folder "eclipse/plugins" to your target platform and reload the target platform. Done. How do I use albireo in your own plugin? Simply open the MANIFEST.MF file of your plugin (in eclipse) and open the tab "Dependencies". Under the "Required Plug-ins" section, use the "Add..." button and type "albireo" to the text field to query the albireo plugin. Select the albireo plugin and hit "OK". That's it. (You may need dependencies to other plugins as well, e.g. worldwind, gdal, etc. So just select all the plugins your plugin as dependencies here). Very good tutorials about how to use eclipse could be found here: http://www.vogella.de/eclipse.html. For beginners I would really recommend the Eclipse RCP tutorial http://www.vogella.de/articles/EclipseRCP/article.html |
|
|
|
|
|
#8 | |
|
Member
Join Date: Feb 2012
Posts: 43
![]() |
I think the following is incorrect in holgerschmids tutorial.
http://forum.worldwindcentral.com/sh...79&postcount=2 Quote:
|
|
|
|
|
|
|
#9 |
|
Junior Member
Join Date: May 2011
Posts: 21
![]() |
You are right - this is a typo. You need to list the gluegen-rt native libs in the MANIFEST.MF of the com.yourCompany.guegenrt plugin:
Code:
Bundle-NativeCode: gluegen-rt.so; osname=linux; processor=amd64, gluegen-rt.dll; osname=windows; processor=x86 Holger |
|
|
|
|
|
#10 |
|
Member
Join Date: Feb 2012
Posts: 43
![]() |
I must thank you Holger for your guide, it was truly invaluable. I have noticed another error:
Code:
@Override
public void start(final BundleContext context) throws Exception {
super.start(context);
final URL configFile = FileLocator.toFileURL(FileLocator.find(getDefault().getBundle(), new Path("/home/alex/WWplugins/worldwind/config/worldwind.xml"), null));
System.setProperty("gov.nasa.worldwind.config.document", configFile.toString());
}
![]() |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to set breakpoints and debug WWJ in Eclipse? | xuqingxin | Development Help | 4 | 03-02-2010 11:32 PM |
| Gray Screen with WWJ in Eclipse | nlneilson | Development Help | 0 | 11-27-2009 02:14 AM |
| Eclipse RCP - NoClassDefFound when attempting to use 3rd party plug-in | markb_1984 | Development Help | 1 | 03-10-2009 09:42 AM |
| Loading WMS-release.zip in Eclipse | gil_dalit@yahoo.com | Development Help | 1 | 11-12-2008 08:05 PM |
| World Wind as Eclipse plugin | Unregistered | Development Help | 24 | 03-07-2008 07:57 AM |