Skip to content

Commit

Permalink
Add polygon classes
Browse files Browse the repository at this point in the history
- add RimPolygon and RimPolygonInView
- add new define ItemIn3dView used to identify surface or polygon data
  • Loading branch information
magnesj committed Feb 12, 2024
1 parent 127b9ed commit 7622612
Show file tree
Hide file tree
Showing 40 changed files with 1,817 additions and 37 deletions.
4 changes: 4 additions & 0 deletions ApplicationLibCode/Application/RiaApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include "RicfCommandObject.h"

#include "PlotTemplates/RimPlotTemplateFolderItem.h"
#include "Polygons/RimPolygonCollection.h"

#include "Rim2dIntersectionViewCollection.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h"
Expand Down Expand Up @@ -544,6 +546,8 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
{
seismicData->ensureFileReaderIsInitialized();
}

oilField->polygonCollection()->loadData();
}

{
Expand Down
9 changes: 9 additions & 0 deletions ApplicationLibCode/Application/RiaDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,17 @@ enum class View3dContent
ALL = 0b00011111
};

enum class ItemIn3dView
{
NONE = 0b00000000,
SURFACE = 0b00000001,
POLYGON = 0b00000010,
ALL = 0b00000011
};

}; // namespace RiaDefines

// Activate bit mask operators at global scope
ENABLE_BITMASK_OPERATORS( RiaDefines::MultiPlotPageUpdateType )
ENABLE_BITMASK_OPERATORS( RiaDefines::View3dContent )
ENABLE_BITMASK_OPERATORS( RiaDefines::ItemIn3dView )
1 change: 1 addition & 0 deletions ApplicationLibCode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ list(
ProjectDataModel/Intersections/CMakeLists_files.cmake
ProjectDataModel/CellFilters/CMakeLists_files.cmake
ProjectDataModel/ProcessControl/CMakeLists_files.cmake
ProjectDataModel/Polygons/CMakeLists_files.cmake
ProjectDataModel/WellLog/CMakeLists_files.cmake
ProjectDataModel/WellMeasurement/CMakeLists_files.cmake
ProjectDataModel/WellPath/CMakeLists_files.cmake
Expand Down
1 change: 1 addition & 0 deletions ApplicationLibCode/Commands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ set(COMMAND_REFERENCED_CMAKE_FILES
PlotTemplateCommands/CMakeLists_files.cmake
FractureCommands/CMakeLists_files.cmake
PlotBuilderCommands/CMakeLists_files.cmake
PolygonCommands/CMakeLists_files.cmake
)

# Include source file lists from *.cmake files
Expand Down
19 changes: 19 additions & 0 deletions ApplicationLibCode/Commands/PolygonCommands/CMakeLists_files.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicAppendPolygonFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicAppendPolygonFileFeature.h
)

set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicAppendPolygonFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicAppendPolygonFileFeature.cpp
)

list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

list(APPEND COMMAND_CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})

source_group(
"CommandFeature\\Polygons"
FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES}
${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 "RicAppendPolygonFeature.h"

#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonCollection.h"
#include "RimOilField.h"
#include "RimProject.h"

#include "RiuPlotMainWindowTools.h"

#include <QAction>

CAF_CMD_SOURCE_INIT( RicAppendPolygonFeature, "RicAppendPolygonFeature" );

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendPolygonFeature::onActionTriggered( bool isChecked )
{
auto proj = RimProject::current();
auto polygonCollection = proj->activeOilField()->polygonCollection();

auto newPolygon = polygonCollection->appendUserDefinedPolygon();
polygonCollection->uiCapability()->updateAllRequiredEditors();

RiuPlotMainWindowTools::setExpanded( newPolygon );
RiuPlotMainWindowTools::selectAsCurrentItem( newPolygon );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendPolygonFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Append Polygon" );
actionToSetup->setIcon( QIcon( ":/PolylinesFromFile16x16.png" ) );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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.
//
/////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "cafCmdFeature.h"

//==================================================================================================
///
//==================================================================================================
class RicAppendPolygonFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;

protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 "RicAppendPolygonFileFeature.h"

#include "Polygons/RimPolygon.h"
#include "Polygons/RimPolygonCollection.h"
#include "Polygons/RimPolygonFile.h"
#include "RimOilField.h"
#include "RimProject.h"

#include "RiuPlotMainWindowTools.h"

#include <QAction>

CAF_CMD_SOURCE_INIT( RicAppendPolygonFileFeature, "RicAppendPolygonFileFeature" );

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendPolygonFileFeature::onActionTriggered( bool isChecked )
{
auto proj = RimProject::current();
auto polygonCollection = proj->activeOilField()->polygonCollection();

auto newPolygonFile = new RimPolygonFile();
newPolygonFile->setName( "File Polygon " + QString::number( polygonCollection->polygonFiles().size() + 1 ) );
polygonCollection->addPolygonFile( newPolygonFile );
polygonCollection->uiCapability()->updateAllRequiredEditors();

RiuPlotMainWindowTools::setExpanded( newPolygonFile );
RiuPlotMainWindowTools::selectAsCurrentItem( newPolygonFile );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAppendPolygonFileFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Append File Polygon" );
actionToSetup->setIcon( QIcon( ":/PolylinesFromFile16x16.png" ) );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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.
//
/////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "cafCmdFeature.h"

//==================================================================================================
///
//==================================================================================================
class RicAppendPolygonFileFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;

protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};
11 changes: 10 additions & 1 deletion ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "RigFormationNames.h"
#include "RigGeoMechCaseData.h"

#include "Polygons/RimPolygonInViewCollection.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimCellFilterCollection.h"
#include "RimEclipseResultDefinition.h"
Expand Down Expand Up @@ -153,7 +154,7 @@ void RimGeoMechView::onLoadDataAndUpdate()

onUpdateScaleTransform();

updateSurfacesInViewTreeItems();
updateViewTreeItems( RiaDefines::ItemIn3dView::ALL );

if ( m_geomechCase )
{
Expand Down Expand Up @@ -319,6 +320,12 @@ void RimGeoMechView::onCreateDisplayModel()
m_seismicSectionCollection->appendPartsToModel( this, m_seismicVizModel.p(), transform.p(), femBBox );
nativeOrOverrideViewer()->addStaticModelOnce( m_seismicVizModel.p(), isUsingOverrideViewer() );

// Polygons

m_polygonVizModel->removeAllParts();
m_polygonCollection->appendPartsToModel( m_polygonVizModel.p(), transform.p(), femBBox );
nativeOrOverrideViewer()->addStaticModelOnce( m_polygonVizModel.p(), isUsingOverrideViewer() );

// Surfaces

m_surfaceVizModel->removeAllParts();
Expand Down Expand Up @@ -1043,6 +1050,8 @@ void RimGeoMechView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
if ( surfaceInViewCollection() ) uiTreeOrdering.add( surfaceInViewCollection() );
if ( seismicSectionCollection()->shouldBeVisibleInTree() ) uiTreeOrdering.add( seismicSectionCollection() );

uiTreeOrdering.add( m_polygonCollection );

uiTreeOrdering.skipRemainingChildren( true );
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimPolygon.h
${CMAKE_CURRENT_LIST_DIR}/RimPolygonFile.h
${CMAKE_CURRENT_LIST_DIR}/RimPolygonCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPolygonInView.h
${CMAKE_CURRENT_LIST_DIR}/RimPolygonInViewCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPolygonAppearance.h
)

set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimPolygon.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPolygonFile.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPolygonCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPolygonInView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPolygonInViewCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPolygonAppearance.cpp
)

list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES})

source_group(
"ProjectDataModel\\Polygons"
FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES}
${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake
)
Loading

0 comments on commit 7622612

Please sign in to comment.