Commits
Ville Suoranta authored 080dc4f304a Merge
249 249 | |
250 250 | ////////////////////////// |
251 251 | // QPSYMBOL DEFINITIONS // |
252 252 | ////////////////////////// |
253 253 | |
254 254 | QPSymbol::QPSymbol() : m_style(QPOptions::symbol(style())), m_char('o'), |
255 255 | m_heightIsPixel(true), m_drawPen(&pen()), m_drawBrush(&brush()) { } |
256 256 | |
257 257 | |
258 258 | QPSymbol::QPSymbol(QwtSymbol::Style style, const QBrush & brush, |
259 - | const QPen & pen, const QSize & sz) : QwtSymbol(style, brush, pen, sz) { } |
260 - | |
259 + | const QPen & pen, const QSize & sz) : QwtSymbol(style, brush, pen, sz) { } |
260 + | |
261 261 | QPSymbol::QPSymbol(const QwtSymbol& s): QwtSymbol(s), |
262 262 | m_style(QPOptions::symbol(s.style())), m_char('o'), |
263 263 | m_heightIsPixel(true), m_drawPen(&pen()), m_drawBrush(&brush()) { } |
264 264 | |
265 265 | |
266 266 | QPSymbol::QPSymbol(const PlotSymbol& copy) : m_style(QPOptions::symbol(style())), |
267 267 | m_heightIsPixel(true), m_drawPen(&pen()), m_drawBrush(&brush()) { |
268 268 | operator=(copy); } |
269 269 | |
270 270 | QPSymbol::QPSymbol(const PlotSymbolPtr copy) : m_style(CIRCLE), m_char('o'), |
279 279 | const QSize& s = QwtSymbol::size(); |
280 280 | return psize_t(s.width(), s.height()); |
281 281 | } |
282 282 | |
283 283 | void QPSymbol::setSize(double width, double height, bool heightIsPixel) { |
284 284 | const QSize& s = QwtSymbol::size(); |
285 285 | if(s.width() != width || s.height() != height || (isCharacter() && |
286 286 | heightIsPixel != m_heightIsPixel)) { |
287 287 | m_heightIsPixel = heightIsPixel; |
288 288 | QwtSymbol::setSize((int)(width + 0.5), (int)(height + 0.5)); |
289 - | } else m_heightIsPixel = heightIsPixel; |
289 + | } else { |
290 + | m_heightIsPixel = heightIsPixel; |
291 + | } |
290 292 | } |
291 293 | |
292 294 | bool QPSymbol::heightIsPixel() const { return m_heightIsPixel; } |
293 295 | |
294 296 | void QPSymbol::setHeightIsPixel(bool pixel) { |
295 297 | if(isCharacter() && pixel != m_heightIsPixel) { |
296 298 | m_heightIsPixel = pixel; |
297 299 | QwtSymbol::setSize(QwtSymbol::size()); |
298 300 | } else m_heightIsPixel = pixel; |
299 301 | } |
395 397 | switch(a) { |
396 398 | case X_BOTTOM: return QwtPlot::xBottom; |
397 399 | case X_TOP: return QwtPlot::xTop; |
398 400 | case Y_LEFT: return QwtPlot::yLeft; |
399 401 | case Y_RIGHT: return QwtPlot::yRight; |
400 402 | default: return QwtPlot::xBottom; |
401 403 | } |
402 404 | } |
403 405 | |
404 406 | bool QPOptions::isAxisX( PlotAxis a ){ |
405 - | bool horizontal = false; |
406 - | if ( a == X_BOTTOM || a == X_TOP ){ |
407 - | horizontal = true; |
408 - | } |
409 - | return horizontal; |
407 + | bool horizontal = false; |
408 + | if ( a == X_BOTTOM || a == X_TOP ){ |
409 + | horizontal = true; |
410 + | } |
411 + | return horizontal; |
410 412 | } |
411 413 | |
412 414 | |
413 415 | PlotAxis QPOptions::axis(QwtPlot::Axis a) { |
414 416 | switch(a) { |
415 417 | case QwtPlot::xBottom: return X_BOTTOM; |
416 418 | case QwtPlot::xTop: return X_TOP; |
417 419 | case QwtPlot::yLeft: return Y_LEFT; |
418 420 | case QwtPlot::yRight: return Y_RIGHT; |
419 421 | default: return X_BOTTOM; |