procedure initMapView;
var
scratchLayer: TMapLayer;
procedure addArea(const area: TRegionDegs; colour: TColor; opacity: single);
var
scratchArea: TMapArea;
i: integer;
begin
(* Add an areas object to the layer which will act as a container for *)
(* coloured static blocks, returning a reference which may be used *)
(* locally. *)
scratchArea := scratchLayer.Areas.Add as TMapArea;
(* Using that reference which is retained in-scope, set up drawing style *)
(* and add features. *)
scratchArea.LineColor := clNone;
scratchArea.FillColor := colour;
scratchArea.Opacity := opacity;
for i := 0 to High(area) do
with scratchArea.Points.Add as TMapAreaPoint do begin
Latitude := area[i].Lat;
Longitude := area[i].Lon
end
end { addArea } ;
procedure addAreas(const areas: TRegionsDegs; colour: TColor; opacity: single);
var
i: integer;
begin
for i := 0 to High(areas) do
addArea(areas[i], colour, opacity)
end { addAreas } ;
procedure addTrack(const pLine: TPolylineDegs; colour: TColor; opacity: single);
var
scratchTrack: TMapTrack;
i: integer;
begin
(* Add a tracks object to the layer which will act as a container for *)
(* coloured static polylines, returning a reference which may be used *)
(* locally. *)
scratchTrack := scratchLayer.Tracks.Add as TMapTrack;
(* Using that reference which is retained in-scope, set up drawing style *)
(* and add features. *)
scratchTrack.LineWidth := 2;
scratchTrack.LineColor := colour;
scratchTrack.ConnectWidth := scratchTrack.LineWidth;
scratchTrack.ConnectColor := scratchTrack.LineColor;
scratchTrack.Opacity := opacity;
for i := 0 to High(pLine) do
with scratchTrack.Points.Add as TMapTrackPoint do begin
Latitude := pLine[i].Lat;
Longitude := pLine[i].Lon
end
end { addTrack } ;
procedure addTracks(const pLines: TPolylinesDegs; colour: TColor; opacity: single);
var
i: integer;
begin
for i := 0 to High(pLines) do
addTrack(pLines[i], colour, opacity)
end { addTracks } ;
begin
(* Add a layer object to the MapView which will act as a container for areas *)
(* and tracks, returning a reference which may be used locally. *)
scratchLayer := MapView1.Layers.Add as TMapLayer;
(* Using that reference which is retained in-scope, add coloured static areas *)
(* to represent properties or villages which should not be overflown at low- *)
(* levels, and an "in-circuit" area within which aircraft should exercise *)
(* caution. *)
addAreas(Avoids, clRed, 1/6);
addArea(InCircuit, clBlue, 1/16);
// scratchLayer := MapView1.Layers.Add as TMapLayer; DOESN'T HELP
(* Again using the retained reference, add the circuit and the runway *)
(* alignment. *)
addTrack(Circuit, clGreen, 1/4);
addTrack(RunwayDegs, clBlack, 1/4)
end { initMapView } ;