I'm trying to add a function to heatmap, but I can only put them and do not pull them. Anybody have any suggestions?
procedure TUniGMap.AddHeatMap(aHeatMap: array of THeatMap); var i: Integer; lat, lng: string; Script: string; begin Script := 'HeatMap = new google.maps.visualization.HeatmapLayer({' + 'radius: ' + StringReplace(Format('%2.2f', [aHeatMap[0].Radius]), ',', '.', [rfReplaceAll]) + ',' + 'data: getPoints(),' + 'map: @googleMap@' + '});' + 'function getPoints() {' + 'return ['; for i := 0 to Length(aHeatMap) -1 do if i <> Length(aHeatMap) -1 then begin lat := StringReplace(Format('%2.6f', [aHeatMap.Latitude]), ',', '.', [rfReplaceAll]); lng := StringReplace(Format('%2.6f', [aHeatMap.Longitude]), ',', '.', [rfReplaceAll]); Script := Script + 'new google.maps.LatLng(' + lat + ', ' + lng + '),' end else begin lat := StringReplace(Format('%2.6f', [aHeatMap.Latitude]), ',', '.', [rfReplaceAll]); lng := StringReplace(Format('%2.6f', [aHeatMap.Longitude]), ',', '.', [rfReplaceAll]); Script := Script + 'new google.maps.LatLng(' + lat + ', ' + lng + ')' + '];' + '}'; end; ExecJScript(Script); end;
procedure TUniGMap.RemoveHeatmap; begin ExecJScript( 'google.maps.event.clearInstanceListeners(HeatMap);' + 'HeatMap.setMap(null);'); end;