2016-09-02 20:32:37 +02:00
|
|
|
package org.warp.picalculator;
|
|
|
|
|
|
|
|
import static org.warp.engine.Display.Render.glColor3f;
|
|
|
|
import static org.warp.engine.Display.Render.glDrawLine;
|
|
|
|
|
2016-09-18 14:33:25 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
2016-09-12 16:30:51 +02:00
|
|
|
public class EquationsSystemPart extends AnteriorFunction {
|
2016-09-02 20:32:37 +02:00
|
|
|
|
2016-09-12 16:30:51 +02:00
|
|
|
public EquationsSystemPart(Equation equazione) {
|
2016-09-02 20:32:37 +02:00
|
|
|
super(equazione);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-09-12 16:30:51 +02:00
|
|
|
public String getSymbol() {
|
|
|
|
return MathematicalSymbols.SYSTEM;
|
2016-09-02 20:32:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-09-18 14:33:25 +02:00
|
|
|
public List<Function> solveOneStep() throws NumberFormatException, Error {
|
2016-09-02 20:32:37 +02:00
|
|
|
// TODO implementare il calcolo dei sistemi
|
2016-09-18 14:33:25 +02:00
|
|
|
return variable.solveOneStep();
|
2016-09-02 20:32:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-09-12 16:30:51 +02:00
|
|
|
public void generateGraphics() {
|
2016-09-02 20:32:37 +02:00
|
|
|
variable.setSmall(false);
|
2016-09-12 16:30:51 +02:00
|
|
|
variable.generateGraphics();
|
2016-09-02 20:32:37 +02:00
|
|
|
|
|
|
|
width = 5 + getVariable().getWidth();
|
|
|
|
height = 3 + getVariable().getHeight() + 2;
|
|
|
|
line = 3 + getVariable().getLine();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void draw(int x, int y) {
|
|
|
|
final int h = this.getHeight() - 1;
|
|
|
|
final int paddingTop = 3;
|
|
|
|
final int spazioSotto = (h - 3 - 2) / 2 + paddingTop;
|
|
|
|
final int spazioSopra = h - spazioSotto;
|
|
|
|
variable.draw(x + 5, y + paddingTop);
|
|
|
|
glColor3f(0, 0, 0);
|
|
|
|
glDrawLine(x + 2, y + 0, x + 3, y + 0);
|
|
|
|
glDrawLine(x + 1, y + 1, x + 1, y + spazioSotto / 2);
|
|
|
|
glDrawLine(x + 2, y + spazioSotto / 2 + 1, x + 2, y + spazioSotto - 1);
|
|
|
|
glDrawLine(x + 0, y + spazioSotto, x + 1, y + spazioSotto);
|
|
|
|
glDrawLine(x + 2, y + spazioSotto + 1, x + 2, y + spazioSotto + spazioSopra / 2 - 1);
|
|
|
|
glDrawLine(x + 1, y + spazioSotto + spazioSopra / 2, x + 1, y + h - 1);
|
|
|
|
glDrawLine(x + 2, y + h, x + 3, y + h);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getWidth() {
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getHeight() {
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getLine() {
|
|
|
|
return line;
|
|
|
|
}
|
|
|
|
}
|