Map
TsgcHTMLComponent_Map — Delphi、C++ Builder、.NET で、OpenStreetMap または CartoDB のタイルと、独自のマーカー、ポップアップ、ツールチップを備えた、インタラクティブな Leaflet.js マップをレンダリングします。
TsgcHTMLComponent_Map — Delphi、C++ Builder、.NET で、OpenStreetMap または CartoDB のタイルと、独自のマーカー、ポップアップ、ツールチップを備えた、インタラクティブな Leaflet.js マップをレンダリングします。
Leaflet.js マップのコンテナと、それを初期化するスクリプトを出力するマッピングコンポーネントです。中心、ズーム、タイルプロバイダーを設定し、マーカーを追加してから、HTML プロパティを読み取ります。
TsgcHTMLComponent_Map
Leaflet.js マップ + タイルレイヤー
Delphi, C++ Builder, .NET
CenterLatitude、CenterLongitude、Zoom を設定し、TileProvider を選択し、各地点について AddMarker を呼び出してから、HTML を読み取ります。
uses
sgcHTML_Enums, sgcHTML_Component_Map;
var
oMap: TsgcHTMLComponent_Map;
begin
oMap := TsgcHTMLComponent_Map.Create(nil);
try
oMap.CenterLatitude := 40.4168;
oMap.CenterLongitude := -3.7038;
oMap.Zoom := 12;
oMap.Height := '420px';
oMap.TileProvider := mtCartoDB;
oMap.AddMarker(40.4168, -3.7038, 'Madrid', 'Head office');
oMap.AddMarker(41.3851, 2.1734, 'Barcelona');
WebModule.Response := oMap.HTML; // Leaflet map + markers
finally
oMap.Free;
end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Map.hpp
TsgcHTMLComponent_Map *oMap = new TsgcHTMLComponent_Map(NULL);
try
{
oMap->CenterLatitude = 40.4168;
oMap->CenterLongitude = -3.7038;
oMap->Zoom = 12;
oMap->Height = "420px";
oMap->TileProvider = mtCartoDB;
oMap->AddMarker(40.4168, -3.7038, "Madrid", "Head office");
oMap->AddMarker(41.3851, 2.1734, "Barcelona");
String html = oMap->HTML; // Leaflet map + markers
}
__finally
{
delete oMap;
}
using esegece.sgcWebSockets;
var map = new TsgcHTMLComponent_Map();
map.CenterLatitude = 40.4168;
map.CenterLongitude = -3.7038;
map.Zoom = 12;
map.Height = "420px";
map.TileProvider = TsgcHTMLMapTileProvider.mtCartoDB;
map.AddMarker(40.4168, -3.7038, "Madrid", "Head office");
map.AddMarker(41.3851, 2.1734, "Barcelona");
string html = map.HTML; // Leaflet map + markers
最もよく使うメンバーです。
CenterLatitude と CenterLongitude(Double)は初期表示を設定します。Zoom(既定値 13)はズームレベルを設定します。
TileProvider(TsgcHTMLMapTileProvider)は、mtOpenStreetMap、mtCartoDB(ライト)、または mtCartoDBDark を選択します。
Markers(TsgcHTMLMapMarkers)はピンを保持します。各 TsgcHTMLMapMarker は Latitude、Longitude、PopupText、TooltipText、Color を持ちます。
AddMarker(aLat, aLng, aPopup, aTooltip) はピンを置きます。ポップアップはクリックで開き、ツールチップはホバー時に表示されます。
Height('420px' などの CSS 長さ)はマップの高さを制御します。MapID はコンテナの要素 id を設定します。
HTML は、Leaflet のスタイルシートリンク、マップの <div>、初期化スクリプトを返します — そのまま配信するか、ページテンプレートの BodyContent に割り当てます。