#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

@@ -16,8 +16,8 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimGeoMechContourMapView.h"
#include "RivContourMapProjectionPartMgr.h"
#include "RiuViewer.h"
#include "RivContourMapProjectionPartMgr.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimCase.h"
@@ -38,35 +38,32 @@
#include "cvfPart.h"
#include "cvfScene.h"
CAF_PDM_SOURCE_INIT(RimGeoMechContourMapView, "RimGeoMechContourMapView");
CAF_PDM_SOURCE_INIT( RimGeoMechContourMapView, "RimGeoMechContourMapView" );
const cvf::Mat4d RimGeoMechContourMapView::sm_defaultViewMatrix = cvf::Mat4d(1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 1000,
0, 0, 0, 1);
const cvf::Mat4d RimGeoMechContourMapView::sm_defaultViewMatrix =
cvf::Mat4d( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1000, 0, 0, 0, 1 );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechContourMapView::RimGeoMechContourMapView()
: m_cameraPositionLastUpdate(cvf::Vec3d::UNDEFINED)
: m_cameraPositionLastUpdate( cvf::Vec3d::UNDEFINED )
{
CAF_PDM_InitObject("GeoMech Contour Map View", ":/2DMap16x16.png", "", "");
CAF_PDM_InitObject( "GeoMech Contour Map View", ":/2DMap16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault(&m_contourMapProjection, "ContourMapProjection", "Contour Map Projection", "", "", "");
CAF_PDM_InitFieldNoDefault( &m_contourMapProjection, "ContourMapProjection", "Contour Map Projection", "", "", "" );
m_contourMapProjection = new RimGeoMechContourMapProjection();
CAF_PDM_InitField(&m_showAxisLines, "ShowAxisLines", true, "Show Axis Lines", "", "", "");
CAF_PDM_InitField(&m_showScaleLegend, "ShowScaleLegend", true, "Show Scale Legend", "", "", "");
CAF_PDM_InitField( &m_showAxisLines, "ShowAxisLines", true, "Show Axis Lines", "", "", "" );
CAF_PDM_InitField( &m_showScaleLegend, "ShowScaleLegend", true, "Show Scale Legend", "", "", "" );
m_gridCollection->setActive(false); // This is also not added to the tree view, so cannot be enabled.
m_gridCollection->setActive( false ); // This is also not added to the tree view, so cannot be enabled.
setDefaultCustomName();
m_contourMapProjectionPartMgr = new RivContourMapProjectionPartMgr(contourMapProjection(), this);
m_contourMapProjectionPartMgr = new RivContourMapProjectionPartMgr( contourMapProjection(), this );
((RiuViewerToViewInterface*)this)->setCameraPosition(sm_defaultViewMatrix);
( (RiuViewerToViewInterface*)this )->setCameraPosition( sm_defaultViewMatrix );
}
//--------------------------------------------------------------------------------------------------
@@ -84,41 +81,41 @@ QString RimGeoMechContourMapView::createAutoName() const
{
QStringList autoName;
if (!nameConfig()->customName().isEmpty())
if ( !nameConfig()->customName().isEmpty() )
{
autoName.push_back(nameConfig()->customName());
autoName.push_back( nameConfig()->customName() );
}
QStringList generatedAutoTags;
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfTypeAsserted(ownerCase);
this->firstAncestorOrThisOfTypeAsserted( ownerCase );
if (nameConfig()->addCaseName())
if ( nameConfig()->addCaseName() )
{
generatedAutoTags.push_back(ownerCase->caseUserDescription());
generatedAutoTags.push_back( ownerCase->caseUserDescription() );
}
if (nameConfig()->addAggregationType())
if ( nameConfig()->addAggregationType() )
{
generatedAutoTags.push_back(contourMapProjection()->resultAggregationText());
generatedAutoTags.push_back( contourMapProjection()->resultAggregationText() );
}
if (nameConfig()->addProperty() && !contourMapProjection()->isColumnResult())
if ( nameConfig()->addProperty() && !contourMapProjection()->isColumnResult() )
{
generatedAutoTags.push_back(cellResult()->resultFieldUiName());
generatedAutoTags.push_back( cellResult()->resultFieldUiName() );
}
if (nameConfig()->addSampleSpacing())
if ( nameConfig()->addSampleSpacing() )
{
generatedAutoTags.push_back(QString("%1").arg(contourMapProjection()->sampleSpacingFactor(), 3, 'f', 2));
generatedAutoTags.push_back( QString( "%1" ).arg( contourMapProjection()->sampleSpacingFactor(), 3, 'f', 2 ) );
}
if (!generatedAutoTags.empty())
if ( !generatedAutoTags.empty() )
{
autoName.push_back(generatedAutoTags.join(", "));
autoName.push_back( generatedAutoTags.join( ", " ) );
}
return autoName.join(": ");
return autoName.join( ": " );
}
//--------------------------------------------------------------------------------------------------
@@ -126,11 +123,11 @@ QString RimGeoMechContourMapView::createAutoName() const
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::setDefaultCustomName()
{
nameConfig()->setCustomName("Contour Map");
nameConfig()->hideCaseNameField(false);
nameConfig()->hideAggregationTypeField(false);
nameConfig()->hidePropertyField(false);
nameConfig()->hideSampleSpacingField(false);
nameConfig()->setCustomName( "Contour Map" );
nameConfig()->hideCaseNameField( false );
nameConfig()->hideAggregationTypeField( false );
nameConfig()->hidePropertyField( false );
nameConfig()->hideSampleSpacingField( false );
}
//--------------------------------------------------------------------------------------------------
@@ -139,7 +136,7 @@ void RimGeoMechContourMapView::setDefaultCustomName()
void RimGeoMechContourMapView::updatePickPointAndRedraw()
{
appendPickPointVisToModel();
if (m_viewer)
if ( m_viewer )
{
m_viewer->update();
}
@@ -175,11 +172,11 @@ bool RimGeoMechContourMapView::isTimeStepDependentDataVisible() const
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::initAfterRead()
{
m_gridCollection->setActive(false); // This is also not added to the tree view, so cannot be enabled.
m_gridCollection->setActive( false ); // This is also not added to the tree view, so cannot be enabled.
disablePerspectiveProjectionField();
setShowGridBox(false);
meshMode.setValue(RiaDefines::NO_MESH);
surfaceMode.setValue(FAULTS);
setShowGridBox( false );
meshMode.setValue( RiaDefines::NO_MESH );
surfaceMode.setValue( FAULTS );
scheduleCreateDisplayModelAndRedraw();
}
@@ -190,13 +187,13 @@ void RimGeoMechContourMapView::createDisplayModel()
{
RimGeoMechView::createDisplayModel();
if (!this->isTimeStepDependentDataVisible())
if ( !this->isTimeStepDependentDataVisible() )
{
// Need to add geometry even if it hasn't happened during dynamic time step update.
updateGeometry();
}
if (this->viewer()->mainCamera()->viewMatrix() == sm_defaultViewMatrix)
if ( this->viewer()->mainCamera()->viewMatrix() == sm_defaultViewMatrix )
{
this->zoomAll();
}
@@ -205,31 +202,32 @@ void RimGeoMechContourMapView::createDisplayModel()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimGeoMechContourMapView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* viewGroup = uiOrdering.addNewGroup("Viewer");
viewGroup->add(this->userDescriptionField());
viewGroup->add(this->backgroundColorField());
viewGroup->add(&m_showAxisLines);
viewGroup->add(&m_showScaleLegend);
caf::PdmUiGroup* viewGroup = uiOrdering.addNewGroup( "Viewer" );
viewGroup->add( this->userDescriptionField() );
viewGroup->add( this->backgroundColorField() );
viewGroup->add( &m_showAxisLines );
viewGroup->add( &m_showScaleLegend );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Contour Map Name");
nameConfig()->uiOrdering(uiConfigName, *nameGroup);
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Contour Map Name" );
nameConfig()->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields(true);
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
void RimGeoMechContourMapView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
QString uiConfigName /*= ""*/ )
{
uiTreeOrdering.add(m_overlayInfoConfig());
uiTreeOrdering.add(m_contourMapProjection);
uiTreeOrdering.add(cellResult());
cellResult()->uiCapability()->setUiReadOnly(m_contourMapProjection->isColumnResult());
uiTreeOrdering.add(m_rangeFilterCollection());
uiTreeOrdering.add(nativePropertyFilterCollection());
uiTreeOrdering.add( m_overlayInfoConfig() );
uiTreeOrdering.add( m_contourMapProjection );
uiTreeOrdering.add( cellResult() );
cellResult()->uiCapability()->setUiReadOnly( m_contourMapProjection->isColumnResult() );
uiTreeOrdering.add( m_rangeFilterCollection() );
uiTreeOrdering.add( nativePropertyFilterCollection() );
uiTreeOrdering.skipRemainingChildren();
}
@@ -247,28 +245,28 @@ void RimGeoMechContourMapView::updateCurrentTimeStep()
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::updateGeometry()
{
caf::ProgressInfo progress(100, "Generate Contour Map", true);
caf::ProgressInfo progress( 100, "Generate Contour Map", true );
{ // Step 1: generate results. About 30% of the time.
if (m_contourMapProjection->isChecked())
if ( m_contourMapProjection->isChecked() )
{
m_contourMapProjection->generateResultsIfNecessary(m_currentTimeStep());
m_contourMapProjection->generateResultsIfNecessary( m_currentTimeStep() );
}
updateLegends();
progress.setProgress(30);
progress.setProgress( 30 );
}
{ // Step 2: generate geometry. Takes about 60% of the time.
createContourMapGeometry();
progress.setProgress(90);
progress.setProgress( 90 );
}
{ // Step 3: generate drawables. About 10% of the time.
appendContourMapProjectionToModel();
appendContourLinesToModel();
appendPickPointVisToModel();
progress.setProgress(100);
progress.setProgress( 100 );
}
m_overlayInfoConfig->update3DInfo();
}
@@ -278,7 +276,7 @@ void RimGeoMechContourMapView::updateGeometry()
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::createContourMapGeometry()
{
if (m_viewer && m_contourMapProjection->isChecked())
if ( m_viewer && m_contourMapProjection->isChecked() )
{
m_contourMapProjectionPartMgr->createProjectionGeometry();
}
@@ -289,22 +287,23 @@ void RimGeoMechContourMapView::createContourMapGeometry()
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::appendContourMapProjectionToModel()
{
if (m_viewer && m_contourMapProjection->isChecked())
if ( m_viewer && m_contourMapProjection->isChecked() )
{
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
if (frameScene)
cvf::Scene* frameScene = m_viewer->frame( m_currentTimeStep );
if ( frameScene )
{
cvf::String name = "ContourMapProjection";
this->removeModelByName(frameScene, name);
this->removeModelByName( frameScene, name );
cvf::ref<cvf::ModelBasicList> contourMapProjectionModelBasicList = new cvf::ModelBasicList;
contourMapProjectionModelBasicList->setName(name);
contourMapProjectionModelBasicList->setName( name );
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
m_contourMapProjectionPartMgr->appendProjectionToModel(contourMapProjectionModelBasicList.p(), transForm.p());
m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(),
transForm.p() );
contourMapProjectionModelBasicList->updateBoundingBoxesRecursive();
frameScene->addModel(contourMapProjectionModelBasicList.p());
frameScene->addModel( contourMapProjectionModelBasicList.p() );
}
}
}
@@ -314,23 +313,24 @@ void RimGeoMechContourMapView::appendContourMapProjectionToModel()
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::appendContourLinesToModel()
{
if (m_viewer && m_contourMapProjection->isChecked())
if ( m_viewer && m_contourMapProjection->isChecked() )
{
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
if (frameScene)
cvf::Scene* frameScene = m_viewer->frame( m_currentTimeStep );
if ( frameScene )
{
cvf::String name = "ContourMapLines";
this->removeModelByName(frameScene, name);
this->removeModelByName( frameScene, name );
cvf::ref<cvf::ModelBasicList> contourMapLabelModelBasicList = new cvf::ModelBasicList;
contourMapLabelModelBasicList->setName(name);
contourMapLabelModelBasicList->setName( name );
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
m_contourMapProjectionPartMgr->appendContourLinesToModel(
viewer()->mainCamera(), contourMapLabelModelBasicList.p(), transForm.p());
m_contourMapProjectionPartMgr->appendContourLinesToModel( viewer()->mainCamera(),
contourMapLabelModelBasicList.p(),
transForm.p() );
contourMapLabelModelBasicList->updateBoundingBoxesRecursive();
frameScene->addModel(contourMapLabelModelBasicList.p());
frameScene->addModel( contourMapLabelModelBasicList.p() );
}
}
}
@@ -340,22 +340,23 @@ void RimGeoMechContourMapView::appendContourLinesToModel()
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::appendPickPointVisToModel()
{
if (m_viewer && m_contourMapProjection->isChecked())
if ( m_viewer && m_contourMapProjection->isChecked() )
{
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
if (frameScene)
cvf::Scene* frameScene = m_viewer->frame( m_currentTimeStep );
if ( frameScene )
{
cvf::String name = "ContourMapPickPoint";
this->removeModelByName(frameScene, name);
this->removeModelByName( frameScene, name );
cvf::ref<cvf::ModelBasicList> contourMapProjectionModelBasicList = new cvf::ModelBasicList;
contourMapProjectionModelBasicList->setName(name);
contourMapProjectionModelBasicList->setName( name );
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
m_contourMapProjectionPartMgr->appendPickPointVisToModel(contourMapProjectionModelBasicList.p(), transForm.p());
m_contourMapProjectionPartMgr->appendPickPointVisToModel( contourMapProjectionModelBasicList.p(),
transForm.p() );
contourMapProjectionModelBasicList->updateBoundingBoxesRecursive();
frameScene->addModel(contourMapProjectionModelBasicList.p());
frameScene->addModel( contourMapProjectionModelBasicList.p() );
}
}
}
@@ -365,24 +366,24 @@ void RimGeoMechContourMapView::appendPickPointVisToModel()
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::updateLegends()
{
if (m_viewer)
if ( m_viewer )
{
m_viewer->removeAllColorLegends();
if (m_contourMapProjection && m_contourMapProjection->isChecked())
if ( m_contourMapProjection && m_contourMapProjection->isChecked() )
{
RimRegularLegendConfig* projectionLegend = m_contourMapProjection->legendConfig();
if (projectionLegend)
if ( projectionLegend )
{
m_contourMapProjection->updateLegend();
if (projectionLegend->showLegend())
if ( projectionLegend->showLegend() )
{
m_viewer->addColorLegendToBottomLeftCorner(projectionLegend->titledOverlayFrame());
m_viewer->addColorLegendToBottomLeftCorner( projectionLegend->titledOverlayFrame() );
}
}
}
m_viewer->showScaleLegend(m_showScaleLegend());
m_viewer->showScaleLegend( m_showScaleLegend() );
}
}
@@ -391,11 +392,11 @@ void RimGeoMechContourMapView::updateLegends()
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::updateViewWidgetAfterCreation()
{
if (m_viewer)
if ( m_viewer )
{
m_viewer->showAxisCross(false);
m_viewer->showEdgeTickMarksXY(true, m_showAxisLines());
m_viewer->enableNavigationRotation(false);
m_viewer->showAxisCross( false );
m_viewer->showEdgeTickMarksXY( true, m_showAxisLines() );
m_viewer->enableNavigationRotation( false );
}
Rim3dView::updateViewWidgetAfterCreation();
@@ -406,7 +407,7 @@ void RimGeoMechContourMapView::updateViewWidgetAfterCreation()
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::updateViewFollowingRangeFilterUpdates()
{
m_contourMapProjection->setCheckState(true);
m_contourMapProjection->setCheckState( true );
scheduleCreateDisplayModelAndRedraw();
}
@@ -416,31 +417,31 @@ void RimGeoMechContourMapView::updateViewFollowingRangeFilterUpdates()
void RimGeoMechContourMapView::onLoadDataAndUpdate()
{
RimGeoMechView::onLoadDataAndUpdate();
if (m_viewer)
if ( m_viewer )
{
m_viewer->setView(cvf::Vec3d(0, 0, -1), cvf::Vec3d(0, 1, 0));
m_viewer->setView( cvf::Vec3d( 0, 0, -1 ), cvf::Vec3d( 0, 1, 0 ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechContourMapView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
void RimGeoMechContourMapView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimGeoMechView::fieldChangedByUi(changedField, oldValue, newValue);
RimGeoMechView::fieldChangedByUi( changedField, oldValue, newValue );
if (changedField == &m_showAxisLines)
if ( changedField == &m_showAxisLines )
{
m_viewer->showEdgeTickMarksXY(true, m_showAxisLines());
m_viewer->showEdgeTickMarksXY( true, m_showAxisLines() );
scheduleCreateDisplayModelAndRedraw();
}
else if (changedField == backgroundColorField())
else if ( changedField == backgroundColorField() )
{
scheduleCreateDisplayModelAndRedraw();
}
else if (changedField == &m_showScaleLegend)
else if ( changedField == &m_showScaleLegend )
{
updateLegends();
scheduleCreateDisplayModelAndRedraw();
@@ -458,14 +459,14 @@ caf::PdmFieldHandle* RimGeoMechContourMapView::userDescriptionField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimGeoMechContourMapView::createViewWidget(QWidget* mainWindowParent)
QWidget* RimGeoMechContourMapView::createViewWidget( QWidget* mainWindowParent )
{
auto widget = Rim3dView::createViewWidget(mainWindowParent);
auto widget = Rim3dView::createViewWidget( mainWindowParent );
if (viewer())
if ( viewer() )
{
viewer()->showZScaleLabel(false);
viewer()->hideZScaleCheckbox(true);
viewer()->showZScaleLabel( false );
viewer()->hideZScaleCheckbox( true );
}
return widget;
}
@@ -476,7 +477,7 @@ QWidget* RimGeoMechContourMapView::createViewWidget(QWidget* mainWindowParent)
void RimGeoMechContourMapView::onViewNavigationChanged()
{
cvf::Vec3d currentCameraPosition = viewer()->mainCamera()->position();
if (m_cameraPositionLastUpdate.isUndefined() || zoomChangeAboveTreshold(currentCameraPosition))
if ( m_cameraPositionLastUpdate.isUndefined() || zoomChangeAboveTreshold( currentCameraPosition ) )
{
appendContourLinesToModel();
m_cameraPositionLastUpdate = currentCameraPosition;
@@ -486,11 +487,9 @@ void RimGeoMechContourMapView::onViewNavigationChanged()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGeoMechContourMapView::zoomChangeAboveTreshold(const cvf::Vec3d& currentCameraPosition) const
bool RimGeoMechContourMapView::zoomChangeAboveTreshold( const cvf::Vec3d& currentCameraPosition ) const
{
double distance = std::max(std::fabs(m_cameraPositionLastUpdate.z()), std::fabs(currentCameraPosition.z()));
double distance = std::max( std::fabs( m_cameraPositionLastUpdate.z() ), std::fabs( currentCameraPosition.z() ) );
const double threshold = 0.05 * distance;
return std::fabs(m_cameraPositionLastUpdate.z() - currentCameraPosition.z()) > threshold;
return std::fabs( m_cameraPositionLastUpdate.z() - currentCameraPosition.z() ) > threshold;
}