#!/bin/sh
# Shell script wrapper around the worldwind program,
# Copyright 2008 by Sylvestre Ledru <sylvestre.ledru@inria.fr>
#

# Include the wrappers utility script
. /usr/lib/java-wrappers/java-wrappers.sh


# Startup script of Worldwind for Debian

if test "$1" = "-h" -o "$1" = "--help"; then
	echo "Worldwind"
	echo "Usage: $0 [example]
By default, calling worldwind will display the default example.

However, other use case of worldwind are available: 
	AlarmIcons
	AnaglyphStereo
	Annotations
	ApplicationTemplate
	BasicDragger
	BMNGTwelveMonth
	ClickAndGoSelectListener
	DraggingShapes
	FlatWorldEarthquakes
	FlatWorld
	FlatWorldPanel
	GazetteerPanel
	GeoRSS
	GoToCoordinatePanel
	GraticuleAttributesPanel
	HelloWorldWind
	LayerPanel
	LineBuilder
	LocallyGeneratedImagery
	LoggingControl
	Mars
	MGRSAttributesPanel
	MGRSGraticule
	Moon
	PipeTracks
	PlaceNames
	PlaceNamesPanel
	RemoteSurfaceImage
	RuntimeStatistics
	Shapes
	StatisticsPanel
	SurfaceImageLayer
	SurfaceImages
	SurfaceImageViewer
	TerrainProfiler
	Tracks
	UsageInTabbedPane
	ViewIteration
	ViewLookAround
	WMSLayerManager
	WMSLayersPanel
"
	exit 0
fi

APPLICATION=$1

if [ -z "${APPLICATION}" ]; then
	APPLICATION="ApplicationTemplate"
fi

# We prefer to use openjdk or Sun's java if available
find_java_runtime openjdk sun  || find_java_runtime 

find_jars jogl gluegen-rt worldwind worldwind-demo
JAVA_ARGS="-Dsun.java2d.noddraw=true -Djava.library.path=/usr/lib/jni/"

run_java gov.nasa.worldwind.examples.$APPLICATION
