mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #5324 from OPM/well-measurements-delete-imported-files-5116
Well measurements delete imported files 5116
This commit is contained in:
commit
5d5df1e89f
@ -60,6 +60,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemExecData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSubItemsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSummaryCaseCollectionFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteWellMeasurementFilePathFeature.h
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCloseSourSimDataFeature.h
|
||||
|
||||
@ -147,6 +148,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemFeature.cpp
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSubItemsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSummaryCaseCollectionFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteWellMeasurementFilePathFeature.cpp
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCloseSourSimDataFeature.cpp
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimWellMeasurementCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
@ -99,6 +100,11 @@ std::vector<RimWellPath*> RicExportCompletionsForVisibleWellPathsFeature::visibl
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
{
|
||||
auto measurementColl = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellMeasurementCollection>();
|
||||
if ( measurementColl ) return wellPaths;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<RimWellPathCollection*> wellPathCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPathCollections );
|
||||
|
@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RicDeleteWellMeasurementFilePathFeature.h"
|
||||
|
||||
#include "RimWellMeasurement.h"
|
||||
#include "RimWellMeasurementCollection.h"
|
||||
#include "RimWellMeasurementFilePath.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicDeleteWellMeasurementFilePathFeature, "RicDeleteWellMeasurementFilePathFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteWellMeasurementFilePathFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellMeasurementFilePath*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
return !objects.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteWellMeasurementFilePathFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimWellMeasurementFilePath*> selectedFilePaths;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFilePaths );
|
||||
if ( selectedFilePaths.empty() ) return;
|
||||
|
||||
RimWellMeasurementFilePath* filePath = selectedFilePaths[0];
|
||||
|
||||
RimWellMeasurementCollection* wellMeasurementCollection = nullptr;
|
||||
filePath->firstAncestorOrThisOfType( wellMeasurementCollection );
|
||||
if ( !wellMeasurementCollection ) return;
|
||||
|
||||
wellMeasurementCollection->removeMeasurementsForFilePath( filePath );
|
||||
wellMeasurementCollection->removeFilePath( filePath );
|
||||
|
||||
wellMeasurementCollection->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteWellMeasurementFilePathFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Delete Well Measurement File" );
|
||||
actionToSetup->setIcon( QIcon( ":/Erase.png" ) );
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 RicDeleteWellMeasurementFilePathFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -94,6 +94,7 @@ void RicImportWellMeasurementsFeature::onActionTriggered( bool isChecked )
|
||||
wellMeasurement->setQuality( measurement.quality );
|
||||
wellMeasurement->setKind( measurement.kind );
|
||||
wellMeasurement->setRemark( measurement.remark );
|
||||
wellMeasurement->setFilePath( measurement.filePath );
|
||||
|
||||
// Ignore values for kinds which is known to not have values
|
||||
if ( !RimWellMeasurement::kindHasValue( measurement.kind ) )
|
||||
@ -149,5 +150,11 @@ RimWellPathCollection* RicImportWellMeasurementsFeature::selectedWellPathCollect
|
||||
return objects[0];
|
||||
}
|
||||
|
||||
auto measurementColl = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellMeasurementCollection>();
|
||||
if ( measurementColl )
|
||||
{
|
||||
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPathCollection>();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimWellMeasurement.h"
|
||||
#include "RimWellMeasurementCollection.h"
|
||||
#include "RimWellMeasurementInView.h"
|
||||
#include "RimWellMeasurementInViewCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathAttribute.h"
|
||||
#include "RimWellPathAttributeCollection.h"
|
||||
@ -159,7 +161,23 @@ bool RicWellPathPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& event
|
||||
}
|
||||
|
||||
RiuMainWindow::instance()->setResultInfo( measurementText );
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( collection );
|
||||
|
||||
Rim3dView* rimView = RiaApplication::instance()->activeReservoirView();
|
||||
if ( rimView )
|
||||
{
|
||||
// Find the RimWellMeasurementInView which matches the selection
|
||||
std::vector<RimWellMeasurementInViewCollection*> wellMeasurementInViewCollections;
|
||||
rimView->descendantsIncludingThisOfType( wellMeasurementInViewCollections );
|
||||
if ( !wellMeasurementInViewCollections.empty() )
|
||||
{
|
||||
RimWellMeasurementInView* wellMeasurementInView =
|
||||
wellMeasurementInViewCollections[0]->getWellMeasurementInView( measurement );
|
||||
if ( wellMeasurementInView )
|
||||
{
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( wellMeasurementInView );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurement.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementFilePath.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGeometryDef.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttribute.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCollection.h
|
||||
@ -179,6 +180,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurement.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementFilePath.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGeometryDef.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttribute.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCollection.cpp
|
||||
|
@ -117,6 +117,8 @@
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellMeasurementCollection.h"
|
||||
#include "RimWellMeasurementFilePath.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathAttributeCollection.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
@ -326,6 +328,15 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder.subMenuEnd();
|
||||
appendExportCompletions( menuBuilder );
|
||||
}
|
||||
else if ( dynamic_cast<RimWellMeasurementFilePath*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicDeleteWellMeasurementFilePathFeature";
|
||||
menuBuilder << "RicImportWellMeasurementsFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimWellMeasurementCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicImportWellMeasurementsFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimWellPath*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewEditableWellPathFeature";
|
||||
|
@ -38,6 +38,7 @@ RimWellMeasurement::RimWellMeasurement()
|
||||
CAF_PDM_InitFieldNoDefault( &m_kind, "Kind", "Kind", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_quality, "Quality", "Quality", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_remark, "Remark", "Remark", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -157,6 +158,22 @@ void RimWellMeasurement::setRemark( const QString& remark )
|
||||
m_remark = remark;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellMeasurement::filePath() const
|
||||
{
|
||||
return m_filePath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurement::setFilePath( const QString& filePath )
|
||||
{
|
||||
m_filePath = filePath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -54,6 +54,8 @@ public:
|
||||
void setQuality( int quality );
|
||||
QString remark() const;
|
||||
void setRemark( const QString& remark );
|
||||
QString filePath() const;
|
||||
void setFilePath( const QString& filePath );
|
||||
|
||||
static bool kindHasValue( const QString& measurementKind );
|
||||
static cvf::Color3f mapToColor( const QString& measurementKind );
|
||||
@ -73,4 +75,5 @@ private:
|
||||
caf::PdmField<QString> m_kind;
|
||||
caf::PdmField<int> m_quality;
|
||||
caf::PdmField<QString> m_remark;
|
||||
caf::PdmField<QString> m_filePath;
|
||||
};
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellMeasurement.h"
|
||||
#include "RimWellMeasurementFilePath.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiTableViewEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
@ -33,14 +33,15 @@ CAF_PDM_SOURCE_INIT( RimWellMeasurementCollection, "WellMeasurements" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellMeasurementCollection::RimWellMeasurementCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Well Measurement", "", "", "" );
|
||||
CAF_PDM_InitObject( "Well Measurements", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_measurements, "Measurements", "Well Measurements", "", "", "" );
|
||||
m_measurements.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
|
||||
m_measurements.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
m_measurements.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
this->setName( "Well Measurements" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_importedFiles, "ImportedFiles", "Imported Files", "", "", "" );
|
||||
m_importedFiles.uiCapability()->setUiTreeHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -77,6 +78,14 @@ std::vector<RimWellMeasurement*> RimWellMeasurementCollection::measurements() co
|
||||
return attrs;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellMeasurementCollection::isEmpty() const
|
||||
{
|
||||
return m_measurements.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -88,6 +97,7 @@ void RimWellMeasurementCollection::insertMeasurement( RimWellMeasurement* insert
|
||||
else
|
||||
m_measurements.push_back( measurement );
|
||||
|
||||
addFilePath( measurement->filePath() );
|
||||
this->updateAllReferringTracks();
|
||||
}
|
||||
|
||||
@ -97,6 +107,7 @@ void RimWellMeasurementCollection::insertMeasurement( RimWellMeasurement* insert
|
||||
void RimWellMeasurementCollection::appendMeasurement( RimWellMeasurement* measurement )
|
||||
{
|
||||
m_measurements.push_back( measurement );
|
||||
addFilePath( measurement->filePath() );
|
||||
this->updateAllReferringTracks();
|
||||
}
|
||||
|
||||
@ -145,6 +156,7 @@ void RimWellMeasurementCollection::defineEditorAttribute( const caf::PdmFieldHan
|
||||
void RimWellMeasurementCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_measurements );
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -153,21 +165,74 @@ void RimWellMeasurementCollection::defineUiOrdering( QString uiConfigName, caf::
|
||||
void RimWellMeasurementCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
||||
QString uiConfigName /*= ""*/ )
|
||||
{
|
||||
if ( !m_importedFiles.empty() )
|
||||
{
|
||||
uiTreeOrdering.add( &m_importedFiles );
|
||||
}
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
std::set<QString> RimWellMeasurementCollection::importedFiles() const
|
||||
{
|
||||
if ( changedField == &m_isChecked )
|
||||
std::set<QString> importedFiles;
|
||||
for ( auto importedFile : m_importedFiles )
|
||||
{
|
||||
RimProject* proj;
|
||||
this->firstAncestorOrThisOfTypeAsserted( proj );
|
||||
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
this->updateAllReferringTracks();
|
||||
importedFiles.insert( importedFile->filePath() );
|
||||
}
|
||||
|
||||
return importedFiles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::addFilePath( const QString& filePath )
|
||||
{
|
||||
std::set<QString> existingFilePaths = importedFiles();
|
||||
if ( existingFilePaths.find( filePath ) == existingFilePaths.end() )
|
||||
{
|
||||
RimWellMeasurementFilePath* measurementFilePath = new RimWellMeasurementFilePath;
|
||||
measurementFilePath->setFilePath( filePath );
|
||||
m_importedFiles.push_back( measurementFilePath );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::removeFilePath( RimWellMeasurementFilePath* measurementFilePath )
|
||||
{
|
||||
m_importedFiles.removeChildObject( measurementFilePath );
|
||||
delete measurementFilePath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::removeMeasurementsForFilePath( RimWellMeasurementFilePath* measurementFilePath )
|
||||
{
|
||||
// Find all measurements for this file path
|
||||
std::vector<RimWellMeasurement*> measurementsToRemove;
|
||||
for ( auto attr : m_measurements )
|
||||
{
|
||||
if ( attr->filePath() == measurementFilePath->filePath() )
|
||||
{
|
||||
measurementsToRemove.push_back( attr );
|
||||
}
|
||||
}
|
||||
|
||||
// Remove then remove them without invalidating the iterator
|
||||
for ( unsigned int i = 0; i < measurementsToRemove.size(); i++ )
|
||||
{
|
||||
m_measurements.removeChildObject( measurementsToRemove[i] );
|
||||
delete measurementsToRemove[i];
|
||||
}
|
||||
|
||||
RimProject* proj;
|
||||
this->firstAncestorOrThisOfTypeAsserted( proj );
|
||||
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
this->updateAllReferringTracks();
|
||||
}
|
||||
|
@ -17,19 +17,18 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RimCheckableNamedObject.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
|
||||
class RimWellMeasurement;
|
||||
class RimWellMeasurementFilePath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellMeasurementCollection : public RimCheckableNamedObject
|
||||
class RimWellMeasurementCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -44,6 +43,13 @@ public:
|
||||
void appendMeasurement( RimWellMeasurement* measurement );
|
||||
void deleteMeasurement( RimWellMeasurement* measurementToDelete );
|
||||
void deleteAllMeasurements();
|
||||
bool isEmpty() const;
|
||||
|
||||
std::set<QString> importedFiles() const;
|
||||
|
||||
void addFilePath( const QString& filePath );
|
||||
void removeFilePath( RimWellMeasurementFilePath* measurementFilePath );
|
||||
void removeMeasurementsForFilePath( RimWellMeasurementFilePath* measurementFilePath );
|
||||
|
||||
protected:
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
@ -51,10 +57,8 @@ protected:
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimWellMeasurement*> m_measurements;
|
||||
caf::PdmChildArrayField<RimWellMeasurement*> m_measurements;
|
||||
caf::PdmChildArrayField<RimWellMeasurementFilePath*> m_importedFiles;
|
||||
};
|
||||
|
@ -0,0 +1,71 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RimWellMeasurementFilePath.h"
|
||||
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellMeasurementFilePath, "WellMeasurementFilePath" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellMeasurementFilePath::RimWellMeasurementFilePath()
|
||||
{
|
||||
CAF_PDM_InitObject( "RimWellMeasurementFilePath", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_userDescription, "UserDecription", "Name", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path", "", "", "" );
|
||||
m_filePath.uiCapability()->setUiReadOnly( true );
|
||||
m_filePath.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellMeasurementFilePath::~RimWellMeasurementFilePath() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellMeasurementFilePath::filePath() const
|
||||
{
|
||||
return m_filePath.v().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementFilePath::setFilePath( const QString& filePath )
|
||||
{
|
||||
m_filePath = filePath;
|
||||
if ( m_userDescription().isEmpty() )
|
||||
{
|
||||
m_userDescription = QFileInfo( filePath ).fileName();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWellMeasurementFilePath::userDescriptionField()
|
||||
{
|
||||
return &m_userDescription;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "cafFilePath.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellMeasurementFilePath : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellMeasurementFilePath();
|
||||
~RimWellMeasurementFilePath() override;
|
||||
|
||||
QString filePath() const;
|
||||
void setFilePath( const QString& filePath );
|
||||
|
||||
private:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
caf::PdmField<QString> m_userDescription;
|
||||
caf::PdmField<caf::FilePath> m_filePath;
|
||||
};
|
@ -142,3 +142,21 @@ void RimWellMeasurementInViewCollection::syncWithChangesInWellMeasurementCollect
|
||||
updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get the "in-view" measurement corresponding to a give measurement.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellMeasurementInView*
|
||||
RimWellMeasurementInViewCollection::getWellMeasurementInView( const RimWellMeasurement* measurement ) const
|
||||
{
|
||||
for ( RimWellMeasurementInView* wellMeasurementInView : measurements() )
|
||||
{
|
||||
if ( wellMeasurementInView->measurementKind() == measurement->kind() )
|
||||
{
|
||||
return wellMeasurementInView;
|
||||
}
|
||||
}
|
||||
|
||||
// No match
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <vector>
|
||||
|
||||
class RimWellMeasurementInView;
|
||||
class RimWellMeasurement;
|
||||
|
||||
class RimWellMeasurementInViewCollection : public RimCheckableNamedObject
|
||||
{
|
||||
@ -37,6 +38,8 @@ public:
|
||||
|
||||
void syncWithChangesInWellMeasurementCollection();
|
||||
|
||||
RimWellMeasurementInView* getWellMeasurementInView( const RimWellMeasurement* measurement ) const;
|
||||
|
||||
protected:
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "RifWellPathImporter.h"
|
||||
|
||||
#include "cafPdmUiEditorHandle.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include <QFile>
|
||||
@ -108,7 +109,7 @@ RimWellPathCollection::RimWellPathCollection()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellMeasurements, "WellMeasurements", "Measurements", "", "", "" );
|
||||
m_wellMeasurements = new RimWellMeasurementCollection;
|
||||
m_wellMeasurements->uiCapability()->setUiTreeHidden( true );
|
||||
m_wellMeasurements.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
m_wellPathImporter = new RifWellPathImporter;
|
||||
m_wellPathFormationsImporter = new RifWellPathFormationsImporter;
|
||||
@ -432,6 +433,24 @@ void RimWellPathCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
|
||||
advancedGroup->add( &wellPathClipZDistance );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
||||
{
|
||||
if ( !m_wellMeasurements->isEmpty() )
|
||||
{
|
||||
uiTreeOrdering.add( &m_wellMeasurements );
|
||||
}
|
||||
|
||||
if ( !wellPaths.empty() )
|
||||
{
|
||||
uiTreeOrdering.add( &wellPaths );
|
||||
}
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -121,7 +121,9 @@ protected:
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
void readAndAddWellPaths( std::vector<RimFileWellPath*>& wellPathArray );
|
||||
|
Loading…
Reference in New Issue
Block a user