diff --git a/generic_data/defaultValues.json b/generic_data/defaultValues.json index 79669cf..f213d51 100644 --- a/generic_data/defaultValues.json +++ b/generic_data/defaultValues.json @@ -21,7 +21,7 @@ }, "font":{ "name":"sans-serif", - "size":"8" + "size":8 }, "layout":{ "type":"vertical", @@ -41,7 +41,7 @@ }, "font":{ "name":"sans-serif", - "size":"8" + "size":8 }, "backgroundColor":"none", "status":{ @@ -53,12 +53,12 @@ "scale":"linear", "tickPosition":"outwards", "color":"#000000", - "thickness":"1", + "thickness":1, "legend":{ "color":"#000000", "font":{ "name":"sans-serif", - "size":"8" + "size":8 } }, "timeFormat":"dd/mm/yy", @@ -96,7 +96,7 @@ }, "font":{ "name":"sans-serif", - "size":"8" + "size":8 } }, "intervaltick":{ @@ -109,7 +109,7 @@ }, "font":{ "name":"sans-serif", - "size":"8" + "size":8 } }, "errorbar":{ @@ -158,7 +158,7 @@ "color":"#000000", "font":{ "name":"sans-serif", - "size":"8" + "size":8 } } }, @@ -176,7 +176,7 @@ "yRelative":true, "align":"left", "color":"#000000", - "font":{"name":"sans-serif","size":"8"} + "font":{"name":"sans-serif","size":8} }, "curves":{ "line":{ diff --git a/generic_data/defaultValuesConfig.json b/generic_data/defaultValuesConfig.json index 22ac7bd..05b1576 100644 --- a/generic_data/defaultValuesConfig.json +++ b/generic_data/defaultValuesConfig.json @@ -115,15 +115,43 @@ ], "availableColorMaps": [ - { "key": "0", "value": "Blue Red" }, - { "key": "1", "value": "Default" }, - { "key": "2", "value": "Blue Yellow" }, - { "key": "3", "value": "Grayscale" }, - { "key": "4", "value": "AMDA Default" }, - { "key": "5", "value": "GeoWhite" }, - { "key": "6", "value": "GeoBlack" }, - { "key": "7", "value": "Violet Yellow" }, - { "key": "8", "value": "Red Blue 4" } + { "key": "0", "value": "Blue Red", "svgFile":"cmap1_blue_red.svg" }, + { "key": "1", "value": "Default", "svgFile":"cmap1_default.svg"}, + { "key": "2", "value": "Blue Yellow", "svgFile":"cmap1_blue_yellow.svg" }, + { "key": "3", "value": "Grayscale", "svgFile":"cmap1_gray.svg" }, + { "key": "4", "value": "AMDA Default", "svgFile":"cmap1_amda_default.svg" }, + { "key": "5", "value": "GeoWhite", "svgFile":"cmap1_geowhite.svg" }, + { "key": "6", "value": "GeoBlack", "svgFile":"cmap1_geoblack.svg" }, + { "key": "7", "value": "Violet Yellow", "svgFile":"cmap1_dark_violet_yellow.svg" }, + { "key": "8", "value": "Red Blue 4", "svgFile":"cmap1_red_blue.svg" }, + { "key": "9", "value": "Acton", "svgFile":"cmap1_acton.svg" }, + { "key": "11", "value": "Bamako", "svgFile":"cmap1_bamako.svg" }, + { "key": "12", "value": "Batlow", "svgFile":"cmap1_batlow.svg" }, + { "key": "13", "value": "BatlowK", "svgFile":"cmap1_batlowK.svg" }, + { "key": "14", "value": "BatlowW", "svgFile":"cmap1_batlowW.svg" }, + { "key": "15", "value": "Bilbao", "svgFile":"cmap1_bilbao.svg" }, + { "key": "16", "value": "Buda", "svgFile":"cmap1_buda.svg" }, + { "key": "17", "value": "Davos", "svgFile":"cmap1_davos.svg" }, + { "key": "18", "value": "Devon", "svgFile":"cmap1_devon.svg" }, + { "key": "19", "value": "GrayC", "svgFile":"cmap1_grayC.svg" }, + { "key": "20", "value": "Hawaii", "svgFile":"cmap1_hawaii.svg" }, + { "key": "21", "value": "Imola", "svgFile":"cmap1_imola.svg" }, + { "key": "22", "value": "Lajolla", "svgFile":"cmap1_lajolla.svg" }, + { "key": "23", "value": "Lapaz", "svgFile":"cmap1_lapaz.svg" }, + { "key": "24", "value": "Nuuk", "svgFile":"cmap1_nuuk.svg" }, + { "key": "25", "value": "Oslo", "svgFile":"cmap1_oslo.svg" }, + { "key": "26", "value": "Tokyo", "svgFile":"cmap1_tokyo.svg" }, + { "key": "27", "value": "Turku", "svgFile":"cmap1_turku.svg" }, + + { "key": "28", "value": "Bam", "svgFile":"cmap1_div_bam.svg" }, + { "key": "29", "value": "Berlin", "svgFile":"cmap1_div_berlin.svg" }, + { "key": "30", "value": "Broc", "svgFile":"cmap1_div_broc.svg" }, + { "key": "31", "value": "Cork", "svgFile":"cmap1_div_cork.svg" }, + { "key": "32", "value": "Lisbon", "svgFile":"cmap1_div_lisbon.svg" }, + { "key": "33", "value": "Roma", "svgFile":"cmap1_div_roma.svg" }, + { "key": "34", "value": "Tofino", "svgFile":"cmap1_div_tofino.svg" }, + { "key": "35", "value": "Vanimo", "svgFile":"cmap1_div_vanimo.svg" }, + { "key": "36", "value": "vik", "svgFile":"cmap1_div_vik.svg" } ], "availableColors": [ diff --git a/generic_data/defaultValuesLinks.json b/generic_data/defaultValuesLinks.json index 699d85e..aa67bcf 100644 --- a/generic_data/defaultValuesLinks.json +++ b/generic_data/defaultValuesLinks.json @@ -103,7 +103,7 @@ }, "plot.axis.colorMap": { - "type":"combobox", + "type":"colormap", "store":"availableColorMaps" }, "plot.serie.lines.style": diff --git a/js/app/views/ColorMap.js b/js/app/views/ColorMap.js new file mode 100644 index 0000000..3fa037f --- /dev/null +++ b/js/app/views/ColorMap.js @@ -0,0 +1,72 @@ +Ext.define('amdaUI.ColorMap', { + extend: 'Ext.form.ComboBox', + alias: 'widget.colormap', + + + data : [], + + constructor:function(config){ + this.getData(); + this.init(config); + this.callParent(); + }, + + getData:function(){ + var me = this; + amdaDefaultConfigs.availableColorMaps.forEach(function(color){ + me.data.push({key:color.key,name:color.value, iconUrl:'generic_data/colormaps/'+ color.svgFile}) + }); + }, + init: function(config){ + var me = this; + var size = (typeof config !== "undefined" && config.size) ? config.size : '12'; + Ext.apply(this,{ + xtype:'combobox', + name: (typeof config !== "undefined" && config.name) ? config.name:null, + fieldLabel: (typeof config !== "undefined" && config.fieldLabel) ? config.fieldLabel:null, + store: new Ext.data.Store({ + fields: ['key','name', 'iconUrl'], + data: me.data + }), + displayField: 'name', + valueField: 'key', + tpl: '<tpl for="."><div class="x-boundlist-item"><span data-qtip="{name}"> \ + <img src="{iconUrl}" class="svg-icon" style="height:'+size+'px;"> \ + </span>\ + </div></tpl>', + editable: false, + queryMode: 'local', + listeners: { + change: function (combo, newValue, oldValue, eOpts) { + var iconUrl=""; + me.data.forEach(function(colorData){ + if(colorData.key == newValue ){ + iconUrl= colorData.iconUrl; + } + }); + combo.inputEl.setStyle('background-image', 'url(' + iconUrl + ')'); + combo.inputEl.setStyle('background-size', '100%'); + combo.inputEl.setStyle('background-repeat', 'no-repeat'); + combo.inputEl.setStyle('background-position', 'center'); + combo.inputEl.setStyle('font-size', '0'); + if(typeof me.up().object !== 'undefined') + me.up().object.set('axis-color-map', newValue); + }, + click: { + element: 'el', + fn: function(e,t) { + var me = t, + text = me.getAttribute('amda_clicktip'); + if (text) { + e.preventDefault(); + AmdaAction.getInfo({name : text}, function(res,e) { + if (res.success) myDesktopApp.infoMsg(res.result); + }); + } + } + }, + scope:this + }, + }) + } +}); \ No newline at end of file diff --git a/js/app/views/DefaultTreeGrid.js b/js/app/views/DefaultTreeGrid.js index ef85755..5fca486 100644 --- a/js/app/views/DefaultTreeGrid.js +++ b/js/app/views/DefaultTreeGrid.js @@ -6,7 +6,8 @@ Ext.define('amdaUI.DefaultTreeGrid', { 'Ext.grid.*', 'Ext.tree.*', 'amdaModel.DefaultValuesModel', - 'amdaUI.ColorPicker' + 'amdaUI.ColorPicker', + 'amdaUI.ColorMap' ], xtype: 'tree-grid', @@ -25,6 +26,17 @@ Ext.define('amdaUI.DefaultTreeGrid', { this.callParent(); }, + getFullParentName:function(record){ + var parentNode = record; + var parameter =""; + while (parentNode.parentNode) { + parentNode = parentNode.parentNode; + if(parentNode.get('parameter')) + parameter = parentNode.get('parameter')+'.'.concat(parameter); + } + return parameter; + }, + extractData : function(node=null,parentName = '',) { var me =this; if(node === null){ @@ -117,14 +129,8 @@ Ext.define('amdaUI.DefaultTreeGrid', { // Do this to avoid memory leaks editors.remove(editor); } - var parentNode = record; - var parameter =""; - while (parentNode.parentNode) { - parentNode = parentNode.parentNode; - if(parentNode.get('parameter')) - parameter = parentNode.get('parameter')+'.'.concat(parameter); - } - option = amdaDefaultOptions[parameter+record.get('parameter')]; + + var option = amdaDefaultOptions[me.getFullParentName(record)+record.get('parameter')]; var value = record.get('value'); var store = null; @@ -143,7 +149,7 @@ Ext.define('amdaUI.DefaultTreeGrid', { } else if(value === true || value === false){ fieldType = 'combobox' - store= [[true, 'true'], [false, 'false']]; + store= [[true, 'True'], [false, 'False']]; } else{ fieldType = isNaN(parseFloat(record.get('value'))) ? 'textfield' : 'numberfield'; @@ -164,15 +170,34 @@ Ext.define('amdaUI.DefaultTreeGrid', { sortable: true, dataIndex: 'value', align: 'center', - renderer: function(value, meta) { + renderer: function(value, meta,record) { if (me.isHexCode(value)){ value = value.substring(1, 7); return '<div style="background-color:#' + value + '; margin-left: auto; \ margin-right: auto;width:15px;height:15px;"></div>'; } - else{ - return value; + if( record.get('parameter') === 'colorMap'){ + var iconUrl=""; + var colorMap = Ext.create('amdaUI.ColorMap'); + colorMap.data.forEach(function(colorData){ + if(colorData.key == value ){ + iconUrl= colorData.iconUrl; + } + }); + return '<div style="background-image:url(' + iconUrl + ');background-size:100%;\ + background-repeat:no-repeat; background-position:center; \ + font-size:0;width:90px;height:15px;"></div>'; + } + + var option = amdaDefaultOptions[me.getFullParentName(record)+record.get('parameter')]; + + if(option){ + Ext.each(option.store, function(line){ + if (line.key === value) + value = line.value; + }) } + return value; }, },{ text: 'Reset', diff --git a/js/app/views/PlotComponents/PlotColorAxisForm.js b/js/app/views/PlotComponents/PlotColorAxisForm.js index 7fd4646..f9d7488 100644 --- a/js/app/views/PlotComponents/PlotColorAxisForm.js +++ b/js/app/views/PlotComponents/PlotColorAxisForm.js @@ -10,67 +10,15 @@ Ext.define('amdaPlotComp.PlotColorAxisForm', { extend: 'amdaPlotComp.PlotBaseAxisForm', + + requires:['amdaUI.ColorMap'], showColorOption : false, showTickGridOptions : false, getFormItems: function() { - var data = []; - amdaDefaultConfigs.availableColorMaps.forEach(function(color){ - data.push({key:color.key,name:color.value, iconUrl:'generic_data/colormaps/'+ color.svgFile}) - }); - - var combo = new Ext.form.ComboBox({ - name: 'axis-color-map', - fieldLabel: 'Color Map <img amda_clicktip="colourMaps" style="vertical-align:bottom" src="js/resources/images/16x16/info_mini.png"', - store: new Ext.data.Store({ - fields: ['key','name', 'iconUrl'], - data: data - }), - displayField: 'name', - valueField: 'key', - tpl: '<tpl for="."><div class="x-boundlist-item"><span data-qtip="{name}"> \ - <img src="{iconUrl}" class="svg-icon" style="height: 26px;"> \ - </span>\ - </div></tpl>', - editable: false, - queryMode: 'local', - listeners: { - change: function (combo, newValue, oldValue, eOpts) { - var iconUrl=""; - data.forEach(function(colorData){ - if(colorData.key == newValue ){ - iconUrl= colorData.iconUrl; - } - }); - combo.inputEl.setStyle('background-image', 'url(' + iconUrl + ')'); - combo.inputEl.setStyle('background-size', '100%'); - combo.inputEl.setStyle('background-repeat', 'no-repeat'); - combo.inputEl.setStyle('background-position', 'center'); - combo.inputEl.setStyle('font-size', '0'); - - this.object.set('axis-color-map', newValue); - }, - click: { - element: 'el', - fn: function(e,t) { - var me = t, - text = me.getAttribute('amda_clicktip'); - if (text) { - e.preventDefault(); - AmdaAction.getInfo({name : text}, function(res,e) { - if (res.success) myDesktopApp.infoMsg(res.result); - }); - } - } - }, - scope:this - }, - }); - - - var timeItems = [combo, + var timeItems = [Ext.create('amdaUI.ColorMap',{name: 'axis-color-map',fieldLabel: 'Color Map <img amda_clicktip="colourMaps" style="vertical-align:bottom" src="js/resources/images/16x16/info_mini.png"', size:26}), this.addColorsPicker('axis-color-minval', 'Min. Val. Color', amdaDefaultConfigs.availableColorsNew, 'none'), this.addColorsPicker('axis-color-maxval', 'Max. Val. Color', amdaDefaultConfigs.availableColorsNew, 'none') ]; -- libgit2 0.21.2