<< Click to Display Table of Contents >> Navigation: 3D API 說明範例 > 建立圖台 > 設定地圖參數值 |
<說明>
初始化地圖設定值的選項相當多元,可依開發者意願或者使用者喜好進行設定,讓顯示的地圖更加協調優化。運用下列方法,可進行以下變數設定,括號後為指定物件與範例:
<範例>
var earth_ = null; var app_ = null; function documentLoad() { SuperGIS.Initialize("/ServerGate/", function () { SuperGIS.ServerEarth.Initialize(InitEarth); }); }
function InitEarth() { var pBody = new SuperGIS.Windows.HTMLContainer(document.body);
var sHost = location.href; var idx = sHost.indexOf("/", 8); if (idx >= 0) sHost = sHost.substring(0, idx);
var pSGServer = new SuperGIS.Server.SGServer(sHost + "/ServerGate/SGSGate.ashx", false); pSGServer.GetApp("8fd8b63a-100b-4a96-b77f-f3eded5f30e7", function (pApp) { //pSGServer.GetApp(SGS3DEarth.GUID, function (pApp) { // 透過所建 3D 網站的 GUID 來取得 Application 參數 CreateHTML5Earth(pBody, function (pEarth) { EarthLoaded(pEarth, pApp); }); });
function EarthLoaded(pEarth, pApp) { var sHost = location.href; var idx = sHost.indexOf("/", 8); if (idx >= 0) sHost = sHost.substring(0, idx);
earth_ = pEarth; app_ = pApp; pEarth.Scene.BackgroundColor = pEarth.CreateColor(0, 0, 0, 1); pEarth.SetupSystem(true, s_WGS84); pEarth.SetupSkin(pEarth.CreateEnvelope(-180, 180, -90, 90, s_WGS84), sHost + "/ServerGate/Skin1.jpg");
pEarth.addEventListener("mousemove", mousemoveTest, false); } function mousemoveTest(tEvent) { var pScene = earth_.GetScene(); var pG = pScene.GetGraphics(2);
// 可設定的 Application 參數有: var txt = ""; txt += "Title: 瀏覽器視窗標題\n"; txt += "Name: 設定此站台的名稱\n"; txt += "Copyright: 設定版權聲明文字\n"; txt += "Graticule: 是否要顯示經緯格線\n"; txt += "Toolbar: 是否要顯示工具列\n"; txt += "IsCube: 地圖是否為 Cube 平面模式\n"; txt += "IndexMap: 是否要使用索引圖\n"; txt += "AddGeometries: 是否要使用建立 Geometry 工具\n"; txt += "AddKml: 是否要使用加入 KML 工具\n"; txt += "Query: 是否要使用查詢工具\n"; txt += "Measurements: 是否要使用測量工具\n"; txt += "Share: 是否要使用郵寄地圖工具\n"; txt += "Controler: 是否要使用 Navigation 工具\n"; txt += "TableOfContents: 是否要使用 TOC 工具\n"; txt += "Exaggeration: 設定高程誇張係數\n"; txt += "Resource: 設定預設加入的地圖服務 (可多個)\n";
pG.drawText(txt, 20, 20, "black", "white", "15", "Consolas"); } }
|
© 2017 Supergeo Technologies Inc.