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

Labels

you are here :TECMap > Overlays

Summary

Not available CloudMade

14

Labels are containers Html movable with the mouse, they are manipulated through the Labels list.

// Delphi map component ECMap
// add label at center of map
id := map.Labels.add;
map.labels [id].setPosition(map.latitude, map.longitude)
// set draggable
map.Labels[id].draggable := true;

They have properties and methods
procedure setPosition(dlatitude,dLongitude:double);
Moves the label in Latitude, Longitude, triggers the event OnOverlayMove
property Content : string
Properties for reading / writing describing the contents of the HTML label
property Css : string;
Properties read / write CSS styles applied to the label
property Draggable : boolean
Property read / written, set the label is moved to the mouse.

Even if a label is not moved with the mouse you can change its position through setPosition code or properties Latitude and Longitude

34
property Id : integer
Index number of the label in its list
Property read / written, defining the scope of the label, the event triggers OnOverlayMove
property Longitude : double;
Property read / written, defining the longitude of the label, the event triggers OnOverlayMove
property Visible : boolean;
Property read / written to display or not the label
property Zindex : integer;
Property read / written, a priority key attribute for displaying the label, a label with a zIndex higher will be displayed on top of that having a lower zIndex
property ToTxt : string;
Property read / write access to the label which gives the form of a text string

// Delphi map component ECMap
// add label at center of map
id := map.Labels.add;
map.labels[id].setPosition(map.latitude, map.longitude)

// set draggable
map.Labels[id].draggable := true;
// set content html
map.Labels[id].Content := 'my <b>label</b> html';
// set css style
map.Labels[id].Css := 'background: red;border: 2px solid #fff;padding: 3px;';

Events

Labels respond to events:
OnOverlayClick(sender: Tobject;const Index:integer;const dLatitude,dLongitude:double;const OverlayType:TOverlayType)
simple click on a label

index is the index of the label in its list

dLatitude,dLongitude geographical coordinates of the click

OverlayType the type of overlay (ovCircle, ovRectangle, ovLine, ovPolygone,ovLabel ou ovGroundOverlay), So ovLabel for a label
OnOverlayMove(sender: Tobject;const Index:integer;const dLatitude,dLongitude:double;const OverlayType:TOverlayType)
Triggered when moving a label, with code or mouse
OnLink(sender: TObject;const Url:string)
If your label contains a link you catch the click event in this event

Url contains the target link
go to page
© 2016 ESCOT-SEP Christophe - Made width Help&Web - RSS - Google+