Files
Upsilon/apps/calculation/additional_outputs/complex_graph_view.cpp
Émilie Feral f7942207f5 [apps/shared][apps/calculation] Create a methods
Shared::CurveView::drawAxisLabel and use it in ComplexGraphView
2020-02-12 15:13:18 +01:00

26 lines
674 B
C++

#include "complex_graph_view.h"
using namespace Shared;
namespace Calculation {
ComplexGraphView::ComplexGraphView(ComplexModel * complexModel) :
CurveView(complexModel),
m_complex(complexModel)
{
}
void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(rect, KDColorWhite);
drawAxes(ctx, rect);
drawDot(ctx, rect, m_complex->x(), m_complex->y(), KDColorBlack);
drawLabel(ctx, rect, Axis::Horizontal, m_complex->x());
drawLabel(ctx, rect, Axis::Vertical, m_complex->y());
drawAxisLabel(ctx, rect, Axis::Horizontal, "Re", m_complex->x() > 0.0f);
drawAxisLabel(ctx, rect, Axis::Vertical, "Im", m_complex->y() > 0.0f);
}
}