Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Die Delphi-IDE (https://www.delphipraxis.net/62-die-delphi-ide/)
-   -   Delphi XE8 MapView-Komponente (https://www.delphipraxis.net/185008-delphi-xe8-mapview-komponente.html)

geosucher 7. Mai 2015 09:31

Delphi XE8 MapView-Komponente
 
Hallo zusammen,

bin gerade am testen von RADStudio XE8. Finde die neue TMapView-Komponente sehr interessant, besonders, dass man neben den üblichen Markern auch Punkte, Polylinien und Polygone in die Karte eintragen kann.
Genau hier liegt mein Problem: Es gibt eine Property AddPolygon, übergeben wird ihr das Objekt TMapPolygonDescriptor.
Ich verstehe nur nicht, wie ich in den TMapPolygonDescriptor meine x Koordinaten bekomme???

Falls jemand da schon weiter ist, wäre ich für Tipps dankbar.

Gruß

Geosucher:oops:

himitsu 7. Mai 2015 09:50

AW: Delphi XE8 MapView-Komponente
 
Outline klingt nicht schlecht?
http://docwiki.embarcadero.com/Libra...ygonDescriptor
http://docwiki.embarcadero.com/Libra...criptor_Fields

Sir Rufo 7. Mai 2015 10:06

AW: Delphi XE8 MapView-Komponente
 
Oder wenn man sich ganz einfach den
Delphi-Quellcode:
constructor
anschaut ;)
Delphi-Quellcode:
type
  TMapPolygonDescriptor = record
    Outline: TMapPolygonPolyvertex;
    Holes: TArray<TMapPolygonPolyvertex>;
    Geodesic: Boolean;
    FillColor: TAlphaColor;
    StrokeColor: TAlphaColor;
    StrokeWidth: Single;
    ZIndex: Single;
    class function Create(const Outline: TArray<TMapCoordinate>): TMapPolygonDescriptor; static;
    procedure AddHole(const Points: TArray<TMapCoordinate>);
  end;
Aha, ein Array vom Typen
Delphi-Quellcode:
type
  TMapCoordinate = record
    Latitude: Double;
    Longitude: Double;
    class function Create(const Latitude: Double; const Longitude: Double): TMapCoordinate; overload; static; inline;
    class function Create(const Point: TPointF): TMapCoordinate; overload; static; inline;
    class function Zero: TMapCoordinate; static; inline;
    function ToString: string;
  end;
Wozu so eine Dokumentation nicht alles gut ist ... (oder hier hätte auch ein STRG-Klick auf den Typen gereicht)

geosucher 7. Mai 2015 10:28

AW: Delphi XE8 MapView-Komponente
 
Hallo himitsu,

danke für die schnelle Antwort.
Die Idee hatte ich auch schon. Ich hatte folgendes probiert:

Delphi-Quellcode:
procedure TTabbedForm.CornerButton1Click(Sender: TObject);
var Plg    : TMapPolygonDescriptor;
    Outline : System.TArray<TMapCoordinate>;
begin
 Plg:=TMapPolygonDescriptor.Create(Outline);
 SetLength(Outline,5);
 Outline[0]:=TMapCoordinate.Create(51.35619, 12.58328);
 Outline[1]:=TMapCoordinate.Create(51.35620, 12.58328);
 Outline[2]:=TMapCoordinate.Create(51.35620, 12.58329);
 Outline[3]:=TMapCoordinate.Create(51.35619, 12.58329);
 Outline[4]:=TMapCoordinate.Create(51.35619, 12.58328);
 MapView1.AddPolygon(Plg);
end;
Allerdings steht der Debugger mit mir noch auf dem Kriegsfuß (oder andersrum). Sobald ich den Button drücke,
verschwindet die App im Nirwana.

Gruß

Geosucher

Uwe Raabe 7. Mai 2015 10:30

AW: Delphi XE8 MapView-Komponente
 
Die Reihenfolge passt nicht. Versuchs doch mal so:

Delphi-Quellcode:
procedure TTabbedForm.CornerButton1Click(Sender: TObject);
var Plg : TMapPolygonDescriptor;
    Outline : System.TArray<TMapCoordinate>;
begin
 SetLength(Outline,5);
 Outline[0]:=TMapCoordinate.Create(51.35619, 12.58328);
 Outline[1]:=TMapCoordinate.Create(51.35620, 12.58328);
 Outline[2]:=TMapCoordinate.Create(51.35620, 12.58329);
 Outline[3]:=TMapCoordinate.Create(51.35619, 12.58329);
 Outline[4]:=TMapCoordinate.Create(51.35619, 12.58328);
 Plg:=TMapPolygonDescriptor.Create(Outline);
 MapView1.AddPolygon(Plg);
end;

mkinzler 7. Mai 2015 10:31

AW: Delphi XE8 MapView-Komponente
 
Versuch mal
Delphi-Quellcode:
procedure TTabbedForm.CornerButton1Click(Sender: TObject);
var Plg : TMapPolygonDescriptor;
    Outline : System.TArray<TMapCoordinate>;
begin
 SetLength(Outline,5);
 Outline[0]:=TMapCoordinate.Create(51.35619, 12.58328);
 Outline[1]:=TMapCoordinate.Create(51.35620, 12.58328);
 Outline[2]:=TMapCoordinate.Create(51.35620, 12.58329);
 Outline[3]:=TMapCoordinate.Create(51.35619, 12.58329);
 Outline[4]:=TMapCoordinate.Create(51.35619, 12.58328);
 Plg:=TMapPolygonDescriptor.Create(Outline);
 MapView1.AddPolygon(Plg);
end;

himitsu 7. Mai 2015 10:44

AW: Delphi XE8 MapView-Komponente
 
Jupp, das sind Records und keine Objekte/Zeiger ... die werden bei Übergabe komplett kopiert und nachträgliches Füllen wird da nicht mehr beachtet.

geosucher 7. Mai 2015 10:49

AW: Delphi XE8 MapView-Komponente
 
Hallo,

ja danke- das war's. Jetzt noch etwas sinnvollere Koordinaten und es funktioniert. Bin beeindruckt.

Danke!

Geosucher


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:46 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz