Pois (point of interest) are equivalent to the markers, the difference is that they are supported natively by Delphi, they are so light and fast, you can incorporate several thousands without worries.
You have 4 predefined shapes (Ellipse, rectangle, triangle and star) but you can also take in charge their design.
Does not work on Chromium !
23POIs are managed by an TECMapPois list accessible through the Pois TECMap property
TECMapPois
This list has the following methods and properties :
function Add(const dLatitude,dLongitude:double):integer;
// Delphi
map component ECMap
// add POI at center of
map
id := map.Pois.add(map.latitude,map.longitude);
// set caption to this
POI
map.Pois[id].caption := 'my first
POI!';
function ByLatLng(const dLatitude,dLongitude:double):TECMapPoi;
procedure Clear;
procedure Delete(index:integer);
property Count:integer;
procedure fitBounds
property Poi[index:integer]:TECMapPOI;
In writing it is an addition, not a replacement, If you do not want to keep the old values made a Clear before adding
45property ShowHint : boolean
property OnOwnerDrawPOI : TOnOwnerDrawPOI
// Delphi
map component ECMap
map.Pois.OnOwnerDraw := doOwnerDrawPOI;
...
// owner draw poi, here
transparancy text
procedure
TFormPoi.doOwnerDrawPOI(const canvas:TCanvas;var Rect:TRect;item:TECMapPoi) ;
begin
canvas.brush.Style := bsClear;
if item.Hover then
canvas.font.color := item.HoverColor
else
canvas.font.color := item.color;
canvas.font.Style := [fsBold];
item.Width := canvas.TextWidth(item.caption) ;
item.height := canvas.TextHeight(item.caption) ;
item.x := item.x - (item.Width div 2);
item.y := item.y - (item.height div 2);
canvas.TextOut(item.x,item.y,item.caption);
end;
property DragPoi : TECMapPoi
TECMapPOI
This class manages a POI, it has the following methods and properties :
property Caption: string
property Color: TColor
property HoverColor: TColor
property Latitude: double
property Longitude: double
property X : integer
property Y : integer
property Width : integer
property height : integer
property Draggable : boolean
property Shape : TPOIShape
property Hover : boolean
property OnBeforeDrawPOI : TOnOwnerDrawPOI
Specify a procedure to draw on top of type POI poiEllipse, poiRectangle, poiTriangle et poiStar
Example, written his number on a POI
// Delphi
map component ECMap
i := map.pois.add(map.Latitude,map.Longitude);
map.pois[i].Shape := poiStar;
map.pois[i].width := 25;
map.pois[i].height := 25;
map.pois[i].OnBeforeDrawPOI := doNumDrawPOI;
// draw poi id
procedure
TFormDemoECMap.doNumDrawPOI(const canvas:TCanvas;var r:TRect;item:TECMapPoi) ;
var x,y,w,h :
integer;
s : string;
begin
canvas.font.style := [fsBold];
s := inttostr(item.id);
w := canvas.TextWidth(s) ;
h := canvas.TextHeight(s) ;
x := 1+((r.Left + r.Right)
- w) DIV 2 ;
y := 1+((r.Top + r.Bottom)
- h) DIV 2 ;
canvas.brush.Style := bsClear;
canvas.font.color := clWhite;
canvas.TextRect(r,x,y,s);
end;
Évenements
Pois meet the same events as overlays (OnOverlayXXX), their TOverlayType is ovPoi