git_sitools_idoc / szcluster-db / workspace / client-user / js / components / datasetServices / plotService.js @ d16caf89
1 |
/*******************************************************************************
|
---|---|
2 |
* Copyright 2010-2014 CNES - CENTRE NATIONAL d'ETUDES SPATIALES
|
3 |
*
|
4 |
* This file is part of SITools2.
|
5 |
*
|
6 |
* SITools2 is free software: you can redistribute it and/or modify it under the
|
7 |
* terms of the GNU General Public License as published by the Free Software
|
8 |
* Foundation, either version 3 of the License, or (at your option) any later
|
9 |
* version.
|
10 |
*
|
11 |
* SITools2 is distributed in the hope that it will be useful, but WITHOUT ANY
|
12 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13 |
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License along with
|
16 |
* SITools2. If not, see <http://www.gnu.org/licenses/>.
|
17 |
******************************************************************************/
|
18 |
/*global Ext, sitools, ID, i18n, document, showResponse, alertFailure, LOCALE, ImageChooser, loadUrl, extColModelToStorage, SitoolsDesk, WARNING_NB_RECORDS_PLOT*/
|
19 |
|
20 |
Ext.namespace('sitools.user.component.dataviews.services');
|
21 |
|
22 |
/**
|
23 |
* service used to show the plot
|
24 |
*
|
25 |
* @required datasetId
|
26 |
* @required datasetUrl
|
27 |
* @cfg {Ext.data.JsonStore} the store where nodes are saved
|
28 |
* @class sitools.user.component.dataviews.services.addSelectionService
|
29 |
* @extends Ext.Window
|
30 |
*/
|
31 |
sitools.user.component.dataviews.services.plotService = {}; |
32 |
|
33 |
Ext.reg('sitools.user.component.dataviews.services.plotService', sitools.user.component.dataviews.services.plotService);
|
34 |
|
35 |
sitools.user.component.dataviews.services.plotService.getParameters = function () { |
36 |
return [{
|
37 |
jsObj : "Ext.form.TextField", |
38 |
config : {
|
39 |
anchor : "100%", |
40 |
fieldLabel : i18n.get("label.warning_nb_records"), |
41 |
value : WARNING_NB_RECORDS_PLOT,
|
42 |
name : "warning_nb_records" |
43 |
} |
44 |
}]; |
45 |
}; |
46 |
|
47 |
sitools.user.component.dataviews.services.plotService.executeAsService = function (config) { |
48 |
|
49 |
var grid = config.dataview;
|
50 |
var datasetId = grid.datasetId;
|
51 |
var datasetUrl = grid.sitoolsAttachementForUsers;
|
52 |
var datasetName = grid.datasetName;
|
53 |
var columnModel = grid.datasetCm;
|
54 |
var formParams = grid.formParams;
|
55 |
var formMultiDsParams = grid.formMultiDsParams;
|
56 |
|
57 |
var sortInfo = grid.getSortInfo();
|
58 |
|
59 |
var maxWarningRecords = WARNING_NB_RECORDS_PLOT;
|
60 |
Ext.each(config.parameters, function (param) {
|
61 |
if (param.name === "warning_nb_records") { |
62 |
maxWarningRecords = parseInt(param.value, 10);
|
63 |
} |
64 |
}, this);
|
65 |
|
66 |
var jsObj = sitools.user.component.dataPlotter;
|
67 |
var componentCfg = {
|
68 |
columnModel : columnModel,
|
69 |
formParams : formParams,
|
70 |
formMultiDsParams : formMultiDsParams,
|
71 |
dataUrl : datasetUrl,
|
72 |
datasetName : datasetName,
|
73 |
datasetId : datasetId,
|
74 |
componentType : "plot", |
75 |
preferencesPath : "/" + datasetName, |
76 |
preferencesFileName : "plot", |
77 |
filters : grid.getFilters(),
|
78 |
selections : Ext.isEmpty(grid.getSelections()) ? undefined : grid.getSelectionForPlot(), |
79 |
sortInfo : sortInfo,
|
80 |
selectionSize : (grid.isAllSelected()) ? grid.store.getTotalCount() : grid.getNbRowsSelected(),
|
81 |
maxWarningRecords : maxWarningRecords
|
82 |
}; |
83 |
var windowConfig = {
|
84 |
id : "plot" + datasetId, |
85 |
title : "Data plot",//"Data plot : " + datasetName, |
86 |
iconCls : "plot", |
87 |
datasetName : datasetName,
|
88 |
type : "plot", |
89 |
saveToolbar : true, |
90 |
winHeight : 600 |
91 |
}; |
92 |
SitoolsDesk.addDesktopWindow(windowConfig, componentCfg, jsObj); |
93 |
}; |