Now, it is time to implement the functionality to display pictures we created with our application. It would be nice to display markers on the map for the locations where we created the picture. Let's create a new controller called Places
:
$ sencha generate controller Places
This command creates the app/controllers/Places.js
file for us. Let's modify it a little bit to look like this:
Ext.define('Travelly.controller.Places', { extend: 'Ext.app.Controller', config: { refs: { mapPlaces: '#mapPlaces' }, control: { mapPlaces: { maprender: 'mapPlacesMapRenderer' } } }, mapPlacesMapRenderer: function(comp, map) { var pictures = this.getPictures(); var map = this.getMapPlaces().getMap(); for (var i = 0; i < pictures.length; i++) { this.addMarker(pictures[i], map); } }, ... });
It is a standard Sencha Touch controller...