-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnplot.cpp
152 lines (114 loc) · 3.61 KB
/
nplot.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// nplot program -> takes care of showing the menu, canvas, status
// and button groups widgets
#include "nplot.h"
//
// Construct the main window with buttons.
//
Nplot::Nplot()
{
#include "fonts.h"
QFontMetrics fontm5(font5);
setMinimumSize( fontm5.height()*20, fontm5.height()*17 );
}
//
// Called when the widget has been resized.
// Moves the button group to the upper right corner
// of the widget.
void Nplot::resizeEvent( QResizeEvent * )
{
menu->move(0,0);
menu->resize(width(),menu->height());
butgr->move( width()-butgr->width(),
height()-status->height()-butgr->height() );
butgr->resize( butgr->width(), butgr->height());
canvas->resize( width()-butgr->width(),
height()-menu->height()-status->height()-1);
canvas->move(0,menu->height()+1);
status->setGeometry(0, height() - status->height(),
width(), status->height());
}
//
// This function initializes
//
void Nplot::init(char *inputfilename1,bool mainwidget1, long is1, long ie1,
long js1, long je1,
long ks1, long ke1 ,
long numprop, proptitlename *proptitle,
double *data1)
{
mainwidget=mainwidget1;
long i,j,k;
#include "fonts.h"
QFontMetrics fontm3(font3);
cv.is=is1; cv.iso=cv.is;
cv.ie=ie1; cv.ieo=cv.ie;
cv.js=js1; cv.jso=cv.js;
cv.je=je1; cv.jeo=cv.je;
cv.ks=ks1; cv.kso=cv.ks;
cv.ke=ke1; cv.keo=cv.ke;
strcpy(cv.upaxis,"kij");
cv.data=data1;
cv.numprop=numprop;
cv.proptitle=proptitle;
cv.scandatamin= (double *) malloc( (cv.numprop+1)*sizeof(double));
cv.scandatamax= (double *) malloc( (cv.numprop+1)*sizeof(double));
for (cv.prop=0; cv.prop<cv.numprop; cv.prop++) {
cv.scandatamin[cv.prop]=1.0e99;
cv.scandatamax[cv.prop]=-1.0e99;
}
for (cv.prop=0; cv.prop<cv.numprop; cv.prop++) {
for (i=cv.is; i<=cv.ie; i++) {
for (j=cv.js; j<=cv.je; j++) {
for (k=cv.ks; k<=cv.ke; k++) {
if (cv.data[transfo.ai(&cv,i,j,k)] < cv.scandatamin[cv.prop])
cv.scandatamin[cv.prop]=cv.data[transfo.ai(&cv,i,j,k)];
if (cv.data[transfo.ai(&cv,i,j,k)] > cv.scandatamax[cv.prop])
cv.scandatamax[cv.prop]=cv.data[transfo.ai(&cv,i,j,k)];
}
}
}
}
cv.prop=0;
cv.datamin=cv.scandatamin[cv.prop];
cv.datamax=cv.scandatamax[cv.prop];
cv.decalx=0;
cv.decaly=0;
cv.kk=(cv.ke+cv.ks)/2;
cv.resfact=6400.0*100.0;
cv.scalelevels=32;
cv.colortype=1;
cv.zoomfactx=1.0;
cv.zoomfacty=1.0;
cv.zoomfactref=1.0;
cv.proportional=TRUE;
cv.shownode=0;
cv.instanthelp=FALSE;
cv.inputfilename=inputfilename1;
status = new QLabel(this);
status->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
status->setFont(font3);
status->setFixedHeight( fontm3.height() + 4 );
status->setCursor(arrowCursor);
canvas=new Canvas(this);
canvas->linkcanvas(&cv,status);
canvas->init();
butgr=new ButGr(this);
butgr->linkcanvas(&cv,canvas);
menu = new Menu(this);
menu->move( 0, 0 );
menu->linkcanvas(&cv,canvas);
menu->init(this);
char newcaptionname[256],captionname[256],captionname2[256];
if (mainwidget) {
strcpy(captionname,"nodplot");
}
else {
strcpy(captionname,"nodplot");
}
sprintf(captionname2, "%s : %s", captionname, cv.inputfilename);
sprintf(newcaptionname, "%s : %s", captionname2, proptitle[0]);
setCaption( newcaptionname );
// QColor c;
// c.setHsv( 36, 36, 177 );
// setBackgroundColor( c );
}