InstantPlot.cc
37.5 KB
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
/*
* InstantPlot.cc
*
* Created on: 29 oct. 2013
* Author: CS
*/
#include <fstream>
#include <iomanip>
#include <boost/lexical_cast.hpp>
#include "InstantPlot.hh"
#include "ParamsNode.hh"
#include "AxesNode.hh"
#include "PlotLogger.hh"
#include "PlotOutput.hh"
#include "TimeUtil.hh"
#include "ParamMgr.hh"
using namespace AMDA::Parameters;
using namespace AMDA::Info;
namespace plot {
InstantPlot::InstantPlot(AMDA::Parameters::ParameterManager& manager,
boost::shared_ptr<Panel> panel) :
PanelPlotOutput(manager, panel),
_time(0),
_originalParamId("") {
}
InstantPlot::~InstantPlot() {
}
void InstantPlot::createParameters(std::list<std::string>& usedParametersId_) {
if (_originalParamId.empty())
return;
// Fill usedParameterId_ list with the only used parameter
// We do not want any resampling on the parameter
AMDA::Parameters::ParameterSPtr originalParam = _parameterManager.getParameter(_originalParamId);
if (std::find (usedParametersId_.begin(),usedParametersId_.end(),originalParam->getId()) == usedParametersId_.end())
usedParametersId_.push_back(originalParam->getId());
// Force use of normalized parameter id
_originalParamId = originalParam->getId();
}
/**
* @overload PanelPlotOutput::preparePlotArea()
*/
void InstantPlot::preparePlotArea(double startTime, double stopTime, int intervalIndex) {
LOG4CXX_DEBUG(gLogger, "InstantPlot::preparePlotArea");
// for test, dump plot properties
const char* lBuildType=getenv("BUILD_TYPE");
if(lBuildType && std::string(lBuildType) == "Debug") {
std::ofstream out("instantPlot.txt");
dump(out);
out.close();
}
if (_iSerieProperties != nullptr)
{
/*
* Sequence for an instant series
*/
// Configure range of series and color.
configureSeriesAxis();
// Configure axis legend
configureSeriesAxisLegend();
// Configure params legend
configureParamsLegend(startTime,stopTime,intervalIndex);
}
else if (_iSpectroProperties != nullptr)
{
/*
* Sequence for an instant spectro
*/
// Configure range of spectro axis.
configureSpectroAxis();
// Configure axis legend
configureSpectroAxisLegend();
}
// check instant "cut" time validity
if ((_time == 0) || (_time < startTime) || (_time > stopTime)) {
double middleTime = (startTime + stopTime) / 2;
LOG4CXX_WARN(gLogger, "InstantPlot::preparePlotArea invalid \"cut\" time : " << _time << " replaced by middle time : " << middleTime);
_time = middleTime;
}
// If panel title is empty, replace it with start and end date.
if (_panel->_title._text.empty() || _panel->_updateTitleOnNextInterval) {
//Title must be updated during the next interval plot
_panel->_updateTitleOnNextInterval = true;
// Set start date and end date.
std::string lTimeFormat("%H:%M:%S %d/%m/%y");
long int lStartTime = static_cast<long int>(_time);
tm * lStartTimeTm = gmtime(&lStartTime);
char lStartTimeChr[80];
// Format date.
strftime(lStartTimeChr, 80, lTimeFormat.c_str(), lStartTimeTm);
_panel->_title._text = std::string(lStartTimeChr);
}
PanelPlotOutput::preparePlotArea(startTime,stopTime,intervalIndex);
}
/*
* Dumps properties for test.
*/
void InstantPlot::dump(std::ostream& out_){
PanelPlotOutput::dump(out_);
std::string prefix = "instantplot.";
if (_iSerieProperties != nullptr)
_iSerieProperties->dump(out_,prefix);
if (_iSpectroProperties != nullptr)
_iSpectroProperties->dump(out_,prefix);
}
/**
* @brief Retrieve ConstantLine informations for a given serieId and constantId.
*/
ConstantLine * InstantPlot::getConstantLineFromSerieId (int serieId, int constantId) {
if (_iSerieProperties == nullptr)
return NULL;
// Look for serieId correspondence
if (_iSerieProperties->getId() == serieId) {
if (_iSerieProperties->getTableOnXAxis()) {
boost::shared_ptr<Axis> yAxis(_panel->getAxis(_iSerieProperties->getYAxisId()));
// Look for constantId correspondence
for (auto constantLine : yAxis->_constantLines) {
if (constantLine->getId() == constantId) {
return constantLine.get();
}
}
} else {
boost::shared_ptr<Axis> xAxis(_panel->getAxis(_iSerieProperties->getXAxisId()));
// Look for constantId correspondence
for (auto constantLine : xAxis->_constantLines) {
if (constantLine->getId() == constantId) {
return constantLine.get();
}
}
}
}
// ConstantId not found, we throw an exception
std::stringstream lError;
lError << "InstantPlot::getConstantLineFromSerieId : Unable to find constantId='" << constantId << "' for serieId='" << serieId << "'";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
return NULL;
}
/**
* @brief Retrieve values for a given serieId.
*/
void InstantPlot::getSerieParameterValues(int serieId, double **xValues, double **yValues, int *nbValues) {
*nbValues = 0;
if (_iSerieProperties == nullptr)
return;
if (_iSerieProperties->getId() == serieId) {
// Retrieve parameter informations and param Table if it exists
ParameterSPtr p = _parameterManager.getParameter(_originalParamId);
AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(p->getInfoId());
boost::shared_ptr<AMDA::Info::ParamTable> paramTable;
if (paramInfo)
paramTable = paramInfo->getTable(0);
ParameterData& paramData = (*_pParameterValues)[_originalParamId];
*nbValues = paramData._indexes.size();
// Build valueData and tableData
double valueData[*nbValues];
double tableData[*nbValues];
double valueMin = DBL_MAX;
double valueMax = -DBL_MAX;
double tableMin = DBL_MAX;
double tableMax = -DBL_MAX;
double tableValue = 0;
AMDA::Info::t_TableBound crtBound;
for (int i = 0; i < *nbValues; ++i) {
double value = paramData.getInterpolatedValue(_time, i);
valueData[i] = value;
valueMin = std::min (valueMin,value);
valueMax = std::max (valueMax,value);
if (paramTable) {
crtBound = paramTable->getBound(&_parameterManager, i);
tableValue = (crtBound.min + crtBound.max) /2;;
} else {
tableValue = i;
}
tableData [i] = tableValue;
tableMin = std::min (tableMin,tableValue);
tableMax = std::max (tableMax,tableValue);
}
//Attach valueData and tableData x / y value depending on table values associated axe
if (_iSerieProperties->getTableOnXAxis()) {
*xValues = _panel->getAxis (_iSerieProperties->getXAxisId())->getComputedValues(
tableData, *nbValues, tableMin, tableMax);
*yValues = _panel->getAxis (_iSerieProperties->getYAxisId())->getComputedValues(
valueData, *nbValues, valueMin, valueMax);
// If table values decrease, change values order
if ((*xValues) [0] > (*xValues) [(*nbValues) -1]) {
double swapX [*nbValues];
double swapY [*nbValues];
for (int i=0; i<*nbValues; i++) {
swapX [i] = (*xValues) [*nbValues - 1 - i];
swapY [i] = (*yValues) [*nbValues - 1 - i];
}
for (int i=0; i<*nbValues; i++) {
(*xValues) [i] = swapX [i];
(*yValues) [i] = swapY [i];
}
}
}
else {
*xValues = _panel->getAxis (_iSerieProperties->getXAxisId())->getComputedValues(
valueData, *nbValues, valueMin, valueMax);
*yValues = _panel->getAxis (_iSerieProperties->getYAxisId())->getComputedValues(
tableData, *nbValues, tableMin, tableMax);
// If table values decrease, change values order
if ((*yValues) [0] > (*yValues) [(*nbValues) -1]) {
double swapX [*nbValues];
double swapY [*nbValues];
for (int i=0; i<*nbValues; i++) {
swapX [i] = (*xValues) [*nbValues - 1 - i];
swapY [i] = (*yValues) [*nbValues - 1 - i];
}
for (int i=0; i<*nbValues; i++) {
(*xValues) [i] = swapX [i];
(*yValues) [i] = swapY [i];
}
}
}
}
}
/**
* @brief Merge, sort and remove duplicate from 2 arrays in a vector
*/
void InstantPlot::mergeAndSortTime ( double *values1Table, int values1Nb,
double *values2Table, int values2Nb,
std::vector<double> &valuesTableMerged) {
// Build 2 vectors
std::vector<double> v1(values1Table, values1Table + values1Nb);
std::vector<double> v2(values2Table, values2Table + values2Nb);
// Populate resulting vector
valuesTableMerged.insert( valuesTableMerged.end(), v1.begin(), v1.end() );
valuesTableMerged.insert( valuesTableMerged.end(), v2.begin(), v2.end() );
// Sort and remove duplicates for the resulting vector
sort (valuesTableMerged.begin(), valuesTableMerged.end());
valuesTableMerged.erase( unique( valuesTableMerged.begin(), valuesTableMerged.end() ), valuesTableMerged.end() );
}
/**
* @brief Return or compute an interpolated value
*/
double InstantPlot::getInterpolatedValue (double *valuesData, double *valuesTable, int valuesNb, double atTableValue) {
// get index of first time after given time_
if(isnan(atTableValue)){
return nan("");
}
double *pTable = valuesTable;
for(int t=0; t<valuesNb; t++) {
// No interpolation required
if (*pTable == atTableValue){
return valuesData [t];
}
// Interpolation required
if (*pTable >= atTableValue){
if (t == 0) {
return nan("");
}
else {
double v1 = valuesData [t-1];
double v2 = valuesData [t];
double d1 = valuesTable [t-1];
double d2 = valuesTable [t];
// Return a linear interpolation of the value for the index
return (v1 + (v2-v1) * (atTableValue-d1)/(d2-d1));
}
}
pTable++;
}
return nan("");
}
/**
* @brief Compute if two ligne segments intersects
*/
bool InstantPlot::intersect ( double xi, double y1i, double y2i,
double xj, double y1j, double y2j,
double *xInter) {
// Simply checks if segment are above or below the other
if ( ((y1i >= y2i) && (y1j >= y2j)) ||( (y1i <= y2i) && (y1j <= y2j)) ) {
return false;
}
// Computes intersection point :
// Compute a and b (y = a * x + b) for each segment
double a1 = (y1j - y1i) / (xj - xi);
double b1 = y1i - a1 * xi ;
double a2 = (y2j - y2i) / (xj - xi);
double b2 = y2i - a2 * xi ;
// Compute intersection point (a1*x+b1 = a2*x+b2)
*xInter = (b2-b1) / (a1-a2);
return true;
}
/**
* @brief Compute and add intersections time to the vector if intersections exist
*/
void InstantPlot::addIntersectionTable (double *values1Data, double *values1Table, int values1Nb,
double *values2Data, double *values2Table, int values2Nb,
std::vector<double> &valuesTableMerged) {
if (valuesTableMerged.empty() == true)
return;
// For each table segment compute intersection if it exists
std::vector<double> intersectionTable;
double xi = valuesTableMerged [0];
double y1i = getInterpolatedValue (values1Data, values1Table, values1Nb, xi);
double y2i = getInterpolatedValue (values2Data, values2Table, values2Nb, xi);
double xj, y1j, y2j, xInter;
for (size_t t=1; t<valuesTableMerged.size(); t++) {
xj = valuesTableMerged [t];
y1j = getInterpolatedValue (values1Data, values1Table, values1Nb, xj);
y2j = getInterpolatedValue (values2Data, values2Table, values2Nb, xj);
if (intersect (xi, y1i, y2i, xj, y1j, y2j, &xInter) == true) {
intersectionTable.push_back(xInter);
}
// Next vector element
xi = xj;
y1i = y1j;
y2i = y2j;
}
// Add intersections informations to the resulting values
valuesTableMerged.insert( valuesTableMerged.end(), intersectionTable.begin(), intersectionTable.end() );
// Sort and remove duplicates for the resulting vector
sort (valuesTableMerged.begin(), valuesTableMerged.end());
valuesTableMerged.erase( unique( valuesTableMerged.begin(), valuesTableMerged.end() ), valuesTableMerged.end() );
}
/**
* @brief Draw Fill Area for the given arrays and the valueTime timeline
*/
void InstantPlot::drawFillArea (double *values1Data, double *values1Table, int values1Nb,
double *values2Data, double *values2Table, int values2Nb,
std::vector<double> &valuesTableMerged,
bool colorGreaterSpecified, Color& colorGreater,
bool colorLessSpecified, Color& colorLess) {
// Get X and Y axis.
boost::shared_ptr<Axis> lXAxis(_panel->getAxis(_iSerieProperties->getXAxisId()));
boost::shared_ptr<Axis> lYAxis(_panel->getAxis(_iSerieProperties->getYAxisId()));
Range lXRange = getXAxisRange (*_iSerieProperties, lXAxis);
Range lYRange = getYAxisRange (*_iSerieProperties, lYAxis);
_pls->wind(lXRange.getMin(), lXRange.getMax(), lYRange.getMin(), lYRange.getMax());
PLFLT x[4], y[4], deltai, deltaj;
Color curColor;
Color lInitialColor = changeColor(_pls, colorGreater, _panel->_page->_mode);
for ( size_t i = 0; i < (valuesTableMerged.size() - 1); i++ )
{
x[0] = valuesTableMerged[i];
x[1] = x[0];
x[2] = valuesTableMerged[i+1];
x[3] = x[2];
y[0] = getInterpolatedValue (values1Data, values1Table, values1Nb, valuesTableMerged[i]);
y[1] = getInterpolatedValue (values2Data, values2Table, values2Nb, valuesTableMerged[i]);
y[2] = getInterpolatedValue (values2Data, values2Table, values2Nb, valuesTableMerged[i+1]);
y[3] = getInterpolatedValue (values1Data, values1Table, values1Nb, valuesTableMerged[i+1]);
deltai = y[1] - y[0];
deltaj = y[2] - y[3];
// Set fill color depending on segment position
if ( ((deltai > 0) && (fabs(deltai) > fabs(deltaj))) ||
((deltaj > 0) && (fabs(deltaj) > fabs(deltai))) ) {
// s1 above s2
if (colorGreaterSpecified == true) {
curColor = colorGreater;
} else {
continue;
}
}
else if ( ((deltai < 0) && (fabs(deltai) > fabs(deltaj))) ||
((deltaj < 0) && (fabs(deltaj) > fabs(deltai))) ) {
// s1 under s2
if (colorLessSpecified == true) {
curColor = colorLess;
} else {
continue;
}
} else {
// Colinear segments, no fill required
continue;
}
// Fill polygon using the given color
changeColor(_pls, curColor, _panel->_page->_mode);
if (_iSerieProperties->getTableOnXAxis())
_pls->fill(4, x, y);
else
_pls->fill(4, y, x);
}
// Restore color.
restoreColor(_pls, lInitialColor, _panel->_page->_mode);
}
void InstantPlot::drawFills(double startDate, double stopDate) {
if (_iSerieProperties == nullptr)
return;
PanelPlotOutput::drawFills(startDate, stopDate);
LOG4CXX_DEBUG(gLogger, "InstantPlot::drawFillArea");
double *values1Data = NULL;
double *values1Table = NULL;
int values1Nb = 0;
double values2Data [2];
double values2Table [2];
int values2Nb = 0;
double *values1X = NULL;
double *values1Y = NULL;
std::vector<double> valuesTableMerged;
// Drawing Fill Area located between Serie and Constant (horizontal) line
for (auto fillSerieConstant : _panel->_fillSerieConstants) {
// Retrieve serie parameter values for serieId
getSerieParameterValues (fillSerieConstant->getSerieId(), &values1X, &values1Y, &values1Nb);
if (_iSerieProperties->getTableOnXAxis()) {
values1Table = values1X;
values1Data = values1Y;
} else {
values1Table = values1Y;
values1Data = values1X;
}
// Retrieve constantLine informations for these fill
ConstantLine *constantLine = getConstantLineFromSerieId ( fillSerieConstant->getSerieId(),
fillSerieConstant->getConstantId());
// Build values2 values2Time array with 2 values : yConst & (first value, last value) for serie
values2Data [0] = convertYAxisValue (constantLine->getValue());
values2Data [1] = convertYAxisValue (constantLine->getValue());
values2Table [0] = values1Table [0];
values2Table [1] = values1Table [values1Nb-1];
// Logarithmic scale for X ?
// already done !
values2Nb = 2;
if (_iSerieProperties->getTableOnXAxis()) {
// Logarithmic scale for Y ?
if (_panel->getAxis(_iSerieProperties->getYAxisId())->_scale == Axis::Scale::LOGARITHMIC) {
values2Data [0] = log10 (values2Data [0]);
values2Data [1] = log10 (values2Data [1]);
}
} else {
// Logarithmic scale for X ?
if (_panel->getAxis(_iSerieProperties->getXAxisId())->_scale == Axis::Scale::LOGARITHMIC) {
values2Data [0] = log10 (values2Data [0]);
values2Data [1] = log10 (values2Data [1]);
}
}
// Build time vector by merging existing times and computing intersections, and draw it !
mergeAndSortTime ( values1Table, values1Nb,
values2Table, values2Nb,
valuesTableMerged);
addIntersectionTable (values1Data, values1Table, values1Nb,
values2Data, values2Table, values2Nb,
valuesTableMerged);
drawFillArea ( values1Data, values1Table, values1Nb,
values2Data, values2Table, values2Nb,
valuesTableMerged,
fillSerieConstant->isColorGreaterSpecified(), fillSerieConstant->getColorGreater(),
fillSerieConstant->isColorLessSpecified(), fillSerieConstant->getColorLess());
delete [] values1Data;
delete [] values1Table;
}
}
void InstantPlot::drawSeries(double startDate, double stopDate, int intervalIndex, std::string pParamId,
SeriesProperties& pSeries,
AMDA::Common::ParameterIndexComponent pParamIndex, ParameterAxes& param,
bool moreThanOneSerieForAxis) {
if (_iSerieProperties == nullptr)
return;
PanelPlotOutput::drawSeries(startDate, stopDate, intervalIndex, pParamId, pSeries, pParamIndex, param, moreThanOneSerieForAxis);
LOG4CXX_DEBUG(gLogger, "InstantPlot::drawSeries");
double* xValues = NULL;
double* yValues = NULL;
int nbValues;
getSerieParameterValues (_iSerieProperties->getId(), &xValues, &yValues, &nbValues);
Color lineColor = getSerieLineColor(pSeries, moreThanOneSerieForAxis);
Color symbolColor = getSerieSymbolColor(pSeries, lineColor);
drawSymbols(
pSeries.getSymbolProperties().getType(),
pSeries.getSymbolProperties().getSize(), 1.,
symbolColor,
nbValues, xValues, yValues);
drawLines(
pSeries.getLineProperties().getType(),
pSeries.getLineProperties().getStyle(),
pSeries.getLineProperties().getWidth(),
lineColor,
nbValues, xValues, yValues);
//add serie to the params legend
addSerieToParamsLegend(*_iSerieProperties,pParamIndex,param._originalParamId,
lineColor,symbolColor,startDate,stopDate, intervalIndex);
//delete data
delete [] xValues;
delete [] yValues;
}
void InstantPlot::configureSeriesAxis() {
if (_iSerieProperties == nullptr)
//nothing to do
return;
LOG4CXX_DEBUG(gLogger, "InstantPlot::configureSeriesAxis");
///////////////////////////////////////////////////////////////////////////
// Retrieve X and Y axis
///////////////////////////////////////////////////////////////////////////
boost::shared_ptr<Axis> lXAxis = _panel->getAxis(_iSerieProperties->getXAxisId());
if (lXAxis.get() == nullptr) {
std::stringstream lError;
lError << "InstantPlot::configureSeriesAxis" << ": X axis with id '" << _iSerieProperties->getXAxisId() << "' not found.";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
lXAxis->_used = true;
boost::shared_ptr<Axis> lYAxis = _panel->getAxis(_iSerieProperties->getYAxisId());
if (lYAxis.get() == nullptr) {
std::stringstream lError;
lError << "InstantPlot::configureSeriesAxis" << ": Y axis with id '" << _iSerieProperties->getYAxisId() << "' not found.";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
lYAxis->_used = true;
if (_iSerieProperties->getTableOnXAxis())
{
configureTableAxis (lXAxis, false, 0);
configureDataAxis (lYAxis, false);
}
else
{
configureTableAxis (lYAxis, false, 0);
configureDataAxis (lXAxis, false);
}
}
void InstantPlot::configureTableAxis (boost::shared_ptr<Axis> axisSPtr, bool isSpectro, int relatedDim)
{
///////////////////////////////////////////////////////////////////////////
// Configure range for table axis.
///////////////////////////////////////////////////////////////////////////
ParameterSPtr p = _parameterManager.getParameter(_originalParamId);
int dimSize;
if (relatedDim == 0)
dimSize = (*_pParameterValues)[_originalParamId].getDim1Size();
else
dimSize = (*_pParameterValues)[_originalParamId].getDim2Size();
//set axis range
Range lAxisRange = axisSPtr->Axis::getRange();
AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(p->getInfoId());
if (isnan(lAxisRange.getMin()) && isnan(lAxisRange.getMax()))
{
boost::shared_ptr<AMDA::Info::ParamTable> tableSPtr;
if (paramInfo != nullptr)
tableSPtr = paramInfo->getTable(relatedDim);
if (tableSPtr == nullptr) {
LOG4CXX_DEBUG(gLogger, "No table defined => use index");
lAxisRange.setMin(std::min(0.,lAxisRange.getMin()));
lAxisRange.setMax(std::max((double)dimSize,lAxisRange.getMax()));
} else {
AMDA::Info::t_TableBound crtBound;
for (int i = 0; i < dimSize; ++i)
{
crtBound = tableSPtr->getBound(&_parameterManager, i);
if (isSpectro)
{
lAxisRange.setMin(std::min(crtBound.min,lAxisRange.getMin()));
lAxisRange.setMax(std::max(crtBound.max,lAxisRange.getMax()));
}
else
{
lAxisRange.setMin(std::min((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMin()));
lAxisRange.setMax(std::max((crtBound.min+ crtBound.max) / 2.0,lAxisRange.getMax()));
}
}
}
}
//do not extend the axis
lAxisRange._extend = false;
axisSPtr->setRange(lAxisRange);
LOG4CXX_DEBUG(gLogger, "Table axis range : min = " << lAxisRange.getMin() << ", max = " << lAxisRange.getMax());
}
void InstantPlot::configureDataAxis (boost::shared_ptr<Axis> axisSPtr, bool isSpectro)
{
int dim1Size = (*_pParameterValues)[_originalParamId].getDim1Size();
int dim2Size = (*_pParameterValues)[_originalParamId].getDim2Size();
///////////////////////////////////////////////////////////////////////////
// Configure range axis
///////////////////////////////////////////////////////////////////////////
Range lAxisRange(axisSPtr->getRange());
// If user didn't set a range, calculate range automatically (based on parameters values).
if (!lAxisRange.isSet()) {
double instantTimeMin = +DBL_MAX;
double instantTimeMax = -DBL_MAX;
ParameterData& data = (*_pParameterValues)[_originalParamId];
if (isSpectro)
{
for (int i = 0; i < dim1Size; ++i) {
for (int j = 0; j < dim2Size; ++j) {
double valIdx = data.getInterpolatedValue(_time, AMDA::Common::ParameterIndexComponent(i,j));
if (valIdx > instantTimeMax)
instantTimeMax = valIdx;
if (valIdx < instantTimeMin)
instantTimeMin = valIdx;
}
}
}
else
{
for (int i = 0; i < dim1Size; ++i) {
double valIdx = data.getInterpolatedValue(_time, AMDA::Common::ParameterIndexComponent(i));
if (valIdx > instantTimeMax)
instantTimeMax = valIdx;
if (valIdx < instantTimeMin)
instantTimeMin = valIdx;
}
}
//do not extend the axis
lAxisRange._extend = false;
lAxisRange.setMin(instantTimeMin);
lAxisRange.setMax(instantTimeMax);
axisSPtr->setRange(lAxisRange);
}
LOG4CXX_DEBUG(gLogger, "Data axis range : min = " << lAxisRange.getMin() << ", max = " << lAxisRange.getMax());
}
void InstantPlot::configureSeriesAxisLegend () {
if (_iSerieProperties == nullptr)
return;
std::string yAxisId = _iSerieProperties->getYAxisId();
boost::shared_ptr<Axis> lYAxis = _panel->getAxis(yAxisId);
if (lYAxis.get() == nullptr) {
std::stringstream lError;
lError << "TimePlot::configureSeriesAxis" << ": Y axis with id '" << yAxisId << "' not found.";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
std::string xAxisId = _iSerieProperties->getXAxisId();
boost::shared_ptr<Axis> lXAxis = _panel->getAxis(xAxisId);
if (lXAxis.get() == nullptr) {
std::stringstream lError;
lError << "TimePlot::configureSeriesAxis" << ": Y axis with id '" << xAxisId << "' not found.";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
if (_iSerieProperties->getTableOnXAxis())
{
configureTableAxisLegend(lXAxis,0);
configureDataAxisLegend(lYAxis, false);
}
else
{
configureTableAxisLegend(lYAxis,0);
configureDataAxisLegend(lXAxis, false);
}
}
void InstantPlot::configureTableAxisLegend(boost::shared_ptr<Axis> axisSPtr, int relatedDim) {
// Retrieve ParamInfo Manager
ParamMgr *piMgr =ParamMgr::getInstance();
// If axis legend already set, nothing to do
if (axisSPtr->_legend._text.empty() == true) {
// Otherwise, build legend depending on paramInfo availability
ParameterSPtr p = _parameterManager.getParameter(_originalParamId);
ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(p->getInfoId());
if (paramInfo) {
boost::shared_ptr<AMDA::Info::ParamTable> tableSPtr = paramInfo->getTable(relatedDim);
if (tableSPtr) {
axisSPtr->_legend._text = tableSPtr->getName();
if (tableSPtr->getUnits().empty() == false)
axisSPtr->_legend._text += ", " + tableSPtr->getUnits();
} else {
axisSPtr->_legend._text = "Table ";
axisSPtr->_legend._text += std::to_string(relatedDim);
axisSPtr->_legend._text += " indexes";
}
}
}
}
void InstantPlot::configureDataAxisLegend(boost::shared_ptr<Axis> axisSPtr, bool isSpectro) {
// Retrieve ParamInfo Manager
ParamMgr *piMgr =ParamMgr::getInstance();
// If axis legend already set, nothing to do
if (axisSPtr->_legend._text.empty() == true) {
// Otherwise, build multi or single line legend depending on paramInfo availability
ParameterSPtr p = _parameterManager.getParameter(_originalParamId);
ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(p->getInfoId());
if (isSpectro)
{
if ((paramInfo != nullptr) &&
(paramInfo->getUnits().empty() == false) &&
(axisSPtr->_legend._text.empty() == true)) {
axisSPtr->_legend._text = "";
if (axisSPtr->_scale == Axis::Scale::LOGARITHMIC)
axisSPtr->_legend._text = "log ";
axisSPtr->_legend._text += paramInfo->getUnits();
}
}
else
{
if (paramInfo) {
// legend is build using short_name, units, coordinates_system
std::stringstream legendInfo;
legendInfo << paramInfo->getShortName();
if (paramInfo->getUnits().empty() == false)
legendInfo << ", " + paramInfo->getUnits();
if (paramInfo->getCoordinatesSystem().empty() == false)
legendInfo << ", " + paramInfo->getCoordinatesSystem();
axisSPtr->_legend._text = legendInfo.str();
}
}
}
}
void InstantPlot::drawSpectro(double startDate, double stopDate, std::string pParamId,
SpectroProperties& pSpectro)
{
if (_iSpectroProperties == nullptr)
return;
PanelPlotOutput::drawSpectro(startDate, stopDate, pParamId, pSpectro);
LOG4CXX_DEBUG(gLogger, "InstantPlot::drawSpectro");
//get parameter data and info
ParameterSPtr p = _parameterManager.getParameter(pParamId);
ParameterData& data = (*_pParameterValues)[pParamId];
boost::shared_ptr<AMDA::Info::ParamTable> tableXSPtr;
boost::shared_ptr<AMDA::Info::ParamTable> tableYSPtr;
AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(p->getInfoId());
if (paramInfo != nullptr)
{
if (_iSpectroProperties->getDimOnXAxis() == 0)
{
tableXSPtr = paramInfo->getTable(0);
tableYSPtr = paramInfo->getTable(1);
}
else
{
tableXSPtr = paramInfo->getTable(1);
tableYSPtr = paramInfo->getTable(0);
}
}
//get axis
boost::shared_ptr<Axis> lXAxis = _panel->getAxis(_iSpectroProperties->getXAxisId());
boost::shared_ptr<Axis> lYAxis = _panel->getAxis(_iSpectroProperties->getYAxisId());
boost::shared_ptr<ColorAxis> lZAxis = _panel->getColorAxis();
//Check dimensions
if ((data.getDim1Size() + 1 <= 0) || (data.getDim2Size() + 1 <= 0))
{
LOG4CXX_INFO(gLogger, "InstantPlot::drawSpectro - No data to plot");
return;
}
MatrixGrid matrixGrid;
for (int i = 0; i < data.getDim1Size(); ++i)
{
GridPart part;
if (_iSpectroProperties->getDimOnXAxis() == 0)
{
if (tableXSPtr == nullptr)
{
//no table defined => use index
part.x[0] = i;
part.x[1] = i+1;
}
else
{
part.x[0] = tableXSPtr->getBound(&_parameterManager, i).min;
part.x[1] = tableXSPtr->getBound(&_parameterManager, i).max;
}
}
else
{
if (tableYSPtr == nullptr)
{
//no table defined => use index
part.y[0] = i;
part.y[1] = i+1;
}
else
{
part.y[0] = tableYSPtr->getBound(&_parameterManager, i).min;
part.y[1] = tableYSPtr->getBound(&_parameterManager, i).max;
}
}
for (int j = 0; j < data.getDim2Size(); ++j)
{
if (_iSpectroProperties->getDimOnXAxis() == 0)
{
if (tableYSPtr == nullptr)
{
//no table defined => use index
part.y[0] = j;
part.y[1] = j+1;
}
else
{
part.y[0] = tableYSPtr->getBound(&_parameterManager, j).min;
part.y[1] = tableYSPtr->getBound(&_parameterManager, j).max;
}
}
else
{
if (tableXSPtr == nullptr)
{
part.x[0] = j;
part.x[1] = j+1;
}
else
{
part.x[0] = tableXSPtr->getBound(&_parameterManager, j).min;
part.x[1] = tableXSPtr->getBound(&_parameterManager, j).max;
}
}
if (lXAxis->_scale == Axis::Scale::LOGARITHMIC)
{
part.x[0] = ((part.x[0] > 0) ? log10(part.x[0]) : 10e-3);
part.x[1] = ((part.x[1] > 0) ? log10(part.x[1]) : 10e-3);
}
if (lYAxis->_scale == Axis::Scale::LOGARITHMIC)
{
part.y[0] = ((part.y[0] > 0) ? log10(part.y[0]) : 10e-3);
part.y[1] = ((part.y[1] > 0) ? log10(part.y[1]) : 10e-3);
}
part.value = data.getInterpolatedValue(_time, AMDA::Common::ParameterIndexComponent(i,j));
matrixGrid.push_back(part);
}
}
//get specific colors for min / max values
Color minValColor = lZAxis->getMinValColor();
Color maxValColor = lZAxis->getMaxValColor();
//draw spectro
drawMatrix(matrixGrid, _iSpectroProperties->getMin(), _iSpectroProperties->getMax(),
minValColor, maxValColor, lZAxis->_color._colorMapIndex);
}
void InstantPlot::configureSpectroAxis()
{
if (_iSpectroProperties == nullptr)
return;
LOG4CXX_DEBUG(gLogger, "InstantPlot::configureSpectroAxis");
///////////////////////////////////////////////////////////////////////////
// Retrieve X, Y and Z axis
///////////////////////////////////////////////////////////////////////////
boost::shared_ptr<Axis> lXAxis = _panel->getAxis(_iSpectroProperties->getXAxisId());
if (lXAxis.get() == nullptr) {
std::stringstream lError;
lError << "InstantPlot::configureSpectroAxis" << ": X axis with id '" << _iSpectroProperties->getXAxisId() << "' not found.";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
lXAxis->_used = true;
boost::shared_ptr<Axis> lYAxis = _panel->getAxis(_iSpectroProperties->getYAxisId());
if (lYAxis.get() == nullptr) {
std::stringstream lError;
lError << "InstantPlot::configureSpectroAxis" << ": Y axis with id '" << _iSpectroProperties->getYAxisId() << "' not found.";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
lYAxis->_used = true;
boost::shared_ptr<Axis> lZAxis = _panel->getAxis(_iSpectroProperties->getZAxisId());
if (lZAxis.get() == nullptr) {
std::stringstream lError;
lError << "InstantPlot::configureSpectroAxis" << ": Z axis with id '" << _iSpectroProperties->getYAxisId() << "' not found.";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
lZAxis->_used = true;
if (_iSpectroProperties->getDimOnXAxis() == 0)
{
configureTableAxis (lXAxis, true, 0);
configureTableAxis (lYAxis, true, 1);
configureDataAxis (lZAxis, true);
}
else
{
configureTableAxis (lXAxis, true, 1);
configureTableAxis (lYAxis, true, 0);
configureDataAxis (lZAxis, true);
}
}
void InstantPlot::configureSpectroAxisLegend ()
{
if (_iSpectroProperties == nullptr)
return;
LOG4CXX_DEBUG(gLogger, "InstantPlot::configureSpectroAxisLegend");
//get X axis
std::string xAxisId = _iSpectroProperties->getXAxisId();
boost::shared_ptr<Axis> lXAxis = _panel->getAxis(xAxisId);
if (lXAxis.get() == nullptr) {
std::stringstream lError;
lError << "TimePlot::configureSpectroAxisLegend" << ": X axis with id '" << xAxisId << "' not found.";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
//get y axis
std::string yAxisId = _iSpectroProperties->getYAxisId();
boost::shared_ptr<Axis> lYAxis = _panel->getAxis(yAxisId);
if (lYAxis.get() == nullptr) {
std::stringstream lError;
lError << "TimePlot::configureSpectroAxisLegend" << ": Y axis with id '" << yAxisId << "' not found.";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
//get z axis
std::string zAxisId = _iSpectroProperties->getZAxisId();
boost::shared_ptr<Axis> lZAxis = _panel->getAxis(zAxisId);
if (lZAxis.get() == nullptr) {
std::stringstream lError;
lError << "InstantPlot::configureSpectroAxisLegend" << ": Z axis with id '" << zAxisId << "' not found.";
BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
if (_iSpectroProperties->getDimOnXAxis() == 0)
{
configureTableAxisLegend(lXAxis,0);
configureTableAxisLegend(lYAxis,1);
configureDataAxisLegend(lZAxis, true);
}
else
{
configureTableAxisLegend(lXAxis,1);
configureTableAxisLegend(lYAxis,0);
configureDataAxisLegend(lZAxis, true);
}
}
/**
* @overload PanelPlotOutput::getSerieParamsLegendString Get the instant serie legend
*/
std::string InstantPlot::getSerieParamsLegendString(SeriesProperties &/*rSeriesProperties*/,
AMDA::Common::ParameterIndexComponent& /*index*/, std::string /*originalParamId*/)
{
if (_iSerieProperties == nullptr)
return "";
// Retrieve ParamInfo Manager
ParamMgr *piMgr =ParamMgr::getInstance();
// Build parameter text legend depending on the availability of paramInfo
// for Y and X component
// Try to retrieve informations from paramInfo for table component
ParameterSPtr p = _parameterManager.getParameter(_originalParamId);
ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(p->getInfoId());
std::string tableLegendText;
if (paramInfo)
{
boost::shared_ptr<AMDA::Info::ParamTable> tableSPtr = paramInfo->getTable(0);
if (tableSPtr) {
tableLegendText = tableSPtr->getName();
} else {
tableLegendText = "Table indexes";
}
}
// Build parameter text legend depending on the availability of paramInfo
std::string dataLegendText;
if (paramInfo) {
dataLegendText = paramInfo->getShortName();
} else {
dataLegendText = _originalParamId;
}
// Data always depends on table, no inversion even if table not on x axis
std::stringstream paramLegendText;
paramLegendText << dataLegendText << " = f(" << tableLegendText << ")";
return paramLegendText.str();
}
/**
* @overload PanelPlotOutput::configureParamsLegend Configure params legend for an instant plot.
*/
void InstantPlot::configureParamsLegend(double startTime, double stopTime, int intervalIndex)
{
LOG4CXX_DEBUG(gLogger, "InstantPlot::configureParamsLegend");
_panel->_paramsLegendProperties.reset();
if (_iSerieProperties == nullptr)
return;
//for the legend configuration, we don't need to know the line and symbol colors
Color fakeColor(0,0,0);
AMDA::Common::ParameterIndexComponent index(-1,-1);
addSerieToParamsLegend(*_iSerieProperties,index,
_originalParamId,fakeColor, fakeColor,startTime,stopTime, intervalIndex);
}
/**
* @brief Override PanelPlotOutput:draw
* draw the plot for the current time interval
*/
void InstantPlot::draw(double startTime, double stopTime, int intervalIndex,
bool /*isFirstInterval*/, bool /*isLastInterval*/) {
LOG4CXX_DEBUG(gLogger, "InstantPlot::draw");
_panel->_paramsLegendProperties.reset();
// Sets panel plplot viewport, draw background & title for the panel
_panel->draw(_pls);
if (!_originalParamId.empty())
{
//Set pointer to ParameterData list
if (_pParameterValues == NULL)
{
std::stringstream lError;
lError << "PanelPlotOutput::draw - Pointer to parameterValues is not set";
BOOST_THROW_EXCEPTION(
PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
}
// Compute panel XY ratio used for angular conversions
computePanelPlotXYRatio();
// Draw fill area between parameter and constant or between parameters
drawFills (startTime, stopTime);
if (_iSerieProperties != nullptr)
{
// Draw series for parameters.
ParameterAxes param;
drawSeries(startTime, stopTime, intervalIndex, _originalParamId,
*_iSerieProperties, AMDA::Common::ParameterIndexComponent(-1,-1),
param, false);
}
else if (_iSpectroProperties != nullptr)
{
drawSpectro(startTime, stopTime, _originalParamId, *_iSpectroProperties);
}
// Draw additionnal objects for this series.
drawAdditionalObjects();
//Draw parameter legend
drawParamsLegend();
//Draw text legends
drawTextLegends();
}
else
_panel->drawEmptyPanel(_pls);
}
/**
* @brief Override drawAdditionalObjects
* draw additional objects
*/
void InstantPlot::drawAdditionalObjects() {
if (_iSpectroProperties != nullptr)
{
boost::shared_ptr<Axis> lXAxis(_panel->getAxis(_iSpectroProperties->getXAxisId()));
boost::shared_ptr<Axis> lYAxis(_panel->getAxis(_iSpectroProperties->getYAxisId()));
if ((lXAxis != nullptr) && (lYAxis != nullptr))
{
Range lXRange = lXAxis->getRange();
Range lYRange = lYAxis->getRange();
PlWindow lPlWindow = PlWindow(lXRange.getMin(), lXRange.getMax(), lYRange.getMin(), lYRange.getMax());
if (!lXAxis->_additionalObjDrawn)
drawXConstantLines (lXAxis, lPlWindow);
if (!lYAxis->_additionalObjDrawn)
drawYConstantLines (lYAxis, lPlWindow);
if (!lXAxis->_additionalObjDrawn || !lYAxis->_additionalObjDrawn)
drawTextPlots (lXAxis, lYAxis, lPlWindow, _panel->_textPlots);
lXAxis->_additionalObjDrawn = true;
lYAxis->_additionalObjDrawn = true;
}
}
if (_iSerieProperties != nullptr)
{
boost::shared_ptr<Axis> lXAxis(_panel->getAxis(_iSerieProperties->getXAxisId()));
boost::shared_ptr<Axis> lYAxis(_panel->getAxis(_iSerieProperties->getYAxisId()));
if ((lXAxis != nullptr) && (lYAxis != nullptr))
{
Range lXRange = lXAxis->getRange();
Range lYRange = lYAxis->getRange();
PlWindow lPlWindow = PlWindow(lXRange.getMin(), lXRange.getMax(), lYRange.getMin(), lYRange.getMax());
if (!lXAxis->_additionalObjDrawn)
drawXConstantLines (lXAxis, lPlWindow);
if (!lYAxis->_additionalObjDrawn)
drawYConstantLines (lYAxis, lPlWindow);
if (!lXAxis->_additionalObjDrawn || !lYAxis->_additionalObjDrawn)
drawTextPlots (lXAxis, lYAxis, lPlWindow, _panel->_textPlots);
lXAxis->_additionalObjDrawn = true;
lYAxis->_additionalObjDrawn = true;
}
}
}
} /* namespace plot */