mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps/graph] ContinuousFunctionStore::displaysNonCartesianFunctions
This commit is contained in:
committed by
EmilieNumworks
parent
f79e774971
commit
4248128471
@@ -9,6 +9,14 @@ using namespace Shared;
|
||||
|
||||
namespace Graph {
|
||||
|
||||
bool ContinuousFunctionStore::displaysNonCartesianFunctions(int * nbActiveFunctions) const {
|
||||
int nbOfActiveFunctions = numberOfActiveFunctions();
|
||||
if (nbActiveFunctions != nullptr) {
|
||||
*nbActiveFunctions = nbOfActiveFunctions;
|
||||
}
|
||||
return numberOfActiveFunctionsOfType(ContinuousFunction::PlotType::Cartesian) != nbOfActiveFunctions;
|
||||
}
|
||||
|
||||
Ion::Storage::Record::ErrorStatus ContinuousFunctionStore::addEmptyModel() {
|
||||
Ion::Storage::Record::ErrorStatus error;
|
||||
ContinuousFunction newModel = ContinuousFunction::NewModel(&error);
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Graph {
|
||||
|
||||
class ContinuousFunctionStore : public Shared::FunctionStore {
|
||||
public:
|
||||
bool displaysNonCartesianFunctions(int * nbActiveFunctions = nullptr) const;
|
||||
int numberOfActiveFunctionsOfType(Shared::ContinuousFunction::PlotType plotType) const {
|
||||
return numberOfModelsSatisfyingTest(&isFunctionActiveOfType, &plotType);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,10 @@ void GraphController::viewWillAppear() {
|
||||
selectFunctionWithCursor(indexFunctionSelectedByCursor());
|
||||
}
|
||||
|
||||
bool GraphController::defautRangeIsNormalized() const {
|
||||
return functionStore()->displaysNonCartesianFunctions();
|
||||
}
|
||||
|
||||
void GraphController::interestingFunctionRange(ExpiringPointer<ContinuousFunction> f, float tMin, float tMax, float step, float * xm, float * xM, float * ym, float * yM) const {
|
||||
Poincare::Context * context = textFieldDelegateApp()->localContext();
|
||||
const int balancedBound = std::floor((tMax-tMin)/2/step);
|
||||
@@ -58,7 +62,7 @@ void GraphController::interestingRanges(float * xm, float * xM, float * ym, floa
|
||||
float resultyMax = -FLT_MAX;
|
||||
assert(functionStore()->numberOfActiveFunctions() > 0);
|
||||
int functionsCount = 0;
|
||||
if (displaysNonCartesianFunctions(&functionsCount)) {
|
||||
if (functionStore()->displaysNonCartesianFunctions(&functionsCount)) {
|
||||
for (int i = 0; i < functionsCount; i++) {
|
||||
ExpiringPointer<ContinuousFunction> f = functionStore()->modelForRecord(functionStore()->activeRecordAtIndex(i));
|
||||
if (f->plotType() == ContinuousFunction::PlotType::Cartesian) {
|
||||
@@ -149,7 +153,7 @@ bool GraphController::moveCursorHorizontally(int direction) {
|
||||
|
||||
int GraphController::nextCurveIndexVertically(bool goingUp, int currentSelectedCurve, Poincare::Context * context) const {
|
||||
int nbOfActiveFunctions = 0;
|
||||
if (!displaysNonCartesianFunctions(&nbOfActiveFunctions)) {
|
||||
if (!functionStore()->displaysNonCartesianFunctions(&nbOfActiveFunctions)) {
|
||||
return FunctionGraphController::nextCurveIndexVertically(goingUp, currentSelectedCurve, context);
|
||||
}
|
||||
int nextActiveFunctionIndex = currentSelectedCurve + (goingUp ? -1 : 1);
|
||||
@@ -164,16 +168,8 @@ double GraphController::defaultCursorT(Ion::Storage::Record record) {
|
||||
return function->tMin();
|
||||
}
|
||||
|
||||
bool GraphController::displaysNonCartesianFunctions(int * nbActiveFunctions) const {
|
||||
int nbOfActiveFunctions = functionStore()->numberOfActiveFunctions();
|
||||
if (nbActiveFunctions != nullptr) {
|
||||
*nbActiveFunctions = nbOfActiveFunctions;
|
||||
}
|
||||
return functionStore()->numberOfActiveFunctionsOfType(ContinuousFunction::PlotType::Cartesian) != nbOfActiveFunctions;
|
||||
}
|
||||
|
||||
bool GraphController::shouldSetDefaultOnModelChange() const {
|
||||
return displaysNonCartesianFunctions();
|
||||
return functionStore()->displaysNonCartesianFunctions();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,8 +34,7 @@ private:
|
||||
GraphView * functionGraphView() override { return &m_view; }
|
||||
CurveParameterController * curveParameterController() override { return &m_curveParameterController; }
|
||||
ContinuousFunctionStore * functionStore() const override { return static_cast<ContinuousFunctionStore *>(Shared::FunctionGraphController::functionStore()); }
|
||||
bool displaysNonCartesianFunctions(int * nbActiveFunctions = nullptr) const;
|
||||
bool defautRangeIsNormalized() const override { return displaysNonCartesianFunctions(); }
|
||||
bool defautRangeIsNormalized() const override;
|
||||
void interestingFunctionRange(Shared::ExpiringPointer<Shared::ContinuousFunction> f, float tMin, float tMax, float step, float * xm, float * xM, float * ym, float * yM) const;
|
||||
bool shouldSetDefaultOnModelChange() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user