![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: May 2007
Posts: 57
![]() |
Hi !
With the help of Vash my coworker I have deployed on Liferay Open Source Portal 4.2.2 the WorldWind Applet. Some steps : 1 - Refactor a bit BasicDemo.java in the SDK (application -> applet) ( use JApplet instead of Applet ) 2 - Build the jar and... 3 - .. DON'T Forget to SIGN IT !!!! ( multiple local access ) use keytool and jarsigner from your jdk 4 - copy BasicDemo.jar and worldwind.jar on your applet directory with full jogl and gluegen lib ( use the pack from their website ) 5 - here some sample code for your jsp page ( we use JOGLAppletLauncher ) Code:
<applet code="com.sun.opengl.util.JOGLAppletLauncher"
width=600
height=400
codebase='<%=response.encodeURL(request.getContextPath() + "/applet")%>'
archive="jogl.jar,gluegen-rt.jar,worldwind.jar,BasicDemo.jar">
<param name="subapplet.classname" VALUE="worldwinddemo.BasicDemo">
<param name="subapplet.displayname" VALUE="WorldWind">
<param name="progressbar" value="true">
<param name="cache_archive" VALUE="jogl.jar,gluegen-rt.jar,worldwind.jar,BasicDemo.jar">
<param name="cache_archive_ex" VALUE="jogl.jar;preload,gluegen-rt.jar;preload,worldwind.jar;preload,BasicDemo.jar;preload">
</applet>
|
|
|
|
|
|
#2 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
![]() |
Any link to try it out ?
|
|
|
|
|
|
#3 |
|
Member
Join Date: May 2007
Posts: 57
![]() |
Yes I will upload on my personnal Host the applet thing ( without portlet, there isn't any J2EE server ).
Today I will try to refactor again the main applet class, I don't like all these 'private static' things ^^. I have to work on Rss layer too, my applet have to communicate with the portlet to edit geoRSS flows : A Double Click on the 3D World add coordinates to an HTML input outside the applet with the help of JSObject. This is to generate geoRSS information ( a servlet translate informations on DabaBase or write them in a xml temp file readed by the applet ). I don't know if I'm truly understandable, my English is bad ( 'Oh Toulouse !' ), and this is a bit new for me ^^ Last edited by pred; 05-25-2007 at 04:14 PM. |
|
|
|
|
|
#4 |
|
God. Root. What is difference?
Join Date: Sep 2004
Location: Eastern Pennsylvania
Posts: 2,847
![]() |
Any new status on this?
__________________
![]() Earth is Square blog PUBLIC NOTICE AS REQUIRED BY LAW: Any use of this forum post, in any manner whatsoever, will increase the amount of disorder in the universe. Although no liability is implied herein, the consumer is warned that this process will ultimately lead to the heat death of the universe. |
|
|
|
|
|
#5 | |
|
Junior Member
Join Date: Jun 2007
Posts: 3
![]() |
Hi all,
I did the applet starting from the World Wind BasicDemo code, built a JAR, signed it with jarsigner and a key I created using keytool. I created the HTML file as suggested by pred, just changing the path. When I open the HTML file, I receive the message Error : Start failed : class not found : worldwinddemo.BasicDemo I checked again the JAR file, which is correct since the signed file worldwinddemo/BasicDemo.class is there. The applet tag part in the HTML is the following (the applet and all the libs and native libraries are in the same directory called "GeoSel"): Code:
<applet code="com.sun.opengl.util.JOGLAppletLauncher"
width=600
height=400
codebase="file:///Users/frank/IdeaProjects/GeoSel/"
archive="jogl.jar,gluegen-rt.jar,worldwind.jar,BasicDemo.jar">
<param name="subapplet.classname" VALUE="worldwinddemo.BasicDemo">
<param name="subapplet.displayname" VALUE="WorldWind">
<param name="progressbar" value="true">
<param name="cache_archive" VALUE="jogl.jar,gluegen-rt.jar,worldwind.jar,BasicDemo.jar">
<param name="cache_archive_ex" VALUE="jogl.jar;preload,gluegen-rt.jar;preload,worldwind.jar;preload,BasicDemo.jar;preload">
</applet>
The original BasicDemo application works perfectly. Does somebody have an idea why the applet doesn't? Thanks! Quote:
|
|
|
|
|
|
|
#6 |
|
Member
Join Date: May 2007
Posts: 57
![]() |
Hi ciccio !
Please post your BasicDemo.java , I'm feeling troubles with it ^^ I put my applet version on a sample html page ( HERE). I can't show Edit GeoRSS functionnality and Layer Manager because there are in my portlet application. I'm working with Liferay portal, jsr-168 JSF-MYFACES Portlets and DWR Ajax Proxy. And yes, there is some PatMurris work on this !! ( I yell every days I LOVE YOU PAT from Toulouse in France ).For fun try multiple shift and click on map ^^, this is part of edit GeoRSS functionnality. Last edited by pred; 06-22-2007 at 06:29 PM. |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Jun 2005
Location: France
Posts: 167
![]() |
Hi pred,
That's really great, WW in an applet. I'm quite new to java (as many people here...). Could you explain more in details how to do it ? What do you change in BasicDemo to make it an applet ? My first experiments just gave me a blank panel... Please please please ! Thanks |
|
|
|
|
|
#8 | |
|
Junior Member
Join Date: Jun 2007
Posts: 3
![]() |
Hi pred!
Thank you for your reply. Below my BasicDemo code, I'm not sure whether I the applet has some problem, I didn't do a clean refactoring (I'm using JIdea and couldn't find). However, I think the main problem is the OS. Your applet runs fine on Windows but on Mac OS X I get the same error message: Error : Start failed : class not found : worldwinddemo.WorldWindIcare So the problem is most probably the JOGL libraries on Mac and I have search in that direction. Code:
package worldwinddemo;
import gov.nasa.worldwind.*;
import gov.nasa.worldwind.awt.*;
import gov.nasa.worldwind.layers.*;
import gov.nasa.worldwind.layers.Earth.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
public class BasicDemo extends JApplet
{
private BasicDemo.LayerAction[] layers = new BasicDemo.LayerAction[] {
new BasicDemo.LayerAction(new BMNGSurfaceLayer(), true),
new BasicDemo.LayerAction(new LandsatI3(), true),
new BasicDemo.LayerAction(new USGSDigitalOrtho(), false),
new BasicDemo.LayerAction(new USGSUrbanAreaOrtho(), true),
new BasicDemo.LayerAction(new EarthNASAPlaceNameLayer(), true),
new BasicDemo.LayerAction(new CompassLayer(), true),
};
public void init()
{
System.out.println("Java run-time version: " + System.getProperty("java.version"));
System.out.println(gov.nasa.worldwind.Version.getVersion());
try
{
BasicDemo demo = new BasicDemo();
appFrame = new BasicDemo.AppFrame(demo.layers, getContentPane());
}
catch (Exception e)
{
e.printStackTrace();
}
}
private static class AppFrame
{
private final WorldWindowGLCanvas wwd = new WorldWindowGLCanvas();
public AppFrame(BasicDemo.LayerAction[] layers, Container c)
{
LayerList layerList = new LayerList();
try
{
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
wwd.setPreferredSize(new Dimension(800, 600));
mainPanel.add(wwd, BorderLayout.CENTER);
StatusBar statusBar = new StatusBar();
statusBar.setEventSource(wwd);
mainPanel.add(statusBar, BorderLayout.PAGE_END);
c.add(mainPanel, BorderLayout.CENTER);
JPanel westContainer = new JPanel(new BorderLayout());
{
JPanel westPanel = new JPanel(new GridLayout(0, 1, 0, 10));
westPanel.setBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9));
{
JPanel layersPanel = new JPanel(new GridLayout(0, 1, 0, 15));
layersPanel.setBorder(new TitledBorder("Layers"));
for (BasicDemo.LayerAction action : layers)
{
JCheckBox jcb = new JCheckBox(action);
jcb.setSelected(action.selected);
layersPanel.add(jcb);
layerList.add(action.layer);
if (action.layer instanceof TiledImageLayer)
((TiledImageLayer) action.layer).setShowImageTileOutlines(false);
if (action.layer instanceof LandsatI3)
((TiledImageLayer) action.layer).setDrawBoundingVolumes(false);
if (action.layer instanceof USGSDigitalOrtho)
((TiledImageLayer) action.layer).setDrawTileIDs(false);
}
westPanel.add(layersPanel);
westContainer.add(westPanel, BorderLayout.NORTH);
}
}
c.add(westContainer, BorderLayout.WEST);
Model m = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
m.setLayers(layerList);
m.setShowWireframeExterior(false);
m.setShowWireframeInterior(false);
m.setShowTessellationBoundingVolumes(false);
wwd.setModel(m);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
private static class LayerAction extends AbstractAction
{
private Layer layer;
private boolean selected;
public LayerAction(Layer layer, boolean selected)
{
super(layer.getName());
this.layer = layer;
this.selected = selected;
this.layer.setEnabled(this.selected);
}
public void actionPerformed(ActionEvent actionEvent)
{
if (((JCheckBox) actionEvent.getSource()).isSelected())
this.layer.setEnabled(true);
else
this.layer.setEnabled(false);
appFrame.wwd.repaint();
}
}
static
{
if (Configuration.isMacOS())
{
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "World Wind Basic Demo");
System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
}
}
private static BasicDemo.AppFrame appFrame;
}
Quote:
|
|
|
|
|
|
|
#9 |
|
Member
Join Date: May 2007
Posts: 57
![]() |
Ok, thx for your reply too. It's quite strange applet doesn't work on Mac OS, BasicDemo contains some MacOS specific lines. I will search a work around later. :'(
|
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Jun 2007
Posts: 3
![]() |
Hi pred,
Unfortunately Java is not that plattform independent when it comes to more complex and interesting applications... I will also try to find how to download and make those native libraries on the Mac work, independently of World Wind, since the problem must be with the Java's Open GL. Regarding the Mac-specific lines, they seem to have no effect (except from the application name in the menu bar). Even after deleting them, the BasicDemo application works as with them. |
|
|
|
![]() |
| 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 |
| worldwind java sdk problem | research4681 | Development Help | 14 | 08-19-2010 10:57 PM |
| Reg compiling the source code | Raj | Developers' Corner | 10 | 08-26-2008 06:58 PM |
| Any news about WorldWind 1.5 (Java) ? | turman | Feature Discussion | 40 | 04-10-2007 08:24 PM |
| Newbies guide to worldwind | Llynix | WorldWind General | 14 | 12-25-2004 01:55 PM |