Commit 225ac17f7f442f831b8c53d224a75a2b76746a7a

Authored by Benjamin Renard
1 parent 413a6873

Fix tickmarks plot

src/ParamOutputImpl/Plot/ParameterData.cc
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 namespace plot { 14 namespace plot {
15 15
16 ParameterData::ParameterData() : 16 ParameterData::ParameterData() :
17 - _minTime(nan("")), _maxTime(nan("")), _dim1Size(-1), _dim2Size(-1) { 17 + _minTime(nan("")), _maxTime(nan("")), _dim1Size(-1), _dim2Size(-1), _paramGapSize(0.) {
18 } 18 }
19 19
20 ParameterData::~ParameterData() { 20 ParameterData::~ParameterData() {
@@ -44,7 +44,7 @@ void ParameterData::preAllocate(int nbData) @@ -44,7 +44,7 @@ void ParameterData::preAllocate(int nbData)
44 * @brief Adds a value by time to parameter 44 * @brief Adds a value by time to parameter
45 */ 45 */
46 void ParameterData::addValue(double time, double value, 46 void ParameterData::addValue(double time, double value,
47 - double sampling, double gapSize, bool &gapDetected, AMDA::Common::ParameterIndexComponent& index) { 47 + double sampling, bool &gapDetected, AMDA::Common::ParameterIndexComponent& index) {
48 int valueIndex = componentToValuesIndex(index); 48 int valueIndex = componentToValuesIndex(index);
49 if (valueIndex >= (int)_values.size()) 49 if (valueIndex >= (int)_values.size())
50 { 50 {
@@ -53,7 +53,7 @@ void ParameterData::addValue(double time, double value, @@ -53,7 +53,7 @@ void ParameterData::addValue(double time, double value,
53 // add time if not already in 53 // add time if not already in
54 if (_dates.empty() || _dates.back() != time) { 54 if (_dates.empty() || _dates.back() != time) {
55 55
56 - if (!_dates.empty() && ((time - _dates.back()) > gapSize)) 56 + if (!_dates.empty() && ((time - _dates.back()) > _paramGapSize))
57 { 57 {
58 //gap detected => push a NaN value in data list 58 //gap detected => push a NaN value in data list
59 if (_dates.back() + sampling > time) 59 if (_dates.back() + sampling > time)
src/ParamOutputImpl/Plot/ParameterData.hh
@@ -90,7 +90,7 @@ public: @@ -90,7 +90,7 @@ public:
90 /** 90 /**
91 * @brief Adds a value by time to parameter 91 * @brief Adds a value by time to parameter
92 */ 92 */
93 - void addValue(double time_, double value_, double sampling, double gapSize, 93 + void addValue(double time_, double value_, double sampling,
94 bool &gapDetected, AMDA::Common::ParameterIndexComponent& index_); 94 bool &gapDetected, AMDA::Common::ParameterIndexComponent& index_);
95 95
96 /** 96 /**
@@ -209,6 +209,22 @@ public: @@ -209,6 +209,22 @@ public:
209 _dim2Size = dim2Size; 209 _dim2Size = dim2Size;
210 } 210 }
211 211
  212 + /*
  213 + * @brief Get param gap size (in seconds)
  214 + */
  215 + double getParamGapSize()
  216 + {
  217 + return _paramGapSize;
  218 + }
  219 +
  220 + /*
  221 + * @brief Set param gap size
  222 + */
  223 + void setParamGapSize(double gapSize)
  224 + {
  225 + _paramGapSize = gapSize;
  226 + }
  227 +
212 /** 228 /**
213 * Gets the index of the given time (or just after) in time array, 229 * Gets the index of the given time (or just after) in time array,
214 * returns -1 if not found 230 * returns -1 if not found
@@ -289,6 +305,11 @@ private: @@ -289,6 +305,11 @@ private:
289 * @brief Dim 2 Size 305 * @brief Dim 2 Size
290 */ 306 */
291 int _dim2Size; 307 int _dim2Size;
  308 +
  309 + /*
  310 + * @brief Param gap size (in seconds)
  311 + */
  312 + double _paramGapSize;
292 }; 313 };
293 314
294 315
src/ParamOutputImpl/Plot/PlotOutput.cc
@@ -623,6 +623,7 @@ void PlotOutput::visit( @@ -623,6 +623,7 @@ void PlotOutput::visit(
623 bool gapDetected = false; 623 bool gapDetected = false;
624 //ParamDataScalaireShort 624 //ParamDataScalaireShort
625 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 625 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  626 + crtParameterData.setParamGapSize(gapSize);
626 AMDA::Common::ParameterIndexComponent componentIndex = AMDA::Common::ParameterIndexComponent(-1,-1); 627 AMDA::Common::ParameterIndexComponent componentIndex = AMDA::Common::ParameterIndexComponent(-1,-1);
627 628
628 crtParameterData.preAllocate(_paramDataIndexInfo._nbDataToProcess 629 crtParameterData.preAllocate(_paramDataIndexInfo._nbDataToProcess
@@ -636,7 +637,7 @@ void PlotOutput::visit( @@ -636,7 +637,7 @@ void PlotOutput::visit(
636 pParamData->getTime(index), 637 pParamData->getTime(index),
637 pParamData->get(index), 638 pParamData->get(index),
638 pParamData->getMinSampling(), 639 pParamData->getMinSampling(),
639 - gapSize, gapDetected, componentIndex); 640 + gapDetected, componentIndex);
640 } 641 }
641 } 642 }
642 643
@@ -649,6 +650,7 @@ void PlotOutput::visit( @@ -649,6 +650,7 @@ void PlotOutput::visit(
649 bool gapDetected = false;; 650 bool gapDetected = false;;
650 //ParamDataScalaireFloat 651 //ParamDataScalaireFloat
651 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 652 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  653 + crtParameterData.setParamGapSize(gapSize);
652 AMDA::Common::ParameterIndexComponent componentIndex = AMDA::Common::ParameterIndexComponent(-1,-1); 654 AMDA::Common::ParameterIndexComponent componentIndex = AMDA::Common::ParameterIndexComponent(-1,-1);
653 655
654 crtParameterData.preAllocate(_paramDataIndexInfo._nbDataToProcess 656 crtParameterData.preAllocate(_paramDataIndexInfo._nbDataToProcess
@@ -663,7 +665,7 @@ void PlotOutput::visit( @@ -663,7 +665,7 @@ void PlotOutput::visit(
663 pParamData->getTime(index), 665 pParamData->getTime(index),
664 pParamData->get(index), 666 pParamData->get(index),
665 pParamData->getMinSampling(), 667 pParamData->getMinSampling(),
666 - gapSize, gapDetected, componentIndex); 668 + gapDetected, componentIndex);
667 } 669 }
668 } 670 }
669 671
@@ -676,6 +678,7 @@ void PlotOutput::visit( @@ -676,6 +678,7 @@ void PlotOutput::visit(
676 bool gapDetected = false;; 678 bool gapDetected = false;;
677 //ParamDataScalaireDouble 679 //ParamDataScalaireDouble
678 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 680 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  681 + crtParameterData.setParamGapSize(gapSize);
679 AMDA::Common::ParameterIndexComponent componentIndex = AMDA::Common::ParameterIndexComponent(-1,-1); 682 AMDA::Common::ParameterIndexComponent componentIndex = AMDA::Common::ParameterIndexComponent(-1,-1);
680 683
681 crtParameterData.preAllocate(_paramDataIndexInfo._nbDataToProcess 684 crtParameterData.preAllocate(_paramDataIndexInfo._nbDataToProcess
@@ -689,7 +692,7 @@ void PlotOutput::visit( @@ -689,7 +692,7 @@ void PlotOutput::visit(
689 pParamData->getTime(index), 692 pParamData->getTime(index),
690 pParamData->get(index), 693 pParamData->get(index),
691 pParamData->getMinSampling(), 694 pParamData->getMinSampling(),
692 - gapSize, gapDetected, componentIndex); 695 + gapDetected, componentIndex);
693 } 696 }
694 } 697 }
695 698
@@ -702,6 +705,7 @@ void PlotOutput::visit( @@ -702,6 +705,7 @@ void PlotOutput::visit(
702 bool gapDetected = false;; 705 bool gapDetected = false;;
703 //ParamDataScalaireLongDouble 706 //ParamDataScalaireLongDouble
704 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 707 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  708 + crtParameterData.setParamGapSize(gapSize);
705 AMDA::Common::ParameterIndexComponent componentIndex = AMDA::Common::ParameterIndexComponent(-1,-1); 709 AMDA::Common::ParameterIndexComponent componentIndex = AMDA::Common::ParameterIndexComponent(-1,-1);
706 710
707 crtParameterData.preAllocate(_paramDataIndexInfo._nbDataToProcess 711 crtParameterData.preAllocate(_paramDataIndexInfo._nbDataToProcess
@@ -715,7 +719,7 @@ void PlotOutput::visit( @@ -715,7 +719,7 @@ void PlotOutput::visit(
715 pParamData->getTime(index), 719 pParamData->getTime(index),
716 pParamData->get(index), 720 pParamData->get(index),
717 pParamData->getMinSampling(), 721 pParamData->getMinSampling(),
718 - gapSize, gapDetected, componentIndex); 722 + gapDetected, componentIndex);
719 } 723 }
720 } 724 }
721 725
@@ -728,6 +732,7 @@ void PlotOutput::visit( @@ -728,6 +732,7 @@ void PlotOutput::visit(
728 bool gapDetected = false;; 732 bool gapDetected = false;;
729 //ParamDataScalaireInt 733 //ParamDataScalaireInt
730 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 734 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  735 + crtParameterData.setParamGapSize(gapSize);
731 AMDA::Common::ParameterIndexComponent componentIndex = AMDA::Common::ParameterIndexComponent(-1,-1); 736 AMDA::Common::ParameterIndexComponent componentIndex = AMDA::Common::ParameterIndexComponent(-1,-1);
732 737
733 crtParameterData.preAllocate(_paramDataIndexInfo._nbDataToProcess 738 crtParameterData.preAllocate(_paramDataIndexInfo._nbDataToProcess
@@ -741,7 +746,7 @@ void PlotOutput::visit( @@ -741,7 +746,7 @@ void PlotOutput::visit(
741 pParamData->getTime(index), 746 pParamData->getTime(index),
742 pParamData->get(index), 747 pParamData->get(index),
743 pParamData->getMinSampling(), 748 pParamData->getMinSampling(),
744 - gapSize, gapDetected, componentIndex); 749 + gapDetected, componentIndex);
745 } 750 }
746 } 751 }
747 752
@@ -760,6 +765,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab1DShort *pParamData) { @@ -760,6 +765,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab1DShort *pParamData) {
760 bool gapDetected = false;; 765 bool gapDetected = false;;
761 //ParamDataTab1DShort 766 //ParamDataTab1DShort
762 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 767 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  768 + crtParameterData.setParamGapSize(gapSize);
763 769
764 //init parameter values container 770 //init parameter values container
765 if (crtParameterData._indexes.size() == 0) 771 if (crtParameterData._indexes.size() == 0)
@@ -777,7 +783,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab1DShort *pParamData) { @@ -777,7 +783,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab1DShort *pParamData) {
777 crtParameterData.addValue(time, 783 crtParameterData.addValue(time,
778 pParamData->get(i)[index.getDim1Index()], 784 pParamData->get(i)[index.getDim1Index()],
779 pParamData->getMinSampling(), 785 pParamData->getMinSampling(),
780 - gapSize, gapDetected, index); 786 + gapDetected, index);
781 } 787 }
782 } 788 }
783 } 789 }
@@ -791,6 +797,7 @@ void PlotOutput::visit( @@ -791,6 +797,7 @@ void PlotOutput::visit(
791 bool gapDetected = false;; 797 bool gapDetected = false;;
792 //ParamDataTab1DFloat 798 //ParamDataTab1DFloat
793 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 799 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  800 + crtParameterData.setParamGapSize(gapSize);
794 801
795 //init parameter values container 802 //init parameter values container
796 if (crtParameterData._indexes.size() == 0) 803 if (crtParameterData._indexes.size() == 0)
@@ -808,7 +815,7 @@ void PlotOutput::visit( @@ -808,7 +815,7 @@ void PlotOutput::visit(
808 crtParameterData.addValue(time, 815 crtParameterData.addValue(time,
809 pParamData->get(i)[index.getDim1Index()], 816 pParamData->get(i)[index.getDim1Index()],
810 pParamData->getMinSampling(), 817 pParamData->getMinSampling(),
811 - gapSize, gapDetected, index); 818 + gapDetected, index);
812 } 819 }
813 } 820 }
814 } 821 }
@@ -822,6 +829,7 @@ void PlotOutput::visit( @@ -822,6 +829,7 @@ void PlotOutput::visit(
822 bool gapDetected = false;; 829 bool gapDetected = false;;
823 //ParamDataTab1DDouble 830 //ParamDataTab1DDouble
824 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 831 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  832 + crtParameterData.setParamGapSize(gapSize);
825 833
826 //init parameter values container 834 //init parameter values container
827 if (crtParameterData._indexes.size() == 0) 835 if (crtParameterData._indexes.size() == 0)
@@ -839,7 +847,7 @@ void PlotOutput::visit( @@ -839,7 +847,7 @@ void PlotOutput::visit(
839 crtParameterData.addValue(time, 847 crtParameterData.addValue(time,
840 pParamData->get(i)[index.getDim1Index()], 848 pParamData->get(i)[index.getDim1Index()],
841 pParamData->getMinSampling(), 849 pParamData->getMinSampling(),
842 - gapSize, gapDetected, index); 850 + gapDetected, index);
843 } 851 }
844 } 852 }
845 } 853 }
@@ -853,6 +861,7 @@ void PlotOutput::visit( @@ -853,6 +861,7 @@ void PlotOutput::visit(
853 bool gapDetected = false;; 861 bool gapDetected = false;;
854 //ParamDataTab1DLongDouble 862 //ParamDataTab1DLongDouble
855 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 863 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  864 + crtParameterData.setParamGapSize(gapSize);
856 865
857 //init parameter values container 866 //init parameter values container
858 if (crtParameterData._indexes.size() == 0) 867 if (crtParameterData._indexes.size() == 0)
@@ -870,7 +879,7 @@ void PlotOutput::visit( @@ -870,7 +879,7 @@ void PlotOutput::visit(
870 crtParameterData.addValue(time, 879 crtParameterData.addValue(time,
871 pParamData->get(i)[index.getDim1Index()], 880 pParamData->get(i)[index.getDim1Index()],
872 pParamData->getMinSampling(), 881 pParamData->getMinSampling(),
873 - gapSize, gapDetected, index); 882 + gapDetected, index);
874 } 883 }
875 } 884 }
876 } 885 }
@@ -883,6 +892,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab1DInt *pParamData) { @@ -883,6 +892,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab1DInt *pParamData) {
883 bool gapDetected = false;; 892 bool gapDetected = false;;
884 //ParamDataTab1DInt 893 //ParamDataTab1DInt
885 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 894 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  895 + crtParameterData.setParamGapSize(gapSize);
886 896
887 //init parameter values container 897 //init parameter values container
888 if (crtParameterData._indexes.size() == 0) 898 if (crtParameterData._indexes.size() == 0)
@@ -900,7 +910,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab1DInt *pParamData) { @@ -900,7 +910,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab1DInt *pParamData) {
900 crtParameterData.addValue(time, 910 crtParameterData.addValue(time,
901 pParamData->get(i)[index.getDim1Index()], 911 pParamData->get(i)[index.getDim1Index()],
902 pParamData->getMinSampling(), 912 pParamData->getMinSampling(),
903 - gapSize, gapDetected, index); 913 + gapDetected, index);
904 } 914 }
905 } 915 }
906 } 916 }
@@ -920,6 +930,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DShort *pParamData) { @@ -920,6 +930,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DShort *pParamData) {
920 bool gapDetected = false;; 930 bool gapDetected = false;;
921 //ParamDataTab2DShort 931 //ParamDataTab2DShort
922 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 932 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  933 + crtParameterData.setParamGapSize(gapSize);
923 934
924 //init parameter values container 935 //init parameter values container
925 if (crtParameterData._indexes.size() == 0) 936 if (crtParameterData._indexes.size() == 0)
@@ -937,7 +948,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DShort *pParamData) { @@ -937,7 +948,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DShort *pParamData) {
937 crtParameterData.addValue(time, 948 crtParameterData.addValue(time,
938 pParamData->get(i)[index.getDim1Index()][index.getDim2Index()], 949 pParamData->get(i)[index.getDim1Index()][index.getDim2Index()],
939 pParamData->getMinSampling(), 950 pParamData->getMinSampling(),
940 - gapSize, gapDetected, index); 951 + gapDetected, index);
941 } 952 }
942 } 953 }
943 } 954 }
@@ -950,6 +961,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DFloat *pParamData) { @@ -950,6 +961,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DFloat *pParamData) {
950 bool gapDetected = false;; 961 bool gapDetected = false;;
951 //ParamDataTab2DFloat 962 //ParamDataTab2DFloat
952 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 963 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  964 + crtParameterData.setParamGapSize(gapSize);
953 965
954 //init parameter values container 966 //init parameter values container
955 if (crtParameterData._indexes.size() == 0) 967 if (crtParameterData._indexes.size() == 0)
@@ -967,7 +979,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DFloat *pParamData) { @@ -967,7 +979,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DFloat *pParamData) {
967 crtParameterData.addValue(time, 979 crtParameterData.addValue(time,
968 pParamData->get(i)[index.getDim1Index()][index.getDim2Index()], 980 pParamData->get(i)[index.getDim1Index()][index.getDim2Index()],
969 pParamData->getMinSampling(), 981 pParamData->getMinSampling(),
970 - gapSize, gapDetected, index); 982 + gapDetected, index);
971 } 983 }
972 } 984 }
973 } 985 }
@@ -980,6 +992,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DDouble *pParamData) { @@ -980,6 +992,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DDouble *pParamData) {
980 bool gapDetected = false;; 992 bool gapDetected = false;;
981 //ParamDataTab2DDouble 993 //ParamDataTab2DDouble
982 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 994 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  995 + crtParameterData.setParamGapSize(gapSize);
983 996
984 //init parameter values container 997 //init parameter values container
985 if (crtParameterData._indexes.size() == 0) 998 if (crtParameterData._indexes.size() == 0)
@@ -997,7 +1010,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DDouble *pParamData) { @@ -997,7 +1010,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DDouble *pParamData) {
997 crtParameterData.addValue(time, 1010 crtParameterData.addValue(time,
998 pParamData->get(i)[index.getDim1Index()][index.getDim2Index()], 1011 pParamData->get(i)[index.getDim1Index()][index.getDim2Index()],
999 pParamData->getMinSampling(), 1012 pParamData->getMinSampling(),
1000 - gapSize, gapDetected, index); 1013 + gapDetected, index);
1001 } 1014 }
1002 } 1015 }
1003 } 1016 }
@@ -1010,6 +1023,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DLongDouble *pParamData) { @@ -1010,6 +1023,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DLongDouble *pParamData) {
1010 bool gapDetected = false;; 1023 bool gapDetected = false;;
1011 //ParamDataTab2DLongDouble 1024 //ParamDataTab2DLongDouble
1012 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 1025 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  1026 + crtParameterData.setParamGapSize(gapSize);
1013 1027
1014 //init parameter values container 1028 //init parameter values container
1015 if (crtParameterData._indexes.size() == 0) 1029 if (crtParameterData._indexes.size() == 0)
@@ -1027,7 +1041,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DLongDouble *pParamData) { @@ -1027,7 +1041,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DLongDouble *pParamData) {
1027 crtParameterData.addValue(time, 1041 crtParameterData.addValue(time,
1028 pParamData->get(i)[index.getDim1Index()][index.getDim2Index()], 1042 pParamData->get(i)[index.getDim1Index()][index.getDim2Index()],
1029 pParamData->getMinSampling(), 1043 pParamData->getMinSampling(),
1030 - gapSize, gapDetected, index); 1044 + gapDetected, index);
1031 } 1045 }
1032 } 1046 }
1033 } 1047 }
@@ -1040,6 +1054,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DInt *pParamData) { @@ -1040,6 +1054,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DInt *pParamData) {
1040 bool gapDetected = false;; 1054 bool gapDetected = false;;
1041 //ParamDataTab2DInt 1055 //ParamDataTab2DInt
1042 ParameterData& crtParameterData = _parameterValues[_currentParamId]; 1056 ParameterData& crtParameterData = _parameterValues[_currentParamId];
  1057 + crtParameterData.setParamGapSize(gapSize);
1043 1058
1044 //init parameter values container 1059 //init parameter values container
1045 if (crtParameterData._indexes.size() == 0) 1060 if (crtParameterData._indexes.size() == 0)
@@ -1057,7 +1072,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DInt *pParamData) { @@ -1057,7 +1072,7 @@ void PlotOutput::visit(AMDA::Parameters::ParamDataTab2DInt *pParamData) {
1057 crtParameterData.addValue(time, 1072 crtParameterData.addValue(time,
1058 pParamData->get(i)[index.getDim1Index()][index.getDim2Index()], 1073 pParamData->get(i)[index.getDim1Index()][index.getDim2Index()],
1059 pParamData->getMinSampling(), 1074 pParamData->getMinSampling(),
1060 - gapSize, gapDetected, index); 1075 + gapDetected, index);
1061 } 1076 }
1062 } 1077 }
1063 } 1078 }
src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc
@@ -55,7 +55,7 @@ TickMarkDecorator& TickMarkDecorator::operator=(const TickMarkDecorator& ref_) { @@ -55,7 +55,7 @@ TickMarkDecorator& TickMarkDecorator::operator=(const TickMarkDecorator& ref_) {
55 } else { 55 } else {
56 _pTimeInfo->_timeFormat = ref_._pTimeInfo->_timeFormat; 56 _pTimeInfo->_timeFormat = ref_._pTimeInfo->_timeFormat;
57 _pTimeInfo->_timeTitle = ref_._pTimeInfo->_timeTitle; 57 _pTimeInfo->_timeTitle = ref_._pTimeInfo->_timeTitle;
58 - _pTimeInfo->_min = ref_._pTimeInfo->_min; 58 + _pTimeInfo->_isFirstLabel = ref_._pTimeInfo->_isFirstLabel;
59 _pTimeInfo->_maxLen = ref_._pTimeInfo->_maxLen; 59 _pTimeInfo->_maxLen = ref_._pTimeInfo->_maxLen;
60 } 60 }
61 _seriesInfoList = ref_._seriesInfoList; 61 _seriesInfoList = ref_._seriesInfoList;
@@ -342,91 +342,6 @@ void TickMarkDecorator::draw(PanelPlotOutput* pplot_, Axis* axis_, @@ -342,91 +342,6 @@ void TickMarkDecorator::draw(PanelPlotOutput* pplot_, Axis* axis_,
342 restoreColor(pls_, lInitialColor, pplot_->_panel->_page->_mode); 342 restoreColor(pls_, lInitialColor, pplot_->_panel->_page->_mode);
343 343
344 } 344 }
345 -/**  
346 - * @brief Search for each tick time, the closest parameter time in the paramdata_ and store the corresponding value.  
347 - * Selected parameter time is in range ]ticktime-step, ticktime+step[ where step is the space between two tick.  
348 - * If no such time is found for a given tick, associated value is marked as NaN.  
349 - * Note that this algorithm may retrieve same value twice if there is exactly one time between two ticks  
350 - * and it is exactly at the middle.  
351 - * @param seriesdata_ series data to fill  
352 - * @param pAxis_ related axis  
353 - * @param paramdata_ related parameter  
354 - * @param serieIndex_ series index.  
355 - * @return longest label to display for that series (in number of char).  
356 - */  
357 -unsigned int TickMarkDecorator::fillSeriesData(SeriesData& seriesdata_,  
358 - TimeAxis* pAxis_, ParameterData& paramdata_, AMDA::Common::ParameterIndexComponent serieIndex_) {  
359 - LOG4CXX_DEBUG(_logger, " filling series data...");  
360 - // string used to compute formattedvalue max length  
361 - char formattedValue [40];  
362 - unsigned int maxlen = 0;  
363 -  
364 - // time range :  
365 - double start = pAxis_->getRange().getMin();  
366 - double stop = pAxis_->getRange().getMax();  
367 - double step = getMajorTickSpace(pAxis_, start, stop);  
368 - LOG4CXX_TRACE(_logger,  
369 - " for all ticks between " << start << " and " << stop << " spaced by " << step);  
370 -  
371 - int index = -1;  
372 - int size = paramdata_.getSize();  
373 -  
374 - for (double tickTime = start; tickTime <= stop; tickTime += step) {  
375 - // search index closest value to that time :  
376 - double* ptime = paramdata_.getTimes();  
377 - int i = index + 1;  
378 - while (i < size && (*(ptime + i) < tickTime)) {  
379 - i++;  
380 - }  
381 -  
382 - double cur = (i >= size) ? -1 : *(ptime + i);  
383 - double prev = (i == 0) ? -1 : *(ptime + i - 1);  
384 -  
385 - if (prev != -1 && prev <= (tickTime - step)) {  
386 - prev = -1;  
387 - }  
388 - if (cur != -1 && cur >= (tickTime + step)) {  
389 - cur = -1;  
390 - }  
391 -  
392 - if (prev == -1) {  
393 - // only cur can be eligible  
394 - if (cur == -1) {  
395 - index = -1; // no suitable value  
396 - } else {  
397 - index = i;  
398 - }  
399 - } else if (cur == -1) {  
400 - // only prev can be eligible and it is not -1 due to previous test  
401 - index = i - 1;  
402 - } else {  
403 - // both are eligible, choose closest one :  
404 - if ((tickTime - prev) > (cur - tickTime)) {  
405 - index = i;  
406 - } else {  
407 - index = i - 1;  
408 - }  
409 - }  
410 -  
411 - // time found, retrieve related value or put a nan one:  
412 - if (index == -1) {  
413 - LOG4CXX_TRACE(_logger,  
414 - "updating series data at time:"<<tickTime<<" with value:(NaN)");  
415 - seriesdata_[tickTime] = nan("NaN");  
416 - // restore last index for next loop :  
417 - index = i;  
418 - } else {  
419 - double value = *(paramdata_.getValues(serieIndex_) + index);  
420 - LOG4CXX_TRACE(_logger,  
421 - "updating series data at time:"<<tickTime<<" with value :("<<value<<")");  
422 - // compute formatted value length :  
423 - const unsigned int len = snprintf(formattedValue, 40, getValuesFormat().c_str(), value);  
424 - maxlen = std::max((const unsigned int) maxlen, len);  
425 - seriesdata_[tickTime] = value;  
426 - }  
427 - }  
428 - return std::min((const unsigned int) maxlen, (const unsigned int) 40);  
429 -}  
430 345
431 void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeAxis* timeAxis_) { 346 void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeAxis* timeAxis_) {
432 347
@@ -436,7 +351,7 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA @@ -436,7 +351,7 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA
436 // install time format 351 // install time format
437 _pTimeInfo->_timeFormat = getPlFormat(); 352 _pTimeInfo->_timeFormat = getPlFormat();
438 _pTimeInfo->_timeTitle = timeAxis_->_legend._text; 353 _pTimeInfo->_timeTitle = timeAxis_->_legend._text;
439 - _pTimeInfo->_min = timeAxis_->getRange().getMin(); 354 + _pTimeInfo->_isFirstLabel = true;
440 355
441 unsigned int maxNameLen = _pTimeInfo->_timeTitle.size(); 356 unsigned int maxNameLen = _pTimeInfo->_timeTitle.size();
442 // init maximum value len with formatted time : 357 // init maximum value len with formatted time :
@@ -473,15 +388,18 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA @@ -473,15 +388,18 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA
473 if (pSerie->_name.size() > maxNameLen) { 388 if (pSerie->_name.size() > maxNameLen) {
474 maxNameLen = pSerie->_name.size(); 389 maxNameLen = pSerie->_name.size();
475 } 390 }
476 - pSerie->_min = timeAxis_->getRange().getMin(); 391 + pSerie->_isFirstLabel = true;
477 pSerie->_valuesFormat = getValuesFormat(); 392 pSerie->_valuesFormat = getValuesFormat();
478 - // get serie at index :  
479 - SeriesData data;  
480 - _maxValueLen = std::max((const unsigned int) _maxValueLen,  
481 - fillSeriesData(data, timeAxis_,  
482 - (*_pParameterValues)[p.getYSeriePropertiesAt(q).getParamId()],  
483 - q));  
484 - pSerie->_data = data; 393 +
  394 + //Compute max len
  395 + pSerie->_parameterData = &((*_pParameterValues)[p.getYSeriePropertiesAt(q).getParamId()]);
  396 + pSerie->_indexComponents = AMDA::Common::ParameterIndexComponent(q.getDim1Index(),q.getDim2Index());
  397 +
  398 + for (int i = 0; i < pSerie->_parameterData->getSize(); ++i) {
  399 + const unsigned int len = snprintf(formattedStr, 40, getValuesFormat().c_str(), *pSerie->_parameterData->getValues(pSerie->_indexComponents, i));
  400 + _maxValueLen = std::max(_maxValueLen, len);
  401 + }
  402 +
485 _seriesInfoList.push_back(pSerie); 403 _seriesInfoList.push_back(pSerie);
486 } 404 }
487 } 405 }
@@ -517,24 +435,35 @@ void generateYLabel(PLINT axis, PLFLT value, char *label, PLINT length, @@ -517,24 +435,35 @@ void generateYLabel(PLINT axis, PLFLT value, char *label, PLINT length,
517 SeriesInfo* pInfo = static_cast<SeriesInfo*> (data); 435 SeriesInfo* pInfo = static_cast<SeriesInfo*> (data);
518 // if value equals min, display _name string 436 // if value equals min, display _name string
519 // otherwise, format value and display it 437 // otherwise, format value and display it
520 - if (value == pInfo->_min) { 438 + if (pInfo->_isFirstLabel) {
521 // do not display min value label 439 // do not display min value label
522 // but display title : 440 // but display title :
523 snprintf(label, length, "%*s", pInfo->_maxLen, 441 snprintf(label, length, "%*s", pInfo->_maxLen,
524 pInfo->_name.c_str()); 442 pInfo->_name.c_str());
525 - 443 + pInfo->_isFirstLabel = false;
526 } else { 444 } else {
527 // display formatted value 445 // display formatted value
528 std::ostringstream labels; 446 std::ostringstream labels;
529 - // loops over each series and display value at this time  
530 - auto q = pInfo->_data.find((double) value);  
531 - if (q != pInfo->_data.end()) {  
532 - // we found it !  
533 - labels << boost::format(pInfo->_valuesFormat) % q->second;  
534 - } else {  
535 - // not found just display Nan indicator 447 +
  448 + //get nearest value
  449 + double crtTime = (double) value;
  450 +
  451 + int crtIndex = pInfo->_parameterData->indexOf(crtTime);
  452 +
  453 + if (crtIndex == -1 && (crtTime - (pInfo->_parameterData->getTimes()[pInfo->_parameterData->getSize()-1]) < pInfo->_parameterData->getParamGapSize()))
  454 + //Fix last value
  455 + crtIndex = pInfo->_parameterData->getSize()-1;
  456 + else if ((crtTime - (pInfo->_parameterData->getTimes()[crtIndex])) > pInfo->_parameterData->getParamGapSize())
  457 + //Be sure that we are not in a data gap
  458 + crtIndex = -1;
  459 +
  460 + if (crtIndex == -1) {
536 labels << "NaN" << std::endl; 461 labels << "NaN" << std::endl;
537 } 462 }
  463 + else {
  464 + labels << boost::format(pInfo->_valuesFormat) % (*pInfo->_parameterData->getValues(pInfo->_indexComponents, crtIndex));
  465 + }
  466 +
538 snprintf(label, length, "%s", labels.str().c_str()); 467 snprintf(label, length, "%s", labels.str().c_str());
539 } 468 }
540 } 469 }
@@ -557,11 +486,12 @@ void generateOrbitTimeLabel(PLINT axis, PLFLT value, char *label, PLINT length, @@ -557,11 +486,12 @@ void generateOrbitTimeLabel(PLINT axis, PLFLT value, char *label, PLINT length,
557 // if value equals min, display an empty string 486 // if value equals min, display an empty string
558 // otherwise, format time and display formatted time 487 // otherwise, format time and display formatted time
559 488
560 - if (value == pInfo->_min) { 489 + if (pInfo->_isFirstLabel) {
561 // do not display min value label 490 // do not display min value label
562 // but display title : 491 // but display title :
563 snprintf(label, length, "%*s", pInfo->_maxLen, 492 snprintf(label, length, "%*s", pInfo->_maxLen,
564 pInfo->_timeTitle.c_str()); 493 pInfo->_timeTitle.c_str());
  494 + pInfo->_isFirstLabel = false;
565 495
566 } else { 496 } else {
567 // display formatted time 497 // display formatted time
src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.hh
@@ -23,8 +23,6 @@ using std::map; @@ -23,8 +23,6 @@ using std::map;
23 23
24 namespace plot { 24 namespace plot {
25 25
26 -typedef std::map<double,double> SeriesData;  
27 -  
28 struct SeriesInfo{ 26 struct SeriesInfo{
29 /** 27 /**
30 * @brief name of that series (i.e. name of parameter and index if not a scalar parameter). 28 * @brief name of that series (i.e. name of parameter and index if not a scalar parameter).
@@ -42,15 +40,21 @@ struct SeriesInfo{ @@ -42,15 +40,21 @@ struct SeriesInfo{
42 * @brief maximum len for value. May be useful to justify formatted output. 40 * @brief maximum len for value. May be useful to justify formatted output.
43 */ 41 */
44 unsigned int _maxValueLen; 42 unsigned int _maxValueLen;
  43 +
45 /** 44 /**
46 - * @brief min time index. (used display _name instead of a value). 45 + * @brief to know if it's the first label to draw
47 */ 46 */
48 - double _min; 47 + bool _isFirstLabel;
  48 +
49 /** 49 /**
50 - * @brief values for that series. Holds for each "time" at a tick ,  
51 - * the related series value. 50 + * @brief link to the parameter data
52 */ 51 */
53 - SeriesData _data; 52 + ParameterData* _parameterData;
  53 +
  54 + /**
  55 + * @brief serie components
  56 + */
  57 + AMDA::Common::ParameterIndexComponent _indexComponents;
54 }; 58 };
55 59
56 typedef std::vector<boost::shared_ptr<SeriesInfo>> SeriesList; 60 typedef std::vector<boost::shared_ptr<SeriesInfo>> SeriesList;
@@ -71,9 +75,9 @@ struct TimeInfo{ @@ -71,9 +75,9 @@ struct TimeInfo{
71 */ 75 */
72 unsigned int _maxLen; 76 unsigned int _maxLen;
73 /** 77 /**
74 - * @brief minimum time index. (used display _timeTitle instead of a value). 78 + * @brief to know if it's the first label to draw
75 */ 79 */
76 - double _min; 80 + bool _isFirstLabel;
77 }; 81 };
78 typedef boost::shared_ptr<TimeInfo> TimeInfoPtr; 82 typedef boost::shared_ptr<TimeInfo> TimeInfoPtr;
79 83
@@ -123,11 +127,6 @@ protected: @@ -123,11 +127,6 @@ protected:
123 private: 127 private:
124 128
125 /** 129 /**
126 - * @brief Calculates tick values (closest value from the tick time)  
127 - */  
128 - unsigned int fillSeriesData(SeriesData& seriesdata_, TimeAxis* pAxis_, ParameterData& paramdata_, AMDA::Common::ParameterIndexComponent indexSerie_);  
129 -  
130 - /**  
131 * @brief Calculates plot area for date display 130 * @brief Calculates plot area for date display
132 */ 131 */
133 double computeStartDateWidth(PanelPlotOutput* pplot_, TimeAxis* pAxis_); 132 double computeStartDateWidth(PanelPlotOutput* pplot_, TimeAxis* pAxis_);