Commit a3db3a90b463338e10778ee1edcca9c06edbd763
1 parent
c05ca21a
Exists in
master
and in
106 other branches
calcularor_restructuring
Showing
4 changed files
with
90 additions
and
48 deletions
Show diff stats
generic_data/Functions/constants.xml
1 | <?xml version="1.0"?> | 1 | <?xml version="1.0"?> |
2 | <constants> | 2 | <constants> |
3 | - <constant info="astronomical unit" name="AU" units="m">1.49598e+11</constant> | ||
4 | - <constant info="Boltzmann constant" name="k" units="J/K">1.38054e-23</constant> | ||
5 | - <constant info="kelvin to electron-volt" name="K2eV" units="eV/K">8.622e-5</constant> | ||
6 | - <constant info="electron-volt to kelvin" name="eV2K" units="K/eV">1.160e4</constant> | ||
7 | - <constant info="proton mass" name="m_p" units="kg">1.67e-27</constant> | ||
8 | - <constant info="electron mass" name="m_e" units="kg">9.1091e-31</constant> | ||
9 | - <constant info="speed of light in vacuum" name="c" units="m/s">2.99792e+08</constant> | ||
10 | - <constant info="elementary charge" name="q_e" units="C">1.6021e-19</constant> | ||
11 | - <constant info='electric constant' name="epsilon_0" units="F/m">8.85416e-12</constant> | ||
12 | - <constant info='magnetic constant' name="mu_0" units="H/m">1.25664e-06</constant> | ||
13 | - <constant info="pi" name="pi">3.14159</constant> | ||
14 | - <constant info="rad2deg" name="rad2deg" units="deg/rad">57.2958</constant> | ||
15 | - <constant info="deg2rad" name="deg2rad" units="rad/deg">0.0174533</constant> | ||
16 | - <constant info="gravitational constant" name="G" units="m3/kg/s2">6.674e-11</constant> | ||
17 | - <constant info="acceleration of gravity at Earth" name="g" units="m/s2">9.81</constant> | ||
18 | - <constant info="Planck constant" name="h" units="Js">6.626e-34</constant> | ||
19 | - <constant info="Avogadro number" name="NA" units="1/mol">6.0221367e+23</constant> | ||
20 | - <constant info="Mercury equatorial radius" name="Rme" units="m">2.4397e+06</constant> | ||
21 | - <constant info="Venus equatorial radius" name="Rv" units="m">6.0518e+06</constant> | ||
22 | - <constant info="Earth equatorial radius" name="Re" units="m">6.3712e+06</constant> | ||
23 | - <constant info="Mars equatorial radius" name="Rma" units="m">3.3962e+06</constant> | ||
24 | - <constant info="Jupiter equatorial radius" name="Rj" units="m">71.492e+06</constant> | ||
25 | - <constant info="Saturn equatorial radius" name="Rs" units="m">60.268e+06</constant> | ||
26 | - <constant info="Uranus equatorial radius" name="Ru" units="m">25.559+06</constant> | ||
27 | - <constant info="Neptune equatorial radius" name="Rn" units="m">24.764+06</constant> | ||
28 | - <constant info="Moon equatorial radius" name="Rmo" units="m">1.738e+06</constant> | ||
29 | - <constant info="Pluto equatorial radius" name="Rpl" units="m">1.195e+06</constant> | ||
30 | - <constant info="Sun equatorial radius" name="Rsun" units="m">6.95e+08</constant> | 3 | + <constant info="astronomical unit" name="AU" units="m" kind="space">1.49598e+11</constant> |
4 | + <constant info="Boltzmann constant" name="k" units="J/K" kind="physics">1.38054e-23</constant> | ||
5 | + <constant info="kelvin to electron-volt" name="K2eV" units="eV/K" kind="units">8.622e-5</constant> | ||
6 | + <constant info="electron-volt to kelvin" name="eV2K" units="K/eV" kind="units">1.160e4</constant> | ||
7 | + <constant info="proton mass" name="m_p" units="kg" kind="physics">1.67e-27</constant> | ||
8 | + <constant info="electron mass" name="m_e" units="kg" kind="physics">9.1091e-31</constant> | ||
9 | + <constant info="speed of light in vacuum" name="c" units="m/s" kind="physics">2.99792e+08</constant> | ||
10 | + <constant info="elementary charge" name="q_e" units="C" kind="physics">1.6021e-19</constant> | ||
11 | + <constant info='electric constant' name="epsilon_0" units="F/m" kind="physics">8.85416e-12</constant> | ||
12 | + <constant info='magnetic constant' name="mu_0" units="H/m" kind="physics">1.25664e-06</constant> | ||
13 | + <constant info="pi" name="pi" kind="physics">3.14159</constant> | ||
14 | + <constant info="rad2deg" name="rad2deg" units="deg/rad" kind="units">57.2958</constant> | ||
15 | + <constant info="deg2rad" name="deg2rad" units="rad/deg" kind="units">0.0174533</constant> | ||
16 | + <constant info="gravitational constant" name="G" units="m3/kg/s2" kind="physics">6.674e-11</constant> | ||
17 | + <constant info="acceleration of gravity at Earth" name="g" units="m/s2" kind="physics">9.81</constant> | ||
18 | + <constant info="Planck constant" name="h" units="Js" kind="physics">6.626e-34</constant> | ||
19 | + <constant info="Avogadro number" name="NA" units="1/mol" kind="physics">6.0221367e+23</constant> | ||
20 | + <constant info="Mercury equatorial radius" name="Rme" units="m" kind="space">2.4397e+06</constant> | ||
21 | + <constant info="Venus equatorial radius" name="Rv" units="m" kind="space">6.0518e+06</constant> | ||
22 | + <constant info="Earth equatorial radius" name="Re" units="m" kind="space" >6.3712e+06</constant> | ||
23 | + <constant info="Mars equatorial radius" name="Rma" units="m" kind="space">3.3962e+06</constant> | ||
24 | + <constant info="Jupiter equatorial radius" name="Rj" units="m" kind="space">71.492e+06</constant> | ||
25 | + <constant info="Saturn equatorial radius" name="Rs" units="m" kind="space">60.268e+06</constant> | ||
26 | + <constant info="Uranus equatorial radius" name="Ru" units="m" kind="space">25.559+06</constant> | ||
27 | + <constant info="Neptune equatorial radius" name="Rn" units="m" kind="space">24.764+06</constant> | ||
28 | + <constant info="Moon equatorial radius" name="Rmo" units="m" kind="space">1.738e+06</constant> | ||
29 | + <constant info="Pluto equatorial radius" name="Rpl" units="m" kind="space">1.195e+06</constant> | ||
30 | + <constant info="Sun equatorial radius" name="Rsun" units="m" kind="space">6.95e+08</constant> | ||
31 | </constants> | 31 | </constants> |
generic_data/Functions/functions.xml
@@ -88,14 +88,18 @@ | @@ -88,14 +88,18 @@ | ||
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="math"> | 91 | + <function name="cross(,)" params="2" kind="vectors"> |
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="math"> | 95 | + <function name="dot(,)" params="2" kind="vectors"> |
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="module()" kind="vectors"> | ||
100 | + <info_brief>Magnitude</info_brief> | ||
101 | + <new_kernel>magnitude</new_kernel> | ||
102 | + </function> | ||
99 | <function name="abs()" kind="math"> | 103 | <function name="abs()" kind="math"> |
100 | <info_brief>Absolute value</info_brief> | 104 | <info_brief>Absolute value</info_brief> |
101 | <new_kernel>abs</new_kernel> | 105 | <new_kernel>abs</new_kernel> |
js/app/models/Constant.js
@@ -20,6 +20,7 @@ Ext.define('amdaModel.Constant', { | @@ -20,6 +20,7 @@ Ext.define('amdaModel.Constant', { | ||
20 | 20 | ||
21 | fields : [ | 21 | fields : [ |
22 | {name: 'name', mapping: '@name', type:'string'}, | 22 | {name: 'name', mapping: '@name', type:'string'}, |
23 | + {name: 'kind', mapping: '@kind', type: 'string', defaultValue: 'space'}, | ||
23 | {name: 'info', mapping: '@info', type:'string'}, | 24 | {name: 'info', mapping: '@info', type:'string'}, |
24 | {name: 'units', mapping: '@units', type: 'string', defaultValue: ''}, | 25 | {name: 'units', mapping: '@units', type: 'string', defaultValue: ''}, |
25 | {name: 'value', mapping: ' ', type: 'string'} | 26 | {name: 'value', mapping: ' ', type: 'string'} |
js/app/views/CalculatorUI.js
@@ -15,6 +15,7 @@ | @@ -15,6 +15,7 @@ | ||
15 | */ | 15 | */ |
16 | 16 | ||
17 | var CalculatorData = ['1','2','3','4','5','6','7','8','9','0','(',')','[',']','+','-','*','/','^', '.','>','<', '&', '|']; | 17 | var CalculatorData = ['1','2','3','4','5','6','7','8','9','0','(',')','[',']','+','-','*','/','^', '.','>','<', '&', '|']; |
18 | +// var CalculatorData = ['1','2','3','4','5','6','7','8','9','0','(',')','[',']','+','-','*','/','^', '.','>','>=', '=', '<=', '<', '&', '|']; | ||
18 | 19 | ||
19 | Ext.define('amdaUI.CalculatorUI', { | 20 | Ext.define('amdaUI.CalculatorUI', { |
20 | extend: 'Ext.util.Observable', | 21 | extend: 'Ext.util.Observable', |
@@ -93,12 +94,12 @@ Ext.define('amdaUI.CalculatorUI', { | @@ -93,12 +94,12 @@ Ext.define('amdaUI.CalculatorUI', { | ||
93 | scope : this, | 94 | scope : this, |
94 | callback: function(records, operation, success) | 95 | callback: function(records, operation, success) |
95 | { | 96 | { |
96 | - this.createConstantBtns(); | 97 | + this.createAllConstantBtns(); |
97 | } | 98 | } |
98 | }); | 99 | }); |
99 | } | 100 | } |
100 | else | 101 | else |
101 | - this.createConstantBtns(); | 102 | + this.createAllConstantBtns(); |
102 | 103 | ||
103 | //load functions store | 104 | //load functions store |
104 | if (!amdaUI.CalculatorUI.functionStore) | 105 | if (!amdaUI.CalculatorUI.functionStore) |
@@ -148,8 +149,10 @@ Ext.define('amdaUI.CalculatorUI', { | @@ -148,8 +149,10 @@ Ext.define('amdaUI.CalculatorUI', { | ||
148 | defaults: { xtype: 'button', columnWidth: .11}, | 149 | defaults: { xtype: 'button', columnWidth: .11}, |
149 | items: this.getItems('Calculator') | 150 | items: this.getItems('Calculator') |
150 | } , { | 151 | } , { |
151 | - title: 'Constants', layout: 'column', | ||
152 | - defaults: { xtype: 'button', columnWidth: .20}, | 152 | + title: 'Constants', xtype:'tabpanel', //iconCls: 'tabs', |
153 | + enableTabScroll: true, tabPosition: 'bottom', | ||
154 | + defaults: { frame: true, border: false, plain: true, layout: 'column', autoScroll:true}, | ||
155 | + activeTab: 0, | ||
153 | id : 'calc_tab_const_id' | 156 | id : 'calc_tab_const_id' |
154 | }, { | 157 | }, { |
155 | title: 'Functions', xtype:'tabpanel', //iconCls: 'tabs', | 158 | title: 'Functions', xtype:'tabpanel', //iconCls: 'tabs', |
@@ -337,14 +340,50 @@ Ext.define('amdaUI.CalculatorUI', { | @@ -337,14 +340,50 @@ Ext.define('amdaUI.CalculatorUI', { | ||
337 | return btns; | 340 | return btns; |
338 | }, | 341 | }, |
339 | 342 | ||
340 | - createConstantBtns : function(){ | 343 | + createAllFunctionBtns : function() |
344 | + { | ||
345 | + this.createFunctionBtns('MathFunctions','Simple Maths'); | ||
346 | + this.createFunctionBtns('VectorFunctions','Vector Functions'); | ||
347 | + this.createFunctionBtns('TimeFunctions','Statistics'); | ||
348 | + this.createFunctionBtns('FunctionsSliding','Statistics/Sliding'); | ||
349 | + this.createFunctionBtns('AmdaFunctions','Special'); | ||
350 | + }, | ||
351 | + | ||
352 | + createAllConstantBtns : function() | ||
353 | + { | ||
354 | + this.createConstantBtns('Space','Planets Constants'); | ||
355 | + this.createConstantBtns('Physics','Physics Constants'); | ||
356 | + this.createConstantBtns('Units','Units Conversion'); | ||
357 | + }, | ||
358 | + | ||
359 | + createConstantBtns : function(item, tabTitle) | ||
360 | + { | ||
341 | var constTab = this.win.query('#calc_tab_const_id'); | 361 | var constTab = this.win.query('#calc_tab_const_id'); |
342 | - | 362 | + |
343 | if (constTab.length < 1) | 363 | if (constTab.length < 1) |
344 | - return; | ||
345 | - | 364 | + return; |
365 | + | ||
366 | + switch (item) | ||
367 | + { | ||
368 | + case 'Space' : | ||
369 | + amdaUI.CalculatorUI.constantStore.filter('kind','space'); | ||
370 | + break; | ||
371 | + case 'Physics' : | ||
372 | + amdaUI.CalculatorUI.constantStore.filter('kind','physics'); | ||
373 | + break; | ||
374 | + case 'Units' : | ||
375 | + amdaUI.CalculatorUI.constantStore.filter('kind','units'); | ||
376 | + break; | ||
377 | + } | ||
378 | + | ||
379 | + var crtTab = constTab[0].add( | ||
380 | + { | ||
381 | + title : tabTitle, | ||
382 | + defaults: { xtype: 'button', columnWidth: .20} | ||
383 | + }); | ||
384 | + | ||
346 | amdaUI.CalculatorUI.constantStore.each( function(c){ | 385 | amdaUI.CalculatorUI.constantStore.each( function(c){ |
347 | - constTab[0].add( | 386 | + crtTab.add( |
348 | { | 387 | { |
349 | text: c.get('name'), | 388 | text: c.get('name'), |
350 | tooltip: c.get('units') == '' ? c.get('info')+'<br/>'+c.get('value') : | 389 | tooltip: c.get('units') == '' ? c.get('info')+'<br/>'+c.get('value') : |
@@ -365,15 +404,10 @@ Ext.define('amdaUI.CalculatorUI', { | @@ -365,15 +404,10 @@ Ext.define('amdaUI.CalculatorUI', { | ||
365 | } | 404 | } |
366 | }); | 405 | }); |
367 | },this); | 406 | },this); |
368 | - }, | ||
369 | - | ||
370 | - createAllFunctionBtns : function() | ||
371 | - { | ||
372 | - this.createFunctionBtns('MathFunctions','Simple Maths'); | ||
373 | - this.createFunctionBtns('TimeFunctions','Statistics'); | ||
374 | - this.createFunctionBtns('FunctionsSliding','Statistics/Sliding'); | ||
375 | - this.createFunctionBtns('AmdaFunctions','Space Physics'); | ||
376 | - }, | 407 | + |
408 | + //clear filter | ||
409 | + amdaUI.CalculatorUI.constantStore.clearFilter(); | ||
410 | + }, | ||
377 | 411 | ||
378 | createFunctionBtns : function(item, tabTitle) | 412 | createFunctionBtns : function(item, tabTitle) |
379 | { | 413 | { |
@@ -396,6 +430,9 @@ Ext.define('amdaUI.CalculatorUI', { | @@ -396,6 +430,9 @@ Ext.define('amdaUI.CalculatorUI', { | ||
396 | case 'FunctionsSliding' : | 430 | case 'FunctionsSliding' : |
397 | amdaUI.CalculatorUI.functionStore.filter('kind','sliding'); | 431 | amdaUI.CalculatorUI.functionStore.filter('kind','sliding'); |
398 | break; | 432 | break; |
433 | + case 'VectorFunctions' : | ||
434 | + amdaUI.CalculatorUI.functionStore.filter('kind','vector'); | ||
435 | + break; | ||
399 | } | 436 | } |
400 | 437 | ||
401 | var crtTab = funcTab[0].add( | 438 | var crtTab = funcTab[0].add( |