mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 19:49:58 +02:00
[apps/graph] Make graph window inherit from window curve view with
cursor Change-Id: Ib787e5175e74c41b08bda59d25740a83f726146f
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
namespace Graph {
|
||||
|
||||
GraphWindow::GraphWindow(FunctionStore * functionStore) :
|
||||
CurveViewWindowWithCursor(),
|
||||
m_xMin(-10.0f),
|
||||
m_xMax(10.0f),
|
||||
m_yMin(-10.0f),
|
||||
@@ -15,8 +16,6 @@ GraphWindow::GraphWindow(FunctionStore * functionStore) :
|
||||
m_yAuto(true),
|
||||
m_xGridUnit(2.0f),
|
||||
m_yGridUnit(2.0f),
|
||||
m_xCursorPosition(NAN),
|
||||
m_yCursorPosition(NAN),
|
||||
m_indexFunctionSelectedByCursor(0),
|
||||
m_functionStore(functionStore),
|
||||
m_context(nullptr)
|
||||
@@ -199,14 +198,6 @@ void GraphWindow::setDefault() {
|
||||
setYAuto(true);
|
||||
}
|
||||
|
||||
float GraphWindow::xCursorPosition() {
|
||||
return m_xCursorPosition;
|
||||
}
|
||||
|
||||
float GraphWindow::yCursorPosition() {
|
||||
return m_yCursorPosition;
|
||||
}
|
||||
|
||||
float GraphWindow::derivativeAtCursorPosition() {
|
||||
Function * f = m_functionStore->activeFunctionAtIndex(m_indexFunctionSelectedByCursor);
|
||||
return f->approximateDerivative(m_xCursorPosition, m_context);
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
#define GRAPH_GRAPH_AXIS_INTERVAL_H
|
||||
|
||||
#include "../function_store.h"
|
||||
#include "../../curve_view_window.h"
|
||||
#include "../../curve_view_window_with_cursor.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class GraphWindow : public CurveViewWindow {
|
||||
class GraphWindow : public CurveViewWindowWithCursor {
|
||||
public:
|
||||
enum class Direction {
|
||||
Up,
|
||||
@@ -38,8 +38,6 @@ public:
|
||||
void roundAbscissa();
|
||||
void normalize();
|
||||
void setDefault();
|
||||
float xCursorPosition();
|
||||
float yCursorPosition();
|
||||
float derivativeAtCursorPosition();
|
||||
Function * functionSelectedByCursor();
|
||||
void setCursorPositionAtAbscissaWithFunction(float abscissa, Function * function);
|
||||
@@ -60,8 +58,6 @@ private:
|
||||
bool m_yAuto;
|
||||
float m_xGridUnit;
|
||||
float m_yGridUnit;
|
||||
float m_xCursorPosition;
|
||||
float m_yCursorPosition;
|
||||
int m_indexFunctionSelectedByCursor;
|
||||
FunctionStore * m_functionStore;
|
||||
Context * m_context;
|
||||
|
||||
Reference in New Issue
Block a user