|
|
GpsActionReplay within a Web Browser (as an Applet)As it is written in Java, GpsAR can be embbed in a Web Browser within an Applet, enabling replays available worldwide... DemoIf you haven't ever seen GpsAR as an applet, you can check some of the on our replays' page.
How to for newbiesWe show here how to make a first applet in the easier way
Here it is. This should work when double-clicking on gpsar.html. You can now copy appletGPSAR (FTP) to your site. Remark: of course, you can rename gpsar.html to index.html so that your web-site automatically shows the applet rather than the content of the directory. Important: once you've copied your maps directory, it's strongly advised to keep only the relevant map(s) really needed by your gpx. This means removing the jpg files, and removing their definition in the default.maps file. Do not forget that otherwise, all these maps will be loaded when visiting your applet, which takes bandwidth and time TroubleshootingSomtimes, people experienced a strange phenomenon with the GpsAR applet. They do all that is written above. They try it locally on their machine, and it works great. Then they copy it with FTP to their site, and the applet doesn't work. Usually, the reason is that Windows is too permissive, and allows non conventional use for naming files and directory. Once put on the web, it's not your windows but, often, a Linux system that has to cope with that, and it doesn't word. So, here are some recommandations:
How to for advanced usersWhat we've just seen above is very simple, since you just have to copy some files and directories, but isn't very handy when you want to provide several applets in your web site. Indeed, it implies to create as many directories as applet provided. Let's introduce here some parameters that enable more handy applets. In fact, you can use 2 parameters when you launch the applet:
Why to use these parameters rather than using the gpsar.html file as it is and using the default names for gpx and maps? The reason is of course that this way, you can program it with php for example. To finish, I provide below the PHP CODE I used for the Defi Wind replays. You will see that a only PHP page can provide the applet with different GPX and different MAPS, although there are only one directory, and one gpsar.jar. Here it is : <html> <title>Defi Wind 2005 sur GPSActionReplay</title> <body style="background-image : url('fond_bois.gif'); color:white"> <h1><center>Defi Wind 2005</center></h1> <h2><center>5 mai - 8 mai</center></h2> <hr/> <div align="center" style="font-size:20"> <?php $numCarte=$_GET["numCarte"]; $manche=$_GET["manche"]; if (!isset($numCarte)) $numCarte=1; if (!isset($manche)) $manche=1; $carte[1]="maps/defiWind1.maps"; $carte[2]="maps/defiWind6.maps"; $description[1]="Jeudi 5 mai"; $description[2]="Vendredi 6 mai"; $description[3]="Vendredi 6 mai"; $description[4]="Samedi 7 mai"; $description[5]="Samedi 7 mai"; $description[6]="Dimanche 8 mai"; $description[7]="Dimanche 8 mai"; $nb=7; for ($i=1;$i<=$nb;$i++) { if ($i != $manche) print "<a href='index.php?manche=$i&numCarte=$numCarte'>Manche $i</a>"; else print "Manche $i"; if ($i!=$nb) print " - "; } print "<hr/>"; print "<span style='font-size:14'>"; if ($numCarte!=1) print "<a href='index.php?manche=$manche&numCarte=1'>Carte BASSE RESOLUTION (157 Ko) - </a>"; else print "Carte BASSE RESOLUTION (157 Ko) - "; if ($numCarte!=2) print "<a href='index.php?manche=$manche&numCarte=2'>Carte HAUTE RESOLUTION (945 Ko)</a>"; else print "Carte HAUTE RESOLUTION (945 Ko)"; print "</span>"; ?> </div> <hr/> <center> <h2>Manche <?php print($manche)?> (<?php print($description[$manche])?>)</h2> <!--"CONVERTED_APPLET"--> <!-- CONVERTER VERSION 1.0 --> <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = "800" HEIGHT = "700" codebase="http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0"> <PARAM NAME = CODE VALUE = "GPSARApplet.class" > <PARAM NAME = ARCHIVE VALUE = "gpsar.jar" > <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2"> <PARAM NAME = "nomFichier" VALUE ="manche<?php print($manche)?>.gpx"/> <PARAM NAME = "maps" VALUE ="<?php print($carte[$numCarte])?>"/> <COMMENT> <EMBED type="application/x-java-applet;version=1.2" java_CODE = "GPSARApplet.class" java_ARCHIVE = "gpsar.jar" WIDTH = "800" HEIGHT = "700" maps="<?php print($carte[$numCarte])?>" nomFichier = "manche<?php print($manche)?>.gpx"/ pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"><NOEMBED></COMMENT> </NOEMBED></EMBED> </OBJECT> <!--"END_CONVERTED_APPLET"--> </center> </body> </html>
|