Commit 4a88c8f9cc13d6a4597a768b31149e686075d615
Exists in
master
and in
5 other branches
Merge branch 'FER_11242' into amdadev
Showing
7 changed files
with
85 additions
and
29 deletions
Show diff stats
config/xsd/request/plot.xsd
... | ... | @@ -588,6 +588,7 @@ |
588 | 588 | </xs:attribute> |
589 | 589 | <xs:attribute name="id" type="xs:integer"></xs:attribute> |
590 | 590 | <xs:attribute name="index" type="xs:integer"></xs:attribute> |
591 | + <xs:attribute name="showIntInfo" type="xs:boolean"></xs:attribute> | |
591 | 592 | </xs:complexType> |
592 | 593 | </xs:element> |
593 | 594 | </xs:sequence> | ... | ... |
src/ParamOutputImpl/Plot/Page.cc
... | ... | @@ -65,7 +65,8 @@ Page::Page() : |
65 | 65 | _superposeMode (false), |
66 | 66 | |
67 | 67 | _font(Font("", 0)), |
68 | - _title(Font("", 0)) | |
68 | + _title(Font("", 0)), | |
69 | + _intIndex(-1) | |
69 | 70 | { |
70 | 71 | // Initialize colormap |
71 | 72 | ColormapManager::getInstance(); |
... | ... | @@ -104,7 +105,8 @@ Page::Page(DefaultPlotConfiguration& defaults) : |
104 | 105 | _superposeMode (defaults._defaultPage._superposeMode), |
105 | 106 | |
106 | 107 | _font(defaults._defaultPage.getFont()), |
107 | - _title(_font) | |
108 | + _title(_font), | |
109 | + _intIndex(defaults._defaultPage._intIndex) | |
108 | 110 | { |
109 | 111 | |
110 | 112 | // Initialize colormap |
... | ... | @@ -143,7 +145,9 @@ Page::Page(const Page& page) : |
143 | 145 | |
144 | 146 | _font(page.getFont()), |
145 | 147 | |
146 | - _title(*page.getTitle()) | |
148 | + _title(*page.getTitle()), | |
149 | + _intIndex(page._intIndex) | |
150 | + | |
147 | 151 | { |
148 | 152 | // Initialize colormap |
149 | 153 | ColormapManager::getInstance(); | ... | ... |
src/ParamOutputImpl/Plot/Page.hh
... | ... | @@ -88,6 +88,10 @@ public: |
88 | 88 | _title._text = titleText; |
89 | 89 | } |
90 | 90 | |
91 | + | |
92 | + int getIntIndex(){return _intIndex;} | |
93 | + void setIntIndex(int index){_intIndex = index;} | |
94 | + | |
91 | 95 | Font getTitleFont() { |
92 | 96 | Font titleFont(_title.getFont()); |
93 | 97 | if (titleFont.getName() == "") |
... | ... | @@ -213,6 +217,8 @@ private: |
213 | 217 | */ |
214 | 218 | Label _title; |
215 | 219 | |
220 | + int _intIndex; | |
221 | + | |
216 | 222 | void initPageParameters(std::shared_ptr<plstream>& pls); |
217 | 223 | |
218 | 224 | void drawCopyright(std::shared_ptr<plstream>& pls); | ... | ... |
src/ParamOutputImpl/Plot/Panel.cc
... | ... | @@ -20,6 +20,7 @@ int Panel::PANEL_COUNTER = -1; |
20 | 20 | |
21 | 21 | Panel::Panel() : _id(--PANEL_COUNTER), |
22 | 22 | _index(-1), |
23 | + _showIntInfo(false), | |
23 | 24 | _resolution(0), |
24 | 25 | _updateTitleOnNextInterval(false), |
25 | 26 | _bounds(Bounds()), |
... | ... | @@ -44,6 +45,7 @@ Panel::Panel() : _id(--PANEL_COUNTER), |
44 | 45 | |
45 | 46 | Panel::Panel(DefaultPlotConfiguration &defaults) : _id(--PANEL_COUNTER), |
46 | 47 | _index(defaults._defaultPanel._index), |
48 | + _showIntInfo(defaults._defaultPanel._showIntInfo), | |
47 | 49 | _resolution(defaults._defaultPanel._resolution), |
48 | 50 | _updateTitleOnNextInterval(false), |
49 | 51 | _bounds(Bounds()), |
... | ... | @@ -67,6 +69,7 @@ Panel::Panel(DefaultPlotConfiguration &defaults) : _id(--PANEL_COUNTER), |
67 | 69 | |
68 | 70 | Panel::Panel(Page *page) : _id(--PANEL_COUNTER), |
69 | 71 | _index(-1), |
72 | + _showIntInfo(false), | |
70 | 73 | _resolution(DefaultPlotConfiguration::getInstance()._defaultPanel._resolution), |
71 | 74 | _updateTitleOnNextInterval(false), |
72 | 75 | _bounds(Bounds()), |
... | ... | @@ -105,7 +108,7 @@ Font Panel::getTitleFont() { |
105 | 108 | |
106 | 109 | void Panel::reserveSpaceForTitle(double& topSpace, double& bottomSpace, double& titleHeight) { |
107 | 110 | LabelRowInfo titleRows(Label::getRowNumber(_title)); |
108 | - if (titleRows.empty()) | |
111 | + if (titleRows.empty() && !_showIntInfo) | |
109 | 112 | return; |
110 | 113 | |
111 | 114 | CharSize lCharSizeTitle; |
... | ... | @@ -113,31 +116,36 @@ void Panel::reserveSpaceForTitle(double& topSpace, double& bottomSpace, double& |
113 | 116 | Font titleFont(getTitleFont()); |
114 | 117 | PlPlotUtil::setPlFont(titleFont); |
115 | 118 | lCharSizeTitle = PlPlotUtil::getCharacterSizeInPlPage(_page); |
116 | - | |
117 | - titleHeight = (titleRows.size() + PlPlotUtil::LINE_SPACE_TITLE * (titleRows.size() + 1)) * lCharSizeTitle.second; | |
118 | - | |
119 | - switch (_titlePosition) | |
119 | + | |
120 | + if (_showIntInfo) | |
120 | 121 | { |
121 | - case PlotCommon::Position::POS_TOP : | |
122 | - topSpace += titleHeight; | |
123 | - break; | |
124 | - case PlotCommon::Position::POS_BOTTOM : | |
125 | - bottomSpace += titleHeight; | |
126 | - break; | |
127 | - default : | |
128 | - //Not possible - Nothing to do | |
129 | - ; | |
122 | + titleHeight = (1 + PlPlotUtil::LINE_SPACE_TITLE * (2)) * lCharSizeTitle.second; | |
123 | + topSpace += titleHeight; | |
124 | + } | |
125 | + | |
126 | + if (!titleRows.empty()){ | |
127 | + titleHeight = (titleRows.size() + PlPlotUtil::LINE_SPACE_TITLE * (titleRows.size() + 1)) * lCharSizeTitle.second; | |
128 | + | |
129 | + switch (_titlePosition) | |
130 | + { | |
131 | + case PlotCommon::Position::POS_TOP : | |
132 | + topSpace += titleHeight; | |
133 | + break; | |
134 | + case PlotCommon::Position::POS_BOTTOM : | |
135 | + bottomSpace += titleHeight; | |
136 | + break; | |
137 | + default : | |
138 | + //Not possible - Nothing to do | |
139 | + ; | |
140 | + } | |
130 | 141 | } |
131 | 142 | } |
132 | 143 | |
133 | 144 | void Panel::drawTitle(std::shared_ptr<plstream>& pls) { |
134 | 145 | LabelRowInfo titleRows(Label::getRowNumber(_title)); |
135 | - if (titleRows.empty()) | |
136 | - return; | |
137 | - | |
138 | - if ((_titlePosition != PlotCommon::Position::POS_TOP) && (_titlePosition != PlotCommon::Position::POS_BOTTOM)) | |
146 | + if ((titleRows.empty() && !_showIntInfo)) | |
139 | 147 | return; |
140 | - | |
148 | + | |
141 | 149 | // Compute panel coordinate in the page |
142 | 150 | Bounds lBounds = getBoundsInPlPage(); |
143 | 151 | |
... | ... | @@ -148,24 +156,47 @@ void Panel::drawTitle(std::shared_ptr<plstream>& pls) { |
148 | 156 | |
149 | 157 | // Specify viewport for the panel |
150 | 158 | pls->vpor(lBounds._x, lBounds._x + lBounds._width, |
151 | - lBounds._y, lBounds._y + lBounds._height); | |
159 | + lBounds._y, lBounds._y + lBounds._height); | |
160 | + | |
152 | 161 | |
153 | 162 | float lRowDisp = -0.5 - PlPlotUtil::LINE_SPACE_TITLE; |
154 | 163 | |
155 | - // Draw each line of title | |
156 | - for (auto row : titleRows) { | |
164 | + if(_showIntInfo && !_page->_superposeMode){ | |
165 | + PlotCommon::Position intPos = PlotCommon::Position::POS_TOP; | |
166 | + PlotCommon::Align intAlign = PlotCommon::Align::RIGHT; | |
167 | + std::string intText = "Int #"+std::to_string(_page->getIntIndex()+1); | |
168 | + // Draw each line of title | |
157 | 169 | pls->mtex( |
158 | - getPlSide(_titlePosition).c_str(), | |
170 | + getPlSide(intPos).c_str(), | |
159 | 171 | lRowDisp, |
160 | - getPlPos(_titleAlign), | |
161 | - getPlJust(_titleAlign), | |
162 | - row.c_str() | |
172 | + getPlPos(intAlign), | |
173 | + getPlJust(intAlign), | |
174 | + intText.c_str() | |
163 | 175 | ); |
164 | 176 | |
165 | 177 | // 1 is for full character and then let space between two line. |
166 | 178 | lRowDisp -= (1 + PlPlotUtil::LINE_SPACE_TITLE); |
167 | 179 | } |
168 | 180 | |
181 | + if (!titleRows.empty()){ | |
182 | + if ((_titlePosition != PlotCommon::Position::POS_TOP) && (_titlePosition != PlotCommon::Position::POS_BOTTOM)) | |
183 | + return; | |
184 | + | |
185 | + // Draw each line of title | |
186 | + for (auto row : titleRows) { | |
187 | + pls->mtex( | |
188 | + getPlSide(_titlePosition).c_str(), | |
189 | + lRowDisp, | |
190 | + getPlPos(_titleAlign), | |
191 | + getPlJust(_titleAlign), | |
192 | + row.c_str() | |
193 | + ); | |
194 | + | |
195 | + // 1 is for full character and then let space between two line. | |
196 | + lRowDisp -= (1 + PlPlotUtil::LINE_SPACE_TITLE); | |
197 | + } | |
198 | + } | |
199 | + | |
169 | 200 | // Restore initial color. |
170 | 201 | restoreColor(pls, lInitialColor, _page->_mode); |
171 | 202 | } | ... | ... |
src/ParamOutputImpl/Plot/Panel.hh
src/ParamOutputImpl/Plot/PanelNode.cc
... | ... | @@ -63,6 +63,14 @@ void PanelNode::proceed(xmlNodePtr pNode, |
63 | 63 | xmlFree(value); |
64 | 64 | } |
65 | 65 | |
66 | + | |
67 | + // -- showIntInfo | |
68 | + value = xmlGetProp(pNode, (const xmlChar *) "showIntInfo"); | |
69 | + if (value) { | |
70 | + panel->_showIntInfo = (strcasecmp ((const char*)value, "true") == 0); | |
71 | + xmlFree(value); | |
72 | + } | |
73 | + | |
66 | 74 | // -- resolution |
67 | 75 | if ((value = xmlGetProp(pNode, (const xmlChar *) "resolution"))) { |
68 | 76 | panel->_resolution = atoi((const char*) value); | ... | ... |
src/ParamOutputImpl/Plot/PlotOutput.cc
... | ... | @@ -247,6 +247,7 @@ bool PlotOutput::initNewPage(int intervalIndex, std::string& ttName) |
247 | 247 | plotFilePrefix << _filePrefix << "_"; |
248 | 248 | |
249 | 249 | //draw page |
250 | + _page->setIntIndex(intervalIndex); | |
250 | 251 | _page->draw(_pls, newFile, plotFilePrefix.str().c_str()); |
251 | 252 | |
252 | 253 | return newFile; | ... | ... |