DAS  3.1.6 - 18/09/2017
Functions | Variables
2DPlot.c File Reference

2DPlot window Creation and callbacks for the 2DPlot window that plot the parameters in the DAS LOG files. More...

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <math.h>
#include <direct.h>
#include <fcntl.h>
#include <sys/stat.h>
#include "mgui.h"
#include "DAS_Spatram.h"
#include "dcl.h"
#include "dil.h"
#include "bil.h"
#include "DOAS.h"
+ Include dependency graph for 2DPlot.c:

Go to the source code of this file.

Functions

void D2D_AreaInputTemp (MOBJECT obj, MEvent *pe, void *a_data)
 
void D2D_AssignOrigin (MOBJECT obj)
 
int D2D_findmaxmin (float plotmat[], int xinf, int xsup, int yinf, int ysup)
 
void D2D_PlotAxis (MOBJECT ob, int sx, int sy, int ex, int ey, MTColor col)
 
void D2D_PlotGrid (MOBJECT ob, MIMAGE mim, int sx, int sy, int ex, int ey, int nx, int ny)
 
void D2D_PlotSpectrum (MOBJECT obj, float plotmat[], int idx, int idy, unsigned long pe[], double costx, double costy, int min, int max, int ox, int oy)
 
void D2D_PoslblX (MOBJECT lbl, int xs, int xe, int xc)
 
void D2D_PoslblY (float l, float h)
 
int D2D_X2Counts (int x)
 
double D2D_Y2Counts (int y)
 
int DrawAreaTempCB (MOBJECT obj, MEvent *pexp, void *a_data)
 
MOBJECT MDCreate_2DPlot (char *title)
 2DPlot Panel. Procedure that build the shell for the plotting of the LOG files. More...
 
int RefreshDrArea (MOBJECT obj)
 Redraw the draw arwa in a 2D Plot window. More...
 
void ToggleButtCB (MOBJECT p, MVALUE od, void *ad)
 

Variables

bil BIL
 
dil DIL
 
palette DPAL
 
mtcl MTCL
 
omutemp OMUTEMP
 

Detailed Description

2DPlot window Creation and callbacks for the 2DPlot window that plot the parameters in the DAS LOG files.

Author
Daniele Bortoli (20/07/2004)

Definition in file 2DPlot.c.

Function Documentation

§ D2D_AreaInputTemp()

void D2D_AreaInputTemp ( MOBJECT  obj,
MEvent pe,
void *  a_data 
)

Definition at line 66 of file 2DPlot.c.

References D2D_X2Counts(), D2D_Y2Counts(), E_BUTTON_PRESS, E_BUTTON_RELEASE, E_MOTION, E_SELECT, E_WINDOW_ENTER, E_WINDOW_EXIT, omutemp::LBL_X, omutemp::LBL_Y, omutemp::locx, omutemp::locy, MDrawXorBox(), MDrawXorLine(), MObjectGetHeight(), MObjectGetWidth(), MObjectSetText(), MObjectShell(), MEvent::mouse, p, MMouseEvent::state, MEvent::type, MMouseEvent::x, and MMouseEvent::y.

Referenced by MDCreate_2DPlot().

67 {
68  static int x1, y1, x2, y2, dx, dy;
69  static int xp1, xp2, xp3, yp1, yp2, yp3, p, pol;
70  char buff[128];
71  static int s, f;
72 // int c;
73  MOBJECT shell;
74 
75  switch (pe->type)
76  {
77 
78  case E_SELECT:
79 
80  break;
81  case E_WINDOW_EXIT:
82 
83  break;
84  case E_BUTTON_PRESS:
85  break;
86  case E_WINDOW_ENTER:
87  case E_MOTION:
88  shell = MObjectShell(obj);
89  // Drag di un vertice del poligono
90  if((pe->mouse.state & Button1Mask) && pol)
91  {
92  if(pol == 2)
93  {
94  MDrawXorLine(obj, xp1, yp1, xp2, yp2);
95  MDrawXorLine(obj, xp1, yp1, xp3, yp3);
96  }
97  pol = 2;
98  xp1 = pe->mouse.x;
99  yp1 = pe->mouse.y;
100 
101  }
102  else
103  {
104  if((pe->mouse.state & Button1Mask) && x1 > 0 && f)
105  {
106  /*
107  * Erase the old line and draw the new one
108  * while dragging the mouse (draw in Xor mode)
109  */
110  if(f == 2)
111  MDrawXorBox(obj, x1, y1, (x2 - x1), (y2 - y1));
112  f = 2;
113  MDrawXorBox(obj, x1, y1, (pe->mouse.x - x1), (pe->mouse.y - y1));
114  }
115  // Drag the box
116  if((pe->mouse.state & Button3Mask) && f == 4)
117  {
118  // Clear previous box
119  MDrawXorBox(obj, x1, y1, (x2 - x1), (y2 - y1));
120  x1 += (pe->mouse.x - dx); x2 += (pe->mouse.x - dx);
121  y1 += (pe->mouse.y - dy); y2 += (pe->mouse.y - dy);
122  MDrawXorBox(obj, x1, y1, (x2 - x1), (y2 - y1));
123  dx = pe->mouse.x;
124  dy = pe->mouse.y;
125  }
126  else
127  {
128 // MDrawXorBox(obj, x2 - 25, y2 - 25, 50, 50);
129 
130  x2 = pe->mouse.x;
131 // BIL.BLENS.LocX = x2 / (int) BIL.BLENS.Pix;
132  y2 = pe->mouse.y;
133 // BIL.BLENS.LocY = y2 / (int) BIL.BLENS.Pix;
134 
135 // MDrawXorBox(obj, LocX[s] - 25, LocY[s] - 25, 50, 50);
136  if(x2 >= 0 && x2 < (int) MObjectGetWidth(obj) &&
137  y2 >= 0 && y2 < (int) MObjectGetHeight(obj) )
138  {
139  OMUTEMP.locx = (float)D2D_X2Counts(x2);
140  sprintf(buff, "%.1f", OMUTEMP.locx);
142 
143  OMUTEMP.locy = (float)D2D_Y2Counts(y2);
144  sprintf(buff, "%.1f", OMUTEMP.locy);
146 
147  }
148 
149  }
150  }
151 
152  break;
153  case E_BUTTON_RELEASE:
154  break;
155  }
156 }
#define E_BUTTON_RELEASE
Definition: Mguidefs.h:276
float locy
Definition: bildef.h:116
void MDrawXorLine(MOBJECT p, int x1, int y1, int x2, int y2)
double D2D_Y2Counts(int y)
Definition: 2DPlot.c:53
MOBJECT LBL_X
Definition: bildef.h:115
int MObjectGetHeight(MOBJECT obj)
void MObjectSetText(MOBJECT obj, const char *text)
int D2D_X2Counts(int x)
Definition: 2DPlot.c:41
MMouseEvent mouse
Definition: Mguidefs.h:832
MOBJECT LBL_Y
Definition: bildef.h:115
int MObjectGetWidth(MOBJECT obj)
float locx
Definition: bildef.h:116
MOBJECT MObjectShell(MOBJECT obj)
#define E_BUTTON_PRESS
Definition: Mguidefs.h:275
omutemp OMUTEMP
Definition: 2DPlot.c:29
void MDrawXorBox(MOBJECT p, int x, int y, int w, int h)
static double p
Definition: SOLPOS.C:131
void * MOBJECT
Definition: Mguidefs.h:192
#define E_SELECT
Definition: Mguidefs.h:287
unsigned int state
buttons and key modifiers mask
Definition: Mguidefs.h:620
#define E_MOTION
Definition: Mguidefs.h:277
#define E_WINDOW_ENTER
Definition: Mguidefs.h:278
int type
Definition: Mguidefs.h:829
int x
pointer x, y coordinates in event window
Definition: Mguidefs.h:616
#define E_WINDOW_EXIT
Definition: Mguidefs.h:279
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ D2D_AssignOrigin()

void D2D_AssignOrigin ( MOBJECT  obj)

Definition at line 161 of file 2DPlot.c.

References omutemp::eX, omutemp::eY, omutemp::hsize, MObjectGetHeight(), MObjectGetWidth(), omutemp::oX, omutemp::oY, and omutemp::wsize.

Referenced by RefreshDrArea().

162 {
163 
166 
167  OMUTEMP.oX = 10; //Origine asse X
168  OMUTEMP.oY = OMUTEMP.hsize - 10; //Origine asse Y
169  OMUTEMP.eX = OMUTEMP.wsize - 10; //Fine asse X
170  OMUTEMP.eY = 10; //Fine asse Y
171 
172 
173 }
int MObjectGetHeight(MOBJECT obj)
int wsize
Definition: bildef.h:111
int MObjectGetWidth(MOBJECT obj)
int eY
Definition: bildef.h:112
omutemp OMUTEMP
Definition: 2DPlot.c:29
int oY
Definition: bildef.h:112
int hsize
Definition: bildef.h:111
int oX
Definition: bildef.h:112
int eX
Definition: bildef.h:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ D2D_findmaxmin()

int D2D_findmaxmin ( float  plotmat[],
int  xinf,
int  xsup,
int  yinf,
int  ysup 
)

Definition at line 245 of file 2DPlot.c.

References MTButtonGetActivationStatus(), omutemp::tgb, omutemp::tmax, and omutemp::tmin.

Referenced by RefreshDrArea().

246 {
247 
248  int t, j, er = 0;
249 
250  float low = 65535;
251  float high= -65535;
252 /*
253  for(t = xinf; t < xsup; t++)
254  {
255  for(j = yinf; j < ysup; j++)
256  {
257  if(plotmat[t * xsup + j] < low) low = plotmat[t * xsup + j];
258  if(plotmat[t * xsup + j] > high) high = plotmat[t * xsup + j];
259  }
260  }
261  OMUTEMP.tmin = low;
262  OMUTEMP.tmax = high;
263  return 0;
264 */
265  for(t = xinf; t < xsup; t++)
266  {
267  for(j = yinf; j < ysup; j++)
268  {
270  if (er)
271  {
272 
273  if(plotmat[t * ysup + j] < low) low = plotmat[t * ysup + j];
274  if(plotmat[t * ysup + j] > high) high = plotmat[t * ysup + j];
275 
276  }
277  }
278  }
279  OMUTEMP.tmin = low ;
280  OMUTEMP.tmax = high + (float) 0.5;
281 
282 /*
283  for(t = 0 ; t < idx ; t++)
284  {
285  for(j = 0; j < idy ; j++)
286  {
287  er = MTButtonGetActivationStatus(OMUTEMP.tgb[j%idy]);
288  if (er)
289  {
290 
291  X = (int) (ox + (t * costx));
292  Y = (int) (oy - abs((int)((double)(plotmat[t * idy + j] - min) / costy)));
293  //Y = (int) (oy - ((plotmat[t * idx + j] - min) / costy));
294  X1 = (int) (ox + (t + 1) * costx);
295  Y1 = (int) (oy - abs((int)((double)(plotmat[t * idy + j + idy] - min) / costy)));
296  //Y1 = (int) (oy - ((plotmat[t * idx + j + 1] - min) / costy));
297  MDrawLine(obj, X, Y, X1, Y1, pe[j]);
298  }
299  }
300  }
301 
302  */
303  return 0;
304 }
MOBJECT tgb[20]
Definition: bildef.h:105
float tmax
Definition: bildef.h:114
omutemp OMUTEMP
Definition: 2DPlot.c:29
float tmin
Definition: bildef.h:114
int MTButtonGetActivationStatus(MOBJECT o)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ D2D_PlotAxis()

void D2D_PlotAxis ( MOBJECT  ob,
int  sx,
int  sy,
int  ex,
int  ey,
MTColor  col 
)

Definition at line 177 of file 2DPlot.c.

References MDrawLine().

Referenced by RefreshDrArea().

178 {
179 
180  //Axis Y Left
181  //DrawArea
182  MDrawLine(ob, sx, sy, sx, ey, col);
183  //Image
184 // DrawYLine(mim, sx, ey, sy, 0,0,0);
185 
186  //Axis X Down
187  //DrawArea
188  MDrawLine(ob, sx, sy, ex, sy, col);
189 // DrawXLine(mim, sy, sx, ex + 1, 0,0,0);
190 
191  //Axis X Up
192  //DrawArea
193  MDrawLine(ob, sx, ey, ex, ey, col);
194 // DrawXLine(mim, sx, sx, ex, 0,0,0);
195 
196  //Axis Y Right
197  //DrawArea
198  MDrawLine(ob, ex, sy, ex, ey, col);
199 // DrawYLine(mim, ex, ey, sy, 0,0,0);
200 
201 }
int ey
Definition: vitesdef.h:8
void MDrawLine(MOBJECT p, int x1, int y1, int x2, int y2, MTColor col)
Definition: Dildef.h:392
int ex
Definition: vitesdef.h:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ D2D_PlotGrid()

void D2D_PlotGrid ( MOBJECT  ob,
MIMAGE  mim,
int  sx,
int  sy,
int  ex,
int  ey,
int  nx,
int  ny 
)

Definition at line 207 of file 2DPlot.c.

References mtcl::green, MDrawLine(), and mtcl::white.

Referenced by RefreshDrArea().

208 {
209  int X1, X, Y1, Y;
210  int j;
211  double incry, incrx;
212  // Y Grid
213  incry = (sy - ey) / ny;
214  for(j = 1; j < ny; j++)
215  {
216  X = sx +1 ;
217  Y = sy - ((int)incry * j);
218  X1 = ex;
219  Y1 = sy - ((int)incry * j);
220  MDrawLine(ob, X, Y, X1, Y1, MTCL.white);
221 // DrawXLine(mim, Y, X, X1, 255,255,255);
222 
223  }
224  //X Grid
225  incrx = (double)(ex - sx) / nx;
226  for(j = 1; j < nx; j++)
227  {
228  X = sx + 1 + ((int)incrx * j);
229  Y = sy;
230  X1 = sx + 1 + ((int)incrx * j);
231  Y1 = ey + 1;
232  if(j == (nx/2))
233  {
234  MDrawLine(ob, X, Y, X1, Y1, MTCL.green);
235 // DrawYLine(mim, X, Y1, Y, 0, 255, 0);
236  }
237  else
238  {
239  MDrawLine(ob, X, Y, X1, Y1, MTCL.white);
240 // DrawYLine(mim, X, Y1, Y, 255,255,255);
241  }
242  }
243 }
mtcl MTCL
Definition: 2DPlot.c:30
int ey
Definition: vitesdef.h:8
void MDrawLine(MOBJECT p, int x1, int y1, int x2, int y2, MTColor col)
MTColor white
int ex
Definition: vitesdef.h:7
MTColor green
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ D2D_PlotSpectrum()

void D2D_PlotSpectrum ( MOBJECT  obj,
float  plotmat[],
int  idx,
int  idy,
unsigned long  pe[],
double  costx,
double  costy,
int  min,
int  max,
int  ox,
int  oy 
)

Definition at line 392 of file 2DPlot.c.

References MDrawLine(), MTButtonGetActivationStatus(), and omutemp::tgb.

Referenced by RefreshDrArea().

395 {
396  int t, j, k = 0,er = 0;
397  int X1, X, Y1, Y;
398 
399  for(t = 0 ; t < idx ; t++)
400  {
401  for(j = 0; j < idy ; j++)
402  {
404  if (er)
405  {
406 
407  X = (int) (ox + (t * costx));
408  Y = (int) (oy - abs((int)((double)(plotmat[t * idy + j] - min) / costy)));
409  //Y = (int) (oy - ((plotmat[t * idx + j] - min) / costy));
410  X1 = (int) (ox + (t + 1) * costx);
411  Y1 = (int) (oy - abs((int)((double)(plotmat[t * idy + j + idy] - min) / costy)));
412  //Y1 = (int) (oy - ((plotmat[t * idx + j + 1] - min) / costy));
413  MDrawLine(obj, X, Y, X1, Y1, pe[j]);
414  }
415  }
416  }
417 }
void MDrawLine(MOBJECT p, int x1, int y1, int x2, int y2, MTColor col)
MOBJECT tgb[20]
Definition: bildef.h:105
omutemp OMUTEMP
Definition: 2DPlot.c:29
int MTButtonGetActivationStatus(MOBJECT o)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ D2D_PoslblX()

void D2D_PoslblX ( MOBJECT  lbl,
int  xs,
int  xe,
int  xc 
)

Definition at line 307 of file 2DPlot.c.

References omutemp::lblx, MObjectMap(), and MObjectSetText().

Referenced by RefreshDrArea().

308 {
309  int xd, i,k, xinf,xsup;
310  char buf[16];
311  int linter;
312  double linterinf, lintersup;
313 
314 
315 
316  if (xc)
317  {
318  k = (sizeof OMUTEMP.lblx / sizeof OMUTEMP.lblx[0] ); // number of labels
319 
320  MObjectMap(OMUTEMP.lblx[0]);
321  sprintf(buf,"%d", xs);
322  MObjectSetText(OMUTEMP.lblx[0], buf);
323 
324  MObjectMap(OMUTEMP.lblx[k/2]);
325  sprintf(buf,"%d", xc);
326  MObjectSetText(OMUTEMP.lblx[k/2], buf);
327 
328  MObjectMap(OMUTEMP.lblx[k-1]);
329  sprintf(buf,"%d", xe);
330  MObjectSetText(OMUTEMP.lblx[k -1], buf);
331 
332 
333  xinf = xc - xs;
334  xsup = xe - xc;
335 
336  linterinf = (double)xinf / (k/2);
337  lintersup = (double)xsup / (k/2);
338 
339  for (i = k/2 - 1 ;i> 0; i--)
340  {
341  MObjectMap(OMUTEMP.lblx[i]);
342  sprintf(buf,"%.0lf", xc - ((k/2 - i) * linterinf) );
343  MObjectSetText(OMUTEMP.lblx[i], buf);
344  }
345  for (i = k/2 + 1 ;i< k - 1; i++)
346  {
347  MObjectMap(OMUTEMP.lblx[i]);
348  sprintf(buf,"%.0lf", xc + ((i - k/2) * lintersup) );
349  MObjectSetText(OMUTEMP.lblx[i], buf);
350  }
351 
352  }
353  else
354  {
355  xd = xe - xs + 1;
356  linter = xd / (sizeof OMUTEMP.lblx / sizeof OMUTEMP.lblx[0] - 1);
357  k = (sizeof OMUTEMP.lblx / sizeof OMUTEMP.lblx[0] );
358 
359  MObjectMap(OMUTEMP.lblx[k/2]);
360  xc = xd / 2;
361  sprintf(buf,"%d", xc);
362  MObjectSetText(OMUTEMP.lblx[k/2], buf);
363  }
364 
365 }
MOBJECT lblx[25]
Definition: bildef.h:106
void MObjectSetText(MOBJECT obj, const char *text)
omutemp OMUTEMP
Definition: 2DPlot.c:29
void MObjectMap(MOBJECT obj)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ D2D_PoslblY()

void D2D_PoslblY ( float  l,
float  h 
)

Definition at line 371 of file 2DPlot.c.

References omutemp::lbly, and MObjectSetText().

Referenced by RefreshDrArea().

372 {
373 
374  float yd, i;
375  int k;
376  char buf[16];
377  float lintery;
378  yd = h - l;
379  lintery = yd / (sizeof OMUTEMP.lbly / sizeof OMUTEMP.lbly[0] );
380 
381  k=sizeof OMUTEMP.lbly / sizeof OMUTEMP.lbly[0] ;
382  for (i =l;i<= h;i+=lintery)
383  {
384  sprintf(buf,"%.1lf", i);
385  if(k==1)
386  sprintf(buf,"%.1lf", h);
387  MObjectSetText(OMUTEMP.lbly[k-1], buf);
388  k--;
389  }
390 }
void MObjectSetText(MOBJECT obj, const char *text)
MOBJECT lbly[11]
Definition: bildef.h:107
omutemp OMUTEMP
Definition: 2DPlot.c:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ D2D_X2Counts()

int D2D_X2Counts ( int  x)

Definition at line 41 of file 2DPlot.c.

References omutemp::COSTX, omutemp::dimx, omutemp::oX, omutemp::ptimeMat, and dtime::ti_hour.

Referenced by D2D_AreaInputTemp().

42 {
43 
44  return (int)(( (x - 2 * OMUTEMP.oX) / (OMUTEMP.ptimeMat[OMUTEMP.dimx-1].ti_hour - OMUTEMP.ptimeMat[0].ti_hour + 1) ) / (OMUTEMP.COSTX) );
45 
46 }
struct dtime * ptimeMat
Definition: bildef.h:101
unsigned char ti_hour
Definition: bildef.h:79
int dimx
Definition: bildef.h:113
omutemp OMUTEMP
Definition: 2DPlot.c:29
int oX
Definition: bildef.h:112
double COSTX
Definition: bildef.h:110
+ Here is the caller graph for this function:

§ D2D_Y2Counts()

double D2D_Y2Counts ( int  y)

Definition at line 53 of file 2DPlot.c.

References omutemp::COSTY, omutemp::oY, and omutemp::tmin.

Referenced by D2D_AreaInputTemp().

54 {
55 
56  return - OMUTEMP.COSTY * (y - OMUTEMP.oY) + OMUTEMP.tmin;
57 
58 }
double COSTY
Definition: bildef.h:110
omutemp OMUTEMP
Definition: 2DPlot.c:29
int oY
Definition: bildef.h:112
float tmin
Definition: bildef.h:114
+ Here is the caller graph for this function:

§ DrawAreaTempCB()

int DrawAreaTempCB ( MOBJECT  obj,
MEvent pexp,
void *  a_data 
)

Definition at line 462 of file 2DPlot.c.

References RefreshDrArea().

Referenced by MDCreate_2DPlot().

463 {
464 
465  int er =0;
466 
467  er = RefreshDrArea(obj);
468 
469  return er;
470 
471 }
int RefreshDrArea(MOBJECT obj)
Redraw the draw arwa in a 2D Plot window.
Definition: 2DPlot.c:428
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ MDCreate_2DPlot()

MOBJECT MDCreate_2DPlot ( char *  title)

2DPlot Panel. Procedure that build the shell for the plotting of the LOG files.

Returns
void

Definition at line 473 of file 2DPlot.c.

References _shell000, CENTER_ALIGN, D2D_AreaInputTemp(), palette::DB_BG, palette::DB_BG_Albl, palette::DB_BG_lblUP, palette::DB_BG_Plbl, palette::DB_BG_RButt, palette::DB_FG_Albl, palette::DB_FG_lblUP, palette::DB_FG_Plbl, palette::DB_FG_RButt, omutemp::drawarea000, DrawAreaTempCB(), F_ATT_FORM, False, HELV_SMALL, lbl, omutemp::LBL_X, omutemp::LBL_Y, omutemp::lblx, omutemp::lbly, LEFT_ALIGN, MCreateColForm(), MCreateDrawArea(), MCreateLabel(), MCreateRowForm(), MCreateScrollBar(), MCreateShell(), MCreateTableForm(), MCreateTButton(), MDrawAreaSetExposeCallback(), MDrawAreaSetInputCallback(), MFormSetSpacing(), MObjectAlign(), MObjectSetBackgroundRGB(), MObjectSetFGColorFromParent(), MObjectSetForegroundRGB(), MObjectSetResize(), MObjectSetShadow(), MObjectSetTransparency(), MObjectUnmap(), MScrollBarSetSliderColorShift(), MTableFormSetColAlign(), MTButtonSetCallback(), MTopAttach(), SBT_HOR, SBT_VERT, omutemp::tgb, ToggleButtCB(), TOP_ALIGN, True, WS_SHADOW_IN, and WS_SHADOW_OUT.

Referenced by MDCreate2DPlot().

474 {
476 
477  MOBJECT _rowform000;
478 // MOBJECT _tablefrm000;
479  MOBJECT _colform000;
480  MOBJECT _rowform001;
481 // MOBJECT _tablefrm001;
482  MOBJECT _rowform002;
483  MOBJECT _tablefrm002;
484  MOBJECT _colform001;
485  MOBJECT _scrollbar000;
486  MOBJECT _rowform004;
487  MOBJECT _rowform005;
488  MOBJECT _rowform006;
489  MOBJECT _rowform007;
490  MOBJECT _scrollbar001;
491 
492  MOBJECT lbl, tb;
493  MOBJECT rowfrm;
494 
495  int i;
496 
497  _shell000 = MCreateShell(title, 0);
498  MObjectSetBackgroundRGB(_shell000, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
499  MObjectSetShadow(_shell000, WS_SHADOW_IN, 0, 0);
500 
501  _rowform000 = MCreateRowForm(_shell000);
502  MTopAttach(_rowform000, F_ATT_FORM, 1, NULL);
503  MObjectAlign(_rowform000, CENTER_ALIGN, TOP_ALIGN);
504  MObjectSetBackgroundRGB(_rowform000, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
505  MObjectSetResize(_rowform000, True, True);
506 
507  tb = MCreateTableForm(_rowform000, 7);
508  MFormSetSpacing(tb, 1);
510 
511 // _label000 = MCreateLabel(_tablefrm000, "Measurement Header", HELV_SMALL);
512 // MObjectSetForegroundRGB(_label000, 255, 255, 0);
513 
514  _colform000 = MCreateColForm(_rowform000);
515  MFormSetSpacing(_colform000, 1);
516  MObjectSetBackgroundRGB(_colform000, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
517  MObjectSetResize(_colform000, True, True);
518 
519  _rowform001 = MCreateRowForm(_colform000);
520  MFormSetSpacing(_rowform001, 1);
521  MObjectAlign(_rowform001, LEFT_ALIGN, TOP_ALIGN);
522  MObjectSetBackgroundRGB(_rowform001, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
523  MObjectSetResize(_rowform001, False, False);
524 
525  lbl = MCreateLabel(_rowform001, "Select Channel", HELV_SMALL);
529  MObjectSetTransparency(lbl, 0);
530  MObjectSetShadow(lbl, WS_SHADOW_OUT, 1, 0);
532 
533  tb = MCreateTableForm(_rowform001, 1);
534  MFormSetSpacing(tb, 1);
539 
540  OMUTEMP.tgb[0] = MCreateTButton(tb, " Optic ", HELV_SMALL);
545 
546  OMUTEMP.tgb[1] = MCreateTButton(tb, "Int SX ", HELV_SMALL);
551 
552  OMUTEMP.tgb[2] = MCreateTButton(tb, "Out SX ", HELV_SMALL);
557 
558  OMUTEMP.tgb[3] = MCreateTButton(tb, "Int DX ", HELV_SMALL);
563 
564  OMUTEMP.tgb[4] = MCreateTButton(tb, "Out DX ", HELV_SMALL);
569 
570  OMUTEMP.tgb[5] = MCreateTButton(tb, "Grating", HELV_SMALL);
575 
576  OMUTEMP.tgb[6] = MCreateTButton(tb, "Spare ", HELV_SMALL);
581 
582  OMUTEMP.tgb[7] = MCreateTButton(tb, "Elect. ", HELV_SMALL);
587 
588  OMUTEMP.tgb[8] = MCreateTButton(tb, "Spare ", HELV_SMALL);
593 
594  OMUTEMP.tgb[9] = MCreateTButton(tb, "Spare ", HELV_SMALL);
598 
599  OMUTEMP.tgb[10] = MCreateTButton(tb, "Spare ", HELV_SMALL);
603 
604  OMUTEMP.tgb[11] = MCreateTButton(tb, "Spare ", HELV_SMALL);
608 
609  OMUTEMP.tgb[12] = MCreateTButton(tb, "Spare ", HELV_SMALL);
613 
614  OMUTEMP.tgb[13] = MCreateTButton(tb, "Spare ", HELV_SMALL);
618 
619  OMUTEMP.tgb[14] = MCreateTButton(tb, "Spare ", HELV_SMALL);
623 
624  OMUTEMP.tgb[15] = MCreateTButton(tb, "Spare ", HELV_SMALL);
628 
629  OMUTEMP.tgb[16] = MCreateTButton(tb, "CCD ", HELV_SMALL);
633 
634 
635  lbl = MCreateLabel(_rowform001, "Percent", HELV_SMALL);
639  MObjectSetTransparency(lbl, 0);
640  MObjectSetShadow(lbl, WS_SHADOW_OUT, 1, 0);
642 
643  tb = MCreateTableForm(_rowform001, 1);
644  MFormSetSpacing(tb, 1);
649 
650  OMUTEMP.tgb[17] = MCreateTButton(tb, "Pwr CCD", HELV_SMALL);
654 
655  OMUTEMP.tgb[18] = MCreateTButton(tb, "Pwr Pelt", HELV_SMALL);
659 
660 
661 
662 
663  _rowform002 = MCreateRowForm(_colform000);
664  MObjectSetFGColorFromParent(_rowform002, False);
665  MObjectSetResize(_rowform002, True, True);
666 /*
667  _label002 = MCreateLabel(_rowform002, "VarY -> Blu Line", HELV_SMALL);
668  MObjectAlign(_label002, CENTER_ALIGN, TOP_ALIGN);
669  MObjectSetForegroundRGB(_label002, 255, 255, 0);
670  MObjectSetBackgroundRGB(_label002, 117, 117, 169);
671  MObjectSetTransparency(_label002, 0);
672  MObjectSetShadow(_label002, WS_SHADOW_IN, 1, 0);
673  MObjectSetResize(_label002, False, False);
674 */
675  _tablefrm002 = MCreateTableForm(_rowform002, 2);
676  MFormSetSpacing(_tablefrm002, 1);
677 // MTableFormShowGrid(_tablefrm002);
678  MObjectAlign(_tablefrm002, CENTER_ALIGN, TOP_ALIGN);
679  MObjectSetResize(_tablefrm002, True, True);
680 
681  _colform001 = MCreateColForm(_tablefrm002);
682 
683  _scrollbar000 = MCreateScrollBar(_colform001, SBT_VERT, 10, 110);
684  MScrollBarSetSliderColorShift(_scrollbar000, 50);
685 
686  rowfrm = MCreateRowForm(_colform001);
687  MFormSetSpacing(rowfrm, 1);
690  MObjectSetResize(rowfrm, False, True);
691 
692  for (i=0;i<11;i++)
693  {
694  OMUTEMP.lbly[i] = MCreateLabel(rowfrm, "-------", HELV_SMALL);
700  }
701 
702  _rowform004 = MCreateRowForm(_tablefrm002);
703 
704  OMUTEMP.drawarea000 = MCreateDrawArea(_rowform004, 763, 350);
708 
709  _rowform005 = MCreateRowForm(_tablefrm002);
710  MFormSetSpacing(_rowform005, 1);
711  MObjectSetResize(_rowform005, False, False);
712 
713  tb = MCreateTableForm(_rowform005, 2);
714  MFormSetSpacing(tb, 1);
715  // MTableFormShowGrid(_tablefrm002);
717  MObjectSetResize(tb, True, True);
718 
719  lbl = MCreateLabel(tb, "X:", HELV_SMALL);
723  MObjectSetTransparency(lbl, 0);
724  MObjectSetShadow(lbl, WS_SHADOW_OUT, 1, 0);
726 
727  OMUTEMP.LBL_X = MCreateLabel(tb, "xxxx", HELV_SMALL);
734 
735  lbl = MCreateLabel(tb, "Y:", HELV_SMALL);
739  MObjectSetTransparency(lbl, 0);
740  MObjectSetShadow(lbl, WS_SHADOW_OUT, 1, 0);
742 
743  OMUTEMP.LBL_Y = MCreateLabel(tb, "yyyy", HELV_SMALL);
750 
751 
752  _rowform006 = MCreateRowForm(_tablefrm002);
753  MFormSetSpacing(_rowform006, 1);
754  MObjectSetResize(_rowform006, True, True);
755 
756  tb = MCreateTableForm(_rowform006, (sizeof OMUTEMP.lblx / sizeof OMUTEMP.lblx[0]));
757  MFormSetSpacing(tb, 1);
758 // MTableFormShowGrid(_tablefrm003);
759  MObjectSetBackgroundRGB(tb, 120, 177, 218);
761 
762 
763  for (i=0;i<(sizeof OMUTEMP.lblx / sizeof OMUTEMP.lblx[0]);i++)
764  {
765  OMUTEMP.lblx[i] = MCreateLabel(tb, "-----", HELV_SMALL);
772  }
773 
774  _rowform007 = MCreateRowForm(_rowform006);
775 
776  _scrollbar001 = MCreateScrollBar(_rowform007, SBT_HOR, 10, 110);
777 
778 
779 // MShellRealize( _shell000);
780 
781  return _shell000;
782 }
short DB_BG_lblUP[3]
Background Capital Letters Labels Color UP.
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
MOBJECT MCreateTButton(MOBJECT parent, const char *text, MTFont font)
MOBJECT lbl
Definition: DFileMan.c:42
#define WS_SHADOW_IN
Definition: Mguidefs.h:958
short DB_FG_Plbl[3]
Foreground PASSIVE Label Colors.
void MObjectSetShadow(MOBJECT obj, int type, int in, int out)
MOBJECT LBL_X
Definition: bildef.h:115
MOBJECT MCreateLabel(MOBJECT parent, const char *text, MTFont font)
void MObjectSetResize(MOBJECT obj, int resize_w, int resize_h)
short DB_BG_Albl[3]
Background ACTIVE Label Colors.
#define False
Definition: Mguidefs.h:236
void MObjectAlign(MOBJECT obj, int h_align, int v_align)
void MTableFormSetColAlign(MOBJECT form, int col, int al)
#define SBT_VERT
Definition: Mguidefs.h:1140
MOBJECT lblx[25]
Definition: bildef.h:106
MOBJECT tgb[20]
Definition: bildef.h:105
MOBJECT lbly[11]
Definition: bildef.h:107
short DB_BG_RButt[3]
Background Radio Buttons.
palette DPAL
Definition: 2DPlot.c:27
MOBJECT LBL_Y
Definition: bildef.h:115
MOBJECT MCreateTableForm(MOBJECT parent, int n_cols)
void MTButtonSetCallback(MOBJECT button, OBJ_VALUE_CB cb, void *data)
#define CENTER_ALIGN
Definition: Mguidefs.h:917
void MObjectSetFGColorFromParent(MOBJECT obj, int true_false)
#define HELV_SMALL
Definition: Mguidefs.h:881
MOBJECT MCreateScrollBar(MOBJECT parent, int type, long n, long max)
#define SBT_HOR
Definition: Mguidefs.h:1139
MOBJECT _shell000
Definition: DAS_Spatram.h:3052
void MScrollBarSetSliderColorShift(MOBJECT p, int percentage)
short DB_FG_Albl[3]
Foreground ACTIVE Label Colors.
omutemp OMUTEMP
Definition: 2DPlot.c:29
MOBJECT MCreateDrawArea(MOBJECT parent, int width, int height)
MOBJECT MCreateColForm(MOBJECT parent)
void ToggleButtCB(MOBJECT p, MVALUE od, void *ad)
Definition: 2DPlot.c:420
short DB_BG_Plbl[3]
Background PASSIVE Label Colors.
void MDrawAreaSetExposeCallback(MOBJECT obj, OBJ_EVENT_CB cb, void *ad)
void D2D_AreaInputTemp(MOBJECT obj, MEvent *pe, void *a_data)
Definition: 2DPlot.c:66
void MDrawAreaSetInputCallback(MOBJECT obj, OBJ_EVENT_CB cb, void *ad)
MOBJECT MCreateShell(const char *title, int flags)
short DB_BG[3]
Default Background Color.
void MObjectUnmap(MOBJECT obj)
short DB_FG_RButt[3]
Foreground Radio Buttons.
#define F_ATT_FORM
Definition: Mguidefs.h:1107
int DrawAreaTempCB(MOBJECT obj, MEvent *pexp, void *a_data)
Definition: 2DPlot.c:462
void MFormSetSpacing(MOBJECT p, int offset)
void * MOBJECT
Definition: Mguidefs.h:192
#define True
Definition: Mguidefs.h:235
#define LEFT_ALIGN
Definition: Mguidefs.h:915
void MObjectSetTransparency(MOBJECT obj, CARD8 level)
void MObjectSetForegroundRGB(MOBJECT obj, int r, int g, int b)
MOBJECT drawarea000
Definition: bildef.h:109
MOBJECT MCreateRowForm(MOBJECT parent)
void MTopAttach(MOBJECT child, int att_type, int off, MOBJECT obj)
#define TOP_ALIGN
Definition: Mguidefs.h:918
short DB_FG_lblUP[3]
Foreground Capital Letters Labels Color UP.
#define WS_SHADOW_OUT
Definition: Mguidefs.h:957
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ RefreshDrArea()

int RefreshDrArea ( MOBJECT  obj)

Redraw the draw arwa in a 2D Plot window.

Definition at line 428 of file 2DPlot.c.

References mtcl::black, bil::BLENS, omutemp::COSTX, omutemp::COSTY, D2D_AssignOrigin(), D2D_findmaxmin(), D2D_PlotAxis(), D2D_PlotGrid(), D2D_PlotSpectrum(), D2D_PoslblX(), D2D_PoslblY(), omutemp::dimx, omutemp::dimy, omutemp::eX, omutemp::eY, blens::Imim, omutemp::lblx, maxploth, maxplotw, MObjectGetHeight(), MObjectGetWidth(), omutemp::oX, omutemp::oY, mtcl::PLColor, omutemp::pTempMat, omutemp::ptimeMat, dtime::ti_hour, omutemp::tmax, and omutemp::tmin.

Referenced by DrawAreaTempCB(), and ToggleButtCB().

429 {
430  maxplotw = MObjectGetWidth(obj);
431  maxploth = MObjectGetHeight(obj);
432 
433  //Assign limits to the Drawing coordinates
434  D2D_AssignOrigin(obj);
435  //Plot the axes
437  //Plot grid
439 
441 
442 // OMUTEMP.tmin = 0;
443 // OMUTEMP.tmax = 50;
444 
446 
447 
449 
450 
451  //Calculation of the adaptive parameters
452  OMUTEMP.COSTY = (double)(OMUTEMP.tmax - OMUTEMP.tmin) / (double)(OMUTEMP.oY - OMUTEMP.eY);
453  OMUTEMP.COSTX = (double)(OMUTEMP.eX - OMUTEMP.oX) / (double) (OMUTEMP.dimx);
454 
457 
458 
459  return 0;
460 }
mtcl MTCL
Definition: 2DPlot.c:30
MIMAGE Imim
Definition: bildef.h:14
struct dtime * ptimeMat
Definition: bildef.h:101
MTColor black
int MObjectGetHeight(MOBJECT obj)
MOBJECT lblx[25]
Definition: bildef.h:106
unsigned char ti_hour
Definition: bildef.h:79
int maxplotw
Definition: Spat_Plot.c:51
int MObjectGetWidth(MOBJECT obj)
int D2D_findmaxmin(float plotmat[], int xinf, int xsup, int yinf, int ysup)
Definition: 2DPlot.c:245
int dimx
Definition: bildef.h:113
int eY
Definition: bildef.h:112
void D2D_AssignOrigin(MOBJECT obj)
Definition: 2DPlot.c:161
double COSTY
Definition: bildef.h:110
float tmax
Definition: bildef.h:114
omutemp OMUTEMP
Definition: 2DPlot.c:29
void D2D_PlotAxis(MOBJECT ob, int sx, int sy, int ex, int ey, MTColor col)
Definition: 2DPlot.c:177
int oY
Definition: bildef.h:112
void D2D_PlotSpectrum(MOBJECT obj, float plotmat[], int idx, int idy, unsigned long pe[], double costx, double costy, int min, int max, int ox, int oy)
Definition: 2DPlot.c:392
int maxploth
Definition: Spat_Plot.c:51
void D2D_PlotGrid(MOBJECT ob, MIMAGE mim, int sx, int sy, int ex, int ey, int nx, int ny)
Definition: 2DPlot.c:207
float tmin
Definition: bildef.h:114
int oX
Definition: bildef.h:112
bil BIL
Definition: 2DPlot.c:28
int eX
Definition: bildef.h:112
MTColor PLColor[264]
blens BLENS
Definition: bildef.h:252
int dimy
Definition: bildef.h:113
float * pTempMat
Definition: bildef.h:100
double COSTX
Definition: bildef.h:110
void D2D_PoslblY(float l, float h)
Definition: 2DPlot.c:371
void D2D_PoslblX(MOBJECT lbl, int xs, int xe, int xc)
Definition: 2DPlot.c:307
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ ToggleButtCB()

void ToggleButtCB ( MOBJECT  p,
MVALUE  od,
void *  ad 
)

Definition at line 420 of file 2DPlot.c.

References omutemp::drawarea000, MObjectRedraw(), and RefreshDrArea().

Referenced by MDCreate_2DPlot().

421 {
422 
425 
426 }
int RefreshDrArea(MOBJECT obj)
Redraw the draw arwa in a 2D Plot window.
Definition: 2DPlot.c:428
omutemp OMUTEMP
Definition: 2DPlot.c:29
void MObjectRedraw(MOBJECT obj)
MOBJECT drawarea000
Definition: bildef.h:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

§ BIL

bil BIL

§ DIL

dil DIL

§ DPAL

palette DPAL

§ MTCL

mtcl MTCL

§ OMUTEMP

omutemp OMUTEMP

Definition at line 29 of file 2DPlot.c.

______________________________________________________________________________________
Generated on Mon Sep 18 2017 11:44:12 for DAS - Rel. 3.1.6 - 18/09/2017.