[20498] | 1 | Index: ../trunk-jpl/src/m/plot/plot_unit.js
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/plot/plot_unit.js (revision 19770)
|
---|
| 4 | +++ ../trunk-jpl/src/m/plot/plot_unit.js (revision 19771)
|
---|
| 5 | @@ -1,8 +1,8 @@
|
---|
| 6 | -function plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options,canvas,gl) {
|
---|
| 7 | +function plot_unit(md,data,options,canvas,gl) {
|
---|
| 8 | //PLOT_UNIT - unit plot, display data
|
---|
| 9 | //
|
---|
| 10 | // Usage:
|
---|
| 11 | - // plot_unit(x,y,z,elements,data,is2d,isplanet,datatype,options);
|
---|
| 12 | + // plot_unit(md,data,options,canvas,gl);
|
---|
| 13 | //
|
---|
| 14 | // See also: PLOTMODEL, PLOT_MANAGER
|
---|
| 15 |
|
---|
| 16 | @@ -17,11 +17,24 @@
|
---|
| 17 | var zmin,zmax;
|
---|
| 18 | var datamin,datamax;
|
---|
| 19 | var scale;
|
---|
| 20 | + //Process data and model
|
---|
| 21 | + var meshresults = processmesh(md,data,options);
|
---|
| 22 | + var x = meshresults[0];
|
---|
| 23 | + var y = meshresults[1];
|
---|
| 24 | + var z = meshresults[2];
|
---|
| 25 | + var elements = meshresults[3];
|
---|
| 26 | + var is2d = meshresults[4];
|
---|
| 27 | + var isplanet = meshresults[5];
|
---|
| 28 | +
|
---|
| 29 | + var dataresults = processdata(md,data,options);
|
---|
| 30 | + var data2 = dataresults[0];
|
---|
| 31 | + var datatype = dataresults[1];
|
---|
| 32 | //}}}
|
---|
| 33 |
|
---|
| 34 | //Initialize the buffer structure:
|
---|
| 35 | node = Node(gl,options);
|
---|
| 36 |
|
---|
| 37 | +
|
---|
| 38 | //Compute coordinates and data range:
|
---|
| 39 | xmin = ArrayMin(x);
|
---|
| 40 | xmax = ArrayMax(x);
|
---|
| 41 | Index: ../trunk-jpl/src/m/plot/plot_manager.js
|
---|
| 42 | ===================================================================
|
---|
| 43 | --- ../trunk-jpl/src/m/plot/plot_manager.js (revision 19770)
|
---|
| 44 | +++ ../trunk-jpl/src/m/plot/plot_manager.js (revision 19771)
|
---|
| 45 | @@ -15,6 +15,7 @@
|
---|
| 46 |
|
---|
| 47 | //standard plot: initialize open Gl for each canvas:
|
---|
| 48 | var canvas=document.getElementById(options.getfieldvalue('canvasid'));
|
---|
| 49 | + //$.("<canvas id='"+options.getfieldvalue('canvasid')+"' width=640 height=480></canvas>)").append("body");
|
---|
| 50 |
|
---|
| 51 | // Initialize the GL context:
|
---|
| 52 | var gl=initWebGL(canvas,options);
|
---|
| 53 | @@ -86,7 +87,7 @@
|
---|
| 54 | break;
|
---|
| 55 | case 'mesh':
|
---|
| 56 | //plot_mesh(md,options,nlines,ncols,i);
|
---|
| 57 | - plot_mesh(md.mesh.x,md.mesh.y,[0.0],md.mesh.elements,2,options,canvas,gl);
|
---|
| 58 | + plot_mesh(md,options,canvas,gl);
|
---|
| 59 | break;
|
---|
| 60 | case 'none':
|
---|
| 61 | if (!(options.exist('overlay'))){
|
---|
| 62 | @@ -208,21 +209,8 @@
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | if (typeof data !== 'string'){
|
---|
| 66 | - //process data and model
|
---|
| 67 | - var meshresults = processmesh(md,data,options);
|
---|
| 68 | - var x = meshresults[0];
|
---|
| 69 | - var y = meshresults[1];
|
---|
| 70 | - var z = meshresults[2];
|
---|
| 71 | - var elements = meshresults[3];
|
---|
| 72 | - var is2d = meshresults[4];
|
---|
| 73 | - var isplanet = meshresults[5];
|
---|
| 74 | -
|
---|
| 75 | - var dataresults = processdata(md,data,options);
|
---|
| 76 | - var data2 = dataresults[0];
|
---|
| 77 | - var datatype = dataresults[1];
|
---|
| 78 | -
|
---|
| 79 | //plot unit
|
---|
| 80 | - plot_unit(x,y,z,elements,data2,is2d,isplanet,datatype,options,canvas,gl);
|
---|
| 81 | + plot_unit(md,data,options,canvas,gl);
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | //apply all options
|
---|
| 85 | Index: ../trunk-jpl/src/m/plot/plot_mesh.js
|
---|
| 86 | ===================================================================
|
---|
| 87 | --- ../trunk-jpl/src/m/plot/plot_mesh.js (revision 19770)
|
---|
| 88 | +++ ../trunk-jpl/src/m/plot/plot_mesh.js (revision 19771)
|
---|
| 89 | @@ -1,6 +1,6 @@
|
---|
| 90 | -function plot_mesh(x,y,z,elements,datatype,options,canvas,gl) {
|
---|
| 91 | +function plot_mesh(md,options,canvas,gl) {
|
---|
| 92 | // Usage:
|
---|
| 93 | - // plot_mesh(md,options,nlines,ncols,i);
|
---|
| 94 | + // plot_mesh(md,options,canvas,gl);
|
---|
| 95 | //
|
---|
| 96 | // See also: PLOTMODEL
|
---|
| 97 |
|
---|
| 98 | @@ -14,6 +14,11 @@
|
---|
| 99 | var ymin,ymax;
|
---|
| 100 | var zmin,zmax;
|
---|
| 101 | var scale;
|
---|
| 102 | + //Process data and model
|
---|
| 103 | + var x = md.x;
|
---|
| 104 | + var y = md.y;
|
---|
| 105 | + var z = [0.0];
|
---|
| 106 | + var elements = md.elements;
|
---|
| 107 | //}}}
|
---|
| 108 |
|
---|
| 109 | //Initialize the buffer structure:
|
---|
| 110 | Index: ../trunk-jpl/src/m/plot/webgl.js
|
---|
| 111 | ===================================================================
|
---|
| 112 | --- ../trunk-jpl/src/m/plot/webgl.js (revision 19770)
|
---|
| 113 | +++ ../trunk-jpl/src/m/plot/webgl.js (revision 19771)
|
---|
| 114 | @@ -40,7 +40,7 @@
|
---|
| 115 | // Firefox
|
---|
| 116 | canvas.addEventListener("DOMMouseScroll", function (e) {MouseWheelHandler(e,canvas)}, false);
|
---|
| 117 | // Mobile
|
---|
| 118 | - //canvas.addEventListener("gesturechange", MousePinchHandler, false);
|
---|
| 119 | + canvas.addEventListener("gesturechange", MouseWheelHandler, false);
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | return gl;
|
---|
| 123 | @@ -232,7 +232,8 @@
|
---|
| 124 | function MouseWheelHandler(e,canvas) { //{{{
|
---|
| 125 | // prevent scrolling when over canvas
|
---|
| 126 | e.preventDefault();
|
---|
| 127 | - var delta = 1/10 * clamp((e.wheelDelta || -e.detail), -1, 1);
|
---|
| 128 | + var e = window.event || e; // old IE support
|
---|
| 129 | + var delta = 1/10 * clamp((e.scale || e.wheelDelta || -e.detail), -1, 1);
|
---|
| 130 | canvas.zoomFactor = canvas.zoomFactor + -delta * canvas.zoomFactor;
|
---|
| 131 | } //}}}
|
---|
| 132 | //}}}
|
---|