IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Web & réseau Delphi Discussion :

Conseils pour modifier un script Java Google Map API.


Sujet :

Web & réseau Delphi

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    439
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2003
    Messages : 439
    Points : 161
    Points
    161
    Par défaut Conseils pour modifier un script Java Google Map API.
    Bonjour,

    J'utilise un script Java pour afficher des points reliés par des lignes sur une carte du monde.
    Ce script fonctionne bien, mais je souhaiterais le modifier pour ajouter des Infowindow affichant le nom de ces points sur chacun d'entre eux.
    Voici le script:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    '<html> '+
    '<head> '+
    '<meta name="viewport" content="initial-scale=1.0, user-scalable=yes"/> '+
    '<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true&v=3.22"></script> '+   //24/08/2016 (...&V=3.22 au lieu de V=3...)
    '<script type="text/javascript"> '+
    '  var map;'+
    '  var polyline = [];'+
    '  var markersArray = [];'+
    '  var Circle = { '+
    '  path: google.maps.SymbolPath.CIRCLE ,'+
    '  fillColor: "Red",'+
    '  fillOpacity: 1.0,'+
    '  scale: 3,'+
    '  strokeColor:"Black",'+
    '  strokeWeight: 1 '+
    '};'+
    ''+
    ''+
    '  function initialize() {'+
    '  var myLatLng = new google.maps.LatLng(48.0,2.0);'+
    '  var mapOptions = {'+
    '    zoom: 5,'+
    '    center: myLatLng,'+
    '    mapTypeId: google.maps.MapTypeId.TERRAIN'+
    '  };'+
    '  map = new google.maps.Map(document.getElementById("map_canvas"),'+
    '    mapOptions);'+
    '}'+
    ''+
    ' function DrawTrack(FromLat,FromLng,ToLat,ToLng){'+
    ' var geo_path = new Array();'+
    '   var geo_path = [new google.maps.LatLng(FromLat,FromLng),'+
    '                     new google.maps.LatLng(ToLat,ToLng)];'+
    ' var Track = new google.maps.Polyline({'+
    '   path: geo_path,'+
    '   strokeColor: "#FF0000",'+
    '   strokeOpacity: 1.0,'+
    '   strokeWeight: 2'+
    ' });'+
    ''+
    ' polyline.push(Track);'+
    ' Track.setMap(map);'+
    ' }'+
    ''+
    ''+
    ' function RemoveTrack(){' +
    '  if (polyline){' +
    '    for(i in polyline){' +
    '      polyline[i].setMap(null);' +
    '    }' +
    '     polyline.length =0;' +
    '   }' +
    '}' +
    ''+
    ' function ClearMarkers() {  '+
    '  if (markersArray) {        '+
    '    for (i in markersArray) {  '+
    '      markersArray[i].setMap(null); '+
    '    } '+
    '  } '+
    ' Bounds = new google.maps.LatLngBounds();'+
    '}  '+
    ''+
    ' var Bounds = new google.maps.LatLngBounds(); '+
    ' function PutMarker(Lat, Lang, Msg) { '+
    '   var latlng = new google.maps.LatLng(Lat,Lang);'+
    '   var marker = new google.maps.Marker({'+
    '      position: latlng,'+
    '      icon: Circle,'+
    '      map: map,'+
    '      title: Msg'+
    '   });'+
    ''+
    ' Bounds.extend(latlng);'+
    ' map.fitBounds(Bounds);'+
    '}'+
    ''+
    ''+
    ''+'</script> '+
    '</head> '+
    '<body onload="initialize()"> '+
    '  <div id="map_canvas" style="width:100%; height:100%"></div> '+
    '</body> '+
    '</html> ';
    Comment procéder s'il vous plait ?

    Cordialement
    Pierre

  2. #2
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    439
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2003
    Messages : 439
    Points : 161
    Points
    161
    Par défaut
    Bonjour,

    J’essaie avec ce script qui ne fonctionne pas:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    HTMLStr: AnsiString = //Java scrip for Google map
    '<html> '+
    '<head> '+
    '<meta name="viewport" content="initial-scale=1.0, user-scalable=yes"/> '+
    '<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true&v=3.22"></script> '+   //24/08/2016 (...&V=3.22 au lieu de V=3...)
    '<script type="text/javascript"> '+
    '  var map;'+
    '  var polyline = [];'+
    '  var markersArray = [];'+
    '  var Circle = { '+
    '  path: google.maps.SymbolPath.CIRCLE ,'+
    '  fillColor: "Red",'+
    '  fillOpacity: 1.0,'+
    '  scale: 3,'+
    '  strokeColor:"Black",'+
    '  strokeWeight: 1 '+
    '};'+
    ''+
    ''+
    'function initialize() {'+
    '  var myLatLng = new google.maps.LatLng(48.0,2.0);'+
    '  var mapOptions = {'+
    '    zoom: 5,'+
    '    center: myLatLng,'+
    '    mapTypeId: google.maps.MapTypeId.TERRAIN'+
    '  };'+
    '  map = new google.maps.Map(document.getElementById("map_canvas"),'+
    '    mapOptions);'+
    '}'+
    ''+
    ' function DrawTrack(FromLat,FromLng,ToLat,ToLng){'+
    ' var geo_path = new Array();'+
    '   var geo_path = [new google.maps.LatLng(FromLat,FromLng),'+
    '                     new google.maps.LatLng(ToLat,ToLng)];'+
    ' var Track = new google.maps.Polyline({'+
    '   path: geo_path,'+
    '   strokeColor: "#FF0000",'+
    '   strokeOpacity: 1.0,'+
    '   strokeWeight: 2'+
    ' });'+
    ''+
    ' polyline.push(Track);'+
    ' Track.setMap(map);'+
    ' }'+
    ''+
    ''+
    ' function RemoveTrack(){' +
    '  if (polyline){' +
    '    for(i in polyline){' +
    '      polyline[i].setMap(null);' +
    '    }' +
    '     polyline.length =0;' +
    '   }' +
    '}' +
    ''+
    ' function ClearMarkers() {  '+
    '  if (markersArray) {        '+
    '    for (i in markersArray) {  '+
    '      markersArray[i].setMap(null); '+
    '    } '+
    '  } '+
    ' Bounds = new google.maps.LatLngBounds();'+
    '}  '+
    ''+
    ' var Bounds = new google.maps.LatLngBounds(); '+
    ' function PutMarker(Lat, Lang, Msg) { '+
    '  var latlng = new google.maps.LatLng(Lat,Lang);'+
    '  var marker = new google.maps.Marker({'+
    '    position: latlng,'+
    '    icon: Circle,'+
    '    map: map,'+
    '    title: Msg'+
    '   });'+
    '  var oInfo = new google.maps.InfoWindow();'+
    ' oInfo.setContent(Msg);'+
    ' oInfo.open(map, this);'+
    ' Bounds.extend(latlng);'+
    ' map.fitBounds(Bounds);'+
    '}'+
    ''+
    ''+
    ''+'</script> '+
    '</head> '+
    '<body onload="initialize()"> '+
    '  <div id="map_canvas" style="width:100%; height:100%"></div> '+
    '</body> '+
    '</html> ';
    Une idée à me proposer?

    Cordialement
    Pierre

  3. #3
    Modérateur

    Homme Profil pro
    Ingénieur électricien
    Inscrit en
    Septembre 2008
    Messages
    1 267
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ingénieur électricien

    Informations forums :
    Inscription : Septembre 2008
    Messages : 1 267
    Points : 4 829
    Points
    4 829
    Par défaut
    Bonsoir Pierre

    C'est du Delphi? Sinon faudrait voir le bon forum.

    Delias

  4. #4
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    439
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2003
    Messages : 439
    Points : 161
    Points
    161
    Par défaut
    Bonjour,

    En fait c'est un script Java inclus dans une application en Delphi.

    Cordialement
    Pierre

  5. #5
    Rédacteur/Modérateur

    Avatar de SergioMaster
    Homme Profil pro
    Développeur informatique retraité
    Inscrit en
    Janvier 2007
    Messages
    15 043
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2007
    Messages : 15 043
    Points : 40 957
    Points
    40 957
    Billets dans le blog
    62
    Par défaut
    Bonjour,

    ma méthode , c'est de réussir à avoir ça via mon Explorateur Internet (FireFox) puis de regarder le source de la page .
    Si tu réussi à obtenir ce que tu veux sur une page Web alors tout doit être indiqué dans le source, reste juste le plus complexe : comprendre le tout
    MVP Embarcadero
    Delphi installés : D3,D7,D2010,XE4,XE7,D10 (Rio, Sidney), D11 (Alexandria), D12 (Athènes)
    SGBD : Firebird 2.5, 3, SQLite
    générateurs États : FastReport, Rave, QuickReport
    OS : Window Vista, Windows 10, Windows 11, Ubuntu, Androïd

  6. #6
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    439
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2003
    Messages : 439
    Points : 161
    Points
    161
    Par défaut
    Bonjour,

    J'ai ré ouvert ce fil sur le forum Java.

    Merci à tous

    Pierre

  7. #7
    Membre expérimenté Avatar de guillemouze
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    876
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Novembre 2004
    Messages : 876
    Points : 1 448
    Points
    1 448
    Par défaut
    Citation Envoyé par Pierre95 Voir le message
    Bonjour,

    J'ai ré ouvert ce fil sur le forum Java.

    Merci à tous

    Pierre
    Hmmm le plus judicieux aurait été de le rouvrir sur le forum javascript

  8. #8
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2003
    Messages
    439
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2003
    Messages : 439
    Points : 161
    Points
    161
    Par défaut
    Bonjour,

    En fait c'est bien là que je l'ai ré ouvert.

    Merci
    Cordialement
    Pierre

Discussions similaires

  1. aide pour modifier un script php
    Par paul.Rostorp dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 7
    Dernier message: 09/01/2009, 08h39
  2. Google Map - API Java ?
    Par onlytoine dans le forum Collection et Stream
    Réponses: 3
    Dernier message: 28/04/2008, 11h25
  3. conseils pour bien programmer en Java
    Par Patrice Henrio dans le forum AWT/Swing
    Réponses: 5
    Dernier message: 31/08/2007, 23h05
  4. [Forum] Conseil pour trouver un forum java à mettre sur un portail
    Par tinico dans le forum Développement Web en Java
    Réponses: 1
    Dernier message: 02/05/2007, 10h59
  5. conseil pour un noob de java
    Par Th3dJoBiN dans le forum Langage
    Réponses: 3
    Dernier message: 11/12/2006, 15h13

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo