MeasureDistance

- Abort mode via ESCAPE added

BoxZoom, BoxSelection and BoxElementSelection
- Change the cursor to give the user feedback about active mode.
- Abort mode via ESCAPE
This commit is contained in:
uLeonis
2020-12-21 17:32:14 +01:00
parent 3b449e1ce9
commit 96f2ba2cb5
10 changed files with 299 additions and 45 deletions

View File

@@ -63,11 +63,11 @@ void AbstractMouseSelection::grabMouseModel(Gui::View3DInventorViewer* viewer)
initialize();
}
void AbstractMouseSelection::releaseMouseModel()
void AbstractMouseSelection::releaseMouseModel(bool abort)
{
if (_pcView3D) {
// do termination of your mousemodel
terminate();
terminate(abort);
_pcView3D->getWidget()->setCursor(m_cPrevCursor);
_pcView3D = 0;
@@ -278,7 +278,7 @@ void PolyPickerSelection::initialize()
lastConfirmed = false;
}
void PolyPickerSelection::terminate()
void PolyPickerSelection::terminate(bool abort)
{
_pcView3D->removeGraphicsItem(&polyline);
_pcView3D->setRenderType(View3DInventorViewer::Native);
@@ -679,7 +679,7 @@ void RubberbandSelection::initialize()
_pcView3D->redraw();
}
void RubberbandSelection::terminate()
void RubberbandSelection::terminate(bool abort)
{
_pcView3D->removeGraphicsItem(&rubberband);
if (QtGLFramebufferObject::hasOpenGLFramebufferObjects()) {
@@ -771,14 +771,15 @@ BoxZoomSelection::~BoxZoomSelection()
{
}
void BoxZoomSelection::terminate()
void BoxZoomSelection::terminate(bool abort)
{
RubberbandSelection::terminate();
int xmin = std::min<int>(m_iXold, m_iXnew);
int xmax = std::max<int>(m_iXold, m_iXnew);
int ymin = std::min<int>(m_iYold, m_iYnew);
int ymax = std::max<int>(m_iYold, m_iYnew);
SbBox2s box(xmin, ymin, xmax, ymax);
_pcView3D->boxZoom(box);
RubberbandSelection::terminate(abort);
if (!abort) {
int xmin = std::min<int>(m_iXold, m_iXnew);
int xmax = std::max<int>(m_iXold, m_iXnew);
int ymin = std::min<int>(m_iYold, m_iYnew);
int ymax = std::max<int>(m_iYold, m_iYnew);
SbBox2s box(xmin, ymin, xmax, ymax);
_pcView3D->boxZoom(box);
}
}