gmap.js
上传用户:dawnssy
上传日期:2022-08-06
资源大小:9345k
文件大小:2k
源码类别:

JavaScript

开发平台:

JavaScript

  1. /*!  * Ext JS Library 3.1.0  * Copyright(c) 2006-2009 Ext JS, LLC  * licensing@extjs.com  * http://www.extjs.com/license  */
  2. Ext.onReady(function(){
  3.     var mapwin;
  4.     var button = Ext.get('show-btn');
  5.     button.on('click', function(){
  6.         // create the window on the first click and reuse on subsequent clicks
  7.         if(!mapwin){
  8.             mapwin = new Ext.Window({
  9.                 layout: 'fit',
  10.                 title: 'GMap Window',
  11.                 closeAction: 'hide',
  12.                 width:400,
  13.                 height:400,
  14.                 x: 40,
  15.                 y: 60,
  16.                 items: {
  17.                     xtype: 'gmappanel',
  18.                     zoomLevel: 14,
  19.                     gmapType: 'map',
  20.                     mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
  21.                     mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
  22.                     setCenter: {
  23.                         geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',
  24.                         marker: {title: 'Fenway Park'}
  25.                     },
  26.                     markers: [{
  27.                         lat: 42.339641,
  28.                         lng: -71.094224,
  29.                         marker: {title: 'Boston Museum of Fine Arts'},
  30.                         listeners: {
  31.                             click: function(e){
  32.                                 Ext.Msg.alert('Its fine', 'and its art.');
  33.                             }
  34.                         }
  35.                     },{
  36.                         lat: 42.339419,
  37.                         lng: -71.09077,
  38.                         marker: {title: 'Northeastern University'}
  39.                     }]
  40.                 }
  41.             });
  42.             
  43.         }
  44.         
  45.         mapwin.show();
  46.         
  47.     });
  48.     
  49.  });