Thema: Delphi Googlemaps Icons ändern

Einzelnen Beitrag anzeigen

manfred_h

Registriert seit: 4. Nov 2005
Ort: Basel
442 Beiträge
 
Delphi XE2 Enterprise
 
#10

Re: Googlemaps Icons ändern

  Alt 19. Jan 2010, 17:26
>>ToZie: Danke für die Hilfe

Konnte es lösen:

Delphi-Quellcode:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAALAyPM0cN5H4k4KM-7W6VQBRf0FePgkyxmUXJn9hmf5uqva2aGBQEHbZ_hWLtb_TV7znBj6MvQHpX5w" type="text/javascript"></script>
    <script type="text/javascript">

    var map; // need this global so Delphi can access it. (at least for now.)

    //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GScaleControl());
        map.setCenter(new GLatLng(46.818188, 8.227512), 07);
      }

    }

  function addControl(ctrlType) {
    switch(ctrlType)
    {
    case 1:
      map.addControl(new GSmallMapControl())
      break
    case 2:
      map.addControl(new GMapTypeControl());
      break
    }

  }
 

  function createMapMarker_member(lat, lng, html) {
    var memberIcon = new GIcon();
    memberIcon.image = "http://www.gideons.ch/fileadmin/scripts/googlemaps/icons/member.png";
    memberIcon.iconSize = new GSize(28, 33);
    memberIcon.iconAnchor = new GPoint(6, 20);
    memberIcon.infoWindowAnchor = new GPoint(5, 1);
    // Set up our GMarkerOptions object literal
    markerOptions = { icon:memberIcon }
;
  
    var point = new GLatLng(parseFloat(lat),parseFloat(lng));
    var marker = new GMarker(point, markerOptions);
    var html_m = html;

    GEvent.addListener(marker, "click", function()
      {marker.openInfoWindowHtml(html_m)}
      );
    //GLog.write(map.addOverlay(marker, markerOptions)); // only for debugging
    map.addOverlay(marker, markerOptions);
    return marker;
  }

  
    //]]>
    </script>
    
  <style type="text/css">
  html, body { border: 0px; margin: 0px; padding: 0px; }
  </style>
  
  </head>

  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 500px; height: 490px"></div>
  </body>
</html>

Delphi-Quellcode:
procedure Tfrm_googlemap.btn_batch_memberClick(Sender: TObject);
var
  Doc2: IHTMLDocument2;
  Win2: IHTMLWindow2;
  latlng: String;
  i: integer;
begin
  if not DM.Camps.Active then DM.Camps.Open;
  if not DM.tmp.Active then DM.tmp.Open;
    try
      DM.tmp.First;
      for i := 0 to DM.tmp.RecordCount -1 do begin
        with WebBrowser1.HTMLWindow2 do
        begin
          execScript('createMapMarker_member(" '+
            DM.tmp.FieldByName('POS_LAT').AsString+'", "'+
            DM.tmp.FieldByName('POS_LNG').AsString+'", "'+
            DM.tmp.FieldByName('F_NAME').AsString + '
'+
            DM.tmp.FieldByName('STR').AsString + '
'+
            DM.tmp.FieldByName('PLZ').AsString + '-'+
            DM.tmp.FieldByName('CITY').AsString + '
'+
            'TEL-P:' + DM.tmp.FieldByName('TELP').AsString + '
'+
            '______________________
'+
            'Camp ' + '- '+
            DM.tmp.FieldByName('C_NO').AsString +'", "'+
            '")', 'JavaScript');
          log_window.Lines.Add(
            DM.tmp.FieldByName('POS_LAT').AsString +
            ' ' +
            DM.tmp.FieldByName('POS_LNG').AsString +
            ' ' +
            DM.tmp.FieldByName('F_NAME').AsString); // LogeintragDM.tmp.Next;
          DM.tmp.Next;
        end;
      end;
    finally
    latlng:= DM.tmp.FieldByName('POS_LAT').AsString +','+ DM.tmp.FieldByName('POS_LNG').AsString;
  end;

  Doc2 := WebBrowser1.Document as IHTMLDocument2;
  Win2 := Doc2.parentWindow;
end;
Shalom
Manfred
  Mit Zitat antworten Zitat