gmap.js
上传用户:shuoshiled
上传日期:2018-01-28
资源大小:10124k
文件大小:2k
源码类别:

中间件编程

开发平台:

JavaScript

  1. /*!  * Ext JS Library 3.0.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.                     region: 'center',
  19.                     zoomLevel: 14,
  20.                     gmapType: 'map',
  21.                     mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
  22.                     mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
  23.                     setCenter: {
  24.                         geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',
  25.                         marker: {title: 'Fenway Park'}
  26.                     },
  27.                     markers: [{
  28.                         lat: 42.339641,
  29.                         lng: -71.094224,
  30.                         marker: {title: 'Boston Museum of Fine Arts'},
  31.                         listeners: {
  32.                             click: function(e){
  33.                                 Ext.Msg.alert('Its fine', 'and its art.');
  34.                             }
  35.                         }
  36.                     },{
  37.                         lat: 42.339419,
  38.                         lng: -71.09077,
  39.                         marker: {title: 'Northeastern University'}
  40.                     }]
  41.                 }
  42.             });
  43.             
  44.         }
  45.         
  46.         mapwin.show();
  47.         
  48.     });
  49.     
  50.  });