rename "draw support lines" to "draw guides"
This commit is contained in:
parent
cbf29fc087
commit
e3cb8532fc
@ -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()->bind();
|
||||||
OpenGLWidget::instance->getLineProgram()->setUniformValue("color", .2, .2, .2);
|
OpenGLWidget::instance->getLineProgram()->setUniformValue("color", .2, .2, .2);
|
||||||
GLfloat data[6] = {
|
GLfloat data[6] = {
|
||||||
@ -114,8 +114,8 @@ void DroneController::draw(QOpenGLExtraFunctions *f) const {
|
|||||||
if (draw_trajectories) {
|
if (draw_trajectories) {
|
||||||
drawTrajectory(f, d);
|
drawTrajectory(f, d);
|
||||||
}
|
}
|
||||||
if (draw_support_lines) {
|
if (draw_guides) {
|
||||||
drawSupportLine(f, d);
|
drawGuide(f, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +219,8 @@ void DroneController::setDrawTrajectories(bool enable) {
|
|||||||
OpenGLWidget::instance->update();
|
OpenGLWidget::instance->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DroneController::setDrawSupportLines(bool enable) {
|
|
||||||
draw_support_lines = enable;
|
void DroneController::setDrawGuides(bool enable) {
|
||||||
|
draw_guides = enable;
|
||||||
OpenGLWidget::instance->update();
|
OpenGLWidget::instance->update();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ class DroneController : public QObject, public Painter {
|
|||||||
QTimer sphere_timer;
|
QTimer sphere_timer;
|
||||||
QMap<int, QVector<QPair<int, int>>> collisions;
|
QMap<int, QVector<QPair<int, int>>> collisions;
|
||||||
bool draw_trajectories = false;
|
bool draw_trajectories = false;
|
||||||
bool draw_support_lines = false;
|
bool draw_guides = false;
|
||||||
|
|
||||||
static OpenGLMesh *sphere;
|
static OpenGLMesh *sphere;
|
||||||
static const unsigned char sphere_neutral[];
|
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);
|
static bool collides(const Drone &a, const Drone &b, double radius);
|
||||||
|
|
||||||
void drawTrajectory(QOpenGLExtraFunctions *f, const Drone &d) const;
|
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:
|
public:
|
||||||
DroneController(const QJsonObject &json);
|
DroneController(const QJsonObject &json);
|
||||||
@ -57,7 +57,7 @@ public slots:
|
|||||||
void computeCollisions(double sphere_radius);
|
void computeCollisions(double sphere_radius);
|
||||||
void displaySpheres(double sphere_radius);
|
void displaySpheres(double sphere_radius);
|
||||||
void setDrawTrajectories(bool enable);
|
void setDrawTrajectories(bool enable);
|
||||||
void setDrawSupportLines(bool enable);
|
void setDrawGuides(bool enable);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ void MainWindow::open(const QString &path) {
|
|||||||
dc, &DroneController::displaySpheres);
|
dc, &DroneController::displaySpheres);
|
||||||
connect(settings_pane, &SettingsPane::toggledTrajectories,
|
connect(settings_pane, &SettingsPane::toggledTrajectories,
|
||||||
dc, &DroneController::setDrawTrajectories);
|
dc, &DroneController::setDrawTrajectories);
|
||||||
connect(settings_pane, &SettingsPane::toggledSupportLines,
|
connect(settings_pane, &SettingsPane::toggledGuides,
|
||||||
dc, &DroneController::setDrawSupportLines);
|
dc, &DroneController::setDrawGuides);
|
||||||
settings_pane->setEnabled(true);
|
settings_pane->setEnabled(true);
|
||||||
|
|
||||||
glw.setPainter(dc);
|
glw.setPainter(dc);
|
||||||
|
@ -12,22 +12,22 @@ SettingsPane::SettingsPane(QWidget *parent)
|
|||||||
QDoubleSpinBox *sphere_radius = new QDoubleSpinBox();
|
QDoubleSpinBox *sphere_radius = new QDoubleSpinBox();
|
||||||
sphere_radius->setSingleStep(.1);
|
sphere_radius->setSingleStep(.1);
|
||||||
QCheckBox *show_trajectories = new QCheckBox();
|
QCheckBox *show_trajectories = new QCheckBox();
|
||||||
QCheckBox *show_support_lines = new QCheckBox();
|
QCheckBox *show_guides = new QCheckBox();
|
||||||
collisions = new QListWidget();
|
collisions = new QListWidget();
|
||||||
|
|
||||||
connect(sphere_radius, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
connect(sphere_radius, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
this, &SettingsPane::sphereRadiusChanged);
|
this, &SettingsPane::sphereRadiusChanged);
|
||||||
connect(show_trajectories, &QCheckBox::stateChanged,
|
connect(show_trajectories, &QCheckBox::stateChanged,
|
||||||
this, &SettingsPane::toggledTrajectories);
|
this, &SettingsPane::toggledTrajectories);
|
||||||
connect(show_support_lines, &QCheckBox::stateChanged,
|
connect(show_guides, &QCheckBox::stateChanged,
|
||||||
this, &SettingsPane::toggledSupportLines);
|
this, &SettingsPane::toggledGuides);
|
||||||
connect(collisions, &QListWidget::itemClicked,
|
connect(collisions, &QListWidget::itemClicked,
|
||||||
[&](QListWidgetItem *item) { emit collisionClicked(((CollisionItem *) item)->getFrame()); });
|
[&](QListWidgetItem *item) { emit collisionClicked(((CollisionItem *) item)->getFrame()); });
|
||||||
|
|
||||||
QFormLayout *layout = new QFormLayout;
|
QFormLayout *layout = new QFormLayout;
|
||||||
layout->addRow("Taille de la sphère de collision", sphere_radius);
|
layout->addRow("Taille de la sphère de collision", sphere_radius);
|
||||||
layout->addRow("Afficher les trajectoires", show_trajectories);
|
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();
|
QGroupBox *box = new QGroupBox();
|
||||||
box->setTitle("Collisions");
|
box->setTitle("Collisions");
|
||||||
box->setFlat(true);
|
box->setFlat(true);
|
||||||
|
@ -32,7 +32,7 @@ public slots:
|
|||||||
signals:
|
signals:
|
||||||
void sphereRadiusChanged(double sqRadius);
|
void sphereRadiusChanged(double sqRadius);
|
||||||
void toggledTrajectories(int shown);
|
void toggledTrajectories(int shown);
|
||||||
void toggledSupportLines(int shown);
|
void toggledGuides(int shown);
|
||||||
void collisionClicked(int frame);
|
void collisionClicked(int frame);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user