mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018- Equinor ASA
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicCreateTextAnnotationIn3dViewFeature, "RicCreateTextAnnotationIn3dViewFeature");
|
||||
CAF_CMD_SOURCE_INIT( RicCreateTextAnnotationIn3dViewFeature, "RicCreateTextAnnotationIn3dViewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -50,28 +49,28 @@ bool RicCreateTextAnnotationIn3dViewFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered(bool isChecked)
|
||||
void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
RimEclipseContourMapView * contMapView = dynamic_cast<RimEclipseContourMapView*>(activeView);
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
RimEclipseContourMapView* contMapView = dynamic_cast<RimEclipseContourMapView*>( activeView );
|
||||
|
||||
if ( activeView )
|
||||
{
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
cvf::BoundingBox bbox = activeView->ownerCase()->activeCellsBoundingBox();
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
cvf::BoundingBox bbox = activeView->ownerCase()->activeCellsBoundingBox();
|
||||
|
||||
if (contMapView) domainCoord[2] = bbox.max().z() - bbox.extent().z() * 0.2;
|
||||
if ( contMapView ) domainCoord[2] = bbox.max().z() - bbox.extent().z() * 0.2;
|
||||
|
||||
auto coll = activeView->annotationCollection();
|
||||
|
||||
auto coll = activeView->annotationCollection();
|
||||
|
||||
if ( coll )
|
||||
{
|
||||
auto newAnnotation = new RimTextAnnotation();
|
||||
newAnnotation->setAnchorPoint(domainCoord);
|
||||
newAnnotation->setAnchorPoint( domainCoord );
|
||||
cvf::Vec3d labelPos = domainCoord;
|
||||
|
||||
if (activeView->viewer()->mainCamera()->direction().z() <= 0)
|
||||
|
||||
if ( activeView->viewer()->mainCamera()->direction().z() <= 0 )
|
||||
{
|
||||
labelPos.z() = bbox.max().z();
|
||||
}
|
||||
@@ -81,18 +80,20 @@ void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered(bool isChecked)
|
||||
}
|
||||
|
||||
cvf::Vec3d horizontalRight = activeView->viewer()->mainCamera()->direction() ^ cvf::Vec3d::Z_AXIS;
|
||||
cvf::Vec3d horizontalUp = activeView->viewer()->mainCamera()->up() - (cvf::Vec3d::Z_AXIS * (activeView->viewer()->mainCamera()->up() * cvf::Vec3d::Z_AXIS) );
|
||||
cvf::Vec3d horizontalUp = activeView->viewer()->mainCamera()->up() -
|
||||
( cvf::Vec3d::Z_AXIS *
|
||||
( activeView->viewer()->mainCamera()->up() * cvf::Vec3d::Z_AXIS ) );
|
||||
bool isOk = horizontalRight.normalize();
|
||||
if (!isOk) horizontalRight = {1.0, 0.0, 0.0};
|
||||
if ( !isOk ) horizontalRight = {1.0, 0.0, 0.0};
|
||||
|
||||
double height = fabs(labelPos.z() - domainCoord.z());
|
||||
newAnnotation->setLabelPoint(labelPos + 2.0*height * (horizontalRight + horizontalUp));
|
||||
double height = fabs( labelPos.z() - domainCoord.z() );
|
||||
newAnnotation->setLabelPoint( labelPos + 2.0 * height * ( horizontalRight + horizontalUp ) );
|
||||
|
||||
coll->addAnnotation(newAnnotation);
|
||||
coll->addAnnotation( newAnnotation );
|
||||
coll->scheduleRedrawOfRelevantViews();
|
||||
coll->updateConnectedEditors();
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(newAnnotation);
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( newAnnotation );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,9 +101,8 @@ void RicCreateTextAnnotationIn3dViewFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTextAnnotationIn3dViewFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicCreateTextAnnotationIn3dViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/TextAnnotation16x16.png"));
|
||||
actionToSetup->setText("Create Text Annotation");
|
||||
actionToSetup->setIcon( QIcon( ":/TextAnnotation16x16.png" ) );
|
||||
actionToSetup->setText( "Create Text Annotation" );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user