#4683 clang-format on all files in ApplicationCode

This commit is contained in:
Magne Sjaastad
2019-09-06 10:40:57 +02:00
parent 3a317504bb
commit fe9e567825
2092 changed files with 117952 additions and 111846 deletions

View File

@@ -2,17 +2,17 @@
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -20,105 +20,101 @@
#include "RiuRmsNavigation.h"
#include "cafViewer.h"
#include "cvfCamera.h"
#include "cvfViewport.h"
#include "cvfHitItemCollection.h"
#include "cvfRay.h"
#include "cvfManipulatorTrackball.h"
#include "cvfRay.h"
#include "cvfViewport.h"
#include <QInputEvent>
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuRmsNavigation::RiuRmsNavigation()
RiuRmsNavigation::RiuRmsNavigation() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuRmsNavigation::~RiuRmsNavigation() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuRmsNavigation::handleInputEvent( QInputEvent* inputEvent )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuRmsNavigation::~RiuRmsNavigation()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuRmsNavigation::handleInputEvent(QInputEvent* inputEvent)
{
if (! inputEvent) return false;
if ( !inputEvent ) return false;
bool isEventHandled = false;
switch (inputEvent->type())
switch ( inputEvent->type() )
{
case QEvent::MouseButtonPress:
case QEvent::MouseButtonPress:
{
QMouseEvent * me = static_cast<QMouseEvent*>( inputEvent);
QMouseEvent* me = static_cast<QMouseEvent*>( inputEvent );
int translatedMousePosX, translatedMousePosY;
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY );
if (me->button() == Qt::MidButton && isRotationEnabled())
if ( me->button() == Qt::MidButton && isRotationEnabled() )
{
cvf::HitItemCollection hic;
bool hitSomething = m_viewer->rayPick(me->x(), me->y(), &hic);
bool hitSomething = m_viewer->rayPick( me->x(), me->y(), &hic );
if (hitSomething)
{
if ( hitSomething )
{
cvf::Vec3d pointOfInterest = hic.firstItem()->intersectionPoint();
this->setPointOfInterest(pointOfInterest);
this->setPointOfInterest( pointOfInterest );
}
else
{
initializeRotationCenter();
}
m_trackball->startNavigation(cvf::ManipulatorTrackball::ROTATE, translatedMousePosX, translatedMousePosY);
m_isNavigating = true;
m_trackball->startNavigation( cvf::ManipulatorTrackball::ROTATE, translatedMousePosX, translatedMousePosY );
m_isNavigating = true;
m_hasMovedMouseDuringNavigation = false;
isEventHandled = true;
isEventHandled = true;
}
else if (me->button() == Qt::RightButton)
else if ( me->button() == Qt::RightButton )
{
if (me->modifiers() == Qt::NoModifier)
if ( me->modifiers() == Qt::NoModifier )
{
m_trackball->startNavigation(cvf::ManipulatorTrackball::PAN, translatedMousePosX, translatedMousePosY);
m_isNavigating = true;
m_trackball->startNavigation( cvf::ManipulatorTrackball::PAN,
translatedMousePosX,
translatedMousePosY );
m_isNavigating = true;
m_hasMovedMouseDuringNavigation = false;
isEventHandled = true;
isEventHandled = true;
}
}
else if (me->button() == Qt::LeftButton)
}
else if ( me->button() == Qt::LeftButton )
{
if (me->modifiers() == Qt::NoModifier)
if ( me->modifiers() == Qt::NoModifier )
{
QMouseEvent* we = static_cast<QMouseEvent*> ( inputEvent);
m_lastPosX = we->x();
m_lastPosY = we->y();
QMouseEvent* we = static_cast<QMouseEvent*>( inputEvent );
m_lastPosX = we->x();
m_lastPosY = we->y();
m_zoomRay = createZoomRay(translatedMousePosX, translatedMousePosY);
m_zoomRay = createZoomRay( translatedMousePosX, translatedMousePosY );
m_isNavigating = true;
m_isNavigating = true;
m_hasMovedMouseDuringNavigation = false;
isEventHandled = true;
m_isZooming = true;
isEventHandled = true;
m_isZooming = true;
}
}
forcePointOfInterestUpdateDuringNextWheelZoom();
}
break;
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonRelease:
{
if (m_isNavigating)
if ( m_isNavigating )
{
QMouseEvent * me = static_cast<QMouseEvent*>( inputEvent);
if (me->button() == Qt::RightButton || me->button() == Qt::MidButton )
QMouseEvent* me = static_cast<QMouseEvent*>( inputEvent );
if ( me->button() == Qt::RightButton || me->button() == Qt::MidButton )
{
m_trackball->endNavigation();
m_isNavigating = false;
if (m_hasMovedMouseDuringNavigation) isEventHandled = true;
if ( m_hasMovedMouseDuringNavigation ) isEventHandled = true;
m_hasMovedMouseDuringNavigation = false;
}
else if ( me->button() == Qt::LeftButton )
@@ -126,74 +122,73 @@ bool RiuRmsNavigation::handleInputEvent(QInputEvent* inputEvent)
m_isZooming = false;
m_isNavigating = false;
if (m_hasMovedMouseDuringNavigation) isEventHandled = true;
if ( m_hasMovedMouseDuringNavigation ) isEventHandled = true;
m_hasMovedMouseDuringNavigation = false;
}
}
forcePointOfInterestUpdateDuringNextWheelZoom();
}
break;
case QEvent::MouseMove:
case QEvent::MouseMove:
{
initializeRotationCenter();
if (m_isRotCenterInitialized)
if ( m_isRotCenterInitialized )
{
QMouseEvent * me = static_cast<QMouseEvent*>( inputEvent);
QMouseEvent* me = static_cast<QMouseEvent*>( inputEvent );
int translatedMousePosX, translatedMousePosY;
cvfEventPos(me->x(), me->y(), &translatedMousePosX, &translatedMousePosY);
cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY );
if (m_isNavigating)
if ( m_isNavigating )
{
if (m_isZooming)
if ( m_isZooming )
{
int delta = -3*(m_lastPosY - me->y());
this->zoomAlongRay(m_zoomRay.p(), delta);
int delta = -3 * ( m_lastPosY - me->y() );
this->zoomAlongRay( m_zoomRay.p(), delta );
m_lastPosX = me->x();
m_lastPosY = me->y();
}
else
{
bool needRedraw = m_trackball->updateNavigation(translatedMousePosX, translatedMousePosY);
if (needRedraw)
bool needRedraw = m_trackball->updateNavigation( translatedMousePosX, translatedMousePosY );
if ( needRedraw )
{
m_viewer->navigationPolicyUpdate();
}
}
isEventHandled = true;
isEventHandled = true;
m_hasMovedMouseDuringNavigation = true;
}
}
}
break;
case QEvent::Wheel:
case QEvent::Wheel:
{
if (inputEvent->modifiers() == Qt::NoModifier)
if ( inputEvent->modifiers() == Qt::NoModifier )
{
QWheelEvent* we = static_cast<QWheelEvent*>(inputEvent);
QWheelEvent* we = static_cast<QWheelEvent*>( inputEvent );
updatePointOfInterestDuringZoomIfNecessary(we->x(), we->y());
updatePointOfInterestDuringZoomIfNecessary( we->x(), we->y() );
if (m_isRotCenterInitialized)
if ( m_isRotCenterInitialized )
{
int translatedMousePosX, translatedMousePosY;
cvfEventPos(we->x(), we->y(), &translatedMousePosX, &translatedMousePosY);
cvfEventPos( we->x(), we->y(), &translatedMousePosX, &translatedMousePosY );
cvf::ref<cvf::Ray> ray = createZoomRay(translatedMousePosX, translatedMousePosY);
cvf::ref<cvf::Ray> ray = createZoomRay( translatedMousePosX, translatedMousePosY );
zoomAlongRay(ray.p(), -we->delta());
zoomAlongRay( ray.p(), -we->delta() );
}
isEventHandled = true;
}
}
break;
default:
break;
default:
break;
}
if (isSupposedToConsumeEvents())
if ( isSupposedToConsumeEvents() )
return isEventHandled;
else
return false;
}