Commit ab55087c29c04dc7bbc2137f1c10d19eacbb7bba

Authored by Elena.Budnik
1 parent 0e03919b

idl => math

generic_data/Functions/functions.xml
... ... @@ -88,91 +88,91 @@
88 88 <prompt/>
89 89 <info_brief>GSE to SM transformation</info_brief>
90 90 </function>-->
91   - <function name="cross(,)" params="2" kind="idl">
  91 + <function name="cross(,)" params="2" kind="math">
92 92 <info_brief>Cross product</info_brief>
93 93 <new_kernel>cross</new_kernel>
94 94 </function>
95   - <function name="dot(,)" params="2" kind="idl">
  95 + <function name="dot(,)" params="2" kind="math">
96 96 <info_brief>Dot product</info_brief>
97 97 <new_kernel>dot</new_kernel>
98 98 </function>
99   - <function name="abs()" kind="idl">
  99 + <function name="abs()" kind="math">
100 100 <info_brief>Absolute value</info_brief>
101 101 <new_kernel>abs</new_kernel>
102 102 </function>
103   - <function name="acos()" kind="idl">
  103 + <function name="acos()" kind="math">
104 104 <info_brief>Arc-cosine</info_brief>
105 105 <new_kernel>acos</new_kernel>
106 106 </function>
107   - <function name="alog()" kind="idl">
  107 + <function name="alog()" kind="math">
108 108 <info_brief>Natural logarithm</info_brief>
109 109 <new_kernel>log</new_kernel>
110 110 </function>
111   - <function name="alog10()" kind="idl">
  111 + <function name="alog10()" kind="math">
112 112 <info_brief>Logarithm to the base 10</info_brief>
113 113 <new_kernel>log10</new_kernel>
114 114 </function>
115   - <function name="asin()" kind="idl">
  115 + <function name="asin()" kind="math">
116 116 <info_brief>Arc-sine</info_brief>
117 117 <new_kernel>asin</new_kernel>
118 118 </function>
119   - <function name="atan()" kind="idl">
  119 + <function name="atan()" kind="math">
120 120 <info_brief>Arc-tangent</info_brief>
121 121 <new_kernel>atan</new_kernel>
122 122 </function>
123   - <function name="atan2(,)" kind="idl">
  123 + <function name="atan2(,)" kind="math">
124 124 <info_brief>Arc-tangent</info_brief>
125 125 <new_kernel>atan_2f</new_kernel>
126 126 </function>
127   - <function name="ceil()" kind="idl">
  127 + <function name="ceil()" kind="math">
128 128 <info_brief>Closest integer greater than or equal to its argument</info_brief>
129 129 <new_kernel>Ceil</new_kernel>
130 130 </function>
131   - <function name="cos()" kind="idl">
  131 + <function name="cos()" kind="math">
132 132 <info_brief>cosine</info_brief>
133 133 <new_kernel>cos</new_kernel>
134 134 </function>
135   - <function name="cosh()" kind="idl">
  135 + <function name="cosh()" kind="math">
136 136 <info_brief>Hyperbolic cosine</info_brief>
137 137 <new_kernel>cosh</new_kernel>
138 138 </function>
139   - <function name="deriv_()" kind="idl">
  139 + <function name="deriv_()" kind="math">
140 140 <info_brief>deriv() function with possibly unequal point spacing</info_brief>
141 141 <new_kernel>#deriv</new_kernel>
142 142 </function>
143   - <function name="exp()" kind="idl">
  143 + <function name="exp()" kind="math">
144 144 <info_brief>Natural exponential function</info_brief>
145 145 <new_kernel>exp</new_kernel>
146 146 </function>
147   - <function name="fix()" kind="idl">
  147 + <function name="fix()" kind="math">
148 148 <info_brief>Integer</info_brief>
149 149 <new_kernel>Fix</new_kernel>
150 150 </function>
151   - <function name="floor()" kind="idl">
  151 + <function name="floor()" kind="math">
152 152 <info_brief>Closest integer less than or equal to its argument</info_brief>
153 153 <new_kernel>Floor</new_kernel>
154 154 </function>
155   - <function name="sign()" kind="idl">
  155 + <function name="sign()" kind="math">
156 156 <info_brief>Sign</info_brief>
157 157 <new_kernel>Sign</new_kernel>
158 158 </function>
159   - <function name="sin()" kind="idl">
  159 + <function name="sin()" kind="math">
160 160 <info_brief>Sine</info_brief>
161 161 <new_kernel>sin</new_kernel>
162 162 </function>
163   - <function name="sinh()" kind="idl">
  163 + <function name="sinh()" kind="math">
164 164 <info_brief>Hyperbolic sine</info_brief>
165 165 <new_kernel>sinh</new_kernel>
166 166 </function>
167   - <function name="tan()" kind="idl">
  167 + <function name="tan()" kind="math">
168 168 <info_brief>Tangent</info_brief>
169 169 <new_kernel>tan</new_kernel>
170 170 </function>
171   - <function name="tanh()" kind="idl">
  171 + <function name="tanh()" kind="math">
172 172 <info_brief>Hyperbolic tangent</info_brief>
173 173 <new_kernel>tanh</new_kernel>
174 174 </function>
175   - <function name="sqrt()" kind="idl">
  175 + <function name="sqrt()" kind="math">
176 176 <info_brief>Square root</info_brief>
177 177 <new_kernel>sqrt</new_kernel>
178 178 </function>
... ...
js/app/models/Function.js
... ... @@ -4,43 +4,37 @@
4 4 * @plugin amdaModel.Function
5 5 * @extends Ext.data.Model
6 6 * @brief Data model for functions definition
7   - * @author Benjamin
8   - * @version $Id: Function.js 1399 2013-03-27 12:44:50Z elena $
9   - ********************************************************************************
10   - * FT Id : Date : Name - Description
11   - *******************************************************************************
12   - * :
  7 + * @author Benjamin
13 8 */
14 9  
15 10 Ext.define('amdaModel.Function', {
16   -
17   - extend: 'Ext.data.Model',
18   - idProperty: 'text',
19   -
20   - fields : [
21   - {name: 'name', mapping: '@name', type:'string'},
22   - {name: 'kind', mapping: '@kind', type: 'string', defaultValue: 'amda'},
23   - {name: 'args', mapping: '@args', type: 'int', defaultValue: 0},
24   - {name: 'argv', mapping: '@argv', type: 'string'},
25   - {name: 'params', mapping: '@params', type:'int', defaultValue: 1},
26   - {name: 'prompt', type: 'string', defaultValue: ''},
27   - {name: 'info_brief', type: 'string', defaultValue: ''}
28   - ],
  11 +
  12 + extend: 'Ext.data.Model',
  13 + idProperty: 'text',
  14 +
  15 + fields : [
  16 + {name: 'name', mapping: '@name', type:'string'},
  17 + {name: 'kind', mapping: '@kind', type: 'string', defaultValue: 'amda'},
  18 + {name: 'args', mapping: '@args', type: 'int', defaultValue: 0},
  19 + {name: 'argv', mapping: '@argv', type: 'string'},
  20 + {name: 'params', mapping: '@params', type:'int', defaultValue: 1},
  21 + {name: 'prompt', type: 'string', defaultValue: ''},
  22 + {name: 'info_brief', type: 'string', defaultValue: ''}
  23 + ],
29 24  
30   - validations: [
31   - {type: 'presence', field: 'name'},
32   - {type: 'presence', field: 'kind'},
33   - {type: 'inclusion', field: 'kind', list: ['idl','amda','time','sliding']}
34   - ],
  25 + validations: [
  26 + {type: 'presence', field: 'name'},
  27 + {type: 'presence', field: 'kind'},
  28 + {type: 'inclusion', field: 'kind', list: ['math','amda','time','sliding']}
  29 + ],
35 30  
36   - proxy: {
37   - type: 'ajax',
38   -//TODO url into generique settings
39   - url : 'generic_data/Functions/functions.xml',
40   - reader: {
41   - type: 'xml',
42   - root: 'functions',
43   - record: 'function'
44   - }
45   - }
  31 + proxy: {
  32 + type: 'ajax',
  33 + url : 'generic_data/Functions/functions.xml',
  34 + reader: {
  35 + type: 'xml',
  36 + root: 'functions',
  37 + record: 'function'
  38 + }
  39 + }
46 40 });
47 41 \ No newline at end of file
... ...
js/app/views/CalculatorUI.js
... ... @@ -4,16 +4,7 @@
4 4 * @class amdaDesktop.ExplorerModule
5 5 * @extends Ext.util.Observable
6 6 * @brief Calculator Plugin used in SearchUI and ParameterUI
7   - * @author elena
8   - * @version $Id: CalculatorUI.js 1399 2013-03-27 12:44:50Z elena $
9   - *
10   - ******************************************************************************
11   - * FT Id : Date : Name - Description
12   - ******************************************************************************
13   - *
14   - * : :06/05/2011: CDA - Extjs 4.0.0 Migration
15   - * : :16/06/2011: elena - resolve rendering problem (sencha support)
16   - * : :26/10/2011: BRE -autoload constants and functions from xml files
  7 + * @author elena
17 8 */
18 9  
19 10  
... ... @@ -27,21 +18,21 @@ var CalculatorData = [&#39;1&#39;,&#39;2&#39;,&#39;3&#39;,&#39;4&#39;,&#39;5&#39;,&#39;6&#39;,&#39;7&#39;,&#39;8&#39;,&#39;9&#39;,&#39;0&#39;,&#39;(&#39;,&#39;)&#39;,&#39;[&#39;,&#39;]&#39;,&#39;+
27 18  
28 19 Ext.define('amdaUI.CalculatorUI', {
29 20 extend: 'Ext.util.Observable',
30   -
  21 +
31 22 requires : [
32   - 'amdaModel.Constant',
33   - 'amdaModel.Function'
  23 + 'amdaModel.Constant',
  24 + 'amdaModel.Function'
34 25 ],
35 26  
36 27 alias: 'plugin.calculator',
37 28  
38 29 statics : {
39   - constantStore : null,
40   - functionStore : null
  30 + constantStore : null,
  31 + functionStore : null
41 32 },
42 33  
43 34 win: null,
44   -
  35 +
45 36 constructor: function(config) {
46 37 Ext.apply(this, config);
47 38 this.callParent(arguments);
... ... @@ -49,18 +40,17 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
49 40  
50 41 init: function(cmp)
51 42 {
52   - this.hostCmp = cmp;
53   - this.hostCmp.on({
54   - scope: this,
55   - added: function(){
56   - this.hostCmp.ownerCt.on({
57   - render: this.onRender,
58   - show: this.onShow,
59   - hide : this.onHide,
60   - scope: this });
61   - }
62   - });
63   -
  43 + this.hostCmp = cmp;
  44 + this.hostCmp.on({
  45 + scope: this,
  46 + added: function(){
  47 + this.hostCmp.ownerCt.on({
  48 + render: this.onRender,
  49 + show: this.onShow,
  50 + hide : this.onHide,
  51 + scope: this });
  52 + }
  53 + });
64 54 },
65 55  
66 56 onRender: function()
... ... @@ -88,24 +78,24 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
88 78 },
89 79 getConstrainVector: function(constrainTo){
90 80 var me = this;
91   - if (me.constrain || me.constrainHeader) {
92   - constrainTo = constrainTo || (me.floatParent && me.floatParent.getTargetEl()) || me.container || me.el.getScopeParent();
93   - return (me.constrainHeader ? me.header.el : me.el).getConstrainVector(constrainTo);
94   - }
95   - }
  81 + if (me.constrain || me.constrainHeader) {
  82 + constrainTo = constrainTo || (me.floatParent && me.floatParent.getTargetEl()) || me.container || me.el.getScopeParent();
  83 + return (me.constrainHeader ? me.header.el : me.el).getConstrainVector(constrainTo);
  84 + }
  85 + }
96 86 });
97 87  
98 88 //load constants store
99 89 if (!amdaUI.CalculatorUI.constantStore)
100 90 {
101   - amdaUI.CalculatorUI.constantStore = Ext.create('Ext.data.Store',{model: 'amdaModel.Constant'});
102   - amdaUI.CalculatorUI.constantStore.load({
103   - scope : this,
104   - callback: function(records, operation, success)
105   - {
106   - this.createConstantBtns();
107   - }
108   - });
  91 + amdaUI.CalculatorUI.constantStore = Ext.create('Ext.data.Store',{model: 'amdaModel.Constant'});
  92 + amdaUI.CalculatorUI.constantStore.load({
  93 + scope : this,
  94 + callback: function(records, operation, success)
  95 + {
  96 + this.createConstantBtns();
  97 + }
  98 + });
109 99 }
110 100 else
111 101 this.createConstantBtns();
... ... @@ -113,19 +103,17 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
113 103 //load functions store
114 104 if (!amdaUI.CalculatorUI.functionStore)
115 105 {
116   - amdaUI.CalculatorUI.functionStore = Ext.create('Ext.data.Store',{model: 'amdaModel.Function'});
117   - amdaUI.CalculatorUI.functionStore.load({
118   - scope : this,
119   - callback: function(records, operation, success)
120   - {
121   - this.createAllFunctionBtns();
122   - }
123   - });
  106 + amdaUI.CalculatorUI.functionStore = Ext.create('Ext.data.Store',{model: 'amdaModel.Function'});
  107 + amdaUI.CalculatorUI.functionStore.load({
  108 + scope : this,
  109 + callback: function(records, operation, success)
  110 + {
  111 + this.createAllFunctionBtns();
  112 + }
  113 + });
124 114 }
125 115 else
126 116 this.createAllFunctionBtns();
127   -
128   -
129 117 },
130 118  
131 119 onShow: function() {
... ... @@ -350,40 +338,40 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
350 338 },
351 339  
352 340 createConstantBtns : function(){
353   - var constTab = this.win.query('#calc_tab_const_id');
354   -
355   - if (constTab.length < 1)
356   - return;
  341 + var constTab = this.win.query('#calc_tab_const_id');
  342 +
  343 + if (constTab.length < 1)
  344 + return;
357 345  
358   - amdaUI.CalculatorUI.constantStore.each( function(c){
359   - constTab[0].add(
360   - {
361   - text: c.get('name'),
362   - tooltip: c.get('units') == '' ? c.get('info')+'<br/>'+c.get('value') :
363   - c.get('info')+'<br/>'+c.get('value')+' '+c.get('units'),
364   - scope: this,
365   - handler: function(b,e){
366   - // keep selection into construction field
367   - var selection = this.hostCmp.constructionField.getSelection();
368   - // the new value of construction field
369   - var newConstruction = "";
370   - // replacement of selection into construction field by text of clicked button
371   - newConstruction = selection.beforeText + '@'+b.text;
372   - var caretPos = newConstruction.length;
373   - newConstruction += selection.afterText;
374   - this.hostCmp.constructionField.setValue(newConstruction);
375   - // set Caret Position after inserted Text
376   - this.hostCmp.constructionField.setCaretPosition(caretPos);
377   - }
378   - });
  346 + amdaUI.CalculatorUI.constantStore.each( function(c){
  347 + constTab[0].add(
  348 + {
  349 + text: c.get('name'),
  350 + tooltip: c.get('units') == '' ? c.get('info')+'<br/>'+c.get('value') :
  351 + c.get('info')+'<br/>'+c.get('value')+' '+c.get('units'),
  352 + scope: this,
  353 + handler: function(b,e){
  354 + // keep selection into construction field
  355 + var selection = this.hostCmp.constructionField.getSelection();
  356 + // the new value of construction field
  357 + var newConstruction = "";
  358 + // replacement of selection into construction field by text of clicked button
  359 + newConstruction = selection.beforeText + '@'+b.text;
  360 + var caretPos = newConstruction.length;
  361 + newConstruction += selection.afterText;
  362 + this.hostCmp.constructionField.setValue(newConstruction);
  363 + // set Caret Position after inserted Text
  364 + this.hostCmp.constructionField.setCaretPosition(caretPos);
  365 + }
  366 + });
379 367 },this);
380 368 },
381 369  
382 370 createAllFunctionBtns : function()
383 371 {
384   - this.createFunctionBtns('IdlFunctions','Simple Maths');
385   - this.createFunctionBtns('TimeFunctions','Statistics');
386   - this.createFunctionBtns('FunctionsSliding','Statistics/Sliding');
  372 + this.createFunctionBtns('MathFunctions','Simple Maths');
  373 + this.createFunctionBtns('TimeFunctions','Statistics');
  374 + this.createFunctionBtns('FunctionsSliding','Statistics/Sliding');
387 375 this.createFunctionBtns('AmdaFunctions','Space Physics');
388 376 },
389 377  
... ... @@ -396,8 +384,8 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
396 384  
397 385 switch (item)
398 386 {
399   - case 'IdlFunctions' :
400   - amdaUI.CalculatorUI.functionStore.filter('kind','idl');
  387 + case 'MathFunctions' :
  388 + amdaUI.CalculatorUI.functionStore.filter('kind','math');
401 389 break;
402 390 case 'AmdaFunctions' :
403 391 amdaUI.CalculatorUI.functionStore.filter('kind','amda');
... ... @@ -421,10 +409,9 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
421 409 {
422 410 text: f.get('name'),
423 411 args: f.get('args'),
424   - params: f.get('params'),//"+",
  412 + params: f.get('params'),
425 413 prompt: f.get('prompt'),
426 414 tooltip: f.get('info_brief'),
427   - // disabled: f.get('argv') == 'vector',
428 415 scope: this,
429 416 handler: function(b,e){
430 417 var selection = this.hostCmp.constructionField.getSelection();
... ... @@ -469,22 +456,21 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
469 456 }
470 457 }
471 458 });
472   - },
473   - this
474   - );
475   - //clear filter
476   - amdaUI.CalculatorUI.functionStore.clearFilter();
477   -
  459 + },
  460 + this
  461 + );
  462 + //clear filter
  463 + amdaUI.CalculatorUI.functionStore.clearFilter();
478 464 },
479 465  
480 466 getItems: function(item)
481 467 {
482   - switch (item)
483   - {
484   - case 'Calculator':
485   - return this.getCalculatorBtn();
  468 + switch (item)
  469 + {
  470 + case 'Calculator':
  471 + return this.getCalculatorBtn();
486 472 default: break;
487   - }
488   - return [];
489   - }
  473 + }
  474 + return [];
  475 + }
490 476 });
... ...