<< Click to Display Table of Contents >>

supergis server javascript api

 

new IndexView (pTrans,pLayer)

 

 

Description

索引圖工具函式物件。

 

Position

Navigate.js

 

 

Parameters

 

Parameter

Description

pTrans

設定使用ScaleTransformation或CachedLevelTransformation物件。

pLayer

目標索引圖圖層。

 

 

Properties

 

Property

Description

none

none

 

 

Functions

 

Function

Description

MapCommand(tEvent, pMapBase, hObj)

執行索引圖工具,於工具被按下時呼叫。

 

 

Example

 

 

<script type="text/javascript" src="scripts/MapLayer.js"></script>

<script type="text/javascript" src="scripts/Navigate.js"></script>

 

//Get layer extent

var pLyr = new MapLayer("Layer name", "Agent.aspx");

var pExt = new MapEnvelope(pLyr.getLeft(), pLyr.getTop(), pLyr.getRight(), pLyr.getBottom());

 

//Scale map to fit client's monitor size

var sx = mapNode.clientWidth / (pExt.Right - pExt.Left);

var sy = mapNode.clientHeight / (pExt.Bottom - pExt.Top);

var s = (Math.abs(sx) < Math.abs(sy) ? Math.abs(sx) : Math.abs(sy));

var pTrans = new LevelTransformation(1, 0, 10);

pTrans.putBaseScaleX(sx > 0 ? s : -s);

pTrans.putBaseScaleY(sy > 0 ? s : -s);

 

//Create map

var pMapBase = new MapBase(pOMap, pTrans, 0, 0, "100%", "100%");

 

//Create IndexmapImg button

var IndexmapImg = document.createElement("img");

IndexmapImg.id = "index_map";

IndexmapImg.src = "images/PC_OtherTool/Index-map.png";

 

//Create Indexview tool

var Indexmaptool = new IndexView(pTrans, new MapLayer("SuperGIS Server", "Agent.aspx"));

//Open Indexview (first time call is open)

Indexmaptool.MapCommand("click",pMapBase, IndexmapImg);

//Close Indexview (second time call is close)

Indexmaptool.MapCommand("click",pMapBase, IndexmapImg);

 

 

See live example


©2015 Supergeo Technologies Inc.