Composant Delphi / Google Maps / OpenStreetMap / Leaflet  / Mappilary / Native Maps 100% Delphi 0% WebBrowser 0% Javascript

Groups

you are here :TECMap

Summary

Groups enable you to manage a set of elements, you can load them, save them, display them, hide them, move them to a single command.

// Delphi map component ECMap

// show group 'group-one'

map.Groups['group-one'].visible := true;

// move group
map.Groups['group-one'].setCenter(43.232951,0.078082);

The elements that you can group are the markers, polylines, polygones, circles, rectangles, groundoverlays and labels

the property Groups[] Returns a TECMapItemGroup, Access groups will create a group if it does not exist.

The groups name is not case sensitive, map.Groups['group'] is equivalent to map.Groups['Group']

46
// Delphi map component ECMap
var i:integer;

GLines : TECMapItemGroup;
begin

GLines := map.groups['GLines'];
GLines.BeginUpdate;
GLines.clear;

for i:=0 to map.polylines.count - 1 do
GLines.add(map.Polylines[i]);

for i:=0 to map.polygones.count - 1 do
GLines.add(map.Polygones[i]);

GLines.EndUpdate;

TECMapItemGroup

procedure BeginUpdate;

Procedure to use before multiple changes to the group to optimize speed

procedure EndUpdate;

Procedure to use, coupled with BeginUpdate, before multiple changes to the group to optimize speed

procedure Clear;

Empty the Group of its elements, but they are not deleted from the map

procedure Add(const item:TECMapItem);

Adds an element group
procedure AddBounds(const SouthWestLat,SouthWestLng,NorthEastLat,NorthEastLng:double);
Adds all of the TECMapItem in the area bounded by the low point (South West) and high (North East).
procedure Remove(const item:TECMapItem);
Removes a group element, the element is not removed from the map
procedure Delete;

Removes all the elements of the Group and of the map, the elements no longer exist

If you delete a group by map.Groups['Group'].Free the elements are not removed from the map

47
procedure Show;
Makes visible all of the elements of the Group
procedure Hide;
Cache all of the elements of the Group
function SaveToFile(const filename:string):boolean;

Saves the Group to a text file.

Use the .gpx , .kml and .json to specify a format, otherwise it is the internal format of ECMap that will be used

procedure LoadFromFile(const value: string);

Load the contents of a text file in the internal format of ECMap

Use the .gpx , .kml and .json to specify a format, otherwise it is the internal format of ECMap that will be used

LoadFromFile can download files on internet

48

 

function Contains(const lat, Lng: double): boolean;

Indicates whether the point located in the Lat, Lng is situated in the area of the Group
procedure setCenter(const lat,Lng:double);
Moves all of the items in the group so that its centre is located at Lat, Lng

procedure PanToBounds;

Dragging the map so the group is visible.

procedure fitBounds;

Adjusts the view so that all of the elements of the group is visible

property Visible:boolean ;

This property is used by Show / Hide

property MinZoom:byte ;

Minimum zoom to make the group appear, leave 0 to skip the zoom level

property MaxZoom:byte ;

Maximum zoom to make the group appear, leave 0 to skip the zoom level
property OnChange : TNotifyEvent
Raised when the scope of the group changes or the addition of an element

property SouthWestLat: double ;

Specifies the latitude of the left lower corner of the area that includes the Group

property SouthWestLng: double ;

Specifies the longitude of the left lower corner of the area that includes the Group

property NorthEastLat: double ;

Indicates the latitude of the top corner of the area that includes the Group

property NorthEastLng: double ;

Indicates longitude from the top corner of the area that includes the Group

property CenterLat : double ;

Specifies the latitude of the center of the group, use setCentre to modify

property CenterLng : double ;

Specifies the longitude of the center of the group, use setCentre to modify

property Name : string;

property toGPX : string;

Property read/write which gives access to the data of the card in GPX format.

property ToKml : string;

Property in read / write which returns the overlays (all except the Labels) in Kml format

property ToGeoJSON : string

Property in read / write which returns / adds overlays (just the markers, the polylines, polygons, circles, and rectangles) in the GeoJSON format

property ItemsToTxt : string;

Property in read / write which returns / adds overlays in internal text of TECMAP

property Count : integer

Returns the number of item in the Group

property Item[index:integer]:TECMapItem

Returns an item from the Group
go to page
© 2016 ESCOT-SEP Christophe - Made width Help&Web - RSS - Google+