rename "draw support lines" to "draw guides"

This commit is contained in:
ccolin 2021-01-03 22:39:23 +01:00
parent cbf29fc087
commit e3cb8532fc
5 changed files with 16 additions and 15 deletions

View File

@ -76,7 +76,7 @@ void DroneController::drawTrajectory(QOpenGLExtraFunctions *f, const Drone &d) c
}
void DroneController::drawSupportLine(QOpenGLExtraFunctions *f, const Drone &d) const {
void DroneController::drawGuide(QOpenGLExtraFunctions *f, const Drone &d) const {
OpenGLWidget::instance->getLineProgram()->bind();
OpenGLWidget::instance->getLineProgram()->setUniformValue("color", .2, .2, .2);
GLfloat data[6] = {
@ -114,8 +114,8 @@ void DroneController::draw(QOpenGLExtraFunctions *f) const {
if (draw_trajectories) {
drawTrajectory(f, d);
}
if (draw_support_lines) {
drawSupportLine(f, d);
if (draw_guides) {
drawGuide(f, d);
}
}
}
@ -219,7 +219,8 @@ void DroneController::setDrawTrajectories(bool enable) {
OpenGLWidget::instance->update();
}
void DroneController::setDrawSupportLines(bool enable) {
draw_support_lines = enable;
void DroneController::setDrawGuides(bool enable) {
draw_guides = enable;
OpenGLWidget::instance->update();
}

View File

@ -24,7 +24,7 @@ class DroneController : public QObject, public Painter {
QTimer sphere_timer;
QMap<int, QVector<QPair<int, int>>> collisions;
bool draw_trajectories = false;
bool draw_support_lines = false;
bool draw_guides = false;
static OpenGLMesh *sphere;
static const unsigned char sphere_neutral[];
@ -32,7 +32,7 @@ class DroneController : public QObject, public Painter {
static bool collides(const Drone &a, const Drone &b, double radius);
void drawTrajectory(QOpenGLExtraFunctions *f, const Drone &d) const;
void drawSupportLine(QOpenGLExtraFunctions *f, const Drone &d) const;
void drawGuide(QOpenGLExtraFunctions *f, const Drone &d) const;
public:
DroneController(const QJsonObject &json);
@ -57,7 +57,7 @@ public slots:
void computeCollisions(double sphere_radius);
void displaySpheres(double sphere_radius);
void setDrawTrajectories(bool enable);
void setDrawSupportLines(bool enable);
void setDrawGuides(bool enable);
};

View File

@ -91,8 +91,8 @@ void MainWindow::open(const QString &path) {
dc, &DroneController::displaySpheres);
connect(settings_pane, &SettingsPane::toggledTrajectories,
dc, &DroneController::setDrawTrajectories);
connect(settings_pane, &SettingsPane::toggledSupportLines,
dc, &DroneController::setDrawSupportLines);
connect(settings_pane, &SettingsPane::toggledGuides,
dc, &DroneController::setDrawGuides);
settings_pane->setEnabled(true);
glw.setPainter(dc);

View File

@ -12,22 +12,22 @@ SettingsPane::SettingsPane(QWidget *parent)
QDoubleSpinBox *sphere_radius = new QDoubleSpinBox();
sphere_radius->setSingleStep(.1);
QCheckBox *show_trajectories = new QCheckBox();
QCheckBox *show_support_lines = new QCheckBox();
QCheckBox *show_guides = new QCheckBox();
collisions = new QListWidget();
connect(sphere_radius, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &SettingsPane::sphereRadiusChanged);
connect(show_trajectories, &QCheckBox::stateChanged,
this, &SettingsPane::toggledTrajectories);
connect(show_support_lines, &QCheckBox::stateChanged,
this, &SettingsPane::toggledSupportLines);
connect(show_guides, &QCheckBox::stateChanged,
this, &SettingsPane::toggledGuides);
connect(collisions, &QListWidget::itemClicked,
[&](QListWidgetItem *item) { emit collisionClicked(((CollisionItem *) item)->getFrame()); });
QFormLayout *layout = new QFormLayout;
layout->addRow("Taille de la sphère de collision", sphere_radius);
layout->addRow("Afficher les trajectoires", show_trajectories);
layout->addRow("Afficher les lignes de support", show_support_lines);
layout->addRow("Afficher les guides", show_guides);
QGroupBox *box = new QGroupBox();
box->setTitle("Collisions");
box->setFlat(true);

View File

@ -32,7 +32,7 @@ public slots:
signals:
void sphereRadiusChanged(double sqRadius);
void toggledTrajectories(int shown);
void toggledSupportLines(int shown);
void toggledGuides(int shown);
void collisionClicked(int frame);
};