Retour à la documentation
/**
* @class spw.widgets.SpwStatisticWidget
*/
define(["dojo/_base/declare","spw/api/SpwBaseTemplatedWidget", "dojo/text!./templates/SpwStatisticWidget.html", "spw/api/MapServiceFactory"],
function(declare, SpwBaseTemplatedWidget, template, MapServiceFactory){
return declare("spw.widgets.SpwStatisticWidget", [SpwBaseTemplatedWidget], /** @lends spw.widgets.SpwStatisticWidget.prototype */{
templateString: template,
sourceUrl: null,
repartitionUrl: null,
minColor: null,
maxColor: null,
loader: null,
_mapService: null,
/**
* @constructs
* @param config
*/
constructor: function (config) {
},
postMixInProperties: function (config) {
this.inherited(arguments);
},
buildRendering: function (config) {
this.inherited(arguments);
},
postCreate: function() {
this.inherited(arguments);
},
startup: function() {
this.inherited(arguments);
},
onActivate: function(){
this.inherited(arguments);
},
onDeactivate: function(){
this.inherited(arguments);
},
destroy: function() {
this.inherited(arguments);
},
applyStatistics: function(){
var config = {
"serviceId":"STAT_TEST_123456",
"label": "Stat with file",
"type": "STAT_LAYER",
"dataLayerUrl": this.sourceUrl.value,
"repartitionUrl": this.repartitionUrl.value,
"renderer":{
"title":"Répartition des Etab. aînés par commune",
"color1":this.minColor.value,
"color2":this.maxColor.value
},
"visible": true,
"toLoad": true,
spwMap: this.spwViewer.get('spwMap')
};
if(this._mapService){
this.removeService();
}
// this._mapService = MapServiceFactory.createService(config);
// this.spwViewer.get('spwMap').addMapService(this._mapService);
this._mapService = this.spwViewer.get('spwMap').addMapService(config);
},
removeService: function(){
if(this._mapService){
this.spwViewer.get('spwMap').removeMapService(this._mapService.serviceId);
this._mapService = null;
}
}
});
});