[apps/graphs] Modify how functions are handled by the function store

Change-Id: I0d7a989526440a3b6d6a925b30d0d8742017e3f9
This commit is contained in:
Émilie Feral
2016-09-26 14:51:10 +02:00
parent 2c19b09c9d
commit ab74fe6933
5 changed files with 48 additions and 32 deletions

View File

@@ -16,9 +16,16 @@ Graph::Function * Graph::FunctionStore::functionAtIndex(int i) {
return &m_functions[i];
}
void Graph::FunctionStore::addFunction(Function * f) {
Graph::Function * Graph::FunctionStore::addEmptyFunction() {
assert(m_numberOfFunctions < k_maxNumberOfFunctions);
m_functions[m_numberOfFunctions++] = (*f);
Graph::Function addedFunction = Function();
addedFunction.setColor(defaultColors[numberOfFunctions()%numberOfDefaultColors]);
addedFunction.setName("f(x)");
addedFunction.setActive(true);
m_functions[m_numberOfFunctions] = addedFunction;
Function * result = &m_functions[m_numberOfFunctions];
m_numberOfFunctions++;
return result;
}
void Graph::FunctionStore::removeFunction(Function * f) {