AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Projekte Google Maps über COM (Component Object Model)
Thema durchsuchen
Ansicht
Themen-Optionen

Google Maps über COM (Component Object Model)

Ein Thema von Thom · begonnen am 23. Dez 2010 · letzter Beitrag vom 22. Mai 2022
Antwort Antwort
Seite 5 von 10   « Erste     345 67     Letzte »    
azrin.aris

Registriert seit: 25. Dez 2011
3 Beiträge
 
#1

AW: Google Maps über COM (Component Object Model)

  Alt 25. Dez 2011, 07:42
Dear Thomas,

Thank you for your great contribution. I do not understand German so I use google translate to try to understand your blog. I've downloaded your version 2 and try to compile on on Delphi XE2 - my ultimate is to use C++ Builder. Initially I got some problem to compile but now everything works fine. I'm learning the examples now.

Thank you

Geändert von azrin.aris (25. Dez 2011 um 08:03 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von beeglext
beeglext

Registriert seit: 26. Dez 2011
Ort: Днепропетровск
2 Beiträge
 
Delphi 7 Enterprise
 
#2

AW: Google Maps über COM (Component Object Model)

  Alt 27. Dez 2011, 06:13
error inslal TWebBrowser Delphi7
http://s47.radikal.ru/i116/1112/bc/2b5714883b81.jpg
help please
Дмитрий(Dmitriy)
  Mit Zitat antworten Zitat
Thom

Registriert seit: 19. Mai 2006
570 Beiträge
 
Delphi XE3 Professional
 
#3

AW: Google Maps über COM (Component Object Model)

  Alt 27. Dez 2011, 20:25
Hi Azrin,

thank you very much! Unfortunately I have only Delphi and not RAD Studio, so I could test it yet. If there are problems again, please tell about it!


Hi Дмитрий,

Delphi 7 has a integrated TWebBrowser component (dclie70.bpl). You do not need a additional component.
Thomas Nitzschke
Google Maps mit Delphi

Geändert von Thom (27. Dez 2011 um 23:23 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von beeglext
beeglext

Registriert seit: 26. Dez 2011
Ort: Днепропетровск
2 Beiträge
 
Delphi 7 Enterprise
 
#4

AW: Google Maps über COM (Component Object Model)

  Alt 27. Dez 2011, 23:22
Thom, спасибо (thank you)
Дмитрий(Dmitriy)
  Mit Zitat antworten Zitat
azrin.aris

Registriert seit: 25. Dez 2011
3 Beiträge
 
#5

AW: Google Maps über COM (Component Object Model)

  Alt 28. Dez 2011, 15:15
Hi Azrin,

thank you very much! Unfortunately I have only Delphi and not RAD Studio, so I could test it yet. If there are problems again, please tell about it!
Hi Thom,

I mange to port 2 of your samples int C++ Builder. Now I'm trying to port one of Events sample - the DOMListener sample. Unfortunately, I stuck

here is the code in Delphi (from your sample)
Delphi-Quellcode:
    {$IFDEF USE_ANONYMOUS_METHODS}
    Google.Maps.Event.AddDomListener(Map.Container,'click',NewFunction(
      procedure(Sender: TObject)
      var
        Event: TJScriptObject;
      begin
        //'Sender' is the TJScriptObject that was created with 'NewFunction()'
        //The 'click' event has one parameter - a object with the x and y
        //position of the click.
        Event:=TJScriptObject(CreateObjectWrapper(Script,TJScriptObject,
                                                  TJScriptFunction(Sender).Arguments[0]));
        ShowMessage('DIV clicked'+', ('+
                    'x: '+IntToStr(Event.Properties['x'])+', '+
                    'y: '+IntToStr(Event.Properties['y'])+')');
      end));
    {$ELSE}
    Google.Maps.Event.AddDomListener(Map.Container,'click',NewFunction(DIVClick));
    {$ENDIF}
I also attached here are the C++ codes that I manage to port and compile and is working
Angehängte Dateien
Dateityp: zip Control Options-CBXE2.zip (76,2 KB, 55x aufgerufen)
Dateityp: zip Icon Complex-CBXE2.zip (76,8 KB, 56x aufgerufen)
  Mit Zitat antworten Zitat
azrin.aris

Registriert seit: 25. Dez 2011
3 Beiträge
 
#6

AW: Google Maps über COM (Component Object Model)

  Alt 28. Dez 2011, 22:17
Hi all,

Here is another stumbling block that I encounter

the delphi code is:
Delphi-Quellcode:
procedure TForm1.InitMap(Sender: TObject);
var
  Marker: TMarker;
  MarkerOptions: TMarkerOptions;
  MyMap: TMap;
  MyOptions: TMapOptions;
begin
  with TScript(Sender) do
  begin
    MyOptions:=TMapOptions.Create;
    with MyOptions do
    begin
      Zoom:=4;
      Center:=New(Google.Maps.LatLng(-25.363882,131.044922));
      MapTypeID:=Google.Maps.MapTypeID.Roadmap;
    end;
    MyMap:=New(Google.Maps.Map(MyOptions));
    MarkerOptions:=TMarkerOptions.Create;
    with MarkerOptions do
    begin
      Position:=MyMap.GetCenter;
      Map:=MyMap;
      Title:='Click to zoom';
    end;
    Marker:=New(Google.Maps.Marker(MarkerOptions));
    {$IFDEF USE_ANONYMOUS_METHODS}
    Marker.OnClick:=
      procedure(Sender: TObject; Event: TEvent)
      begin
        if MyMap.GetZoom=8
          then MyMap.SetZoom(4)
          else MyMap.SetZoom(8);
        MyMap.SetCenter(Marker.GetPosition);
      end;
    {$ELSE}
    Marker.OnClick:=MarkerClick;
    {$ENDIF}
  end;
end;

{$IFNDEF USE_ANONYMOUS_METHODS}
procedure TForm1.MarkerClick(Sender: TObject; Event: TEvent);
begin
  with Script do
  begin
    if Maps[0].GetZoom=8
      then Maps[0].SetZoom(4)
      else Maps[0].SetZoom(8);
    Maps[0].SetCenter(TMarker(Sender).GetPosition);
  end;
end;
{$ENDIF}
and the C++ code is:
Code:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <SHDocVw.hpp>
#include <Vcl.OleCtrls.hpp>
#include "gmAPI.hpp"
#include "gmMap.hpp"
#include "gmOverlaysMarker.hpp"
#include "gmEvents.hpp"
#include "HTMLObjects.hpp"
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:   // IDE-managed Components
    TWebBrowser *WebBrowser1;
    void __fastcall FormCreate(TObject *Sender);
private:   // User declarations
    TScript *Script;
    void __fastcall InitMap(TObject *Sender);

public:       // User declarations
    __fastcall TForm1(TComponent* Owner);

    void __fastcall MarkerClick(TObject* Sender, Gmevents::TEvent Event);

};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif



//Unit1.cpp

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"

#pragma link "gmMap"
#pragma link "winInet.lib"

TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
   : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
   Script = new TScript(WebBrowser1);
   Script->LoadAPIAsync(InitMap);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::InitMap(TObject *Sender)
{

   int n;
   TMarker *Marker;
   TMarkerOptions *MarkerOptions;
   TLatLng *MyLatLng;
   TMap *MyMap;

   TScript *Script = dynamic_cast<TScript*>(Sender);

   TMapOptions *MyOptions = new TMapOptions;

   MyOptions->Zoom = 4;
   MyOptions->Center = Script->Google->Maps->LatLng(-25.363882,131.044922);
   MyOptions->MapTypeID = Script->Google->Maps->MapTypeID->Roadmap;

   MyMap = Script->Google->Maps->Map(MyOptions);

   MarkerOptions = new TMarkerOptions;

   MarkerOptions->Position = MyMap->GetCenter();
   MarkerOptions->Map      = MyMap;
   MarkerOptions->Title   = "Click to Zoom";
   Marker = Script->Google->Maps->Marker(MarkerOptions);
   Marker->OnClick = MarkerClick;  //[BCC32 Error] Member function must be called or its address taken

   delete MyOptions;
   delete MarkerOptions;

}
//---------------------------------------------------------------------------
void __fastcall TForm1::MarkerClick(TObject* Sender, Gmevents::TEvent Event)
{
   if(Script->Google->Maps[0]->GetZoom==8) // Error :E2288 Pointer to structure required on left side of -> or ->*
   {

   }
}
//---------------------------------------------------------------------------

I could not get the MarkerClick to be assigned to Marker->OnClick.

Also I could not find the Script->Google->Maps[0]->GetZoom() function.

Attached is the hpp file converted by C++ Builder


Anyhelp would be very much appreciated.

Thank you
Angehängte Dateien
Dateityp: zip gmAPI.zip (6,1 KB, 57x aufgerufen)

Geändert von azrin.aris (28. Dez 2011 um 22:34 Uhr)
  Mit Zitat antworten Zitat
BBoy

Registriert seit: 17. Jan 2007
418 Beiträge
 
Delphi 10 Seattle Professional
 
#7

AW: Google Maps über COM (Component Object Model)

  Alt 25. Jan 2012, 10:59
Ich nutze dies schon eine weile und es funktioniert auch bestens.
Auf der Karte setze ich mit der Maus Wegpunkte oder ich lade diese aus einer Datei.
Nun möchte ich aber noch folgendes realisieren:
Ich möchte mit der Maus einen rechteckigen Rahmen um bestimmte Wegpunkte ziehen, die Wegpunkte innerhalb des Rahmens sollen selektiert werden und diese möchte ich dann mit ENTF löschen können.

Ist das mit dieser api möglich? Wenn ja, könnte mir bitte jemand erklären wie das geht?
Danke!
  Mit Zitat antworten Zitat
Thom

Registriert seit: 19. Mai 2006
570 Beiträge
 
Delphi XE3 Professional
 
#8

AW: Google Maps über COM (Component Object Model)

  Alt 25. Jan 2012, 12:01
Google Maps unterstützt das leider nicht direkt. Selbst einen mit der Maus aufziehbaren Rahmen für den Zoom gibt es nicht.

Du könntest aber eine frei verfügbare Bibliothek - wie zum Beispiel KeyDragZoom - als Markierungsrahmen "mißbrauchen". Allerdings müßtest Du dann den Zoom am Ende unterdrücken. Du erhälst aber die Koordinaten des Auswahlrechtecks. Mit diesen Angaben könntest Du dann alle Deine Marker darauf testen, ob sie in dem betreffenden Bereich liegen, sie optisch hervorheben und bei Betätigung der Entf-Taste von der Karte entfernen.

Das ist aber eine gute Idee - wurde auf meiner ToDo-Liste vermerkt.
Thomas Nitzschke
Google Maps mit Delphi
  Mit Zitat antworten Zitat
BBoy

Registriert seit: 17. Jan 2007
418 Beiträge
 
Delphi 10 Seattle Professional
 
#9

AW: Google Maps über COM (Component Object Model)

  Alt 25. Jan 2012, 15:48
Das ist ein Anfang Hast du eine Idee wie man den Zoom unterdrücken könnte und wie man dann aus KeyDragZoom die koordianten des Rechtecks bekommen könnte?
  Mit Zitat antworten Zitat
Thom

Registriert seit: 19. Mai 2006
570 Beiträge
 
Delphi XE3 Professional
 
#10

AW: Google Maps über COM (Component Object Model)

  Alt 25. Jan 2012, 19:16
Die KeyDragZoom-Bibliothek bietet eine ganze Reihe von Events.
Bei dragend wird auch das entsprechende LatLngBounds-Objekt geliefert.
Wird der JavaScript Code modifiziert, könnte das Event zum Beispiel als Funktion ausgelegt werden, so daß in Abhängigkeit vom zurückgegebenen Wert der Zoom ausgeführt wird oder nicht.

Ein Delphi-Wrapper für diese Bibliothek ist zusammen mit etlichen Demos in den Erweiterungen enthalten.
Thomas Nitzschke
Google Maps mit Delphi
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 5 von 10   « Erste     345 67     Letzte »    


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

(?)

LinkBack to this Thread

Erstellt von For Type Datum
DELPHI | (google maps) This thread Refback 11. Nov 2011 09:07
Twebbrowser HTML tag to UniHTMLFrame1 - uniGUI Discussion Forums This thread Refback 4. Nov 2011 06:52
DoraDev1975: google maps This thread Refback 23. Sep 2011 08:18
delphi osm - Google Search Post #0 Refback 19. Sep 2011 09:02
DoraDev1975: ?&#3636;????? 2011 This thread Refback 11. Sep 2011 16:39
DoraDev1975 This thread Refback 30. Aug 2011 10:13
Untitled document This thread Refback 25. Jun 2011 19:57
Interact with Google Maps in a TWebBrowser from Delphi | Ramblings This thread Refback 26. Jan 2011 05:12
google maps mit delphi link - Google Search This thread Refback 24. Jan 2011 14:24
google maps mit delphi - Google Search This thread Refback 24. Jan 2011 14:20
Untitled document This thread Refback 19. Jan 2011 21:49

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:08 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz