Blog

All Blog Posts  |  Next Post  |  Previous Post

Polygon Holes, Marker Clusters and Truck Routing in TMS FNC Maps v3.5 for Delphi

Tuesday, December 6, 2022

TMS Software Delphi  Components  

One more update before the end of the year for our all-in-one mapping solution TMS FNC Maps
Includes the following new features:

  • Polygon Holes
  • Marker Clusters
  • Truck Routing

Polygon Holes (or Complex Polygons)

Cut out holes in polygons with the new complex polygon support.

TMS Software Delphi  Components


To add holes to an existing polygon, simply use the AddHole call with an array of coordinates.

var
  ArrPoly, ArrHole: TTMSFNCMapsCoordinateRecArray;
  Polygon: TTMSFNCGoogleMapsPolygon;
begin
  Setlength(ArrPoly, 3);
  ArrPoly[0].Longitude := -80.19; 
  ArrPoly[0].Latitude := 25.774;
  ArrPoly[1].Longitude := -66.118; 
  ArrPoly[1].Latitude := 18.466;
  ArrPoly[2].Longitude := -64.757; 
  ArrPoly[2].Latitude := 32.321;

  Setlength(arr2, 3);
  ArrHole[0].Longitude := -66.668; 
  ArrHole[0].Latitude := 27.339;
  ArrHole[1].Longitude := -67.514; 
  ArrHole[1].Latitude := 29.57;
  ArrHole[2].Longitude := -70.579; 
  ArrHole[2].Latitude := 28.745;

  Polygon := TMSFNCGoogleMaps1.AddPolygon(ArrPoly);
  Polygon.FillColor := gcBlue;
  Polygon.StrokeWidth := 0;
  Polygon.AddHole(ArrHole);

  TMSFNCGoogleMaps1.ZoomToBounds(ArrPoly);
end;

Polygon holes are supported for the following mapping services:
Google Maps, OpenLayers, Bing, Here, MapKit

TMS Software Delphi  Components TMS Software Delphi  Components TMS Software Delphi  Components TMS Software Delphi  Components TMS Software Delphi  Components



A sample can be found here:

https://github.com/holgerflick/examples/tree/06_maps_polygon_hole

Marker Clusters

Clusters allow grouping of multiple markers into one or more clusters. This was previously only supported for Google Maps, but now support for OpenLayers has been added as well.

TMS Software Delphi  Components

TMS Software Delphi  Components

To display clustered Markers, simply add a Cluster and then assign the Cluster to each Marker that should be included.

var
  mo: TTMSFNCOpenLayersMarker;
  I: Integer;
  locations: array of TTMSFNCMapsCoordinateRec;
begin
   locations := [
   CreateCoordinate(-31.563910, 147.154312),
   CreateCoordinate(-33.718234, 150.363181),
   CreateCoordinate(-33.727111, 150.371124),
   CreateCoordinate(-33.848588, 151.209834),
   CreateCoordinate(-33.851702, 151.216968),
   CreateCoordinate(-34.671264, 150.863657),
   CreateCoordinate(-35.304724, 148.662905),
   CreateCoordinate(-36.817685, 175.699196),
   CreateCoordinate(-36.828611, 175.790222),
   CreateCoordinate(-37.750000, 145.116667),
   CreateCoordinate(-37.759859, 145.128708),
   CreateCoordinate(-37.765015, 145.133858),
   CreateCoordinate(-37.770104, 145.143299),
   CreateCoordinate(-37.773700, 145.145187),
   CreateCoordinate(-37.774785, 145.137978),
   CreateCoordinate(-37.819616, 144.968119),
   CreateCoordinate(-38.330766, 144.695692),
   CreateCoordinate(-39.927193, 175.053218),
   CreateCoordinate(-41.330162, 174.865694),
   CreateCoordinate(-42.734358, 147.439506),
   CreateCoordinate(-42.734358, 147.501315),
   CreateCoordinate(-42.735258, 147.438000),
   CreateCoordinate(-43.999792, 170.463352)];

   TMSFNCOpenLayers1.BeginUpdate;
   TMSFNCOpenLayers1.Clusters.Add;

   for I := 0 to Length(locations) - 1 do
   begin
     mo := TTMSFNCOpenLayersMarker(TMSFNCOpenLayers1.AddMarker(locations[I]));
     mo.Cluster := TMSFNCOpenLayers1.Clusters[0];
   end;

  TMSFNCOpenLayers1.ZoomToBounds(TMSFNCOpenLayers1.Markers.ToCoordinateArray);
  TMSFNCOpenLayers1.EndUpdate;
end;


Marker Clusters are supported for the following mapping services:
Google Maps, OpenLayers

TMS Software Delphi  Components TMS Software Delphi  Components


Truck Routing

A new feature only for Here. Add extra configurable options to your truck routing to get directions specifically aimed at trucks.
You can, for example, add truck dimensions and weight to retrieve a route that is optimized based on the provided values.

Truck routing options are only supported for Here Directions.
TMS Software Delphi  Components
Note: The routing information can be displayed on all supported mapping services.


A sample can be found here:

https://github.com/holgerflick/examples/tree/05_maps_here_truck

Available Now

The TMS FNC Maps update is available now for Delphi & Visual Studio Code (with TMS WEB Core). You can download the latest version and start using the new features right away!



Bart Holvoet




This blog post has not received any comments yet.



Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.



All Blog Posts  |  Next Post  |  Previous Post