<< Click to Display Table of Contents >> Navigation: 3D API 應用範例 > 道路路名 |
<說明>
在本範例中,我們將示範如何疊加道路路名於地表面上,說明如下:
<範例>
var earth_ = 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); CreateHTML5Earth(pBody, function (pEarth) { EarthLoaded(pEarth); });
function EarthLoaded(pEarth) { earth_ = pEarth; 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.MajorGraticule.Visible = false; pEarth.MinorGraticule.Visible = false;
// 指定向量磚服務的 WMTS 網址, 欲加入的圖層名稱, 及 callback function 名稱 VLayer = new SuperGIS.VectorLayer(getDataServicePath() + '3dtest_RoadName/SimpleWMTS.aspx', pEarth, { layer: '路名' }, RoadNameFinish);
pEarth.SetViewpoint(120.656, 24.160, 500, 0, 50, true);
// PS. 路名圖層建立的方式: // 1. 使用 Desktop 的 Mapnote Tool Add-on, 將指定的道路圖層的標記 (Label), 輸出成 Mapnote Layer. // 2. 使用 Toolkit 中的 MapnoteToPolygon 工具, 將 Mapnote Layer 轉成 Polygon 圖層. // 3. 再使用 Cache Generator, 如同一般產向量磚的步驟, 將路名 Polygon 的圖層產製成向量磚. // 4. 可以透過製作不同比例尺層級的 Mapnote Layer, 決定什麼層級顯示什麼路名內容. }
// 在 callback 中設定每個 feature 的符號樣式 function RoadNameFinish(array) { for (var i = 0; i < array.length; i++) { var mark = array[i]; var fc = earth_.CreateColor(0, 0, 0, 1); mark.ReplaceZ = 0.5; // 設定高程 (公尺) mark.DDDSymbol = earth_.CreateSimpleDDDFillSymbol(earth_.CreateModelMaterial(0, fc), null); } } }
|
© 2017 Supergeo Technologies Inc.