Changeset 20769
- Timestamp:
- 06/17/16 21:43:07 (9 years ago)
- Location:
- issm/trunk-jpl/src/m/plot
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/applyoptions.js
r20748 r20769 41 41 //Handle orientation {{{ 42 42 if (colorbarorientiation=='vertical') { //{{{ 43 ccanvasid = options.getfieldvalue('colorbar canvasid',options.getfieldvalue('canvasid')+'_colorbar');43 ccanvasid = options.getfieldvalue('colorbarid',options.getfieldvalue('canvasid')+'_colorbar'); 44 44 ccanvashtml = document.getElementById(ccanvasid); 45 45 cwidth = ccanvashtml.width*cwidthscale*options.getfieldvalue('colorbarwidth',1); … … 51 51 52 52 var cgradient = ccontext.createLinearGradient(0,cheightoffset/2,0,cheight); 53 var cmap = options.getfieldvalue('c map','jet');53 var cmap = options.getfieldvalue('colormap','jet'); 54 54 var colorbar = colorbars[cmap]; 55 55 for (var i=0; i < colorbar.length; i++) { … … 91 91 } //}}} 92 92 else { //colorbarorientiation=='horizontal' {{{ 93 ccanvasid = options.getfieldvalue('colorbar canvasid',options.getfieldvalue('canvasid')+'_colorbar');93 ccanvasid = options.getfieldvalue('colorbarid',options.getfieldvalue('canvasid')+'_colorbar'); 94 94 ccanvashtml = document.getElementById(ccanvasid); 95 95 cwidth = ccanvashtml.width*0.7*options.getfieldvalue('colorbarwidth',1); … … 101 101 102 102 var cgradient = ccontext.createLinearGradient(cwidth+cwidthoffset,0,cwidthoffset,0); 103 var cmap = options.getfieldvalue('c map','jet');103 var cmap = options.getfieldvalue('colormap','jet'); 104 104 var colorbar = colorbars[cmap]; 105 105 for (var i=0; i < colorbar.length; i++) { … … 159 159 tgradient = tcontext.createLinearGradient(0,0,0,256); 160 160 161 var cmap = options.getfieldvalue('c map','jet');161 var cmap = options.getfieldvalue('colormap','jet'); 162 162 var colorbar = colorbars[cmap]; 163 163 for (var i=0; i < colorbar.length; i++) { -
issm/trunk-jpl/src/m/plot/plot_mesh.js
r20748 r20769 64 64 node["shaderName"] = "colored"; 65 65 node["shader"] = gl["shaders"][node["shaderName"]]["program"]; 66 node["lineWidth"] = options.getfieldvalue('linewidth',1); 66 67 node["scale"] = [scale, scale, scale * matrixscale]; 67 68 node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (2 / scale)]; … … 77 78 78 79 //retrieve some options 79 var linewidth=options.getfieldvalue('linewidth',1); 80 var edgecolor=new RGBColor(options.getfieldvalue('edgecolor','black')); 80 var edgecolor = new RGBColor(options.getfieldvalue('edgecolor','black')); 81 81 if (edgecolor.ok) edgecolor = [edgecolor.r/255.0, edgecolor.g/255.0, edgecolor.b/255.0, 1.0]; 82 82 else throw Error(sprintf("s%s%s\n","initWebGL error message: cound not find out edgecolor color for curent canvas ",canvas)); -
issm/trunk-jpl/src/m/plot/plot_overlay.js
r20748 r20769 67 67 node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (2 / scale)]; 68 68 node["modelMatrix"] = recalculateModelMatrix(node); 69 node["texture"] = initTexture(gl,options.getfieldvalue(' image'));69 node["texture"] = initTexture(gl,options.getfieldvalue('overlay_image')); 70 70 node["alpha"] = options.getfieldvalue('outeralpha',1.0); 71 71 node["drawOrder"] = 1; -
issm/trunk-jpl/src/m/plot/plot_quiver.js
r20748 r20769 66 66 node["shaderName"] = "colored"; 67 67 node["shader"] = gl["shaders"][node["shaderName"]]["program"]; 68 node["lineWidth"] = options.getfieldvalue('linewidth',1); 68 69 node["scale"] = [scale, scale, scale * matrixscale]; 69 70 node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (2 / scale)]; … … 80 81 81 82 //retrieve some options 82 var linewidth=options.getfieldvalue('linewidth',1);83 84 83 var edgecolor=new RGBColor(options.getfieldvalue('edgecolor','black')); 85 84 if (edgecolor.ok) edgecolor = [edgecolor.r/255.0, edgecolor.g/255.0, edgecolor.b/255.0, 1.0]; … … 98 97 var magnitude; 99 98 var color = edgecolor; 99 var scaling = options.getfieldvalue('scaling',1); 100 100 for(var i = 0; i < x.length; i++){ 101 101 //Check for NaN values and remove from indices array as necessary, but preserve vertex array spacing … … 111 111 112 112 xyz2 = vec3.fromValues(vx[i], vy[i], 0.0); 113 magnitude = 1000.0 ; //mesh resolution113 magnitude = 1000.0*scaling; //mesh resolution 114 114 vec3.normalize(direction, xyz2); 115 115 vec3.scale(direction, direction, magnitude); -
issm/trunk-jpl/src/m/plot/plotdoc.js
r20766 r20769 7 7 //TODO: Standardize image to overlay_image, heightscale to scaling, colorbarfontsize/color, clarify innermask/outermask, edgecolor implementation, check colormap, 8 8 9 console.log(' WARNING: documentation may not reflect entire implementation as of June 16 2016');9 console.log(' WARNING: starred methods (*) are experimental and not guarenteed to be stable'); 10 10 console.log(' Plot usage: plotmodel(model,varargin)'); 11 11 console.log(' Options: '); … … 16 16 console.log(' - "mesh": draw mesh using trisurf'); 17 17 console.log(' - "quiver": quiver plot'); 18 console.log(' "caxis": modify colorbar range. (array of type [a b] where b>=a)'); 19 console.log(' "backgroundcolor": plot background color. (default is "w")'); 20 console.log(' "colorbar": add colorbar (string "on" or "off")'); 21 console.log(' "colorbartitle": colorbar title (string)'); 18 console.log(' "caxis": modify colorbar range. (array of type [a, b] where b>=a)'); 19 console.log(' "backgroundcolor": plot background color. (default "lightcyan", ex: "green","blue")'); 20 console.log(' "colorbar": add colorbar (default "off", ex: "on", "off")'); 21 console.log(' "colorbarid": colorbar canvas id (string)'); 22 console.log(' "colorbartitle": colorbar title (string)'); 23 console.log(' "colorbarnticks": number of colorbar ticks (default 6, ex: 2, 10)'); 24 console.log(' "colorbarprecision": colorbar label digit precision (default 3, ex: 1, 4)'); 25 console.log(' "colorbarorientation": oreintation of colorbar (default "vertical", ex: "horizontal")'); 26 console.log(' "colorbarfontsize": specify colorbar font size (default 1, ex: 14, 22)'); 27 console.log(' "colorbarfontcolor": specify colorbar font color (default "black", ex: "green","blue")'); 22 28 console.log(' "colorbarwidth": multiplier (default 1) to the default width colorbar'); 23 29 console.log(' "colorbarheight": multiplier (default 1) to the default height colorbar'); 24 console.log(' "colormap": same as standard matlab option ("jet","hsv","cool","spring","gray","Ala","Rignot",...)'); 25 console.log(' "edgecolor": same as standard matlab option EdgeColor (color name: "black" or RGB array: [0.5 0.2 0.8])'); 26 console.log(' "view": same as standard matlab option (ex: 2, 3 or [90 180]'); 27 console.log(' "xlim": same as standard matlab option (ex: [0 500])'); 28 console.log(' "ylim": same as standard matlab option'); 29 console.log(' "zlim": same as standard matlab option'); 30 console.log(' "xlabel": same as standard matlab option (ex:"km")'); 31 console.log(' "overlay": yes or no. This will overlay a radar amplitude image behind'); 32 console.log(' "overlay_image": path to overlay image. provide overlay_xlim, overlay_ylim, overlay_xposting and overlay_yposting options also'); 33 console.log(' "alpha": transparency coefficient (the higher, the more transparent). Default is 1.5'); 34 console.log(' "scaling": scaling factor used by quiver plots. Default is 0.4'); 35 console.log(' "linewidth": line width for expconsole.log plot (use a cell of strings if more than one)'); 30 console.log(' "colormap": same as standard matlab option (default "jet", ex: "hsv","cool","spring","gray","Ala","Rignot",...)'); 31 console.log(' "edgecolor": same as standard matlab option EdgeColor (default "black", ex: color name: "blue" or RGB array: [0.5, 0.2, 0.8])'); 32 console.log(' "view": initial azimuth and elevation angles for camera (default [0,90], ex: [90, 180]'); 33 console.log(' "zoom": initial camera zoom as a percentage of default (default 1, ex: 1.5, 0.01)'); 34 console.log(' "centeroffset": initial camera offset from model center (default [0,0,0.0], ex: [-2, 1.5, 0.01])'); 35 console.log(' "xlim": x coordinates to fit inside camera (ex: [0, 500])'); 36 console.log(' "ylim": y coordinates to fit inside camera (ex: [0, 500])'); 37 console.log(' "zlim": z coordinates to fit inside camera (ex: [0, 500])'); 38 console.log(' "azlim": azimuth view limits (ex: [0, 180])'); 39 console.log(' "ellim": elevation view limits (ex: [-90, 90])'); 40 console.log(' "zoomlim": zoom view limits (ex: [0.05, 10])'); 41 console.log(' "displayview": print view value to console'); 42 console.log(' "displayzoom": print zoom value to console'); 43 console.log(' "controlsensitivity": sensitivty of view/zoom changes as a percentage of default (default 1, ex: 0.5, 2.75)'); 44 console.log(' "2d": renders orthographic camera with view set to [0, 90] (default "off", ex: "on", "off")'); 45 console.log(' "moviefps": frames per second when displaying transient runs (default 5, ex: 1, 10)'); 46 console.log(' "overlay": overlay a radar amplitude image behind (default "off", ex: "on", "off")'); 47 console.log(' "overlay_image": path to overlay image (default "off", ex: "on", "off")'); 48 console.log(' "alpha": transparency coefficient 0.0 to 1.0, the lower, the more transparent. (default 1.0, ex: 0.5, 0.25)'); 49 console.log(' "heightscale": scaling factor to accentuate height. (default 1, ex: 0.5, 100)'); 50 console.log(' "scaling*": scaling factor used by quiver plots. Default is 0.4'); 51 console.log(' "linewidth*": line width for mesh, quiver, and contour plots, currently limited by WebGL to 1. (default 1, ex: 2, 5)'); 52 console.log(' "cloud*": plot a cloud of points, given a flat array of 3d coordinates (ex: [0.0, 0.0, 0.0, 1.0, 1.0, 1.0])'); 53 console.log(' "expdisp*": plot exp file on top of a data plot. provide exp file as an argument (use a cell of strings if more than one)'); 54 console.log(' "textlabels*": plot text labels rendered in 3d space, using an array of text/coordinate pairs (ex: [{"pos":[0.0,0.0,0.0],"text":"origin"}])'); 55 console.log(' "outermask*": Special mask that colors all parts of a overlay mesh below a height a certain color. provide outermaskheight and outermaskcolor options also (default "off", ex: "on", "off")'); 56 console.log(' "innermask*": Special mask that colors all parts of a data mesh below a height a certain color. provide innermaskheight and innermaskcolor options also (default "off", ex: "on", "off")'); 36 57 console.log(' "mask": list of flags of size numberofnodes or numberofelements. Only "true" values are plotted '); 37 58 console.log(' "log": value of log'); -
issm/trunk-jpl/src/m/plot/webgl.js
r20586 r20769 4 4 //Initialize open Gl for each canvas, if needed: 5 5 var canvas=document.getElementById(options.getfieldvalue('canvasid')); 6 if (!canvas) {7 canvas = $('<div><canvas id="'+options.getfieldvalue('canvasid')+'" width="'+options.getfieldvalue('canvassize',480)+'" height="'+options.getfieldvalue('canvassize',480)+'"></canvas></div>)')8 canvas.css({'height':String(options.getfieldvalue('canvassize',480)+'px')});9 canvas.appendTo('body');10 }11 6 if (!canvas.initialized) { 12 7 canvas.gl = initWebGL(canvas,options); … … 51 46 //TODO:Group variables in objects for organization and naming 52 47 canvas.gl = gl; 53 canvas.zoomBounds = options.getfieldvalue('zoom bounds',[0.001,100.0]);54 canvas.zoomFactor = clamp(options.getfieldvalue('zoom factor',1.0), canvas.zoomBounds[0], canvas.zoomBounds[1]);48 canvas.zoomBounds = options.getfieldvalue('zoomlim',[0.001,100.0]); 49 canvas.zoomFactor = clamp(options.getfieldvalue('zoom',1.0), canvas.zoomBounds[0], canvas.zoomBounds[1]); 55 50 canvas.zoomLast = canvas.zoomFactor; 56 51 canvas.cameraMatrix = mat4.create(); 57 52 canvas.translation = options.getfieldvalue('centeroffset',[0,0,0.0]); 58 canvas.rotationAzimuthBounds = options.getfieldvalue('az imuthbounds',[0,360]);59 canvas.rotationElevationBounds = options.getfieldvalue('el evationbounds',[-180,180]);53 canvas.rotationAzimuthBounds = options.getfieldvalue('azlim',[0,360]); 54 canvas.rotationElevationBounds = options.getfieldvalue('ellim',[-180,180]); 60 55 canvas.rotationDefault = options.getfieldvalue('view',[0,90]); //0 azimuth - up is north, 90 elevation - looking straight down 61 56 canvas.rotation = canvas.rotationDefault; … … 141 136 useIndexBuffer:true, 142 137 alpha:1.0, 138 lineWidth:1.0, 143 139 disableDepthTest:false, 144 140 enableCullFace:false, … … 454 450 gl.disable(gl.DEPTH_TEST); 455 451 } 452 gl.lineWidth(node["lineWidth"]); 456 453 gl.blendFunc (gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); 457 454 if (node["useIndexBuffer"] == true) {
Note:
See TracChangeset
for help on using the changeset viewer.