cms/app-client/app/components/visu-carto.js
changeset 291 478cdcc56a63
parent 290 ca990333f838
child 306 3fccf43160a7
equal deleted inserted replaced
290:ca990333f838 291:478cdcc56a63
    11     countriesMapVar: AmCharts.maps.worldLow,
    11     countriesMapVar: AmCharts.maps.worldLow,
    12     countriesAreas: [],
    12     countriesAreas: [],
    13     franceMapVar: AmCharts.maps.france2016Low,
    13     franceMapVar: AmCharts.maps.france2016Low,
    14     franceAreas: [],
    14     franceAreas: [],
    15 
    15 
    16     locationQueryParam: 'world',
    16     locationQueryParam: '',
       
    17     dataProvider: {},
    17 
    18 
    18     color: 'rgba(113,132,141,.2)',
    19     color: 'rgba(113,132,141,.2)',
    19 
    20 
    20     filter: Ember.inject.service(),
    21     filter: Ember.inject.service(),
    21     locationObserver: Ember.observer('filter.location', function() {
    22     locationObserver: Ember.observer('filter.location', function() {
    29         if(this.get('map')) {
    30         if(this.get('map')) {
    30             if(this.get('map').selectedObject.id) {
    31             if(this.get('map').selectedObject.id) {
    31                 if(this.get('map').selectedObject.parentObject.mapVar === this.get('countriesMapVar')) {
    32                 if(this.get('map').selectedObject.parentObject.mapVar === this.get('countriesMapVar')) {
    32                     if(this.get('map').selectedObject.id === 'FR') {
    33                     if(this.get('map').selectedObject.id === 'FR') {
    33                         this.setFranceAreas();
    34                         this.setFranceAreas();
    34                         this.get('map')['dataProvider'] = {
    35                         this.set('dataProvider', {
    35                             'mapVar': this.get('franceMapVar'),
    36                             'mapVar': this.get('franceMapVar'),
    36                             'getAreasFromMap': true,
    37                             'getAreasFromMap': true,
    37                             'areas': this.get('franceAreas')
    38                             'areas': this.get('franceAreas')
    38                         };
    39                         });
       
    40                         this.get('map')['dataProvider'] = this.get('dataProvider');
    39                         this.get('map').validateData();
    41                         this.get('map').validateData();
    40                     }
    42                     }
    41                 } else if(this.get('map').selectedObject.parentObject.mapVar === this.get('continentsMapVar')) {
    43                 } else if(this.get('map').selectedObject.parentObject.mapVar === this.get('continentsMapVar')) {
    42                     this.setCountriesAreas();
    44                     this.setCountriesAreas();
    43                     this.get('map')['dataProvider'] = {
    45                     this.set('dataProvider', {
    44                         'mapVar': this.get('countriesMapVar'),
    46                         'mapVar': this.get('countriesMapVar'),
    45                         'getAreasFromMap': true,
    47                         'getAreasFromMap': true,
    46                         'areas': this.get('countriesAreas'),
    48                         'areas': this.get('countriesAreas'),
    47                         'zoomLevel': this.get('map').zoomLevel(),
    49                         'zoomLevel': this.get('map').zoomLevel(),
    48                         'zoomLatitude': this.get('map').zoomLatitude(),
    50                         'zoomLatitude': this.get('map').zoomLatitude(),
    49                         'zoomLongitude': this.get('map').zoomLongitude()
    51                         'zoomLongitude': this.get('map').zoomLongitude()
    50                     };
    52                     });
       
    53                     this.get('map')['dataProvider'] = this.get('dataProvider');
    51                     this.get('map').validateData();
    54                     this.get('map').validateData();
    52                 }
    55                 }
    53             } else {
    56             } else {
       
    57                 this.setContinentsAreas();
       
    58                 this.set('dataProvider', {
       
    59                     'mapVar': this.get('continentsMapVar'),
       
    60                     'areas': this.get('continentsAreas')
       
    61                 });
    54                 this.createAmMap();
    62                 this.createAmMap();
    55             }
    63             }
    56         }
    64         }
    57     }),
    65     }),
    58 
    66 
   140         this.createAmMap();
   148         this.createAmMap();
   141     },
   149     },
   142 
   150 
   143     createAmMap: function() {
   151     createAmMap: function() {
   144         var self = this;
   152         var self = this;
       
   153         
   145         this.setContinentsAreas();
   154         this.setContinentsAreas();
       
   155         this.set('dataProvider', {
       
   156             'mapVar': this.get('continentsMapVar'),
       
   157             'areas': this.get('continentsAreas')
       
   158         });
   146         this.set('map', AmCharts.makeChart('mapdiv', {
   159         this.set('map', AmCharts.makeChart('mapdiv', {
   147             'type': 'map',
   160             'type': 'map',
   148             'fontFamily': 'sans-serif',
   161             'fontFamily': 'sans-serif',
   149             'fontSize': '12px',
   162             'fontSize': '12px',
   150             'dragMap': false,
   163             'dragMap': false,
   160                 'rollOverOutlineColor': '#253946'
   173                 'rollOverOutlineColor': '#253946'
   161             },
   174             },
   162             'zoomControl': {
   175             'zoomControl': {
   163                 'zoomControlEnabled': false,
   176                 'zoomControlEnabled': false,
   164             },
   177             },
   165             'dataProvider': {
   178             'dataProvider': this.get('dataProvider'),
   166                 'mapVar': this.get('continentsMapVar'),
       
   167                 'areas': this.get('continentsAreas')
       
   168             },
       
   169             listeners: [{
   179             listeners: [{
   170                 'event':'clickMapObject',
   180                 'event':'clickMapObject',
   171                 'method': Ember.run.bind(this, 'clickMapObject')
   181                 'method': Ember.run.bind(this, 'clickMapObject')
   172             }, {
   182             }, {
   173                 'event':'homeButtonClicked',
   183                 'event':'homeButtonClicked',