1. #1
    Sencha User
    Join Date
    Jul 2013
    Posts
    4
    Vote Rating
    0
    ssdog is on a distinguished road

      0  

    Default Use routes in GMapPanel

    Use routes in GMapPanel


    Hello,

    Can anyone help me put a route in a map?
    I can't figure out how to do this.

    Thanks

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,032
    Vote Rating
    185
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    Most of the map interaction itself will be through the Google Maps API iteself. The GMapPanel has a 'map' property which will give you access to the Google Map. From there it'll be a Google API distinction rather than the ExtJS API.

    https://developers.google.com/maps/
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

  3. #3
    Sencha User
    Join Date
    Jul 2013
    Posts
    4
    Vote Rating
    0
    ssdog is on a distinguished road

      0  

    Default


    Thanks!

    I don't know if it will give the expected results, but I use ExtJS to build the layout and to use it's stores and pure javascript to display the map. I noticed that if two tabs have to render each a map generated with pure javascript, the second one will not work as expected - the map will be truncated and rendered badly

  4. #4
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,032
    Vote Rating
    185
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    Can you post the code that causes the issue you're seeing?
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

  5. #5
    Sencha User
    Join Date
    Jul 2013
    Posts
    4
    Vote Rating
    0
    ssdog is on a distinguished road

      0  

    Default


    Thanks for your help.
    I am using the complex layout, here is the center panel, with two tabs:


    Code:
    Ext.create('Ext.tab.Panel', {                
                     region:               'center', 
                     deferredRender: false,    
                     activeTab:          0,    
                     items:                 [{
                          title:            'Center Panel',    
                          autoShow:  true,
                          layout:        'fit',                    
                          id:              "map1"
                     },{
                       title: 'Close Me',                           
                       closable: true,                    
                       autoShow: true,                    
                       layout: 'fit',
                      id:'map2'                
                   }]            
    })

    And this is the pure javascript code:
    Code:
    window.onload=function() {  
    var str                    = '<?php echo json_encode(getUsersCurrent()); ?>';  
    var mapOptions     = {    
        zoom:               5,    
        mapTypeId:     google.maps.MapTypeId.ROADMAP,    
        center:             new google.maps.LatLng(eval(str)[0].lat, eval(str)[0].lng)  
      }  
        map                   = new google.maps.Map(document.getElementById('map1'), mapOptions);  
        map2                 = new google.maps.Map(document.getElementById('map2'), mapOptions);
        for(var i=0;i<eval(str).length;i++){      
            var b                = eval(str)[i];      
            var div             = document.createElement('DIV');      
           div.innerHTML = '<div class="my-other-marker"><div class="good canv"><p>'+b.iduser+'</p></div><div class="stick"></div></div>';
           marker2            = new RichMarker({        
               map:            map,        
               position:       new google.maps.LatLng(b.lat,b.lng),         
               draggable:    false,        
               flat:              true,        
               anchor:        RichMarkerPosition.BOTTOM,        
               content:       div        
        });  
    }
    }

    When I open the second tab, the map isn't displayed right.

  6. #6
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,032
    Vote Rating
    185
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      1  

    Default


    You might look at the source on the GMapPanel. I believe what it does is after the component (and its body) is rendered it creates the map then and adds it to the panel body. That way it knows that the map's target element exists when instantiated. I'd go that route instead of having it in your onLoad function.
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

  7. #7
    Sencha User
    Join Date
    Jul 2013
    Posts
    4
    Vote Rating
    0
    ssdog is on a distinguished road

      0  

    Default


    I'll go that way.
    Thank you!