Changeset 113 for oceandb/jQuery_Prototype/script
- Timestamp:
- Nov 27, 2009, 5:23:15 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
oceandb/jQuery_Prototype/script/oceandb.js
r94 r113 2 2 var ge; // Google Earth Plugin 物件 3 3 var icon; 4 var tm; // Google Map2 Timeline 4 5 5 6 // 註冊 onReady Event … … 8 9 9 10 // 呼叫 Google Map API 載入地圖 10 load(); 11 onLoad(); 12 GUnload(); 11 13 12 14 var PARENT_ID = []; // 產生一個空的陣列 … … 102 104 // 設定地圖高度 103 105 var map_height=document.documentElement.clientHeight - 68; 106 $('#mapcontainer').css( { height: map_height } ); 104 107 $('#main').css( { height: map_height } ); 105 108 … … 123 126 // 當改變瀏覽器大小時,重新設定地圖高度 124 127 var map_height=document.documentElement.clientHeight - 68; 128 $('#mapcontainer').css( { height: map_height } ); 125 129 $('#main').css( { height: map_height } ); 126 }); 127 128 function load() 129 { 130 if (GBrowserIsCompatible()) { 131 // 取得 DOM 中,名稱為 map 的元件 132 map = new GMap2(document.getElementById("map")); 133 // 加入左上角比例尺規控制列 134 map.addControl(new GLargeMapControl()); 135 // 加入左下角比例尺狀態列 136 map.addControl(new GScaleControl()); 137 // 加入右上角"地圖","衛星","混合地圖"按鈕 138 map.addControl(new GMapTypeControl()); 139 // 加入右上角 Google Earth 的"地球"按鈕 140 map.addMapType(G_SATELLITE_3D_MAP); 141 // 設定預設經緯度北緯 23.8, 東經 121, 預設比例尺 100 公里(7) 142 map.setCenter(new GLatLng(23.8,121), 7); 143 // 設定預設底圖為"衛星" 144 map.setMapType(G_SATELLITE_MAP); 145 // 產生預設 icon 圖示 146 icon = new GIcon(); 147 icon.image = "image/icon.png"; 148 icon.shadow = "image/icon.png"; 149 icon.iconSize = new GSize(12, 12); 150 icon.shadowSize = new GSize(12, 12); 151 icon.iconAnchor = new GPoint(12, 12); 152 icon.infoWindowAnchor = new GPoint(12, 12); 153 } 130 }); 131 132 function onLoad() { 133 134 tm = TimeMap.init({ 135 mapId: "map", // Id of map div element (required) 136 timelineId: "timeline", // Id of timeline div element (required) 137 datasets: [ 138 { 139 id: "artists", 140 title: "Artists", 141 theme: TimeMapDataset.orangeTheme({eventIconPath: "./image"}), 142 // note that the lines below are now the preferred syntax 143 type: "basic", 144 options: { 145 items: [ 146 { 147 "start" : "1981", 148 "end" : "2009-01-11", 149 "point" : { 150 "lat" : 23.8123, 151 "lon" : 121.123 152 }, 153 "title" : "中央氣象局", 154 "options" : { 155 // set the full HTML for the info window 156 "infoHtml": "<div class='custominfostyle'><b>中央氣象局.</div>" 157 } 158 }, 159 { 160 "start" : "1991", 161 "end" : "2010", 162 "point" : { 163 "lat" : 22.5234, 164 "lon" : 120.534 165 }, 166 "title" : "海洋科技研究中心", 167 "options" : { 168 // load HTML from another file via AJAX 169 // Note that this may break in IE if you're running it with 170 // a local file, due to cross-site scripting restrictions 171 "infoUrl": "http://www.nchc.org.tw", 172 "theme": TimeMapDataset.redTheme({eventIconPath: "./image"}) 173 } 174 }, 175 { 176 "start" : "2001", 177 "end" : "2020", 178 "point" : { 179 "lat" : 24.8345, 180 "lon" : 122.845 181 }, 182 "title" : "經濟部水利署", 183 "options" : { 184 // use the default title/description info window 185 "description": "Renaissance Man", 186 "theme": TimeMapDataset.yellowTheme({eventIconPath: "image/"}) 187 } 188 } 189 ] 190 } 191 } 192 ], 193 bandIntervals: [ 194 Timeline.DateTime.DECADE, 195 Timeline.DateTime.CENTURY 196 ] 197 }); 198 // manipulate the timemap further here if you like 199 200 if (GBrowserIsCompatible()) { 201 202 // 宣告 TimelineMap 的 MapID 對應到原本的 map 203 map = tm.map; 204 // 取得 DOM 中,名稱為 map 的元件 205 map = new GMap2(document.getElementById("map")); 206 // 加入左上角比例尺規控制列 207 map.addControl(new GLargeMapControl3D()); 208 // 鳥瞰圖 209 map.addControl(new GOverviewMapControl()); 210 // Mouse Zoom In/Out 211 map.enableScrollWheelZoom(); 212 // 加入左下角比例尺狀態列 213 map.addControl(new GScaleControl()); 214 // 加入右上角"地圖","衛星","混合地圖"按鈕 215 map.addControl(new GMapTypeControl()); 216 // Google Earth 217 map.addMapType(G_SATELLITE_3D_MAP); 218 // GZoom Control 219 map.addControl(new GZoomControl( 220 { 221 sButtonHTML:"<img src='image/zooming.gif' />", 222 sButtonZoomingHTML:"<img src='image/zoom.jpg' />", 223 oButtonStartingStyle:{width:'24px',height:'24px'}, 224 sColor:'#000', 225 nOpacity:.2, 226 sBorder:"2px solid red", 227 nOverlayRemoveMS:'10000', 228 bForceCheckResize:'true' 229 } 230 ),new GControlPosition(G_ANCHOR_BOTTOM_LEFT,new GSize(3,3))); 231 // 設定預設經緯度北緯 23.8, 東經 121, 預設比例尺 100 公里(7) 232 map.setCenter(new GLatLng(23.8,121), 7); 233 // 設定預設底圖為"衛星" 234 map.setMapType(G_SATELLITE_MAP); 235 // 產生預設 icon 圖示 236 icon = new GIcon(); 237 icon.image = "image/icon.png"; 238 icon.shadow = "image/icon.png"; 239 icon.iconSize = new GSize(12, 12); 240 icon.shadowSize = new GSize(12, 12); 241 icon.iconAnchor = new GPoint(12, 12); 242 icon.infoWindowAnchor = new GPoint(12, 12); 243 } 154 244 } 245
Note: See TracChangeset
for help on using the changeset viewer.