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. 114 Polygones

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

Fill style (bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross)

Style does not work under Firemonkey, use BrushFilename to indicate an image that will fill your polygon, BrushFilename can be either a local path or a url or an encoded as base64 for image, like Marker.Filename

30
property Opacity : byte
Opacity of the polygon (0 = fully transparent, 100 = opaque)
property Level : integer
Height in metres of the polygon for a display in pseudo 3D

Fig. 115 Level = 16 - Level = 0

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
© 2016 ESCOT-SEP Christophe - Made width Help&Web - RSS - Google+