<< Click to Display Table of Contents >> Navigation: 3D API 說明範例 > 功能 > 基本控制項 > 索引圖控制項 |
<說明>
在本範例中,我們將示範如何使用索引圖控制項,說明如下:
<範例>
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);
var sHref = location.href; idx = sHref.lastIndexOf("/"); if (idx >= 0) sHref = sHref.substring(0, idx);
var IsCube = true; if (pApp != null) IsCube = pApp.getIsCube(); if (IsCube) { pEarth.Scene.BackgroundColor = pEarth.CreateColor(1, 1, 1, 1); pEarth.SetupSystem(false, null); } else { 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"); if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (pos) { var pGlobe = pEarth.GetGlobe(); var dSMA = pGlobe.GetSemiMajorAxis() var dRadius = pos.coords.accuracy / dSMA; var dAltitude = dSMA * (Math.sin(dRadius) / Math.tan(Math.PI / 8.0) + Math.cos(dRadius) - 1) * 4; var pTour = pEarth.CreateTourAction(); pTour.AddTourPoint(5, pEarth.CreateLatLonAlt(pos.coords.latitude, pos.coords.longitude, dAltitude), 0, 0, 0); pEarth.StartNavigate(pTour, 0); }); } } var pGlobe = pEarth.GetGlobe();
var pTPnl = pEarth.CreateToolbarPanel(0, 0, 0); pEarth.AddPanel(pTPnl);
if (pApp != null) { pTPnl.Visible = pApp.getToolbar(); //pTPnl.SetBackgroundImage(sHost + "/ServerGate/images/Tool_01.png", "", sHost + "/ServerGate/images/Tool_08.png"); //if (pApp.getIndexMap()) // pTPnl.AddTool(pEarth.CreateIndexview(), sHost + "/ServerGate/images/Tool_02.png", sHost + "/ServerGate/images/Tool2_02.png");
pTPnl.SetBackgroundImage(sHref + "/images/Tool_01.png", "", sHref + "/images/Tool_08.png"); if (pApp.getIndexMap()) pTPnl.AddTool(pEarth.CreateIndexview(), sHref + "/images/Tool_02.png", sHref + "/images/Tool2_02.png"); } pEarth.SetCurrentViewExtent(pEarth.GetFullExtent()); pEarth.Invalidate(); } }
|
© 2017 Supergeo Technologies Inc.