Commit 4088b9fd authored by Mathieu Tillet's avatar Mathieu Tillet
Browse files

Manage the mask interface

Create the link between the mask interface and the 2D sector shape
object, and thus adds the possibility to create one such shape.
parent 048632b0
...@@ -66,6 +66,7 @@ public: ...@@ -66,6 +66,7 @@ public:
DrawRectangle, DrawRectangle,
DrawEllipticalRing, DrawEllipticalRing,
DrawRectangularRing, DrawRectangularRing,
DrawSector,
DrawFree DrawFree
}; };
...@@ -165,6 +166,7 @@ protected: ...@@ -165,6 +166,7 @@ protected:
QPushButton *m_rectangle; QPushButton *m_rectangle;
QPushButton *m_ring_ellipse; QPushButton *m_ring_ellipse;
QPushButton *m_ring_rectangle; QPushButton *m_ring_rectangle;
QPushButton *m_sector;
QPushButton *m_free_draw; QPushButton *m_free_draw;
QPushButton *m_applyToData; QPushButton *m_applyToData;
......
...@@ -130,6 +130,12 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget) ...@@ -130,6 +130,12 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget)
m_ring_rectangle->setToolTip("Draw a rectangular ring (Shift+Alt+R)"); m_ring_rectangle->setToolTip("Draw a rectangular ring (Shift+Alt+R)");
m_ring_rectangle->setShortcut(QKeySequence("Shift+Alt+R")); m_ring_rectangle->setShortcut(QKeySequence("Shift+Alt+R"));
m_sector = new QPushButton();
m_sector->setCheckable(true);
m_sector->setAutoExclusive(true);
m_sector->setIcon(QIcon(":/MaskTools/selection-box-ring.png"));
m_sector->setToolTip("Draw a circle sector (Shift+Alt+R)");
m_free_draw = new QPushButton(); m_free_draw = new QPushButton();
m_free_draw->setCheckable(true); m_free_draw->setCheckable(true);
m_free_draw->setAutoExclusive(true); m_free_draw->setAutoExclusive(true);
...@@ -144,6 +150,7 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget) ...@@ -144,6 +150,7 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget)
toolBox->addWidget(m_rectangle); toolBox->addWidget(m_rectangle);
toolBox->addWidget(m_ring_ellipse); toolBox->addWidget(m_ring_ellipse);
toolBox->addWidget(m_ring_rectangle); toolBox->addWidget(m_ring_rectangle);
toolBox->addWidget(m_sector);
toolBox->addWidget(m_free_draw); toolBox->addWidget(m_free_draw);
toolBox->addStretch(); toolBox->addStretch();
toolBox->setSpacing(2); toolBox->setSpacing(2);
...@@ -155,6 +162,7 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget) ...@@ -155,6 +162,7 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget)
connect(m_rectangle, SIGNAL(clicked()), this, SLOT(setActivity())); connect(m_rectangle, SIGNAL(clicked()), this, SLOT(setActivity()));
connect(m_ring_ellipse, SIGNAL(clicked()), this, SLOT(setActivity())); connect(m_ring_ellipse, SIGNAL(clicked()), this, SLOT(setActivity()));
connect(m_ring_rectangle, SIGNAL(clicked()), this, SLOT(setActivity())); connect(m_ring_rectangle, SIGNAL(clicked()), this, SLOT(setActivity()));
connect(m_sector, SIGNAL(clicked()), this, SLOT(setActivity()));
connect(m_free_draw, SIGNAL(clicked()), this, SLOT(setActivity())); connect(m_free_draw, SIGNAL(clicked()), this, SLOT(setActivity()));
m_move->setChecked(true); m_move->setChecked(true);
auto *toolGroup = new QFrame(); auto *toolGroup = new QFrame();
...@@ -405,6 +413,9 @@ void InstrumentWidgetMaskTab::selectTool(Activity tool) { ...@@ -405,6 +413,9 @@ void InstrumentWidgetMaskTab::selectTool(Activity tool) {
case DrawRectangularRing: case DrawRectangularRing:
m_ring_rectangle->setChecked(true); m_ring_rectangle->setChecked(true);
break; break;
case DrawSector:
m_sector->setChecked(true);
break;
case DrawFree: case DrawFree:
m_free_draw->setChecked(true); m_free_draw->setChecked(true);
break; break;
...@@ -461,6 +472,14 @@ void InstrumentWidgetMaskTab::setActivity() { ...@@ -461,6 +472,14 @@ void InstrumentWidgetMaskTab::setActivity() {
m_instrWidget->getSurface()->setInteractionMode( m_instrWidget->getSurface()->setInteractionMode(
ProjectionSurface::DrawRegularMode); ProjectionSurface::DrawRegularMode);
m_activeTool->setText("Tool: Rectangular ring. " + whatIsBeingSelected); m_activeTool->setText("Tool: Rectangular ring. " + whatIsBeingSelected);
} else if (m_sector->isChecked()) {
m_activity = DrawSector;
m_instrWidget->getSurface()->startCreatingShape2D("sector", borderColor,
fillColor);
m_instrWidget->getSurface()->setInteractionMode(
ProjectionSurface::DrawRegularMode);
m_activeTool->setText("Tool: Sector. " + whatIsBeingSelected);
} else if (m_free_draw->isChecked()) { } else if (m_free_draw->isChecked()) {
m_activity = DrawFree; m_activity = DrawFree;
m_instrWidget->getSurface()->startCreatingFreeShape(borderColor, fillColor); m_instrWidget->getSurface()->startCreatingFreeShape(borderColor, fillColor);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment