mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
Remove 95 cvf include lines that the including file does not use. Found by extracting the symbols declared by every VizFwk header, including symbols they re-export, and flagging includes where none of those symbols appear anywhere in the file. Each removal is verified by a full build. Most of them are cvfVector3.h and cvfObject.h, left behind as the files they were once needed by changed. pch.h is left untouched. It includes cvfObject.h and cvfVector3.h on purpose, so that the files using the precompiled header do not have to. Note that a clean build after removing an include does not prove the include was unnecessary, only that the declarations still arrive some other way. That path can differ between platforms and with RESINSIGHT_ENABLE_UNITY_BUILD, so this needs a CI round on Linux as well.
138 lines
5.0 KiB
C++
138 lines
5.0 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// 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>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "RicNewIntersectionViewFeature.h"
|
|
|
|
#include "RiaLogging.h"
|
|
#include "Rim2dIntersectionView.h"
|
|
#include "RimCase.h"
|
|
#include "RimExtrudedCurveIntersection.h"
|
|
#include "RiuMessageDialog.h"
|
|
|
|
#include "Riu3DMainWindowTools.h"
|
|
#include "Riu3dSelectionManager.h"
|
|
#include "RiuViewer.h"
|
|
|
|
#include "cafSelectionManagerTools.h"
|
|
|
|
#include <QAction>
|
|
|
|
CAF_CMD_SOURCE_INIT( RicNewIntersectionViewFeature, "RicNewIntersectionViewFeature" );
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RicNewIntersectionViewFeature::isCommandEnabled() const
|
|
{
|
|
std::set<RimExtrudedCurveIntersection*> objects = selectedIntersections();
|
|
|
|
return !objects.empty();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicNewIntersectionViewFeature::onActionTriggered( bool isChecked )
|
|
{
|
|
std::set<RimExtrudedCurveIntersection*> intersections = selectedIntersections();
|
|
|
|
Rim2dIntersectionView* objectToSelect = nullptr;
|
|
|
|
for ( auto intersection : intersections )
|
|
{
|
|
if ( !intersection ) continue;
|
|
|
|
RimCase* rimCase = intersection->firstAncestorOrThisOfType<RimCase>();
|
|
if ( rimCase )
|
|
{
|
|
if ( intersection->direction() != RimExtrudedCurveIntersection::CrossSectionDirEnum::CS_VERTICAL )
|
|
{
|
|
QString text = QString( "The intersection view only supports vertical intersections.\n"
|
|
"The intersection '%1' is not vertical but a converted version will be shown "
|
|
"in the view ." )
|
|
.arg( intersection->name() );
|
|
|
|
RiuMessageDialog::showError( Riu3DMainWindowTools::mainWindowWidget(), "New Intersection View", text );
|
|
}
|
|
|
|
Rim2dIntersectionView* intersectionView = intersection->correspondingIntersectionView();
|
|
if ( !intersectionView )
|
|
{
|
|
RiaLogging::error( QString( "No intersection view found for intersection '%1'." ).arg( intersection->name() ).toStdString() );
|
|
continue;
|
|
}
|
|
|
|
intersectionView->setVisible( true );
|
|
intersectionView->loadDataAndUpdate();
|
|
|
|
intersectionView->updateConnectedEditors();
|
|
|
|
objectToSelect = intersectionView;
|
|
}
|
|
}
|
|
|
|
if ( objectToSelect )
|
|
{
|
|
// RiuMainWindow::instance()->selectAsCurrentItem(objectToSelect);
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RicNewIntersectionViewFeature::setupActionLook( QAction* actionToSetup )
|
|
{
|
|
actionToSetup->setText( "Show 2D Intersection View" );
|
|
// actionToSetup->setIcon(QIcon(":/chain.png"));
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::set<RimExtrudedCurveIntersection*> RicNewIntersectionViewFeature::selectedIntersections()
|
|
{
|
|
std::set<RimExtrudedCurveIntersection*> objects;
|
|
|
|
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
|
RiuSelectionItem* selItem = riuSelManager->selectedItem( Riu3dSelectionManager::RUI_TEMPORARY );
|
|
|
|
RiuGeneralSelectionItem* generalSelectionItem = static_cast<RiuGeneralSelectionItem*>( selItem );
|
|
if ( generalSelectionItem )
|
|
{
|
|
RimExtrudedCurveIntersection* intersection = dynamic_cast<RimExtrudedCurveIntersection*>( generalSelectionItem->m_object );
|
|
if ( intersection )
|
|
{
|
|
objects.insert( intersection );
|
|
|
|
// Return only the intersection the user clicked on
|
|
|
|
return objects;
|
|
}
|
|
}
|
|
|
|
{
|
|
std::vector<RimExtrudedCurveIntersection*> selectedObjects = caf::selectedObjectsByType<RimExtrudedCurveIntersection*>();
|
|
for ( auto obj : selectedObjects )
|
|
{
|
|
objects.insert( obj );
|
|
}
|
|
}
|
|
|
|
return objects;
|
|
}
|