標記點一般事件
標記點一般事件
標記點一般事件可以在標記點受到各種設定的改變時,觸發一系列的動作。加入監聽事件方法如下,詳細可參照範例:
function InitWnd() {
var pOMap = document.getElementById("TGMap");
pMap = new TGOS.TGOnlineMap(pOMap, TGOS.TGCoordSys.EPSG3826);
//宣告TGOnlineMap地圖物件並設定坐標系統
markerPoint = new TGOS.TGPoint(302430.958,2770552.360);
markerImg = newTGOS.TGImage("http://api.tgos.tw/TGOS_API/images/marker.png",
new TGOS.TGSize(38, 33), new TGOS.TGPoint(0,0), new TGOS.TGPoint(10, 33));
pTGMarker = new TGOS.TGMarker(pMap, markerPoint, "內政部", markerImg);
//加入監聽事件方法
TGOS.TGEvent.addListener(pTGMarker,"clickable_changed",
function () { alert("改變點擊狀態"); });
TGOS.TGEvent.addListener(pTGMarker,"visible_changed",
function () { alert("改變顯示狀態"); });
TGOS.TGEvent.addListener(pTGMarker,"title_changed",
function () { alert("改變標題名稱"); });
TGOS.TGEvent.addListener(pTGMarker,"position_changed",
function () { alert("改變位置"); });
TGOS.TGEvent.addListener(pTGMarker,"icon_changed",
function () { alert("改變標記圖示"); });
TGOS.TGEvent.addListener(pTGMarker,"zindex_changed",
function () { alert("改變堆疊順序"); });
TGOS.TGEvent.addListener(pTGMarker,"cursor_changed",
function () { alert("改變標記游標圖形"); });
TGOS.TGEvent.addListener(pTGMarker,"draggable_changed",
function () { alert("改變拖曳狀態"); });
TGOS.TGEvent.addListener(pTGMarker,"shadow_changed",
function () { alert("改變陰影顯示狀態"); });
TGOS.TGEvent.addListener(pTGMarker,"flat_changed",
function () { alert("改變陰影顯示圖示"); });
}