<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);
|