OnClusterClick

I am currently trying to convert a project from TWebGMaps to TMSFNCGoogleMaps.


Part of my requirements will be to allow the user to click on a Cluster and receive a list of all the underlying Markers.

We need to do this because much of our Markers are duplicated at the lat/lon level, but each have very specific meaning to the customer. We have to have cluster support, but we also need to be able to get the details of the underlying Markers. 

In TWebGMaps I was able to implement a OnClusterClick event, get the lat/lon of the cluster, and I could take it from there. 

Is there some way I can accomplish the same goal with TMSFNCGoogleMaps? 

Hi,


Thank you for your suggestion.
We are investigating if a similar OnClusterClick event can be added in the next version of TTMSFNCGoogleMaps.

That would be very much appreciated. We'll continue to convert the project in hopes to soon have the means to read into the cluster data. 


Thanks Bart!
You probably already thought about it, but I just wanted to throw this out there just in case.

If you are able to get cluster support, we would need a way to have a different bitmap for each cluster/cluster group. 

Thanks again


Note that cluster support is already available in the current version of TMS FNC Maps for TTMSFNCGoogleMaps.

Please have a look at the PDF manual for further details and samples.

I can also confirm that a new OnClusterClick event has been added along with support to assign custom images per cluster via a new ImagePath property.
This update will be available with the next release of TMS FNC Maps.

Awesome, thank you!

Hello Bart,

Thanks for the update, we've downloaded and are working on it.

We're trying to put together sample project that demonstrates the new cluster support, and specifically the ability to assign custom images.

var
  Marker : TTMSFNCGoogleMapsMarker;
  c : TTMSFNCGoogleMapsCluster;
begin
  c := TMSFNCGoogleMaps1.Clusters.Add;
  c.ImagePath := 'file:///c:/temp/';

  Marker := TTMSFNCGoogleMapsMarker(TMSFNCGoogleMaps1.AddMarker(72, -90, 'test'));
  Marker.DataString := 'test marker';
  Marker.Cluster := c;

  Marker := TTMSFNCGoogleMapsMarker(TMSFNCGoogleMaps1.AddMarker(72.555, -90, 'test'));
  Marker.DataString := 'test marker 2';
  Marker.Cluster := c;

  TMSFNCGoogleMaps1.Clusters[0].ImagePath := 'file:///c:/temp/';

Setting the ImagePath for the clusters isn't working for us under this sample. We can copy/paste the ImagePath into Windows Explorer and it opens correctly into the temp folder.

We've also tried setting it directly to the png ( c.ImagePath := 'file:///c:/temp/1.png';) which doesn't work.

Your sample code is working as expected when tested here.
Can you please make sure the code is executed after OnMapInitialized event has fired?

Example:

procedure TForm1.mMapInitialized(Sender: TObject);
var
  Marker : TTMSFNCGoogleMapsMarker;
  c : TTMSFNCGoogleMapsCluster;
begin
  c := m.Clusters.Add;
  c.ImagePath := 'file:///c:/temp/';

  Marker := TTMSFNCGoogleMapsMarker(m.AddMarker(72, -90, 'test'));
  Marker.DataString := 'test marker';
  Marker.Cluster := c;

  Marker := TTMSFNCGoogleMapsMarker(m.AddMarker(72.555, -90, 'test'));
  Marker.DataString := 'test marker 2';
  Marker.Cluster := c;
end;

Something must be different. Here's some debugging steps I took.

I used the Debug console and inspected the cluster. I found the img tag (see first attachment).

I copied the image tag to index.html (saved in C:\Temp) (See second attachment).

index.html works and loads the image.

Annotation 2020-08-10 075039 index.html (169 Bytes)

Can you please make sure the LocalFileAccess property is set to True?

That did it. Thank you sir.