mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/graph] Rename CartesianFunctionStore to ContinuousFunctionStore
This commit is contained in:
committed by
LeaNumworks
parent
d02ecf93a5
commit
0466d00588
@@ -25,14 +25,14 @@ public:
|
||||
App * unpack(Container * container) override;
|
||||
void reset() override;
|
||||
Descriptor * descriptor() override;
|
||||
CartesianFunctionStore * functionStore() override { return &m_functionStore; }
|
||||
ContinuousFunctionStore * functionStore() override { return &m_functionStore; }
|
||||
Shared::InteractiveCurveViewRange * graphRange() { return &m_graphRange; }
|
||||
Shared::Interval * intervalForType(Shared::CartesianFunction::PlotType plotType) {
|
||||
return m_interval + static_cast<size_t>(plotType);
|
||||
}
|
||||
private:
|
||||
void tidy() override;
|
||||
CartesianFunctionStore m_functionStore;
|
||||
ContinuousFunctionStore m_functionStore;
|
||||
Shared::InteractiveCurveViewRange m_graphRange;
|
||||
Shared::Interval m_interval[Shared::CartesianFunction::k_numberOfPlotTypes];
|
||||
};
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
bool XNTCanBeOverriden() const override { return false; }
|
||||
CodePoint XNT() override;
|
||||
NestedMenuController * variableBoxForInputEventHandler(InputEventHandler * textInput) override;
|
||||
CartesianFunctionStore * functionStore() override { return snapshot()->functionStore(); }
|
||||
ContinuousFunctionStore * functionStore() override { return snapshot()->functionStore(); }
|
||||
Shared::Interval * intervalForType(Shared::CartesianFunction::PlotType plotType) {
|
||||
return snapshot()->intervalForType(plotType);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ using namespace Shared;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
int CartesianFunctionStore::numberOfActiveFunctionsOfType(CartesianFunction::PlotType plotType) const {
|
||||
int ContinuousFunctionStore::numberOfActiveFunctionsOfType(CartesianFunction::PlotType plotType) const {
|
||||
int count = 0;
|
||||
for (int i = 0; i < numberOfActiveFunctions(); i++) {
|
||||
Ion::Storage::Record record = activeRecordAtIndex(i);
|
||||
@@ -19,7 +19,7 @@ int CartesianFunctionStore::numberOfActiveFunctionsOfType(CartesianFunction::Plo
|
||||
return count;
|
||||
}
|
||||
|
||||
Ion::Storage::Record CartesianFunctionStore::activeRecordOfTypeAtIndex(CartesianFunction::PlotType plotType, int index) const {
|
||||
Ion::Storage::Record ContinuousFunctionStore::activeRecordOfTypeAtIndex(CartesianFunction::PlotType plotType, int index) const {
|
||||
int count = 0;
|
||||
Ion::Storage::Record record;
|
||||
for (int i = 0; i < numberOfActiveFunctions(); i++) {
|
||||
@@ -35,19 +35,19 @@ Ion::Storage::Record CartesianFunctionStore::activeRecordOfTypeAtIndex(Cartesian
|
||||
return record;
|
||||
}
|
||||
|
||||
Ion::Storage::Record::ErrorStatus CartesianFunctionStore::addEmptyModel() {
|
||||
Ion::Storage::Record::ErrorStatus ContinuousFunctionStore::addEmptyModel() {
|
||||
Ion::Storage::Record::ErrorStatus error;
|
||||
CartesianFunction newModel = CartesianFunction::NewModel(&error);
|
||||
return error;
|
||||
}
|
||||
|
||||
ExpressionModelHandle * CartesianFunctionStore::setMemoizedModelAtIndex(int cacheIndex, Ion::Storage::Record record) const {
|
||||
ExpressionModelHandle * ContinuousFunctionStore::setMemoizedModelAtIndex(int cacheIndex, Ion::Storage::Record record) const {
|
||||
assert(cacheIndex >= 0 && cacheIndex < maxNumberOfMemoizedModels());
|
||||
m_functions[cacheIndex] = CartesianFunction(record);
|
||||
return &m_functions[cacheIndex];
|
||||
}
|
||||
|
||||
ExpressionModelHandle * CartesianFunctionStore::memoizedModelAtIndex(int cacheIndex) const {
|
||||
ExpressionModelHandle * ContinuousFunctionStore::memoizedModelAtIndex(int cacheIndex) const {
|
||||
assert(cacheIndex >= 0 && cacheIndex < maxNumberOfMemoizedModels());
|
||||
return &m_functions[cacheIndex];
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace Graph {
|
||||
|
||||
class CartesianFunctionStore : public Shared::FunctionStore {
|
||||
class ContinuousFunctionStore : public Shared::FunctionStore {
|
||||
public:
|
||||
Shared::ExpiringPointer<Shared::CartesianFunction> modelForRecord(Ion::Storage::Record record) const { return Shared::ExpiringPointer<Shared::CartesianFunction>(static_cast<Shared::CartesianFunction *>(privateModelForRecord(record))); }
|
||||
int numberOfActiveFunctionsOfType(Shared::CartesianFunction::PlotType plotType) const;
|
||||
|
||||
@@ -53,7 +53,7 @@ Coordinate2D<double> CalculationGraphController::computeNewPointOfInterestFromAb
|
||||
return computeNewPointOfInterest(start, step, max, textFieldDelegateApp()->localContext());
|
||||
}
|
||||
|
||||
CartesianFunctionStore * CalculationGraphController::functionStore() const {
|
||||
ContinuousFunctionStore * CalculationGraphController::functionStore() const {
|
||||
return App::app()->functionStore();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ protected:
|
||||
BannerView * bannerView() override { return m_bannerView; }
|
||||
void reloadBannerView() override;
|
||||
Poincare::Coordinate2D<double> computeNewPointOfInterestFromAbscissa(double start, int direction);
|
||||
CartesianFunctionStore * functionStore() const;
|
||||
ContinuousFunctionStore * functionStore() const;
|
||||
virtual Poincare::Coordinate2D<double> computeNewPointOfInterest(double start, double step, double max, Poincare::Context * context) = 0;
|
||||
GraphView * m_graphView;
|
||||
BannerView * m_bannerView;
|
||||
|
||||
@@ -117,7 +117,7 @@ void CalculationParameterController::setRecord(Ion::Storage::Record record) {
|
||||
}
|
||||
|
||||
bool CalculationParameterController::shouldDisplayIntersection() const {
|
||||
CartesianFunctionStore * store = App::app()->functionStore();
|
||||
ContinuousFunctionStore * store = App::app()->functionStore();
|
||||
int numberOfCartesianFunctions = store->numberOfActiveFunctionsOfType(Shared::CartesianFunction::PlotType::Cartesian);
|
||||
// Intersection row is displayed when all functions are cartesian and there are least two of them
|
||||
// TODO: compute intersections between polar/parametric/cartesian functions?
|
||||
|
||||
@@ -112,7 +112,7 @@ void GraphController::interestingRanges(float * xm, float * xM, float * ym, floa
|
||||
float GraphController::interestingXHalfRange() const {
|
||||
float characteristicRange = 0.0f;
|
||||
Poincare::Context * context = textFieldDelegateApp()->localContext();
|
||||
CartesianFunctionStore * store = functionStore();
|
||||
ContinuousFunctionStore * store = functionStore();
|
||||
for (int i = 0; i < store->numberOfActiveFunctions(); i++) {
|
||||
ExpiringPointer<CartesianFunction> f = store->modelForRecord(store->activeRecordAtIndex(i));
|
||||
float fRange = f->expressionReduced(context).characteristicXRange(context, Poincare::Preferences::sharedPreferences()->angleUnit());
|
||||
@@ -164,7 +164,7 @@ double GraphController::defaultCursorT(Ion::Storage::Record record) {
|
||||
}
|
||||
|
||||
bool GraphController::displaysNonCartesianFunctions() const {
|
||||
CartesianFunctionStore * store = functionStore();
|
||||
ContinuousFunctionStore * store = functionStore();
|
||||
return store->numberOfActiveFunctionsOfType(CartesianFunction::PlotType::Polar) > 0
|
||||
|| store->numberOfActiveFunctionsOfType(CartesianFunction::PlotType::Parametric) > 0;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ private:
|
||||
Shared::InteractiveCurveViewRange * interactiveCurveViewRange() override { return m_graphRange; }
|
||||
GraphView * functionGraphView() override { return &m_view; }
|
||||
CurveParameterController * curveParameterController() override { return &m_curveParameterController; }
|
||||
CartesianFunctionStore * functionStore() const override { return static_cast<CartesianFunctionStore *>(Shared::FunctionGraphController::functionStore()); }
|
||||
ContinuousFunctionStore * functionStore() const override { return static_cast<ContinuousFunctionStore *>(Shared::FunctionGraphController::functionStore()); }
|
||||
bool displaysNonCartesianFunctions() const;
|
||||
bool defautRangeIsNormalized() const override { return displaysNonCartesianFunctions(); }
|
||||
void interestingFunctionRange(Shared::ExpiringPointer<Shared::CartesianFunction> f, float tMin, float tMax, float step, float * xm, float * xM, float * ym, float * yM) const;
|
||||
|
||||
@@ -23,7 +23,7 @@ void GraphView::reload() {
|
||||
|
||||
void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
FunctionGraphView::drawRect(ctx, rect);
|
||||
CartesianFunctionStore * functionStore = App::app()->functionStore();
|
||||
ContinuousFunctionStore * functionStore = App::app()->functionStore();
|
||||
for (int i = 0; i < functionStore->numberOfActiveFunctions(); i++) {
|
||||
Ion::Storage::Record record = functionStore->activeRecordAtIndex(i);
|
||||
ExpiringPointer<CartesianFunction> f = functionStore->modelForRecord(record);;
|
||||
|
||||
@@ -189,7 +189,7 @@ void ListController::setFunctionNameInTextField(ExpiringPointer<CartesianFunctio
|
||||
textField->setText(bufferName);
|
||||
}
|
||||
|
||||
CartesianFunctionStore * ListController::modelStore() {
|
||||
ContinuousFunctionStore * ListController::modelStore() {
|
||||
return App::app()->functionStore();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ private:
|
||||
void willDisplayTitleCellAtIndex(HighlightCell * cell, int j) override;
|
||||
void willDisplayExpressionCellAtIndex(HighlightCell * cell, int j) override;
|
||||
void setFunctionNameInTextField(Shared::ExpiringPointer<Shared::CartesianFunction> function, TextField * textField);
|
||||
CartesianFunctionStore * modelStore() override;
|
||||
ContinuousFunctionStore * modelStore() override;
|
||||
TextFieldFunctionTitleCell m_functionTitleCells[k_maxNumberOfDisplayableRows];
|
||||
Shared::FunctionExpressionCell m_expressionCells[k_maxNumberOfDisplayableRows];
|
||||
ListParameterController m_parameterController;
|
||||
|
||||
@@ -81,7 +81,7 @@ KDCoordinate DerivativeParameterController::cellHeight() {
|
||||
return Metric::ParameterCellHeight;
|
||||
}
|
||||
|
||||
CartesianFunctionStore * DerivativeParameterController::functionStore() {
|
||||
ContinuousFunctionStore * DerivativeParameterController::functionStore() {
|
||||
return App::app()->functionStore();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
m_record = record;
|
||||
}
|
||||
private:
|
||||
CartesianFunctionStore * functionStore();
|
||||
ContinuousFunctionStore * functionStore();
|
||||
#if COPY_COLUMN
|
||||
constexpr static int k_totalNumberOfCell = 2;
|
||||
#else
|
||||
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
int maxNumberOfCells() override;
|
||||
int maxNumberOfFunctions() override;
|
||||
double evaluationOfAbscissaAtColumn(double abscissa, int columnIndex) override;
|
||||
CartesianFunctionStore * functionStore() const override { return static_cast<CartesianFunctionStore *>(Shared::ValuesController::functionStore()); }
|
||||
ContinuousFunctionStore * functionStore() const override { return static_cast<ContinuousFunctionStore *>(Shared::ValuesController::functionStore()); }
|
||||
Shared::BufferFunctionTitleCell * functionTitleCells(int j) override;
|
||||
EvenOddBufferTextCell * floatCells(int j) override;
|
||||
int abscissaCellsCount() const override { return k_maxNumberOfAbscissaCells; }
|
||||
|
||||
Reference in New Issue
Block a user