mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5001 Add object definition for well measurement collection.
This commit is contained in:
parent
75c3e8732d
commit
ff15ff939d
@ -27,6 +27,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPath.h
|
||||
${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}/RimWellPathGeometryDef.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttribute.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCollection.h
|
||||
@ -173,6 +174,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPath.cpp
|
||||
${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}/RimWellPathGeometryDef.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttribute.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCollection.cpp
|
||||
|
@ -0,0 +1,187 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimWellMeasurementCollection.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellMeasurement.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiTableViewEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellMeasurementCollection, "WellMeasurements" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellMeasurementCollection::RimWellMeasurementCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Well Measurement", "", "", "" );
|
||||
|
||||
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()->setCustomContextMenuEnabled( true );
|
||||
this->setName( "Well Measurements" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellMeasurementCollection::~RimWellMeasurementCollection() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::updateAllReferringTracks()
|
||||
{
|
||||
std::vector<RimWellLogTrack*> wellLogTracks;
|
||||
|
||||
this->objectsWithReferringPtrFieldsOfType( wellLogTracks );
|
||||
for ( RimWellLogTrack* track : wellLogTracks )
|
||||
{
|
||||
track->loadDataAndUpdate();
|
||||
}
|
||||
this->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellMeasurement*> RimWellMeasurementCollection::measurements() const
|
||||
{
|
||||
std::vector<RimWellMeasurement*> attrs;
|
||||
|
||||
for ( auto attr : m_measurements )
|
||||
{
|
||||
attrs.push_back( attr.p() );
|
||||
}
|
||||
return attrs;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::insertMeasurement( RimWellMeasurement* insertBefore, RimWellMeasurement* measurement )
|
||||
{
|
||||
size_t index = m_measurements.index( insertBefore );
|
||||
if ( index < m_measurements.size() )
|
||||
m_measurements.insert( index, measurement );
|
||||
else
|
||||
m_measurements.push_back( measurement );
|
||||
|
||||
this->updateAllReferringTracks();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::appendMeasurement( RimWellMeasurement* measurement )
|
||||
{
|
||||
m_measurements.push_back( measurement );
|
||||
this->updateAllReferringTracks();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::deleteMeasurement( RimWellMeasurement* measurementToDelete )
|
||||
{
|
||||
m_measurements.removeChildObject( measurementToDelete );
|
||||
delete measurementToDelete;
|
||||
|
||||
this->updateAllReferringTracks();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::deleteAllMeasurements()
|
||||
{
|
||||
m_measurements.deleteAllChildObjects();
|
||||
this->updateAllReferringTracks();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu,
|
||||
QMenu* menu,
|
||||
QWidget* fieldEditorWidget )
|
||||
{
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
// menuBuilder << "RicNewWellMeasurementFeature";
|
||||
// menuBuilder << "Separator";
|
||||
// menuBuilder << "RicDeleteWellMeasurementFeature";
|
||||
|
||||
menuBuilder.appendToMenu( menu );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_measurements )
|
||||
{
|
||||
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>( attribute );
|
||||
if ( tvAttribute )
|
||||
{
|
||||
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FILL_CONTAINER;
|
||||
tvAttribute->alwaysEnforceResizePolicy = true;
|
||||
tvAttribute->minimumHeight = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_measurements );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
||||
QString uiConfigName /*= ""*/ )
|
||||
{
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellMeasurementCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_isChecked )
|
||||
{
|
||||
RimProject* proj;
|
||||
this->firstAncestorOrThisOfTypeAsserted( proj );
|
||||
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||
this->updateAllReferringTracks();
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RimCheckableNamedObject.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimWellMeasurement;
|
||||
|
||||
class RimWellMeasurementCollection : public RimCheckableNamedObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellMeasurementCollection();
|
||||
~RimWellMeasurementCollection() override;
|
||||
|
||||
std::vector<RimWellMeasurement*> measurements() const;
|
||||
|
||||
void updateAllReferringTracks();
|
||||
void insertMeasurement( RimWellMeasurement* insertBefore, RimWellMeasurement* measurement );
|
||||
void appendMeasurement( RimWellMeasurement* measurement );
|
||||
void deleteMeasurement( RimWellMeasurement* measurementToDelete );
|
||||
void deleteAllMeasurements();
|
||||
|
||||
protected:
|
||||
void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu,
|
||||
QMenu* menu,
|
||||
QWidget* fieldEditorWidget ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
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;
|
||||
};
|
@ -42,6 +42,7 @@
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellLogFileChannel.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellMeasurementCollection.h"
|
||||
#include "RimWellPathAttributeCollection.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPathCompletions.h"
|
||||
@ -128,6 +129,10 @@ RimWellPath::RimWellPath()
|
||||
m_wellPathAttributes = new RimWellPathAttributeCollection;
|
||||
m_wellPathAttributes->uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellMeasurements, "WellMeasurements", "Measurements", "", "", "" );
|
||||
m_wellMeasurements = new RimWellMeasurementCollection;
|
||||
m_wellMeasurements->uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
m_wellPath = nullptr;
|
||||
}
|
||||
|
||||
@ -491,6 +496,24 @@ const RimWellPathAttributeCollection* RimWellPath::attributeCollection() const
|
||||
return m_wellPathAttributes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
RimWellMeasurementCollection* RimWellPath::measurementCollection()
|
||||
{
|
||||
return m_wellMeasurements;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
const RimWellMeasurementCollection* RimWellPath::measurementCollection() const
|
||||
{
|
||||
return m_wellMeasurements;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -607,6 +630,11 @@ void RimWellPath::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
||||
uiTreeOrdering.add( m_wellPathAttributes() );
|
||||
}
|
||||
|
||||
if ( !m_wellMeasurements->measurements().empty() )
|
||||
{
|
||||
uiTreeOrdering.add( m_wellMeasurements() );
|
||||
}
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ class RimFishboneWellPathCollection;
|
||||
class RimFishbonesCollection;
|
||||
class RimPerforationCollection;
|
||||
class RimWellPathAttributeCollection;
|
||||
class RimWellMeasurementCollection;
|
||||
class RimWellPathCompletions;
|
||||
class RigWellPathFormations;
|
||||
|
||||
@ -110,6 +111,8 @@ public:
|
||||
const RimWellPathFractureCollection* fractureCollection() const;
|
||||
RimWellPathAttributeCollection* attributeCollection();
|
||||
const RimWellPathAttributeCollection* attributeCollection() const;
|
||||
RimWellMeasurementCollection* measurementCollection();
|
||||
const RimWellMeasurementCollection* measurementCollection() const;
|
||||
|
||||
bool showWellPathLabel() const;
|
||||
bool showWellPath() const;
|
||||
@ -171,6 +174,7 @@ private:
|
||||
caf::PdmChildField<Rim3dWellLogCurveCollection*> m_3dWellLogCurves;
|
||||
caf::PdmChildField<RimWellPathCompletions*> m_completions;
|
||||
caf::PdmChildField<RimWellPathAttributeCollection*> m_wellPathAttributes;
|
||||
caf::PdmChildField<RimWellMeasurementCollection*> m_wellMeasurements;
|
||||
|
||||
private:
|
||||
static size_t simulationWellBranchCount( const QString& simWellName );
|
||||
|
Loading…
Reference in New Issue
Block a user