修訂 | cecbea8c1835f744fb77fb991b6007f41f085636 (tree) |
---|---|
時間 | 2021-03-08 22:14:50 |
作者 | ![]() |
Commiter | Mitsuaki Kawamura |
Color palette for Blue -> White -> Red
@@ -297,9 +297,9 @@ static void draw_bz_lines() { | ||
297 | 297 | // |
298 | 298 | for (i = 0; i < 2; ++i) { |
299 | 299 | for (j = 0; j < 3; ++j) |
300 | - vertices[j + 3 * i] = rot[j][0] * arrow[i][0] | |
301 | - + rot[j][1] * arrow[i][1] | |
302 | - + rot[j][2] * arrow[i][2] | |
300 | + vertices[j + 3 * i] = rot[j][0] * arrow_c[i][0] | |
301 | + + rot[j][1] * arrow_c[i][1] | |
302 | + + rot[j][2] * arrow_c[i][2] | |
303 | 303 | + trans[j]; |
304 | 304 | }/*for (i = 0; i< 2; ++i)*/ |
305 | 305 | glColor3fv(linecolor); |
@@ -360,6 +360,7 @@ static void draw_colorbar() | ||
360 | 360 | vector_color[j + 8 * i + 4] = BarColor[i * 2][j]; |
361 | 361 | } |
362 | 362 | } |
363 | + glLineWidth(linewidth); | |
363 | 364 | glNormal3f(0.0f, 0.0f, 1.0f); |
364 | 365 | glVertexPointer(3, GL_FLOAT, 0, vector); |
365 | 366 | glColorPointer(4, GL_FLOAT, 0, vector_color); |
@@ -210,7 +210,8 @@ GLfloat LineColor[4] = { 1.0, 1.0, 1.0, 1.0 };//!< Line color code | ||
210 | 210 | GLfloat SectionColor[4] = { 0.5f, 0.5f, 0.5f, 1.0 };//!< Line color code |
211 | 211 | GLfloat BarColor[5][4] = { { 0.0, 0.0, 1.0, 1.0 } , { 0.0, 1.0, 1.0, 1.0 } , |
212 | 212 | { 0.0, 1.0, 0.0, 1.0 } ,{ 1.0, 1.0, 0.0, 1.0 } ,{ 1.0, 0.0, 0.0, 1.0 } }; |
213 | -GLfloat arrow[2][3]; | |
213 | +GLfloat arrow_f[2][3]; | |
214 | +GLfloat arrow_c[2][3]; | |
214 | 215 | /* |
215 | 216 | Others |
216 | 217 | */ |
@@ -167,7 +167,7 @@ void MyFrame::button_compute( | ||
167 | 167 | void MyFrame::button_section( |
168 | 168 | wxCommandEvent& event//!<[in] Selected menu |
169 | 169 | ) { |
170 | - int ib, i2d, i, j; | |
170 | + int ib, i2d, i; | |
171 | 171 | FILE *fp; |
172 | 172 | fp = fopen("fermi_line.dat", "w"); |
173 | 173 | for (ib = 0; ib < nb; ib++) { |
@@ -202,72 +202,80 @@ void MyFrame::textctrl_Arrow( | ||
202 | 202 | wxCommandEvent& event //!<[in] Selected menu |
203 | 203 | ) |
204 | 204 | { |
205 | - int ierr; | |
205 | + int ii, jj; | |
206 | 206 | double dvalue; |
207 | 207 | |
208 | 208 | if (event.GetId() == itext_ArrowStart0) { |
209 | 209 | if (event.GetString().ToDouble(&dvalue)) { |
210 | - arrow[0][0] = (GLfloat)dvalue; | |
211 | - textbox_ArrowDiff0->ChangeValue(wxString::Format(wxT("%f"), arrow[1][0] - arrow[0][0])); | |
210 | + arrow_f[0][0] = (GLfloat)dvalue; | |
211 | + textbox_ArrowDiff0->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][0] - arrow_f[0][0])); | |
212 | 212 | Refresh(false); |
213 | 213 | } |
214 | 214 | } |
215 | 215 | else if (event.GetId() == itext_ArrowStart1) { |
216 | 216 | if (event.GetString().ToDouble(&dvalue)) { |
217 | - arrow[0][1] = (GLfloat)dvalue; | |
218 | - textbox_ArrowDiff1->ChangeValue(wxString::Format(wxT("%f"), arrow[1][1] - arrow[0][1])); | |
217 | + arrow_f[0][1] = (GLfloat)dvalue; | |
218 | + textbox_ArrowDiff1->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][1] - arrow_f[0][1])); | |
219 | 219 | Refresh(false); |
220 | 220 | } |
221 | 221 | } |
222 | 222 | else if (event.GetId() == itext_ArrowStart2) { |
223 | 223 | if (event.GetString().ToDouble(&dvalue)) { |
224 | - arrow[0][2] = (GLfloat)dvalue; | |
225 | - textbox_ArrowDiff2->ChangeValue(wxString::Format(wxT("%f"), arrow[1][2] - arrow[0][2])); | |
224 | + arrow_f[0][2] = (GLfloat)dvalue; | |
225 | + textbox_ArrowDiff2->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][2] - arrow_f[0][2])); | |
226 | 226 | Refresh(false); |
227 | 227 | } |
228 | 228 | } |
229 | 229 | else if (event.GetId() == itext_ArrowEnd0) { |
230 | 230 | if (event.GetString().ToDouble(&dvalue)) { |
231 | - arrow[1][0] = (GLfloat)dvalue; | |
232 | - textbox_ArrowDiff0->ChangeValue(wxString::Format(wxT("%f"), arrow[1][0] - arrow[0][0])); | |
231 | + arrow_f[1][0] = (GLfloat)dvalue; | |
232 | + textbox_ArrowDiff0->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][0] - arrow_f[0][0])); | |
233 | 233 | Refresh(false); |
234 | 234 | } |
235 | 235 | } |
236 | 236 | else if (event.GetId() == itext_ArrowEnd1) { |
237 | 237 | if (event.GetString().ToDouble(&dvalue)) { |
238 | - arrow[1][1] = (GLfloat)dvalue; | |
239 | - textbox_ArrowDiff1->ChangeValue(wxString::Format(wxT("%f"), arrow[1][1] - arrow[0][1])); | |
238 | + arrow_f[1][1] = (GLfloat)dvalue; | |
239 | + textbox_ArrowDiff1->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][1] - arrow_f[0][1])); | |
240 | 240 | Refresh(false); |
241 | 241 | } |
242 | 242 | } |
243 | 243 | else if (event.GetId() == itext_ArrowEnd2) { |
244 | 244 | if (event.GetString().ToDouble(&dvalue)) { |
245 | - arrow[1][2] = (GLfloat)dvalue; | |
246 | - textbox_ArrowDiff2->ChangeValue(wxString::Format(wxT("%f"), arrow[1][2] - arrow[0][2])); | |
245 | + arrow_f[1][2] = (GLfloat)dvalue; | |
246 | + textbox_ArrowDiff2->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][2] - arrow_f[0][2])); | |
247 | 247 | Refresh(false); |
248 | 248 | } |
249 | 249 | } |
250 | 250 | else if (event.GetId() == itext_ArrowDiff0) { |
251 | 251 | if (event.GetString().ToDouble(&dvalue)) { |
252 | - arrow[1][0] = arrow[0][0] + (GLfloat)dvalue; | |
253 | - textbox_ArrowEnd0->ChangeValue(wxString::Format(wxT("%f"), arrow[1][0])); | |
252 | + arrow_f[1][0] = arrow_f[0][0] + (GLfloat)dvalue; | |
253 | + textbox_ArrowEnd0->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][0])); | |
254 | 254 | Refresh(false); |
255 | 255 | } |
256 | 256 | } |
257 | 257 | else if (event.GetId() == itext_ArrowDiff1) { |
258 | 258 | if (event.GetString().ToDouble(&dvalue)) { |
259 | - arrow[1][1] = arrow[0][1] + (GLfloat)dvalue; | |
260 | - textbox_ArrowEnd1->ChangeValue(wxString::Format(wxT("%f"), arrow[1][1])); | |
259 | + arrow_f[1][1] = arrow_f[0][1] + (GLfloat)dvalue; | |
260 | + textbox_ArrowEnd1->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][1])); | |
261 | 261 | Refresh(false); |
262 | 262 | } |
263 | 263 | } |
264 | 264 | else if (event.GetId() == itext_ArrowDiff2) { |
265 | 265 | if (event.GetString().ToDouble(&dvalue)) { |
266 | - arrow[1][2] = arrow[0][2] + (GLfloat)dvalue; | |
267 | - textbox_ArrowEnd2->ChangeValue(wxString::Format(wxT("%f"), arrow[1][2])); | |
266 | + arrow_f[1][2] = arrow_f[0][2] + (GLfloat)dvalue; | |
267 | + textbox_ArrowEnd2->ChangeValue(wxString::Format(wxT("%f"), arrow_f[1][2])); | |
268 | 268 | Refresh(false); |
269 | 269 | } |
270 | 270 | } |
271 | + // | |
272 | + // Fractional -> Cartesian | |
273 | + // | |
274 | + for (ii = 0; ii < 2; ++ii) | |
275 | + for (jj = 0; jj < 3; ++jj) | |
276 | + arrow_c[ii][jj] = bvec[0][jj] * arrow_f[ii][0] | |
277 | + + bvec[1][jj] * arrow_f[ii][1] | |
278 | + + bvec[2][jj] * arrow_f[ii][2]; | |
271 | 279 | } |
272 | 280 | /** |
273 | 281 | @brief Change Line color color (::blackback) |
@@ -276,7 +284,6 @@ void MyFrame::textctrl_LineColor( | ||
276 | 284 | wxCommandEvent& event //!<[in] Selected menu |
277 | 285 | ) |
278 | 286 | { |
279 | - int ierr; | |
280 | 287 | double dvalue; |
281 | 288 | |
282 | 289 | if (event.GetId() == itext_LineColorR) { |
@@ -305,7 +312,6 @@ void MyFrame::textctrl_Section( | ||
305 | 312 | wxCommandEvent& event //!<[in] Selected menu |
306 | 313 | ) |
307 | 314 | { |
308 | - int ierr; | |
309 | 315 | double dvalue; |
310 | 316 | |
311 | 317 | if (event.GetId() == itext_SectionR) { |
@@ -334,7 +340,6 @@ void MyFrame::textctrl_Band( | ||
334 | 340 | wxCommandEvent& event //!<[in] Selected menu |
335 | 341 | ) |
336 | 342 | { |
337 | - int ierr; | |
338 | 343 | double dvalue; |
339 | 344 | int ib = (event.GetId() - icheck_band) / 4; |
340 | 345 |
@@ -367,7 +372,6 @@ void MyFrame::textctrl_BackGround( | ||
367 | 372 | wxCommandEvent& event //!<[in] Selected menu |
368 | 373 | ) |
369 | 374 | { |
370 | - int ierr; | |
371 | 375 | double dvalue; |
372 | 376 | |
373 | 377 | if (event.GetId() == itext_BackGroundR) { |
@@ -402,7 +406,6 @@ void MyFrame::textctrl_BZ_number( | ||
402 | 406 | wxCommandEvent& event //!<[in] Selected menu |
403 | 407 | ) |
404 | 408 | { |
405 | - int ierr; | |
406 | 409 | double dvalue; |
407 | 410 | |
408 | 411 | if (event.GetId() == itext_BZ_number0) { |
@@ -490,6 +493,15 @@ void MyFrame::radio_BarColor( | ||
490 | 493 | BarColor[4][ii] = yellow[ii]; |
491 | 494 | } |
492 | 495 | } |
496 | + else if (event.GetString().Cmp(wxT("BWR")) == 0) { | |
497 | + for (ii = 0; ii < 4; ii++) { | |
498 | + BarColor[0][ii] = blue[ii]; | |
499 | + BarColor[1][ii] = 0.5f * (blue[ii] + wgray[ii]); | |
500 | + BarColor[2][ii] = wgray[ii]; | |
501 | + BarColor[3][ii] = 0.5f * (red[ii] + wgray[ii]); | |
502 | + BarColor[4][ii] = red[ii]; | |
503 | + } | |
504 | + } | |
493 | 505 | paint(); |
494 | 506 | Refresh(false); |
495 | 507 | } /* menu_brillouinzone */ |
@@ -511,7 +523,6 @@ void MyFrame::radiovalue_colorscale( | ||
511 | 523 | wxCommandEvent& event //!<[in] Selected menu |
512 | 524 | ) |
513 | 525 | { |
514 | - int ierr, ii; | |
515 | 526 | double dminmax; |
516 | 527 | |
517 | 528 | if (event.GetId() == itext_colorscalemin) { |
@@ -547,7 +558,7 @@ void MyFrame::checkvalue_equator( | ||
547 | 558 | wxCommandEvent& event //!<[in] Selected menu |
548 | 559 | ) |
549 | 560 | { |
550 | - int ierr, ii, jj, ib; | |
561 | + int ii, jj; | |
551 | 562 | double deqvec; |
552 | 563 | |
553 | 564 | if (event.GetId() == icheck_equator) { |
@@ -587,7 +598,6 @@ void MyFrame::textctrl_interpol( | ||
587 | 598 | wxCommandEvent& event //!<[in] Selected menu |
588 | 599 | ) |
589 | 600 | { |
590 | - int ierr; | |
591 | 601 | long int long_interpol; |
592 | 602 | |
593 | 603 | if (event.GetString().ToLong(&long_interpol)) { |
@@ -623,7 +633,6 @@ void MyFrame::textctrl_line( | ||
623 | 633 | wxCommandEvent& event //!<[in] Selected menu |
624 | 634 | ) |
625 | 635 | { |
626 | - int ierr; | |
627 | 636 | double dlinewidth; |
628 | 637 | |
629 | 638 | if (event.GetString().ToDouble(&dlinewidth)) linewidth = (GLfloat)dlinewidth; |
@@ -659,7 +668,7 @@ void MyFrame::radiovalue_section( | ||
659 | 668 | wxCommandEvent& event //!<[in] Selected menu |
660 | 669 | ) |
661 | 670 | { |
662 | - int ierr, ii, jj, ib; | |
671 | + int ii, jj; | |
663 | 672 | double dsecvec; |
664 | 673 | |
665 | 674 | if (event.GetId() == icheck_section) { |
@@ -739,7 +748,6 @@ void MyFrame::textctrl_view( | ||
739 | 748 | wxCommandEvent& event //!<[in] Selected menu |
740 | 749 | ) |
741 | 750 | { |
742 | - int ierr; | |
743 | 751 | double dvalue; |
744 | 752 | |
745 | 753 | if (event.GetId() == itext_scale) { |
@@ -816,9 +824,6 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, | ||
816 | 824 | : wxFrame(frame, wxID_ANY, title, pos, size, style), |
817 | 825 | m_canvas(NULL) |
818 | 826 | { |
819 | - int ib, itet; | |
820 | - char menuname[8]; | |
821 | - | |
822 | 827 | SetIcon(wxICON(fermisurfer)); |
823 | 828 | |
824 | 829 | // Make a menubar |
@@ -1082,14 +1087,14 @@ wxT("8"), wxT("9"), wxT("10"), wxT("11"), wxT("12"), wxT("13"), wxT("14"), | ||
1082 | 1087 | gbsizer->Add(new wxRadioBox(panel, iradio_lighting, wxT("Lighting"), |
1083 | 1088 | wxDefaultPosition, wxDefaultSize, |
1084 | 1089 | WXSIZEOF(choices_light), choices_light, |
1085 | - 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 0), wxGBSpan(4, 1)); | |
1090 | + 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 1), wxGBSpan(4, 1)); | |
1086 | 1091 | |
1087 | - wxString choices_BarColor[] = { wxT("BGR"), wxT("CMY"), wxT("MCY")}; | |
1092 | + wxString choices_BarColor[] = { wxT("BGR"), wxT("CMY"), wxT("MCY"), wxT("BWR") }; | |
1088 | 1093 | Bind(wxEVT_COMMAND_RADIOBOX_SELECTED, &MyFrame::radio_BarColor, this, iradio_BarColor); |
1089 | 1094 | gbsizer->Add(new wxRadioBox(panel, iradio_BarColor, wxT("Bar Color"), |
1090 | 1095 | wxDefaultPosition, wxDefaultSize, |
1091 | 1096 | WXSIZEOF(choices_BarColor), choices_BarColor, |
1092 | - 1, wxRA_SPECIFY_COLS), wxGBPosition(15, 1), wxGBSpan(4, 1)); | |
1097 | + 1, wxRA_SPECIFY_COLS), wxGBPosition(14, 0), wxGBSpan(5, 1)); | |
1093 | 1098 | // |
1094 | 1099 | // Section color |
1095 | 1100 | // |
@@ -1182,7 +1187,7 @@ void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event)) | ||
1182 | 1187 | } |
1183 | 1188 | |
1184 | 1189 | void MyFrame::modify_band() { |
1185 | - int ib, width, height, j; | |
1190 | + int ib, j; | |
1186 | 1191 | wxCheckBox** check; |
1187 | 1192 | wxTextCtrl** textbox_BandR, ** textbox_BandG, ** textbox_BandB; |
1188 | 1193 | GLfloat mat2; |
@@ -155,7 +155,8 @@ extern GLfloat BackGroundColor[4];//!< Background color code | ||
155 | 155 | extern GLfloat LineColor[4];//!< Line color code |
156 | 156 | extern GLfloat SectionColor[4];//!< Line color code |
157 | 157 | extern GLfloat BarColor[5][4]; |
158 | -extern GLfloat arrow[2][3]; | |
158 | +extern GLfloat arrow_f[2][3]; | |
159 | +extern GLfloat arrow_c[2][3]; | |
159 | 160 | /* |
160 | 161 | Others |
161 | 162 | */ |