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

TECShapePolygone

you are here :TECNativeMap > Shapes

Summary

TECShapePolygone descends from TECShapeLine and allows to display on your map polygons.

Fig. 1 Polygone in edition mode

In addition to the properties of TECShapeLine you have access to

Property Area : double

Surface Km²

property FillColor : TColor

Fill color

Property Color : TColor

The border color

property Style : TBrushStyle


property Opacity : byte
Opacity of the polygon (0 = fully transparent, 100 = opaque)

OnAfterDraw

You also have an OnAfterDraw event that allows you to draw on top your polygon, example to include its description.

FPoly : TECShapePolygone;

FPoly := TECShapePolygone(map.add(nsPolygon,Lat,Lng)) ;
FPoly.OnAfterDraw := doAfterDraw;
FPoly.Description := 'Polygone '+inttostr(map.Shapes.Polygones.Count);

procedure TFormNativeLinePolygone.doAfterDraw(const canvas:TECCanvas;var Rect:TRect;item:TECshape) ;
var x,y,w,h:integer;
begin
//transparancy text
canvas.brush.Style := bsClear;

canvas.font.color := clBlack;
canvas.font.Style := [fsBold];

w := canvas.TextWidth(item.Description) ;
h := canvas.TextHeight(item.Description);

x := rect.Left+((rect.Right-rect.Left-w) div 2);
y := rect.top+((rect.bottom-rect.top-h) div 2);

canvas.TextOut(x,y,item.Description);

end;


go to page
Réalisé avec la version gratuite pour les particuliers d'Help&Web