///////////////////////////////////////////////////////////////////////////////// // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RimWellMeasurementInViewCollection.h" #include "Rim3dView.h" #include "RimGridView.h" #include "RimProject.h" #include "RimRegularLegendConfig.h" #include "RimTools.h" #include "RimWellLogTrack.h" #include "RimWellMeasurement.h" #include "RimWellMeasurementCollection.h" #include "RimWellMeasurementFilter.h" #include "RimWellMeasurementInView.h" #include "RimWellPathCollection.h" #include "cafCmdFeatureMenuBuilder.h" #include "cafPdmUiTableViewEditor.h" #include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeSelectionEditor.h" #include CAF_PDM_SOURCE_INIT( RimWellMeasurementInViewCollection, "WellMeasurementsInView" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimWellMeasurementInViewCollection::RimWellMeasurementInViewCollection() { CAF_PDM_InitObject( "Well Measurements", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_measurementsInView, "MeasurementKinds", "Measurement Kinds", "", "", "" ); m_measurementsInView.uiCapability()->setUiHidden( true ); this->setName( "Well Measurements" ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimWellMeasurementInViewCollection::~RimWellMeasurementInViewCollection() {} //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RimWellMeasurementInViewCollection::measurements() const { std::vector attrs; for ( auto attr : m_measurementsInView ) { attrs.push_back( attr.p() ); } return attrs; } //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellMeasurementInViewCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) { uiTreeOrdering.add( &m_measurementsInView ); uiTreeOrdering.skipRemainingChildren( true ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellMeasurementInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) { RimGridView* rimGridView = nullptr; this->firstAncestorOrThisOfTypeAsserted( rimGridView ); rimGridView->scheduleCreateDisplayModelAndRedraw(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellMeasurementInViewCollection::initAfterRead() { // TODO: Need a better solution for this!!! RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection(); if ( wellPathCollection ) { const RimWellMeasurementCollection* measurementCollection = wellPathCollection->measurementCollection(); std::set measurementKinds; for ( RimWellMeasurement* wellMeasurement : measurementCollection->measurements() ) { measurementKinds.insert( wellMeasurement->kind() ); } for ( QString kind : measurementKinds ) { RimWellMeasurementInView* measurementInView = new RimWellMeasurementInView; measurementInView->setName( kind ); measurementInView->setMeasurementKind( kind ); m_measurementsInView.push_back( measurementInView ); } } }