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

Mobile

you are here :TECMap > Overlays > Markers

You can definire a list of markers that have the ability to move along a predetermined path ( roads , polylines or polygons ) .

This list type TMobileList is available through the property Mobiles.

TECMap available in more than two properties related to mobiles

property MobilesEnabled:boolean
Property read / write or not to authorize the automatic displacement of mobile, false by default
property MobilesTiming : dword
Property read / write in milliseconds indicating the time interval between each shift automatic, default 300ms (the minimum interval is 100ms)

TMobileList

You have access to methods and properties
function IndexOf(const iMarker:integer):longint;
Returns the index of the mobile according to an index marker
function add(const iMarker,iRoute,iSpeed,iDistance:integer):longint;
Adds a mobile
iMarker is the index of the list marker Markers
iRoute index is the way forward is in Roads (default) or in Polygons or Polylines
iSpeed is the mobile speed in km / h
iDistance is the starting position on the road in meters

// Delphi map component ECMap

map.DistanceMatrix.origins.clear;
map.DistanceMatrix.destinations.clear;
// origins
map.DistanceMatrix.origins.add('Tarbes');
map.origins.add('Lourdes');
// destinations
map.DistanceMatrix.destination.add('Aureilhan');
map.DistanceMatrix.destination.add('Séméac');
// calcul - fire OnDistanceMatrice
Map.DistanceMatrix.Update;
...

// event fired when matrix is ok, call by map.DistanceMatrix.Update
procedure TFormDemoMatrix.mapDistanceMatrix(Sender: TObject);
begin
if map.DistanceMatrix.count=0 then exit;
// Tarbes/Aureilhan
map.DistanceMatrix[0,0].distanceText;
// Tarbes/Séméac
map.DistanceMatrix[0,1].distanceText;
// Lourdes/Aureilan
map.DistanceMatrix[1,0].distanceText;
// Lourdes/Séméac
map.DistanceMatrix[1,1].distanceText;

end;

procedure clear;
Removes all mobiles
procedure delete(const index:integer);
Clears the mobile index Index
function count:longint;
Returns the number of mobile
property Mobiles[index:integer]:TMobile
Table that allows access to mobile is the default property so you can access it directly by map.Mobiles[index] instead of map.Mobiles.Mobile[index]
property Tracking :integer

Property read / write indicating what is the motive that we will follow the card is automatically refocus on him when he crosses the boundaries visible.

Set this property to -1 to not follow any mobile

29
property ToTxt : string
Property read / write which gives access to the list of mobiles in a text format.

By default, the mobile does not move, you can move in either automatic mode or manual mode.

In automatic mode they will move at the speed that you've assigned them in manual mode or you can directly manipulate the distance is to be calculated according to time and speed.

Even in automatic mode you can manually change the distance, speed, you can also change the road on which the mobile moves, its position is automatically adjusted.

30

To do this you must access the class tmobile

TMobile

function Move:integer;
Mobile Moves by calculating its distance from the starting point versus time elapsed since the last move, speed and direction.
property Distance : integer;

Property read / write sets the distance in meters, mobile since its real starting point, management is not taken into account.

Any change of this property leads to a shift of the marker associated with mobile

31
property Direction: TDirectionSens;

Direction of movement, dsStartEnd or dsEndStart

For a road dsStartEnd corresponds to a displacement of the point of departure or arrival point for polylines and polygons of the first point to last.

The distance is always calculated based on the real starting point, management will not be decisive for a shift automatic or manual call to Move.

property Index : integer

Index in the list of mobile phones

property Marker : integer

Property read / write the index of the Marker to move

property Mobile : boolean

Property read / write set if the mobile moves automatically or not, by default set to false the mobile does not move by itself.

property Route : integer;
Property read / write sets the index of the path in its respective list (Routes, Polylines or Polygones depending RouteType)
property RouteType: TOverlayType;
Property read / write defined path type, ovRoute, ovLine or ovPolygone
property Speed : integer
Property read / write that determines the speed km / h
property Step : integer;
Index in the Path property of the road, polyline or polygon that is mobile, the calculation returns an approximation of the point as your route does not contain all the real points.
property Heading : integer;
Angle of mobile degrees relative to North (0 ° to 360 °)
property ToTxt : string ;
Property read / write which gives access to mobile in a text format.

Events

Two events are related to mobile
OnMarkerMove(sender: Tobject;const Index:integer;var dLatitude,dLongitude:double)
Triggered when moving a marker, by code or mouse

Index is the index of the list marker Markers

dLatitude an dLongitude the new position

Vous can change it in the event

9
procedure OnEndMobile(sender: Tobject;const iMobile:integer);

iMobile index in the list of mobile Mobiles

Depending on the direction the mobile is either at the terminus or point of departure

Property Mobile is set to false, to boost your mobile in automatic mode you must return it to true and reverse the direction.

Demonstration

The program shows you DEMOmobile use of mobile
Fig. 38 Marker moving along a road
Fig. 38 Marker moving along a road
go to page
© 2016 ESCOT-SEP Christophe - Made width Help&Web - RSS - Google+