Outils pour utilisateurs

Outils du site


lespetitshackers:ffox:cartegps

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

lespetitshackers:ffox:cartegps [2013/06/08 17:53] – créée christian.jacolotlespetitshackers:ffox:cartegps [2024/04/16 22:26] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
 +====== Exemple Carte GPS non dynamique- Firefox OS ======
 +
 +===== Création de l'application =====
 +
 +Créer un dossier //gps// qui contiendra tout les scripts de votre application.
 +
 +Fichier index.html :
 +<code>
 +<!doctype html>
 +
 +<html>
 +  <head>
 +    <title>Carte GPS</title>
 +    <link rel="stylesheet" href="hello.css"/>
 +  </head>
 +
 +  <body>
 +    <h1>Bonjour tout le monde</h1>
 +    <div id="map" style="width: 320px; height: 480px; text-indent: 0px; border-radius: 10px 10px 10px 10px;
 +    overflow: hidden; box-shadow: 0px 0px 5px gray; text-align: center;">
 +    </div>
 +
 +    <p>
 +    <script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script>
 +<script type="text/javascript" defer="defer">
 +var map;
 +function init_map(lat, lon){
 +  /* map obj */
 +  map = new OpenLayers.Map('map');
 +  /* Adding OSM layer */ 
 +  map.addLayer( new OpenLayers.Layer.OSM() );
 +  /* Centering map */
 +  var localLocation = new OpenLayers.LonLat(lon,lat).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
 +    map.setCenter(localLocation);
 +    map.zoomTo(17);
 +}
 +
 +function geo_success(position) {
 +  init_map(position.coords.latitude, position.coords.longitude);
 +}
 +
 +navigator.geolocation.watchPosition(geo_success);
 +</script>
 +
 +    </p>
 +  </body>
 +</html>
 +</code>
 +
 +Fichier de l'icone:
 +{{:lespetitshackers:ffos:icon.png?200|}}
 +
 +
 +Création d'un fichier manifest.webapp :
 +<code>
 +{
 +  "version":"1.0",
 +  "name":"Carte GPS",
 +  "description":"Carte MDL",
 +  "type":"web",
 +  "fullscreen":"true",
 +  "orientation": ["portrait"],
 +  "launch_path":"/index.html",
 +  "icons":
 +    { 
 +      "128":"/icon-128.png"
 +    },
 +   "developer":
 +   {
 +    "name":"Maison du Libre",
 +    "url":"http://mdl29.net"
 +    },
 +   "permissions":
 +   {
 +      "geolocation"
 + {
 + "description": "Nécessite l'accès GPS"
 + }
 +   }
 +}
 +</code>
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki