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: |
AW: Delphi XE8 MapView-Komponente
Outline klingt nicht schlecht?
http://docwiki.embarcadero.com/Libra...ygonDescriptor http://docwiki.embarcadero.com/Libra...criptor_Fields |
AW: Delphi XE8 MapView-Komponente
Oder wenn man sich ganz einfach den
Delphi-Quellcode:
anschaut ;)
constructor
Delphi-Quellcode:
Aha, ein Array vom Typen
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;
Delphi-Quellcode:
Wozu so eine Dokumentation nicht alles gut ist ... (oder hier hätte auch ein STRG-Klick auf den Typen gereicht)
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; |
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:
Allerdings steht der Debugger mit mir noch auf dem Kriegsfuß (oder andersrum). Sobald ich den Button drücke,
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; verschwindet die App im Nirwana. Gruß Geosucher |
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; |
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; |
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.
|
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