0
   launch: function() {
    // The following is accomplished with the Google Map API
    var position = new google.maps.LatLng(12.9833, 77.5833),  //Sencha HQ

        infowindow = new google.maps.InfoWindow({
            content: 'bengaluru'
        }),

        //Tracking Marker Image
        image = new google.maps.MarkerImage(
            'resources/images/point.png',
            new google.maps.Size(32, 31),
            new google.maps.Point(0, 0),
            new google.maps.Point(16, 31)
        ),

        shadow = new google.maps.MarkerImage(
            'resources/images/shadow.png',
            new google.maps.Size(64, 52),
            new google.maps.Point(0, 0),
            new google.maps.Point(-5, 42)
        ),

        trackingButton = Ext.create('Ext.Button', {
            iconMask: true,
            iconCls: 'locate'
        }),

        trafficButton = Ext.create('Ext.Button', {
            iconMask: true,
            pressed: true,
            iconCls: 'maps'
        }),

        toolbar = Ext.create('Ext.Toolbar', {
            docked: 'top',
            ui: 'light',
            defaults: {
                iconMask: true
            },
            items: [
                {
                    xtype:'button',
                    id:'calculate',
                    text:'calculate',
                    handler:function(){
                        alert('hello');
                    }
                }
            ]
        });

    var mapdemo = Ext.create('Ext.Map', {
        mapOptions : {
            center : new google.maps.LatLng(37.381592, 122.135672),  //nearby San Fran
            zoom : 12,
            mapTypeId : google.maps.MapTypeId.ROADMAP,
            navigationControl: true,
            navigationControlOptions: {
                style: google.maps.NavigationControlStyle.DEFAULT
            }
        },

        plugins : [
            new Ext.plugin.google.Tracker({
                trackSuspended: true,   //suspend tracking initially
                allowHighAccuracy: false,
                marker: new google.maps.Marker({
                    position: position,
                    title: 'My Current Location',
                    shadow: shadow,
                    icon: image
                })
            }),
            new Ext.plugin.google.Traffic()
        ],

        listeners: {
            maprender: function(comp, map) {
                var marker = new google.maps.Marker({
                    position: position,
                    title : 'Sencha HQ',
                    map: map
                });

                google.maps.event.addListener(marker, 'click', function() {
                    infowindow.open(map, marker);
                });

                setTimeout(function() {
                    map.panTo(position);
                }, 1000);
            }

        }
    });

任何想法如何测量经纬度已知的两个目的地之间的距离........此代码取自 sencha touch2 提供的示例,几乎没有修改。它的煎茶触摸 2

4

1 回答 1

0

尝试google.maps.geometry.spherical.computeDistanceBetween(from:LatLng, to:LatLng, radius?:number)

radius 是地球的半径 = 6371000 米(平均)

于 2012-07-06T09:15:09.223 回答