#include <MathSolverController.h>
|
| virtual | ~MathSolverController ()=default |
| |
| virtual std::vector< String > | getAvailableActions (const String &blockId, std::shared_ptr< ParameterSet > overrideConfiguration=nullptr)=0 |
| |
| virtual String | getActionOutput (const String &blockId, const String &action, MimeType mimeType, std::shared_ptr< ParameterSet > overrideConfiguration=nullptr)=0 |
| |
| virtual void | applyAction (const String &blockId, const String &action, std::shared_ptr< ParameterSet > overrideConfiguration=nullptr)=0 |
| |
| virtual MathDiagnostic | getDiagnostic (const String &blockId, const String &task, std::shared_ptr< ParameterSet > overrideConfiguration=nullptr)=0 |
| |
| virtual std::vector< MathEvaluationVariables > | getEvaluables (const String &blockId)=0 |
| |
| virtual std::vector< std::vector< graphics::PointD > > | evaluate (const String &blockId, const MathEvaluationVariables &variables, double from, double to, int pointCount, std::shared_ptr< ParameterSet > overrideConfiguration=nullptr)=0 |
| |
| virtual MathVariableDefinition | asVariableDefinition (const String &blockId)=0 |
| |
| virtual std::vector< MathVariableInfo > | getVariables (const String &blockId)=0 |
| |
| virtual double | getVariableValue (const String &blockId, const String &name)=0 |
| |
| virtual void | setVariableValue (const String &blockId, const String &name, double value)=0 |
| |
| virtual bool | removeVariableValue (const String &blockId, const String &name)=0 |
| |
The MathSolverController allows to configure and run math operations on an editor.
- Note
- following limitation applies: the part managed by the associated editor must be a "Raw Content" and the specified blocks must be of type "Math".
- See also
- Editor.
-
OffscreenEditor.
- Since
- 4.0
◆ ~MathSolverController()
| virtual myscript::iink::MathSolverController::~MathSolverController |
( |
| ) |
|
|
virtualdefault |
◆ getAvailableActions()
| virtual std::vector<String> myscript::iink::MathSolverController::getAvailableActions |
( |
const String & |
blockId, |
|
|
std::shared_ptr< ParameterSet > |
overrideConfiguration = nullptr |
|
) |
| |
|
pure virtual |
Returns the available actions for the specified block.
- Parameters
-
| blockId | the identifier of the block. |
| overrideConfiguration | the extra configuration used. |
- Returns
- an array of the available actions.
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::invalid_argument | when overrideConfiguration is invalid. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
◆ getActionOutput()
| virtual String myscript::iink::MathSolverController::getActionOutput |
( |
const String & |
blockId, |
|
|
const String & |
action, |
|
|
MimeType |
mimeType, |
|
|
std::shared_ptr< ParameterSet > |
overrideConfiguration = nullptr |
|
) |
| |
|
pure virtual |
Returns the output for the given action and the specified block.
- Parameters
-
| blockId | the identifier of the block. |
| action | the action operated by the math solver. |
| mimeType | the MIME type that specifies the output format, either JIIX or LATEX. |
| overrideConfiguration | the extra configuration used. |
- Returns
- a string representing the output formatted with the given MIME type.
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::invalid_argument | when action is invalid |
| std::invalid_argument | when the specified MIME type is not supported. |
| std::invalid_argument | when overrideConfiguration is invalid. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
◆ applyAction()
| virtual void myscript::iink::MathSolverController::applyAction |
( |
const String & |
blockId, |
|
|
const String & |
action, |
|
|
std::shared_ptr< ParameterSet > |
overrideConfiguration = nullptr |
|
) |
| |
|
pure virtual |
Applies the solved action of the specified block to the rendering.
- Note
- following limitation applies: incompatible with Offscreen interactivity service.
- Parameters
-
| blockId | the identifier of the block. |
| action | the action used by the math solver. |
| overrideConfiguration | the extra configuration used. |
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::invalid_argument | when action is invalid. |
| std::invalid_argument | when overrideConfiguration is invalid. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
| std::runtime_error | when associated with an offscreen editor. |
◆ getDiagnostic()
Returns the diagnostic info for the given task and the specified block.
- Parameters
-
| blockId | the identifier of the block. |
| task | the task to diagnose: either "numerical-computation" or "evaluation". |
| overrideConfiguration | the extra configuration used. |
- Returns
- a diagnostic code.
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::invalid_argument | when task is invalid. |
| std::invalid_argument | when overrideConfiguration is invalid. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
- Since
- 4.1
◆ getEvaluables()
Returns the list of variable names that can be evaluated in the specified block. A block with no syntax error can be evaluated when it contains:
- a variable definition
- a single (multi-occurrence) undefined variable and no equal sign
- an equal sign and two undefined variables, with at least one being a single-occurrence Returns an empty list if block cannot be evaluated.
Example: a math block containing "y = x^3 + 2x + 1" can evaluate: { in:"x", out:"y" } a math block containing "2 * y = x - 1" can evaluate: {{ in:"x", out:"y" }, { in:"y", out:"x" }} a math block containing "y = 3 * 4" can evaluate: { in:"", out:"y" } a math block containing "sin(x) + x/2" can evaluate: { in:"x", out:"" }
Note: in case both variables can be evaluated interchangeably, the first returned MathEvaluationVariables will use the (leftmost) isolated variable as output if any. Example: "y = cos(x) + 1" will always return: {{ in:"x", out:"y" }, { in:"y", out:"x" }} in that order.
- Parameters
-
| blockId | the identifier of the block. |
- Returns
- a list of MathEvaluationVariables that can be evaluated.
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
- Since
- 4.1
◆ evaluate()
Returns the list of points resulting from evaluating the given variables in the specified block.
Example: for "y = 2x", evaluate(blockId, { in:"x", out:"y" }, -1, 1, 3) returns { {-1, -2}, {0, 0}, {1, 2} }
- Parameters
-
| blockId | the identifier of the block. |
| variables | the variables to evaluate. |
| from | the start of the range to evaluate. |
| to | the end of the range to evaluate. |
| pointCount | the number of values to evaluate between [from, to]. |
| overrideConfiguration | the extra configuration used. |
- Returns
- a list of evaluated points, representing continuous parts of a curve. With
point.x being the input value and point.y the evaluated variable output.
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::invalid_argument | when variables are not evaluables. |
| std::invalid_argument | when from or to is not a number. |
| std::invalid_argument | when from is greater than to. |
| std::invalid_argument | when pointCount is not in [1, 10000]. |
| std::invalid_argument | when overrideConfiguration is invalid. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
- Since
- 4.1
◆ asVariableDefinition()
Checks if the specified block represents a variable definition and returns the associated information. A block represents a variable definition if it is an equation with a single variable on the left of the equal sign and a constant expression on the right. Example: "a = 1/2"
- Parameters
-
| blockId | the identifier of the block. |
- Returns
- the name and value of the defined variable if any, otherwise an object which
valid() method returns false.
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
- Since
- 4.1
◆ getVariables()
| virtual std::vector<MathVariableInfo> myscript::iink::MathSolverController::getVariables |
( |
const String & |
blockId | ) |
|
|
pure virtual |
Retrieves information about all variables associated with a specified block.
- Parameters
-
| blockId | the identifier of the block whose variables are to be retrieved. |
- Returns
- a vector containing the information of all variables related to the specified block.
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
- Since
- 4.1
◆ getVariableValue()
| virtual double myscript::iink::MathSolverController::getVariableValue |
( |
const String & |
blockId, |
|
|
const String & |
name |
|
) |
| |
|
pure virtual |
Returns the value associated with the given variable name for the specified block.
- Parameters
-
| blockId | the identifier of the block. |
| name | the variable name. |
- Returns
- a variable value.
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::invalid_argument | if name is not an existing variable name. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
- Since
- 4.1
◆ setVariableValue()
| virtual void myscript::iink::MathSolverController::setVariableValue |
( |
const String & |
blockId, |
|
|
const String & |
name, |
|
|
double |
value |
|
) |
| |
|
pure virtual |
Sets the value associated with the given variable name for the specified block.
- Parameters
-
| blockId | the identifier of the block. |
| name | the variable name. |
| value | the variable value. |
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::invalid_argument | when name is an invalid variable name. |
| std::invalid_argument | when value is an invalid variable value. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
- Since
- 4.1
◆ removeVariableValue()
| virtual bool myscript::iink::MathSolverController::removeVariableValue |
( |
const String & |
blockId, |
|
|
const String & |
name |
|
) |
| |
|
pure virtual |
Removes the definition of the given variable name for the specified block.
- Parameters
-
| blockId | the identifier of the block. |
| name | the variable name. |
- Returns
true if the variable existed, otherwise false.
- Exceptions
-
| std::invalid_argument | when blockId is invalid. |
| std::runtime_error | when associated part type is not "Raw Content" or block type is not "Math". |
- Since
- 4.1
The documentation for this class was generated from the following file: