-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrintSet.cpp
234 lines (186 loc) · 9.38 KB
/
PrintSet.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "PrintSet.h"
#include "doseshell.h"
#include "GlobalData.h"
#include "Cache.h"
#include <sstream>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "TeeSurfa"
#pragma link "RzPanel"
#pragma link "RzSplit"
#pragma resource "*.dfm"
using namespace std;
TPrintForm *PrintForm;
//---------------------------------------------------------------------------
__fastcall TPrintForm::TPrintForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TPrintForm::FormCreate(TObject *Sender)
{
QRChartMeasureContour->Chart->Top = 0;
QRChartMeasureContour->Chart->Left = 0;
QRChartMeasureContour->Chart->Height = QRChartMeasureContour->Height;
QRChartMeasureContour->Chart->Width = QRChartMeasureContour->Width;
QRChartMeasureContour->Chart->Legend->Left = QRChartMeasureContour->Width - QRChartMeasureContour->Chart->Legend->Width;
QRChartCalcContour->Chart->Top = 0;
QRChartCalcContour->Chart->Left = 0;
QRChartCalcContour->Chart->Height = QRChartCalcContour->Height;
QRChartCalcContour->Chart->Width = QRChartCalcContour->Width;
QRChartCalcContour->Chart->Legend->Left = QRChartCalcContour->Width - QRChartCalcContour->Chart->Legend->Width;
GlobalMembers *globalMem = NULL;
PatientInfo *patientInfo = NULL;
ostringstream os;
globalMem = GlobalMembers::getInstance();
if(NULL == globalMem){
RunningLog::writeLog("The globalInstance is NULL;",__LINE__);
return;
}
patientInfo = globalMem->getPatientInfo();
if(NULL == patientInfo){
RunningLog::writeLog("The patientInfo is NULL;",__LINE__);
return;
}
os.clear();
os.str("");
os<<"ID: "<<patientInfo->patientId;
QRLabelId->Caption = os.str().c_str();
os.clear();
os.str("");
os<<"Name:"<<patientInfo->patientName;
QRLabelName->Caption = os.str().c_str();
os.clear();
os.str("");
os<<"Gender: "<<(patientInfo->patientGender>-1?(patientInfo->patientGender==0?"Male":"Female"):"");
this->QRLabelGender->Caption = os.str().c_str();
os.clear();
os.str("");
os<<"Age: "<<patientInfo->patientAge;
QRLabelAge->Caption = os.str().c_str();
os.clear();
os.str("");
os<<"Treated Part: "<<patientInfo->treatedPart;
QRLabelPart->Caption = os.str().c_str();
if(MainFormTempValue.checkedRecord.getSingleGammaResult()->totalPassPercent>=0) {
os.clear();
os.str("");
os<<"%GAMMA pass percent:"<< FormatFloat("0.00",MainFormTempValue.checkedRecord.getSingleGammaResult()->totalPassPercent).c_str();
QRLabelGAMMA->Caption = os.str().c_str();
}else{
QRLabelGAMMA->Caption = "GAMMA 尚未验证";
}
if(MainFormTempValue.checkedRecord.getSingleDTAResult()->totalPassPercent>=0) {
os.clear();
os.str("");
os<<"%DTA pass percent:"<< FormatFloat("0.00",MainFormTempValue.checkedRecord.getSingleDTAResult()->totalPassPercent).c_str();
QRLabelDTA->Caption = os.str().c_str();
}else{
QRLabelDTA->Caption = "DTA 尚未验证";
}
if(MainFormTempValue.checkedRecord.getSingleDDResult()->totalPassPercent>=0) {
os.clear();
os.str("");
os<<"%DD pass percent:"<< FormatFloat("0.00",MainFormTempValue.checkedRecord.getSingleDDResult()->totalPassPercent).c_str();
QRLabelDD->Caption = os.str().c_str();
}else{
QRLabelDD->Caption = "DD 尚未验证";
}
os.clear();
os.str("");
globalMem = NULL;
patientInfo = NULL;
ShowMeasureGraphy();
ShowCalcGraphy();
}
//---------------------------------------------------------------------------
void __fastcall TPrintForm::ShowMeasureGraphy(){
SeriesPrintMeasureContour->Clear();
SeriesPrintMeasureHotPoint->Clear();
if(false==MainFormTempValue.measureFilePath.empty()){
//Measure Contour
QRChartMeasureContour->Chart->MarginBottom = 0;
QRChartMeasureContour->Chart->MarginTop = 0;
QRChartMeasureContour->Chart->MarginLeft = 0;
QRChartMeasureContour->Chart->MarginRight = 0;
QRChartMeasureContour->Chart->BottomAxis->StartPosition = 50 - (MainFormTempValue.measureRowLength)*(25 + 25*((float)(QRChartMeasureContour->Chart->Height))/QRChartMeasureContour->Chart->Legend->Left)/(float)(MainFormTempValue.measureColLength);
QRChartMeasureContour->Chart->BottomAxis->EndPosition = 50 + (MainFormTempValue.measureRowLength)*(25 + 25*((float)(QRChartMeasureContour->Chart->Height))/QRChartMeasureContour->Chart->Legend->Left)/(float)(MainFormTempValue.measureColLength);
for(int j=0;j<MainFormTempValue.measureColLength;j++){
for(int i=0;i<MainFormTempValue.measureRowLength;i++){
SeriesPrintMeasureContour->AddXYZ(i-MainFormTempValue.measureArrayShowCenter.row,
MainFormTempValue.NormMeasureDoseData.at(i,j,0),
j-MainFormTempValue.measureArrayShowCenter.col);
}
}
QRChartMeasureContour->Chart->LeftAxis->StartPosition = 0;
QRChartMeasureContour->Chart->LeftAxis->EndPosition = 0; //通过将所有点压缩到底面来实现向2D转化
QRChartMeasureContour->Chart->View3DOptions->Rotation = 0; //通过将Chart旋转到一个固定角度,使网
QRChartMeasureContour->Chart->View3DOptions->Elevation = 270; //格和轴有2D效果
SeriesPrintMeasureContour->YPositionLevel = false;
SeriesPrintMeasureContour->Visible = true;
//Measure HotPoint
for(int j=0;j<MainFormTempValue.measureColLength;j++){
for(int i=0;i<MainFormTempValue.measureRowLength;i++){
SeriesPrintMeasureHotPoint->AddXYZ(i-MainFormTempValue.measureArrayShowCenter.row,
MainFormTempValue.measureHotPointData.at(i,j,0),
j-MainFormTempValue.measureArrayShowCenter.col);
}
}
QRChartPrintMeasureHotPoint->Chart->LeftAxis->StartPosition = 0;
QRChartPrintMeasureHotPoint->Chart->LeftAxis->EndPosition = 0; //通过将所有点压缩到底面来实现向2D转化
QRChartPrintMeasureHotPoint->Chart->View3DOptions->Rotation = 0; //通过将Chart旋转到一个固定角度,使网
QRChartPrintMeasureHotPoint->Chart->View3DOptions->Elevation = 270; //格和轴有2D效果
SeriesPrintMeasureHotPoint->Visible = true;
}
}
void __fastcall TPrintForm::ShowCalcGraphy(){
//
SeriesPrintCalcContour->Clear();
SeriesPrintCalcHotPoint->Clear();
if(false==MainFormTempValue.calcFilePath.empty()){
//Calculate Contour
QRChartCalcContour->Chart->MarginBottom = 0;
QRChartCalcContour->Chart->MarginTop = 0;
QRChartCalcContour->Chart->MarginLeft = 0;
QRChartCalcContour->Chart->MarginRight = 0;
QRChartCalcContour->Chart->BottomAxis->StartPosition = 50 - (MainFormTempValue.cutBian.at(0,1,0) - MainFormTempValue.cutBian.at(0,0,0))*(25 + 25*((float)(QRChartCalcContour->Chart->Height))/QRChartCalcContour->Chart->Legend->Left)/(float)(MainFormTempValue.cutBian.at(1,1,0) - MainFormTempValue.cutBian.at(1,0,0));
QRChartCalcContour->Chart->BottomAxis->EndPosition = 50 + (MainFormTempValue.cutBian.at(0,1,0) - MainFormTempValue.cutBian.at(0,0,0))*(25 + 25*((float)(QRChartCalcContour->Chart->Height))/QRChartCalcContour->Chart->Legend->Left)/(float)(MainFormTempValue.cutBian.at(1,1,0) - MainFormTempValue.cutBian.at(1,0,0));
for(int j=MainFormTempValue.cutBian.at(1,0,0);j<=MainFormTempValue.cutBian.at(1,1,0);j++){
for(int i=MainFormTempValue.cutBian.at(0,0,0);i<=MainFormTempValue.cutBian.at(0,1,0);i++){
SeriesPrintCalcContour->AddXYZ(i-MainFormTempValue.calcArrayShowCenter.row,
MainFormTempValue.NormCalcDoseData.at(i,j,0),
j-MainFormTempValue.calcArrayShowCenter.col);
}
}
SeriesPrintCalcContour->YPositionLevel = false;
SeriesPrintCalcContour->Visible = true;
//Calculate HotPoint
QRChartPrintCalcHotPoint->Chart->BottomAxis->StartPosition = 50 - (MainFormTempValue.cutBian.at(0,1,0) - MainFormTempValue.cutBian.at(0,0,0))*50/(float)(MainFormTempValue.cutBian.at(1,1,0) - MainFormTempValue.cutBian.at(1,0,0));
QRChartPrintCalcHotPoint->Chart->BottomAxis->EndPosition = 50 + (MainFormTempValue.cutBian.at(0,1,0) - MainFormTempValue.cutBian.at(0,0,0))*50/(float)(MainFormTempValue.cutBian.at(1,1,0) - MainFormTempValue.cutBian.at(1,0,0));
for(int j=MainFormTempValue.cutBian.at(1,0,0);j<=MainFormTempValue.cutBian.at(1,1,0);j++){
for(int i=MainFormTempValue.cutBian.at(0,0,0);i<=MainFormTempValue.cutBian.at(0,1,0);i++){
SeriesPrintCalcHotPoint->AddXYZ(i-MainFormTempValue.calcArrayShowCenter.row,
MainFormTempValue.calcHotPointData.at(i,j,0),
j-MainFormTempValue.calcArrayShowCenter.col);
}
}
SeriesPrintCalcHotPoint->Visible = true;
}
}
void __fastcall TPrintForm::FormClose(TObject *Sender,
TCloseAction &Action)
{
Action = caFree;
}
//---------------------------------------------------------------------------
void __fastcall TPrintForm::QuickRep1AfterPreview(TObject *Sender)
{
//Preview模态窗口现实之后,立刻关闭Print主窗口,
//而且在触发打印时也不显示主窗口,也就是说Print主窗口只起支撑作用,自始至终显示的
//都是PreView模态窗口
Close();
}
//---------------------------------------------------------------------------