TTMSFNCGoogleMaps Class
Publishes the Google map control API for design-time and runtime use.
API unit family: TMSFNCGoogleMaps
Inherits from: TTMSFNCCustomGoogleMaps
Syntax
TTMSFNCGoogleMaps = class(TTMSFNCCustomGoogleMaps)
class PASCALIMPLEMENTATION TTMSFNCGoogleMaps : public TTMSFNCCustomGoogleMaps
Properties
| Name | Description |
|---|---|
| Circles | Provides circles displayed on the map. (inherited from TTMSFNCCustomGoogleMaps) |
| Clusters | Provides marker clusters displayed on the map. (inherited from TTMSFNCCustomGoogleMaps) |
| Directions | Provides directions displayed on the map. (inherited from TTMSFNCCustomGoogleMaps) |
| HeatMaps | Provides heat maps displayed on the map. (inherited from TTMSFNCCustomGoogleMaps) |
| KMLLayers | Provides KML layers displayed on the map. (inherited from TTMSFNCCustomGoogleMaps) |
| Markers | Returns marker references assigned to the item. (inherited from TTMSFNCCustomGoogleMaps) |
| Options | Configures map behavior and appearance. (inherited from TTMSFNCCustomGoogleMaps) |
| OverlayViews | Provides custom overlay views displayed on the map. (inherited from TTMSFNCCustomGoogleMaps) |
| Polygons | Provides polygons displayed on the map. (inherited from TTMSFNCCustomGoogleMaps) |
| Polylines | Provides polylines displayed on the map. (inherited from TTMSFNCCustomGoogleMaps) |
| Rectangles | Provides rectangles displayed on the map. (inherited from TTMSFNCCustomGoogleMaps) |
Methods
| Name | Description |
|---|---|
| AddBridge | Adds a bridge object for browser communication. |
| AddCircle | Adds a circle overlay to the map. (inherited from TTMSFNCCustomGoogleMaps) |
| AddDirections | Adds an address-based directions request to the map. (inherited from TTMSFNCCustomGoogleMaps) |
| AddHeatMap | Adds a heat map overlay to the map. (inherited from TTMSFNCCustomGoogleMaps) |
| AddKMLLayer | Adds a KML layer to the map. (inherited from TTMSFNCCustomGoogleMaps) |
| AddMarker | Adds a marker at the specified coordinate. (inherited from TTMSFNCCustomGoogleMaps) |
| AddOverlayView | Adds an overlay view for the marker. (inherited from TTMSFNCCustomGoogleMaps) |
| AddPolygon | Adds a polygon to the map. (inherited from TTMSFNCCustomGoogleMaps) |
| AddPolyline | Adds a polyline to the map. (inherited from TTMSFNCCustomGoogleMaps) |
| AddRectangle | Adds a rectangle overlay to the map. (inherited from TTMSFNCCustomGoogleMaps) |
| CanGoBack | Returns whether browser history can navigate back. |
| CanGoForward | Returns whether browser history can navigate forward. |
| CaptureScreenShot | Captures a screenshot of the browser surface. |
| Clear | Removes all items from the collection or map layer. (inherited from TTMSFNCCustomGoogleMaps) |
| ClearCache | Clears the browser cache. |
| ClearClusters | Removes all marker clusters. (inherited from TTMSFNCCustomGoogleMaps) |
| ClearDirections | Removes all directions items. (inherited from TTMSFNCCustomGoogleMaps) |
| ClearHeatMaps | Removes all heat map overlays. (inherited from TTMSFNCCustomGoogleMaps) |
| ClearKMLLayers | Removes all KML layers. (inherited from TTMSFNCCustomGoogleMaps) |
| ClearOverlayViews | Removes all overlay views. (inherited from TTMSFNCCustomGoogleMaps) |
| DeInitialize | Releases the browser and map surface. |
| EndUpdate | Finishes an update batch and refreshes dependent map content. (inherited from TTMSFNCCustomGoogleMaps) |
| ExecuteJavaScript | Executes JavaScript in the browser surface. |
| ExecuteJavaScriptSync | Executes JavaScript synchronously and returns its result. |
| GetAddOrUpdateOverlayViewFunction | Returns the add or update overlay view function. (inherited from TTMSFNCCustomGoogleMaps) |
| GetBridgeCommunicationLayer | Returns JavaScript used for bridge communication. |
| GetDeleteOverlayViewFunction | Returns the delete overlay view function. (inherited from TTMSFNCCustomGoogleMaps) |
| GetWebBrowserInstance | Returns the underlying web browser instance. |
| GoBack | Navigates back in browser history. |
| GoForward | Navigates forward in browser history. |
| Initialize | Initializes the browser and map surface. |
| IsFMXBrowser | Returns whether the active browser is the framework browser. |
| LoadFile | Loads a local file into the browser surface. |
| LoadHTML | Loads HTML content into the browser surface. |
| NativeBrowser | Returns the native browser pointer. |
| NativeDialog | Returns the native dialog pointer. |
| NativeEnvironment | Returns the native browser environment pointer. |
| Navigate | Navigates to the configured map URL. |
| Reload | Reloads the browser surface. |
| RemoveBridge | Removes a browser communication bridge. |
| ShowDebugConsole | Shows the browser debug console. |
| StopLoading | Stops the current browser load operation. |
Events
| Name | Description |
|---|---|
| OnClusterClick | Occurs when cluster click. (inherited from TTMSFNCCustomGoogleMaps) |
| OnClusterMouseEnter | Occurs when cluster mouse enter. (inherited from TTMSFNCCustomGoogleMaps) |
| OnClusterMouseLeave | Occurs when cluster mouse leave. (inherited from TTMSFNCCustomGoogleMaps) |
| OnKMLLayerClick | Occurs when kml layer click. (inherited from TTMSFNCCustomGoogleMaps) |
| OnMarkerDragEnd | Occurs when marker drag end. (inherited from TTMSFNCCustomGoogleMaps) |
| OnOverlayViewClick | Occurs when overlay view click. (inherited from TTMSFNCCustomGoogleMaps) |
| OnPolyElementDragEnd | Occurs when poly element drag end. (inherited from TTMSFNCCustomGoogleMaps) |
| OnPolyElementEditEnd | Occurs when poly element edit end. (inherited from TTMSFNCCustomGoogleMaps) |
| OnRetrievedDirectionsData | Occurs when retrieved directions data. (inherited from TTMSFNCCustomGoogleMaps) |
| OnStreetViewChange | Occurs when street view change. (inherited from TTMSFNCCustomGoogleMaps) |
| OnStreetViewEnabledChange | Occurs when street view enabled change. (inherited from TTMSFNCCustomGoogleMaps) |
Usage examples
Combine Google Maps labels, KML, clusters, heat maps, and events
Builds a Google Maps scene with multiple documented feature areas.
procedure TForm1.BuildGoogleMapsOperationsScene;
var
LCluster: TTMSFNCGoogleMapsCluster;
LMarker: TTMSFNCGoogleMapsMarker;
LHeatMap: TTMSFNCGoogleMapsHeatMap;
LWeightedCoordinate: TTMSFNCMapsWeightedCoordinate;
begin
TMSFNCGoogleMaps1.BeginUpdate;
try
TMSFNCGoogleMaps1.APIKey := '<your Google Maps JavaScript API key>';
TMSFNCGoogleMaps1.Options.ShowKeyboardShortcuts := False;
TMSFNCGoogleMaps1.Options.StreetView.Location := slCoordinate;
TMSFNCGoogleMaps1.Options.StreetView.Coordinate.Latitude := 52.52;
TMSFNCGoogleMaps1.Options.StreetView.Coordinate.Longitude := 13.405;
TMSFNCGoogleMaps1.AddKMLLayer(
'https://developers.google.com/maps/documentation/javascript/examples/kml/westcampus.kml',
True,
True);
LCluster := TMSFNCGoogleMaps1.Clusters.Add;
LCluster.Title := 'Operations markers';
LCluster.MinimumNumberOfMarkers := 2;
LCluster.ZoomOnClick := True;
LMarker := TMSFNCGoogleMaps1.Markers.Add;
LMarker.Coordinate.Latitude := 52.52;
LMarker.Coordinate.Longitude := 13.405;
LMarker.Title := 'Berlin depot';
LMarker.Cluster := LCluster;
LCluster.Markers.Add(LMarker);
TMSFNCGoogleMaps1.AddLabel(52.52, 13.405, 'Berlin depot', gcWhite, gcDarkgreen);
LHeatMap := TMSFNCGoogleMaps1.HeatMaps.Add;
LHeatMap.Opacity := 0.45;
LWeightedCoordinate := LHeatMap.WeightedCoordinates.Add;
LWeightedCoordinate.Coordinate.Latitude := 52.52;
LWeightedCoordinate.Coordinate.Longitude := 13.405;
LWeightedCoordinate.Weight := 0.8;
TMSFNCGoogleMaps1.OnKMLLayerClick := TMSFNCGoogleMaps1KMLLayerClick;
TMSFNCGoogleMaps1.OnStreetViewEnabledChange :=
TMSFNCGoogleMaps1StreetViewEnabledChange;
finally
TMSFNCGoogleMaps1.EndUpdate;
end;
end;
Add Google Maps labels and control keyboard shortcuts
Uses the accessible Labels collection and Options.ShowKeyboardShortcuts property.
procedure TForm1.ConfigureGoogleMapsLabels;
var
LLabel: TTMSFNCMapsLabel;
begin
TMSFNCGoogleMaps1.Options.ShowKeyboardShortcuts := False;
TMSFNCGoogleMaps1.Labels.Clear;
LLabel := TMSFNCGoogleMaps1.Labels.Add;
LLabel.Coordinate.Latitude := 51.5074;
LLabel.Coordinate.Longitude := -0.1278;
LLabel.Text := 'Operations hub';
LLabel.BackgroundColor := gcWhite;
LLabel.BorderColor := gcDodgerblue;
end;