Commit ab55087c29c04dc7bbc2137f1c10d19eacbb7bba

Authored by Elena.Budnik
1 parent 0e03919b

idl => math

generic_data/Functions/functions.xml
@@ -88,91 +88,91 @@ @@ -88,91 +88,91 @@
88 <prompt/> 88 <prompt/>
89 <info_brief>GSE to SM transformation</info_brief> 89 <info_brief>GSE to SM transformation</info_brief>
90 </function>--> 90 </function>-->
91 - <function name="cross(,)" params="2" kind="idl"> 91 + <function name="cross(,)" params="2" kind="math">
92 <info_brief>Cross product</info_brief> 92 <info_brief>Cross product</info_brief>
93 <new_kernel>cross</new_kernel> 93 <new_kernel>cross</new_kernel>
94 </function> 94 </function>
95 - <function name="dot(,)" params="2" kind="idl"> 95 + <function name="dot(,)" params="2" kind="math">
96 <info_brief>Dot product</info_brief> 96 <info_brief>Dot product</info_brief>
97 <new_kernel>dot</new_kernel> 97 <new_kernel>dot</new_kernel>
98 </function> 98 </function>
99 - <function name="abs()" kind="idl"> 99 + <function name="abs()" kind="math">
100 <info_brief>Absolute value</info_brief> 100 <info_brief>Absolute value</info_brief>
101 <new_kernel>abs</new_kernel> 101 <new_kernel>abs</new_kernel>
102 </function> 102 </function>
103 - <function name="acos()" kind="idl"> 103 + <function name="acos()" kind="math">
104 <info_brief>Arc-cosine</info_brief> 104 <info_brief>Arc-cosine</info_brief>
105 <new_kernel>acos</new_kernel> 105 <new_kernel>acos</new_kernel>
106 </function> 106 </function>
107 - <function name="alog()" kind="idl"> 107 + <function name="alog()" kind="math">
108 <info_brief>Natural logarithm</info_brief> 108 <info_brief>Natural logarithm</info_brief>
109 <new_kernel>log</new_kernel> 109 <new_kernel>log</new_kernel>
110 </function> 110 </function>
111 - <function name="alog10()" kind="idl"> 111 + <function name="alog10()" kind="math">
112 <info_brief>Logarithm to the base 10</info_brief> 112 <info_brief>Logarithm to the base 10</info_brief>
113 <new_kernel>log10</new_kernel> 113 <new_kernel>log10</new_kernel>
114 </function> 114 </function>
115 - <function name="asin()" kind="idl"> 115 + <function name="asin()" kind="math">
116 <info_brief>Arc-sine</info_brief> 116 <info_brief>Arc-sine</info_brief>
117 <new_kernel>asin</new_kernel> 117 <new_kernel>asin</new_kernel>
118 </function> 118 </function>
119 - <function name="atan()" kind="idl"> 119 + <function name="atan()" kind="math">
120 <info_brief>Arc-tangent</info_brief> 120 <info_brief>Arc-tangent</info_brief>
121 <new_kernel>atan</new_kernel> 121 <new_kernel>atan</new_kernel>
122 </function> 122 </function>
123 - <function name="atan2(,)" kind="idl"> 123 + <function name="atan2(,)" kind="math">
124 <info_brief>Arc-tangent</info_brief> 124 <info_brief>Arc-tangent</info_brief>
125 <new_kernel>atan_2f</new_kernel> 125 <new_kernel>atan_2f</new_kernel>
126 </function> 126 </function>
127 - <function name="ceil()" kind="idl"> 127 + <function name="ceil()" kind="math">
128 <info_brief>Closest integer greater than or equal to its argument</info_brief> 128 <info_brief>Closest integer greater than or equal to its argument</info_brief>
129 <new_kernel>Ceil</new_kernel> 129 <new_kernel>Ceil</new_kernel>
130 </function> 130 </function>
131 - <function name="cos()" kind="idl"> 131 + <function name="cos()" kind="math">
132 <info_brief>cosine</info_brief> 132 <info_brief>cosine</info_brief>
133 <new_kernel>cos</new_kernel> 133 <new_kernel>cos</new_kernel>
134 </function> 134 </function>
135 - <function name="cosh()" kind="idl"> 135 + <function name="cosh()" kind="math">
136 <info_brief>Hyperbolic cosine</info_brief> 136 <info_brief>Hyperbolic cosine</info_brief>
137 <new_kernel>cosh</new_kernel> 137 <new_kernel>cosh</new_kernel>
138 </function> 138 </function>
139 - <function name="deriv_()" kind="idl"> 139 + <function name="deriv_()" kind="math">
140 <info_brief>deriv() function with possibly unequal point spacing</info_brief> 140 <info_brief>deriv() function with possibly unequal point spacing</info_brief>
141 <new_kernel>#deriv</new_kernel> 141 <new_kernel>#deriv</new_kernel>
142 </function> 142 </function>
143 - <function name="exp()" kind="idl"> 143 + <function name="exp()" kind="math">
144 <info_brief>Natural exponential function</info_brief> 144 <info_brief>Natural exponential function</info_brief>
145 <new_kernel>exp</new_kernel> 145 <new_kernel>exp</new_kernel>
146 </function> 146 </function>
147 - <function name="fix()" kind="idl"> 147 + <function name="fix()" kind="math">
148 <info_brief>Integer</info_brief> 148 <info_brief>Integer</info_brief>
149 <new_kernel>Fix</new_kernel> 149 <new_kernel>Fix</new_kernel>
150 </function> 150 </function>
151 - <function name="floor()" kind="idl"> 151 + <function name="floor()" kind="math">
152 <info_brief>Closest integer less than or equal to its argument</info_brief> 152 <info_brief>Closest integer less than or equal to its argument</info_brief>
153 <new_kernel>Floor</new_kernel> 153 <new_kernel>Floor</new_kernel>
154 </function> 154 </function>
155 - <function name="sign()" kind="idl"> 155 + <function name="sign()" kind="math">
156 <info_brief>Sign</info_brief> 156 <info_brief>Sign</info_brief>
157 <new_kernel>Sign</new_kernel> 157 <new_kernel>Sign</new_kernel>
158 </function> 158 </function>
159 - <function name="sin()" kind="idl"> 159 + <function name="sin()" kind="math">
160 <info_brief>Sine</info_brief> 160 <info_brief>Sine</info_brief>
161 <new_kernel>sin</new_kernel> 161 <new_kernel>sin</new_kernel>
162 </function> 162 </function>
163 - <function name="sinh()" kind="idl"> 163 + <function name="sinh()" kind="math">
164 <info_brief>Hyperbolic sine</info_brief> 164 <info_brief>Hyperbolic sine</info_brief>
165 <new_kernel>sinh</new_kernel> 165 <new_kernel>sinh</new_kernel>
166 </function> 166 </function>
167 - <function name="tan()" kind="idl"> 167 + <function name="tan()" kind="math">
168 <info_brief>Tangent</info_brief> 168 <info_brief>Tangent</info_brief>
169 <new_kernel>tan</new_kernel> 169 <new_kernel>tan</new_kernel>
170 </function> 170 </function>
171 - <function name="tanh()" kind="idl"> 171 + <function name="tanh()" kind="math">
172 <info_brief>Hyperbolic tangent</info_brief> 172 <info_brief>Hyperbolic tangent</info_brief>
173 <new_kernel>tanh</new_kernel> 173 <new_kernel>tanh</new_kernel>
174 </function> 174 </function>
175 - <function name="sqrt()" kind="idl"> 175 + <function name="sqrt()" kind="math">
176 <info_brief>Square root</info_brief> 176 <info_brief>Square root</info_brief>
177 <new_kernel>sqrt</new_kernel> 177 <new_kernel>sqrt</new_kernel>
178 </function> 178 </function>
js/app/models/Function.js
@@ -4,43 +4,37 @@ @@ -4,43 +4,37 @@
4 * @plugin amdaModel.Function 4 * @plugin amdaModel.Function
5 * @extends Ext.data.Model 5 * @extends Ext.data.Model
6 * @brief Data model for functions definition 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 Ext.define('amdaModel.Function', { 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 \ No newline at end of file 41 \ No newline at end of file
js/app/views/CalculatorUI.js
@@ -4,16 +4,7 @@ @@ -4,16 +4,7 @@
4 * @class amdaDesktop.ExplorerModule 4 * @class amdaDesktop.ExplorerModule
5 * @extends Ext.util.Observable 5 * @extends Ext.util.Observable
6 * @brief Calculator Plugin used in SearchUI and ParameterUI 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,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 Ext.define('amdaUI.CalculatorUI', { 19 Ext.define('amdaUI.CalculatorUI', {
29 extend: 'Ext.util.Observable', 20 extend: 'Ext.util.Observable',
30 - 21 +
31 requires : [ 22 requires : [
32 - 'amdaModel.Constant',  
33 - 'amdaModel.Function' 23 + 'amdaModel.Constant',
  24 + 'amdaModel.Function'
34 ], 25 ],
35 26
36 alias: 'plugin.calculator', 27 alias: 'plugin.calculator',
37 28
38 statics : { 29 statics : {
39 - constantStore : null,  
40 - functionStore : null 30 + constantStore : null,
  31 + functionStore : null
41 }, 32 },
42 33
43 win: null, 34 win: null,
44 - 35 +
45 constructor: function(config) { 36 constructor: function(config) {
46 Ext.apply(this, config); 37 Ext.apply(this, config);
47 this.callParent(arguments); 38 this.callParent(arguments);
@@ -49,18 +40,17 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, { @@ -49,18 +40,17 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
49 40
50 init: function(cmp) 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 onRender: function() 56 onRender: function()
@@ -88,24 +78,24 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, { @@ -88,24 +78,24 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
88 }, 78 },
89 getConstrainVector: function(constrainTo){ 79 getConstrainVector: function(constrainTo){
90 var me = this; 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 //load constants store 88 //load constants store
99 if (!amdaUI.CalculatorUI.constantStore) 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 else 100 else
111 this.createConstantBtns(); 101 this.createConstantBtns();
@@ -113,19 +103,17 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, { @@ -113,19 +103,17 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
113 //load functions store 103 //load functions store
114 if (!amdaUI.CalculatorUI.functionStore) 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 else 115 else
126 this.createAllFunctionBtns(); 116 this.createAllFunctionBtns();
127 -  
128 -  
129 }, 117 },
130 118
131 onShow: function() { 119 onShow: function() {
@@ -350,40 +338,40 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, { @@ -350,40 +338,40 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
350 }, 338 },
351 339
352 createConstantBtns : function(){ 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 },this); 367 },this);
380 }, 368 },
381 369
382 createAllFunctionBtns : function() 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 this.createFunctionBtns('AmdaFunctions','Space Physics'); 375 this.createFunctionBtns('AmdaFunctions','Space Physics');
388 }, 376 },
389 377
@@ -396,8 +384,8 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, { @@ -396,8 +384,8 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
396 384
397 switch (item) 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 break; 389 break;
402 case 'AmdaFunctions' : 390 case 'AmdaFunctions' :
403 amdaUI.CalculatorUI.functionStore.filter('kind','amda'); 391 amdaUI.CalculatorUI.functionStore.filter('kind','amda');
@@ -421,10 +409,9 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, { @@ -421,10 +409,9 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
421 { 409 {
422 text: f.get('name'), 410 text: f.get('name'),
423 args: f.get('args'), 411 args: f.get('args'),
424 - params: f.get('params'),//"+", 412 + params: f.get('params'),
425 prompt: f.get('prompt'), 413 prompt: f.get('prompt'),
426 tooltip: f.get('info_brief'), 414 tooltip: f.get('info_brief'),
427 - // disabled: f.get('argv') == 'vector',  
428 scope: this, 415 scope: this,
429 handler: function(b,e){ 416 handler: function(b,e){
430 var selection = this.hostCmp.constructionField.getSelection(); 417 var selection = this.hostCmp.constructionField.getSelection();
@@ -469,22 +456,21 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, { @@ -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 getItems: function(item) 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 default: break; 472 default: break;
487 - }  
488 - return [];  
489 - } 473 + }
  474 + return [];
  475 + }
490 }); 476 });