Power System Platform  2026w23a-beta
Loading...
Searching...
No Matches
HMPlane Class Reference

Public Member Functions

 HMPlane (const double &width, const double &height, const double limits[2])
 
virtual void DrawDC (wxGraphicsContext *gc) const
 
virtual void DrawDC (wxDC &dc) const
 
virtual void DrawLabelDC (wxGraphicsContext *gc) const
 
virtual void DrawLabelDC (wxDC &dc) const
 
virtual void SetLabelLimits (const double &min, const double &max)
 
virtual double GetMaxLimit ()
 
virtual double GetMinLimit ()
 
virtual void SetRectSlope (const wxRect2DDouble &rect, const double &angle, const double &depth)
 
virtual void Resize (const double &width, const double &height)
 
virtual void ResizeDC (const double &width, const double &height)
 
virtual void SmoothPlane (const unsigned int &iterations)
 
virtual void Clear ()
 

Protected Member Functions

void FillCoordsBuffer ()
 
wxColour VoltToColour (double volt, int alpha=160) const
 

Protected Attributes

const double m_meshSize = 15.0f
 
size_t m_meshTickX = 0
 
size_t m_meshTickY = 0
 
double m_width = 0.0
 
double m_height = 0.0
 
std::vector< std::vector< BufferMeshCoords * > > m_coords
 
std::vector< std::vector< BufferMeshCoords * > > m_coordsT
 
std::vector< double > m_bufferCoords
 
std::vector< size_t > m_indexBuffer
 
double m_limits [2] = {1.1, 0.9}
 
bool m_isClear = true
 

Detailed Description

Definition at line 27 of file HMPlane.h.

Constructor & Destructor Documentation

◆ HMPlane()

HMPlane::HMPlane ( const double &  width,
const double &  height,
const double  limits[2] 
)

Definition at line 20 of file HMPlane.cpp.

20 : m_width(width), m_height(height)
21{
22 // Fill mesh coords
23 for (auto accHeight = 0; accHeight <= m_height + m_meshSize; accHeight += m_meshSize) {
24 std::vector<BufferMeshCoords*> line;
25 for (auto accWidth = 0; accWidth <= m_width + m_meshSize; accWidth += m_meshSize) {
26 auto* bmc = new BufferMeshCoords;
27 bmc->x = accWidth;
28 bmc->y = accHeight;
29 bmc->z = 0.0f;
30 line.emplace_back(bmc);
31
32 if (accHeight < 0.1f) m_meshTickX++;
33 }
34 m_meshTickY++;
35 m_coords.emplace_back(line);
36 }
37 m_coordsT.resize(m_coords[0].size());
38 for (auto& line : m_coordsT) line.resize(m_coords.size());
39 for (size_t i = 0; i < m_coords.size(); ++i) {
40 const auto& line = m_coords[i];
41 for (size_t j = 0; j < line.size(); ++j) {
42 m_coordsT[j][i] = m_coords[i][j];
43 }
44 }
45
46 m_limits[0] = limits[0];
47 m_limits[1] = limits[1];
48}

◆ ~HMPlane()

HMPlane::~HMPlane ( )
virtual

Definition at line 50 of file HMPlane.cpp.

51{
52 for (const auto& line : m_coords) {
53 for (auto* bmv : line) {
54 delete bmv;
55 }
56 }
57 m_coords.clear();
58}

Member Function Documentation

◆ Clear()

void HMPlane::Clear ( )
virtual

Definition at line 516 of file HMPlane.cpp.

517{
518 if (!m_isClear) {
519 for (const auto& line : m_coords) {
520 for (auto* bmv : line) {
521 bmv->z = 0.0f;
522 }
523 }
524 FillCoordsBuffer();
525 m_isClear = true;
526 }
527}

◆ DrawDC() [1/2]

void HMPlane::DrawDC ( wxDC &  dc) const
virtual

Definition at line 87 of file HMPlane.cpp.

88{
89 if (m_isClear) return;
90 dc.SetPen(*wxTRANSPARENT_PEN);
91
92 for (const auto& line : m_coords)
93 {
94 int y = wxRound(line[0]->y);
95
96 struct Stop {
97 double pos;
98 wxColour color;
99 };
100
101 std::vector<Stop> stops;
102
103 stops.push_back({ 0.0, wxColour(255,255,255) });
104
105 for (const BufferMeshCoords* coords : line)
106 {
107 double pos = coords->x / m_width;
108 stops.push_back({ pos, VoltToColour(coords->z) });
109 }
110
111 auto ColorAt = [&](double t) -> wxColour
112 {
113 if (t <= stops.front().pos)
114 return stops.front().color;
115
116 if (t >= stops.back().pos)
117 return stops.back().color;
118
119 for (size_t i = 0; i < stops.size() - 1; ++i)
120 {
121 if (t >= stops[i].pos && t <= stops[i + 1].pos)
122 {
123 double localT =
124 (t - stops[i].pos) /
125 (stops[i + 1].pos - stops[i].pos);
126
127 const wxColour& c1 = stops[i].color;
128 const wxColour& c2 = stops[i + 1].color;
129
130 return wxColour(
131 c1.Red() + localT * (c2.Red() - c1.Red()),
132 c1.Green() + localT * (c2.Green() - c1.Green()),
133 c1.Blue() + localT * (c2.Blue() - c1.Blue())
134 );
135 }
136 }
137
138 return stops.back().color;
139 };
140
141 for (size_t i = 0; i < stops.size() - 1; ++i)
142 {
143 int x1 = wxRound(stops[i].pos * m_width);
144 int x2 = wxRound(stops[i + 1].pos * m_width);
145
146 if (x2 <= x1)
147 continue;
148
149 double t1 = stops[i].pos;
150 double t2 = stops[i + 1].pos;
151
152 wxColour c1 = ColorAt(t1);
153 wxColour c2 = ColorAt(t2);
154
155 wxRect rect(x1, y, x2 - x1, m_meshSize);
156
157 dc.GradientFillLinear(rect, c1, c2, wxEAST);
158 }
159 }
160}

◆ DrawDC() [2/2]

void HMPlane::DrawDC ( wxGraphicsContext *  gc) const
virtual

Definition at line 60 of file HMPlane.cpp.

61{
62 if (m_isClear) return;
63 gc->SetPen(*wxTRANSPARENT_PEN);
64 for (const auto& line : m_coords) {
65 wxGraphicsGradientStops gStops;
66 gStops.Add(wxColor(255, 255, 255), 0);
67 for (const BufferMeshCoords* coords : line) {
68 gStops.Add(VoltToColour(coords->z), coords->x / (m_width));
69 }
70 wxGraphicsBrush brush = gc->CreateLinearGradientBrush(0, line[0]->y, m_width, line[0]->y, gStops);
71 gc->SetBrush(brush);
72 gc->DrawRectangle(0, line[0]->y, m_width, m_meshSize);
73 }
74
75 for (const auto& line : m_coordsT) {
76 wxGraphicsGradientStops gStops;
77 gStops.Add(wxColor(255, 255, 255), 0);
78 for (const BufferMeshCoords* coords : line) {
79 gStops.Add(VoltToColour(coords->z), coords->y / (m_height));
80 }
81 wxGraphicsBrush brush = gc->CreateLinearGradientBrush(line[0]->x, 0, line[0]->x, m_height, gStops);
82 gc->SetBrush(brush);
83 gc->DrawRectangle(line[0]->x, 0, m_meshSize, m_height);
84 }
85}

◆ DrawLabelDC() [1/2]

void HMPlane::DrawLabelDC ( wxDC &  dc) const
virtual

Definition at line 228 of file HMPlane.cpp.

229{
230 dc.SetUserScale(1.0, 1.0);
231 dc.SetDeviceOrigin(0, 0);
232
233 dc.SetPen(*wxBLACK_PEN);
234 if (wxSystemSettings::GetAppearance().IsDark())
235 {
236 dc.SetPen(wxPen(wxColour(205, 210, 215)));
237 }
238 int xStart = 30;
239 int yStart = m_height - 45;
240 int width = 300;
241 int height = 30;
242
243 struct Stop {
244 double pos;
245 wxColour color;
246 };
247
248 std::vector<Stop> stops = {
249 {0.00, VoltToColour(-1.0, 210)},
250 {0.25, VoltToColour(-0.5, 210)},
251 {0.50, VoltToColour(0.0, 210)},
252 {0.75, VoltToColour(0.5, 210)},
253 {1.00, VoltToColour(1.0, 210)}
254 };
255
256 auto ColorAt = [&](double t) -> wxColour
257 {
258 for (size_t i = 0; i < stops.size() - 1; ++i)
259 {
260 if (t >= stops[i].pos && t <= stops[i + 1].pos)
261 {
262 double localT =
263 (t - stops[i].pos) /
264 (stops[i + 1].pos - stops[i].pos);
265
266 const wxColour& c1 = stops[i].color;
267 const wxColour& c2 = stops[i + 1].color;
268
269 return wxColour(
270 c1.Red() + localT * (c2.Red() - c1.Red()),
271 c1.Green() + localT * (c2.Green() - c1.Green()),
272 c1.Blue() + localT * (c2.Blue() - c1.Blue())
273 );
274 }
275 }
276 return stops.back().color;
277 };
278
279 for (int x = 0; x < width; ++x)
280 {
281 double t = (double)x / width;
282
283 wxColour c = ColorAt(t);
284
285 dc.SetPen(wxPen(c));
286 dc.DrawLine(xStart + x,
287 yStart,
288 xStart + x,
289 yStart + height);
290 }
291
292 dc.SetPen(*wxBLACK_PEN);
293 if (wxSystemSettings::GetAppearance().IsDark())
294 {
295 dc.SetPen(wxPen(wxColour(205, 210, 215)));
296 }
297 dc.SetBrush(*wxTRANSPARENT_BRUSH);
298 dc.DrawRectangle(xStart, yStart, width, height);
299 wxPoint2DDouble lines[10];
300 lines[0] = wxPoint2DDouble(30, m_height - 50);
301 lines[1] = wxPoint2DDouble(30, m_height - 40);
302 lines[2] = wxPoint2DDouble(105, m_height - 50);
303 lines[3] = wxPoint2DDouble(105, m_height - 40);
304 lines[4] = wxPoint2DDouble(180, m_height - 50);
305 lines[5] = wxPoint2DDouble(180, m_height - 40);
306 lines[6] = wxPoint2DDouble(255, m_height - 50);
307 lines[7] = wxPoint2DDouble(255, m_height - 40);
308 lines[8] = wxPoint2DDouble(330, m_height - 50);
309 lines[9] = wxPoint2DDouble(330, m_height - 40);
310 //gc->DrawLines(10, lines, wxWINDING_RULE);
311 for (size_t i = 0; i < 10; i += 2) {
312 dc.DrawLine(lines[i].m_x, lines[i].m_y, lines[i + 1].m_x, lines[i + 1].m_y);
313 }
314
315 dc.SetFont(wxFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
316 dc.DrawText(_("Voltage (p.u.)"), 30, m_height - 15);
317 wxString voltageText = "";
318 int textWidth, textHeight;
319 voltageText = wxString::Format("%.3f", m_limits[0]);
320 dc.GetTextExtent(voltageText, &textWidth, &textHeight);
321 dc.DrawText(voltageText, 330 - textWidth / 2, m_height - 65);
322 voltageText = wxString::Format("%.3f", m_limits[0] * 0.75 + m_limits[1] * 0.25);
323 dc.GetTextExtent(voltageText, &textWidth, &textHeight);
324 dc.DrawText(voltageText, 255 - textWidth / 2, m_height - 65);
325 voltageText = wxString::Format("%.3f", m_limits[0] * 0.5 + m_limits[1] * 0.5);
326 dc.GetTextExtent(voltageText, &textWidth, &textHeight);
327 dc.DrawText(voltageText, 180 - textWidth / 2, m_height - 65);
328 voltageText = wxString::Format("%.3f", m_limits[0] * 0.25 + m_limits[1] * 0.75);
329 dc.GetTextExtent(voltageText, &textWidth, &textHeight);
330 dc.DrawText(voltageText, 105 - textWidth / 2, m_height - 65);
331 voltageText = wxString::Format("%.3f", m_limits[1]);
332 dc.GetTextExtent(voltageText, &textWidth, &textHeight);
333 dc.DrawText(voltageText, 30 - textWidth / 2, m_height - 65);
334}

◆ DrawLabelDC() [2/2]

void HMPlane::DrawLabelDC ( wxGraphicsContext *  gc) const
virtual

Definition at line 162 of file HMPlane.cpp.

163{
164 wxGraphicsMatrix identityMatrix = gc->GetTransform();
165 identityMatrix.Set();
166 gc->PushState();
167 gc->SetTransform(identityMatrix);
168 gc->SetPen(*wxBLACK_PEN);
169 if (wxSystemSettings::GetAppearance().IsDark())
170 {
171 gc->SetPen(wxPen(wxColour(205, 210, 215)));
172 }
173 wxGraphicsGradientStops gStops;
174 gStops.Add(VoltToColour(-1.0, 210), 0.0);
175 gStops.Add(VoltToColour(-0.5, 210), 0.25);
176 gStops.Add(VoltToColour(0.0, 210), 0.5);
177 gStops.Add(VoltToColour(0.5, 210), 0.75);
178 gStops.Add(VoltToColour(1.0, 210), 1.0);
179 wxGraphicsBrush brush = gc->CreateLinearGradientBrush(30, m_height - 45, 330, m_height - 45, gStops);
180 gc->SetBrush(brush);
181
182 gc->DrawRectangle(30, m_height - 45, 300, 30);
183
184 wxPoint2DDouble lines[10];
185 lines[0] = wxPoint2DDouble(30, m_height - 50);
186 lines[1] = wxPoint2DDouble(30, m_height - 40);
187 lines[2] = wxPoint2DDouble(105, m_height - 50);
188 lines[3] = wxPoint2DDouble(105, m_height - 40);
189 lines[4] = wxPoint2DDouble(180, m_height - 50);
190 lines[5] = wxPoint2DDouble(180, m_height - 40);
191 lines[6] = wxPoint2DDouble(255, m_height - 50);
192 lines[7] = wxPoint2DDouble(255, m_height - 40);
193 lines[8] = wxPoint2DDouble(330, m_height - 50);
194 lines[9] = wxPoint2DDouble(330, m_height - 40);
195 //gc->DrawLines(10, lines, wxWINDING_RULE);
196 for (size_t i = 0; i < 10; i += 2) {
197 gc->StrokeLine(lines[i].m_x, lines[i].m_y, lines[i + 1].m_x, lines[i + 1].m_y);
198 }
199 wxColour fontColour = *wxBLACK;
200 if (wxSystemSettings::GetAppearance().IsDark())
201 {
202 fontColour = wxColour(205, 210, 215);
203 }
204
205 gc->SetFont(wxFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL), fontColour);
206 gc->DrawText(_("Voltage (p.u.)"), 30, m_height - 15);
207 wxString voltageText = "";
208 double textWidth, textHeight;
209 voltageText = wxString::Format("%.3f", m_limits[0]);
210 gc->GetTextExtent(voltageText, &textWidth, &textHeight);
211 gc->DrawText(voltageText, 330 - textWidth / 2, m_height - 65);
212 voltageText = wxString::Format("%.3f", m_limits[0] * 0.75 + m_limits[1] * 0.25);
213 gc->GetTextExtent(voltageText, &textWidth, &textHeight);
214 gc->DrawText(voltageText, 255 - textWidth / 2, m_height - 65);
215 voltageText = wxString::Format("%.3f", m_limits[0] * 0.5 + m_limits[1] * 0.5);
216 gc->GetTextExtent(voltageText, &textWidth, &textHeight);
217 gc->DrawText(voltageText, 180 - textWidth / 2, m_height - 65);
218 voltageText = wxString::Format("%.3f", m_limits[0] * 0.25 + m_limits[1] * 0.75);
219 gc->GetTextExtent(voltageText, &textWidth, &textHeight);
220 gc->DrawText(voltageText, 105 - textWidth / 2, m_height - 65);
221 voltageText = wxString::Format("%.3f", m_limits[1]);
222 gc->GetTextExtent(voltageText, &textWidth, &textHeight);
223 gc->DrawText(voltageText, 30 - textWidth / 2, m_height - 65);
224
225 gc->PopState();
226}

◆ FillCoordsBuffer()

void HMPlane::FillCoordsBuffer ( )
protected

Definition at line 529 of file HMPlane.cpp.

530{
531 m_bufferCoords.clear();
532
533 for (const auto& line : m_coords) {
534 for (auto* bmv : line) {
535 m_bufferCoords.push_back(bmv->x);
536 m_bufferCoords.push_back(bmv->y);
537 m_bufferCoords.push_back(bmv->z);
538 }
539 }
540}

◆ GetMaxLimit()

virtual double HMPlane::GetMaxLimit ( )
inlinevirtual

Definition at line 42 of file HMPlane.h.

42{ return m_limits[0]; }

◆ GetMinLimit()

virtual double HMPlane::GetMinLimit ( )
inlinevirtual

Definition at line 43 of file HMPlane.h.

43{ return m_limits[1]; }

◆ Resize()

void HMPlane::Resize ( const double &  width,
const double &  height 
)
virtual

Definition at line 366 of file HMPlane.cpp.

367{
368 //Clear();
369 m_width = width;
370 m_height = height;
371 m_meshTickX = 0;
372 m_meshTickY = 0;
373
374 for (const auto& line : m_coords) {
375 for (auto* bmv : line) {
376 delete bmv;
377 }
378 }
379 m_coords.clear();
380
381 // Fill mesh coords
382 for (auto accHeight = 0; accHeight < m_height + m_meshSize; accHeight += m_meshSize) {
383 std::vector<BufferMeshCoords*> line;
384 for (auto accWidth = 0; accWidth < m_width + m_meshSize; accWidth += m_meshSize) {
385 auto* bmc = new BufferMeshCoords;
386 bmc->x = accWidth;
387 bmc->y = accHeight;
388 bmc->z = 0.0f;
389 line.emplace_back(bmc);
390
391 if (accHeight < 0.1f) m_meshTickX++;
392 }
393 m_meshTickY++;
394 m_coords.emplace_back(line);
395 }
396 FillCoordsBuffer();
397 m_isClear = false;
398}

◆ ResizeDC()

void HMPlane::ResizeDC ( const double &  width,
const double &  height 
)
virtual

Definition at line 400 of file HMPlane.cpp.

401{
402 m_width = width;
403 m_height = height;
404 m_meshTickX = 0;
405 m_meshTickY = 0;
406
407 for (const auto& line : m_coords) {
408 for (auto* bmv : line) {
409 delete bmv;
410 }
411 }
412 m_coords.clear();
413 m_coordsT.clear();
414
415 // Fill mesh coords
416 for (auto accHeight = 0; accHeight < m_height + m_meshSize; accHeight += m_meshSize) {
417 std::vector<BufferMeshCoords*> line;
418 for (auto accWidth = 0; accWidth < m_width + m_meshSize; accWidth += m_meshSize) {
419 auto* bmc = new BufferMeshCoords;
420 bmc->x = accWidth;
421 bmc->y = accHeight;
422 bmc->z = 0.0f;
423 line.emplace_back(bmc);
424
425 if (accHeight < 0.1f) m_meshTickX++;
426 }
427 m_meshTickY++;
428 m_coords.emplace_back(line);
429 }
430 m_coordsT.resize(m_coords[0].size());
431 for (auto& line : m_coordsT) line.resize(m_coords.size());
432 for (size_t i = 0; i < m_coords.size(); ++i) {
433 const auto& line = m_coords[i];
434 for (size_t j = 0; j < line.size(); ++j) {
435 m_coordsT[j][i] = m_coords[i][j];
436 }
437 }
438
439 m_isClear = false;
440}

◆ SetLabelLimits()

void HMPlane::SetLabelLimits ( const double &  min,
const double &  max 
)
virtual

Definition at line 336 of file HMPlane.cpp.

337{
338 m_limits[0] = max;
339 m_limits[1] = min;
340}

◆ SetRectSlope()

void HMPlane::SetRectSlope ( const wxRect2DDouble &  rect,
const double &  angle,
const double &  depth 
)
virtual

Definition at line 342 of file HMPlane.cpp.

343{
344 for (const auto& line : m_coords) {
345 for (auto* coord : line) {
346 wxPoint2DDouble pt(coord->x, coord->y);
347 if (std::abs(angle) > 0.01) {
348
349 wxPoint2DDouble rotPt;
350 rotPt.m_x = cos(angle) * (pt.m_x - rect.GetCentre().m_x) + sin(angle) * (pt.m_y - rect.GetCentre().m_y) + rect.GetCentre().m_x;
351 rotPt.m_y = sin(angle) * (pt.m_x - rect.GetCentre().m_x) - cos(angle) * (pt.m_y - rect.GetCentre().m_y) + rect.GetCentre().m_y;
352
353 pt = rotPt;
354 }
355 if (rect.Contains(pt)) {
356 coord->z += depth;
357 coord->z = std::min<double>(coord->z, 1.0f);
358 coord->z = std::max<double>(coord->z, -1.0f);
359 }
360
361 }
362 }
363 m_isClear = false;
364}

◆ SmoothPlane()

void HMPlane::SmoothPlane ( const unsigned int &  iterations)
virtual

Definition at line 442 of file HMPlane.cpp.

443{
444 const int maxTickX = static_cast<int>(m_meshTickX);
445 const int maxTickY = static_cast<int>(m_meshTickY);
446
447 std::vector< std::vector<BufferMeshCoords> > tmpCoords;
448 for (const auto& line : m_coords) {
449 std::vector<BufferMeshCoords> tmpCoordsLine;
450 for (auto* bmv : line) {
451 tmpCoordsLine.push_back(*bmv);
452 }
453 tmpCoords.push_back(tmpCoordsLine);
454 }
455
456 //Mean Blur
457 //for (int i = 0; i < maxTick; ++i) {
458 // for (int j = 0; j < maxTick; ++j) {
459 // // Get the 8 neighbors and smooth z
460 // float mid = 0.0f;
461 // float div = 0.0f;
462 //
463 // for (int ii = i - 1; ii <= i + 1; ++ii) {
464 // for (int jj = j - 1; jj <= j + 1; ++jj) {
465 //
466 // if (ii >= 0 && ii < maxTick && jj >= 0 && jj < maxTick) {
467 // mid += tmpCoords[ii][jj].z;
468 // div += 1.0;
469 // }
470 // }
471 // }
472 // m_coords[i][j]->z = mid / div;
473 // }
474 //}
475
476 // Gaussian Blur
477 float gaussianKernel[5][5] =
478 {
479 {1.0f / 256.0f, 4.0f / 256.0f, 6 / 256.0f, 4.0f / 256, 1.0f / 256.0f},
480 {4.0f / 256.0f, 16.0f / 256.0f, 24 / 256.0f, 16.0f / 256, 4.0f / 256.0f},
481 {6.0f / 256.0f, 24.0f / 256.0f, 36 / 256.0f, 24.0f / 256, 6.0f / 256.0f},
482 {4.0f / 256.0f, 16.0f / 256.0f, 24 / 256.0f, 16.0f / 256, 4.0f / 256.0f},
483 {1.0f / 256.0f, 4.0f / 256.0f, 6 / 256.0f, 4.0f / 256, 1.0f / 256.0f}
484 };
485
486 for (size_t it = 0; it < iterations; ++it) {
487 for (size_t i = 0; i < m_meshTickY; ++i) {
488 for (size_t j = 0; j < m_meshTickX; ++j) {
489 // Get the 24 neighbors and smooth z
490 float value = 0.0f;
491
492 for (size_t ii = i - 2; ii <= i + 2; ++ii) {
493 for (size_t jj = j - 2; jj <= j + 2; ++jj) {
494
495 if (ii >= 0 && ii < m_meshTickY && jj >= 0 && jj < m_meshTickX) {
496 value += tmpCoords[ii][jj].z * gaussianKernel[ii - i + 2][jj - j + 2];
497 }
498 }
499 }
500 m_coords[i][j]->z = value;
501 }
502 }
503 if (it < iterations - 1) {
504 for (size_t i = 0; i < m_meshTickY; ++i) {
505 for (size_t j = 0; j < m_meshTickX; ++j) {
506 tmpCoords[i][j].z = m_coords[i][j]->z;
507 }
508 }
509 }
510 }
511
512 FillCoordsBuffer();
513 m_isClear = false;
514}

◆ VoltToColour()

wxColor HMPlane::VoltToColour ( double  volt,
int  alpha = 160 
) const
protected

Definition at line 542 of file HMPlane.cpp.

543{
544 int red = 255, green = 255, blue = 255;
545 if (wxSystemSettings::GetAppearance().IsDark())
546 {
547 red = 43;
548 green = 46;
549 blue = 52;
550
551 if (volt <= -0.5) {
552 red = 100 * volt + 100;
553 green = -160 * volt + 40;
554 blue = -150 * volt + 105;
555 }
556 else if (volt > -0.5 && volt < 0.0) {
557 red = -14 * volt + 43;
558 green = -148 * volt + 46;
559 blue = -256 * volt + 52;
560 }
561 else if (volt >= 0.0 && volt < 0.5) {
562 red = 304 * volt + 43;
563 green = 198 * volt + 46;
564 blue = -44 * volt + 52;
565 }
566 else {
567 red = 80 * volt + 155;
568 green = 70 * volt + 110;
569 blue = 30 * volt + 15;
570 }
571
572 }
573 else {
574 if (volt <= -0.5) {
575 red = -100 * volt - 50;
576 green = 200 * volt + 300;
577 blue = 255;
578 }
579 else if (volt > -0.5 && volt < 0) {
580 red = 510 * volt + 255;
581 green = 110 * volt + 255;
582 blue = 255;
583 }
584 else if (volt >= 0.0 && volt < 0.5) {
585 red = 255;
586 green = -110 * volt + 255;
587 blue = -510 * volt + 255;
588 }
589 else if (volt >= 0.5) {
590 red = 255;
591 green = -200 * volt + 300;
592 blue = 100 * volt - 50;
593 }
594 }
595 return wxColor(red, green, blue, alpha);
596}

Member Data Documentation

◆ m_bufferCoords

std::vector<double> HMPlane::m_bufferCoords
protected

Definition at line 71 of file HMPlane.h.

◆ m_coords

std::vector< std::vector<BufferMeshCoords*> > HMPlane::m_coords
protected

Definition at line 69 of file HMPlane.h.

◆ m_coordsT

std::vector< std::vector<BufferMeshCoords*> > HMPlane::m_coordsT
protected

Definition at line 70 of file HMPlane.h.

◆ m_height

double HMPlane::m_height = 0.0
protected

Definition at line 67 of file HMPlane.h.

◆ m_indexBuffer

std::vector<size_t> HMPlane::m_indexBuffer
protected

Definition at line 72 of file HMPlane.h.

◆ m_isClear

bool HMPlane::m_isClear = true
protected

Definition at line 96 of file HMPlane.h.

◆ m_limits

double HMPlane::m_limits[2] = {1.1, 0.9}
protected

Definition at line 94 of file HMPlane.h.

94{1.1, 0.9};

◆ m_meshSize

const double HMPlane::m_meshSize = 15.0f
protected

Definition at line 63 of file HMPlane.h.

◆ m_meshTickX

size_t HMPlane::m_meshTickX = 0
protected

Definition at line 64 of file HMPlane.h.

◆ m_meshTickY

size_t HMPlane::m_meshTickY = 0
protected

Definition at line 65 of file HMPlane.h.

◆ m_width

double HMPlane::m_width = 0.0
protected

Definition at line 66 of file HMPlane.h.


The documentation for this class was generated from the following files: