From 3fabe5f8b59dbef73a7a966a5ad52e4ce13aff86 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 9 Dec 2016 20:36:31 +0100 Subject: [PATCH 01/24] #559 : Linked Views: Linking legend definitions --- .../ProjectDataModel/RimLegendConfig.cpp | 31 +++++++++++ .../ProjectDataModel/RimLegendConfig.h | 2 + .../RimTernaryLegendConfig.cpp | 38 ++++++++++++-- .../ProjectDataModel/RimTernaryLegendConfig.h | 6 ++- .../ProjectDataModel/RimViewController.cpp | 52 +++++++++++++++++-- .../ProjectDataModel/RimViewController.h | 3 ++ .../ProjectDataModel/RimViewLinker.cpp | 22 +++++++- .../ProjectDataModel/RimViewLinker.h | 1 + 8 files changed, 144 insertions(+), 11 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp index d726b519e4..6db35dbec7 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp @@ -26,6 +26,7 @@ #include "RimEclipseCellColors.h" #include "RimEclipseView.h" #include "RimGeoMechResultDefinition.h" +#include "RimViewLinker.h" #include "cafCategoryLegend.h" #include "cafCategoryMapper.h" @@ -182,6 +183,18 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, updateLegend(); + RimView* view = nullptr; + this->firstAncestorOrThisOfType(view); + + if (view) + { + RimViewLinker* viewLinker = view->assosiatedViewLinker(); + if (viewLinker) + { + viewLinker->updateCellResult(); + } + } + if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw(); } @@ -758,6 +771,24 @@ cvf::OverlayItem* RimLegendConfig::legend() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimLegendConfig::setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig) +{ + this->m_numLevels = otherLegendConfig->m_numLevels; + this->m_precision = otherLegendConfig->m_precision; + this->m_tickNumberFormat = otherLegendConfig->m_tickNumberFormat; + this->m_rangeMode = otherLegendConfig->m_rangeMode; + this->m_userDefinedMaxValue = otherLegendConfig->m_userDefinedMaxValue; + this->m_userDefinedMinValue = otherLegendConfig->m_userDefinedMinValue; + this->m_colorRangeMode = otherLegendConfig->m_colorRangeMode; + this->m_mappingMode = otherLegendConfig->m_mappingMode; + + this->m_userDefinedMinValue = otherLegendConfig->m_userDefinedMinValue; + this->m_userDefinedMaxValue = otherLegendConfig->m_userDefinedMaxValue; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.h b/ApplicationCode/ProjectDataModel/RimLegendConfig.h index c71276467e..c151dfe2c1 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.h @@ -126,6 +126,8 @@ private: cvf::ref interpolateColorArray(const cvf::Color3ubArray& colorArray, cvf::uint targetColorCount); double roundToNumSignificantDigits(double value, double precision); + friend class RimViewLinker; + void setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig); private: caf::PdmPointer m_reservoirView; diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 0c107d4f2c..207163eec3 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -19,15 +19,17 @@ #include "RimTernaryLegendConfig.h" -#include "cafPdmUiPushButtonEditor.h" -#include "cafPdmUiTextEditor.h" - #include "RiaApplication.h" + #include "RimEclipseView.h" +#include "RimViewLinker.h" #include "RivTernarySaturationOverlayItem.h" #include "RivTernaryScalarMapper.h" +#include "cafPdmUiPushButtonEditor.h" +#include "cafPdmUiTextEditor.h" + #include "cvfqtUtils.h" #include @@ -152,6 +154,18 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed updateLabelText(); updateLegend(); + RimView* view = nullptr; + this->firstAncestorOrThisOfType(view); + + if (view) + { + RimViewLinker* viewLinker = view->assosiatedViewLinker(); + if (viewLinker) + { + viewLinker->updateCellResult(); + } + } + if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw(); } @@ -231,6 +245,24 @@ void RimTernaryLegendConfig::recreateLegend() updateLegend(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimTernaryLegendConfig::setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig) +{ + this->precision = otherLegendConfig->precision; + this->rangeMode = otherLegendConfig->rangeMode; + this->userDefinedMaxValueSoil = otherLegendConfig->userDefinedMaxValueSoil; + this->userDefinedMinValueSoil = otherLegendConfig->userDefinedMinValueSoil; + this->userDefinedMaxValueSgas = otherLegendConfig->userDefinedMaxValueSgas; + this->userDefinedMinValueSgas = otherLegendConfig->userDefinedMinValueSgas; + this->userDefinedMaxValueSwat = otherLegendConfig->userDefinedMaxValueSwat; + this->userDefinedMinValueSwat = otherLegendConfig->userDefinedMinValueSwat; + this->applyLocalMinMax = otherLegendConfig->applyLocalMinMax; + this->applyGlobalMinMax = otherLegendConfig->applyGlobalMinMax; + this->applyFullRangeMinMax = otherLegendConfig->applyFullRangeMinMax; +} + //-------------------------------------------------------------------------------------------------- /// Rounding the double value to given number of significant digits //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h index 321629cdec..3a3e5e7163 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h @@ -73,7 +73,7 @@ public: void recreateLegend(); RivTernarySaturationOverlayItem* legend(); - RivTernaryScalarMapper* scalarMapper(); + RivTernaryScalarMapper* scalarMapper(); protected: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); @@ -84,7 +84,9 @@ private: void updateLegend(); void updateLabelText(); double roundToNumSignificantDigits(double value, double precision); - + + friend class RimViewLinker; + void setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig); private: caf::PdmField precision; diff --git a/ApplicationCode/ProjectDataModel/RimViewController.cpp b/ApplicationCode/ProjectDataModel/RimViewController.cpp index e016374774..da28fa0a79 100644 --- a/ApplicationCode/ProjectDataModel/RimViewController.cpp +++ b/ApplicationCode/ProjectDataModel/RimViewController.cpp @@ -66,9 +66,10 @@ RimViewController::RimViewController(void) CAF_PDM_InitFieldNoDefault(&m_managedView, "ManagedView", "Linked View", "", "", ""); m_managedView.uiCapability()->setUiTreeChildrenHidden(true); - CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", ""); - CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", ""); - CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Color Result", "", "", ""); + CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", ""); + CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", ""); + CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Result", "", "", ""); + CAF_PDM_InitField(&m_syncLegendDefinitions, "SyncLegendDefinitions", true, " Legend Definition", "", "", ""); CAF_PDM_InitField(&m_syncVisibleCells, "SyncVisibleCells", false, "Visible Cells", "", "", ""); /// We do not support this. Consider to remove sometime @@ -185,6 +186,10 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField managedGeoView()->cellResult()->updateIconState(); } } + else if (changedField == &m_syncLegendDefinitions) + { + updateLegendDefinitions(); + } else if (changedField == &m_syncRangeFilters) { if (!m_syncRangeFilters) @@ -365,6 +370,7 @@ void RimViewController::updateOptionSensitivity() { isMasterAndDependentViewDifferentType = true; } + if (geoMasterView && !managedGeoView()) { isMasterAndDependentViewDifferentType = true; @@ -374,10 +380,22 @@ void RimViewController::updateOptionSensitivity() { this->m_syncCellResult.uiCapability()->setUiReadOnly(true); this->m_syncCellResult = false; + + this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(true); + this->m_syncLegendDefinitions = false; } else { this->m_syncCellResult.uiCapability()->setUiReadOnly(false); + + if (this->m_syncCellResult) + { + this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(false); + } + else + { + this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(true); + } } if (isPropertyFilterControlPossible()) @@ -390,7 +408,6 @@ void RimViewController::updateOptionSensitivity() this->m_syncPropertyFilters = false; } - if (isRangeFilterControlPossible()) { this->m_syncRangeFilters.uiCapability()->setUiReadOnly(false); @@ -440,6 +457,7 @@ void RimViewController::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin scriptGroup->add(&m_syncCamera); scriptGroup->add(&m_syncTimeStep); scriptGroup->add(&m_syncCellResult); + scriptGroup->add(&m_syncLegendDefinitions); caf::PdmUiGroup* visibleCells = uiOrdering.addNewGroup("Link Cell Filters"); visibleCells->add(&m_syncVisibleCells); @@ -498,6 +516,17 @@ void RimViewController::updateResultColorsControl() viewLinker->updateCellResult(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimViewController::updateLegendDefinitions() +{ + if (!this->isLegendDefinitionsControlled()) return; + + RimViewLinker* viewLinker = ownerViewLinker(); + viewLinker->updateCellResult(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -714,6 +743,21 @@ bool RimViewController::isResultColorControlled() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimViewController::isLegendDefinitionsControlled() +{ + if (ownerViewLinker()->isActive() && this->m_isActive()) + { + return m_syncLegendDefinitions; + } + else + { + return false; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimViewController.h b/ApplicationCode/ProjectDataModel/RimViewController.h index 1f30e228f0..b3eb903dae 100644 --- a/ApplicationCode/ProjectDataModel/RimViewController.h +++ b/ApplicationCode/ProjectDataModel/RimViewController.h @@ -61,6 +61,7 @@ public: bool isTimeStepLinked(); bool isResultColorControlled(); + bool isLegendDefinitionsControlled(); bool isRangeFiltersControlled(); bool isVisibleCellsOveridden(); @@ -90,6 +91,7 @@ private: void updateCameraLink(); void updateTimeStepLink(); void updateResultColorsControl(); + void updateLegendDefinitions(); bool isMasterAndDepViewDifferentType(); bool isRangeFilterControlPossible(); @@ -111,6 +113,7 @@ private: // Overridden properties caf::PdmField m_syncCellResult; + caf::PdmField m_syncLegendDefinitions; caf::PdmField m_syncRangeFilters; caf::PdmField m_syncVisibleCells; diff --git a/ApplicationCode/ProjectDataModel/RimViewLinker.cpp b/ApplicationCode/ProjectDataModel/RimViewLinker.cpp index 8d1e71c6a8..c6e41d2df4 100644 --- a/ApplicationCode/ProjectDataModel/RimViewLinker.cpp +++ b/ApplicationCode/ProjectDataModel/RimViewLinker.cpp @@ -24,7 +24,6 @@ #include "RigCaseData.h" #include "RimCase.h" - #include "RimEclipseCellColors.h" #include "RimEclipseInputCase.h" #include "RimEclipseResultCase.h" @@ -34,9 +33,11 @@ #include "RimGeoMechCellColors.h" #include "RimGeoMechResultDefinition.h" #include "RimGeoMechView.h" -#include "RimViewController.h" +#include "RimLegendConfig.h" #include "RimProject.h" +#include "RimTernaryLegendConfig.h" #include "RimView.h" +#include "RimViewController.h" #include "RimViewLinkerCollection.h" #include "RiuViewer.h" @@ -147,6 +148,16 @@ void RimViewLinker::updateCellResult() eclipeView->cellResult()->setPorosityModel(eclipseCellResultDefinition->porosityModel()); eclipeView->cellResult()->setResultType(eclipseCellResultDefinition->resultType()); eclipeView->cellResult()->setResultVariable(eclipseCellResultDefinition->resultVariable()); + + if (viewLink->isLegendDefinitionsControlled()) + { + eclipeView->cellResult()->legendConfig()->setUiValuesFromLegendConfig(masterEclipseView->cellResult()->legendConfig()); + eclipeView->cellResult()->legendConfig()->updateLegend(); + + eclipeView->cellResult()->ternaryLegendConfig()->setUiValuesFromLegendConfig(masterEclipseView->cellResult()->ternaryLegendConfig()); + eclipeView->cellResult()->ternaryLegendConfig()->updateLegend(); + } + eclipeView->scheduleCreateDisplayModelAndRedraw(); } @@ -174,6 +185,13 @@ void RimViewLinker::updateCellResult() if (viewLink->isResultColorControlled()) { geoView->cellResult()->setResultAddress(geoMechResultDefinition->resultAddress()); + + if (viewLink->isLegendDefinitionsControlled()) + { + geoView->cellResult()->legendConfig()->setUiValuesFromLegendConfig(masterGeoView->cellResult()->legendConfig()); + geoView->cellResult()->legendConfig()->updateLegend(); + } + geoView->scheduleCreateDisplayModelAndRedraw(); } diff --git a/ApplicationCode/ProjectDataModel/RimViewLinker.h b/ApplicationCode/ProjectDataModel/RimViewLinker.h index 5ea734651d..b453b2a74d 100644 --- a/ApplicationCode/ProjectDataModel/RimViewLinker.h +++ b/ApplicationCode/ProjectDataModel/RimViewLinker.h @@ -66,6 +66,7 @@ public: void updateScaleZ(RimView* sourceView, double scaleZ); void updateCellResult(); + void updateRangeFilters(RimCellRangeFilter* changedRangeFilter); void applyRangeFilterCollectionByUserChoice(); From 0f630c1f222617620f0b3ec631270a77c495cb1f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 9 Dec 2016 21:04:16 +0100 Subject: [PATCH 02/24] System : Added const to functions related to write of field data --- .../cafPdmXml/cafInternalPdmXmlFieldCapability.h | 10 +++++----- .../cafPdmXml/cafInternalPdmXmlFieldCapability.inl | 10 +++++----- .../cafPdmXml/cafPdmXmlFieldHandle.h | 13 +++++++------ .../cafPdmXml/cafPdmXmlObjectHandle.cpp | 6 +++--- .../cafPdmXml/cafPdmXmlObjectHandle.h | 6 +++--- .../cafPdmXml/cafPdmXmlObjectHandleMacros.h | 2 +- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.h index 420b115320..b904463a0a 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.h @@ -15,7 +15,7 @@ public: // Xml Serializing public: virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory); - virtual void writeFieldData(QXmlStreamWriter& xmlStream); + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const; private: FieldType* m_field; }; @@ -39,7 +39,7 @@ public: // Xml Serializing public: virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory); - virtual void writeFieldData(QXmlStreamWriter& xmlStream); + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const; virtual void resolveReferences(); private: @@ -68,7 +68,7 @@ public: // Xml Serializing public: virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory); - virtual void writeFieldData(QXmlStreamWriter& xmlStream); + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const; virtual void resolveReferences(); private: @@ -92,7 +92,7 @@ public: // Xml Serializing public: virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory); - virtual void writeFieldData(QXmlStreamWriter& xmlStream); + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const; private: FieldType* m_field; }; @@ -110,7 +110,7 @@ public: // Xml Serializing public: virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory); - virtual void writeFieldData(QXmlStreamWriter& xmlStream); + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const; private: FieldType* m_field; }; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl index 2bebe739a2..09ebeb0665 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl @@ -30,7 +30,7 @@ template /// //-------------------------------------------------------------------------------------------------- template - void caf::PdmFieldXmlCap::writeFieldData(QXmlStreamWriter& xmlStream) +void caf::PdmFieldXmlCap::writeFieldData(QXmlStreamWriter& xmlStream) const { this->assertValid(); PdmFieldWriter::writeFieldData(m_field->value(), xmlStream); @@ -79,7 +79,7 @@ template //-------------------------------------------------------------------------------------------------- template - void caf::PdmFieldXmlCap< caf::PdmPtrField >::writeFieldData(QXmlStreamWriter& xmlStream) + void caf::PdmFieldXmlCap< caf::PdmPtrField >::writeFieldData(QXmlStreamWriter& xmlStream) const { this->assertValid(); @@ -142,7 +142,7 @@ template //-------------------------------------------------------------------------------------------------- template - void caf::PdmFieldXmlCap< caf::PdmPtrArrayField >::writeFieldData(QXmlStreamWriter& xmlStream) + void caf::PdmFieldXmlCap< caf::PdmPtrArrayField >::writeFieldData(QXmlStreamWriter& xmlStream) const { this->assertValid(); @@ -264,7 +264,7 @@ void caf::PdmFieldXmlCap< caf::PdmChildField >::readFieldData(QXmlStr //-------------------------------------------------------------------------------------------------- template -void caf::PdmFieldXmlCap< caf::PdmChildField >::writeFieldData(QXmlStreamWriter& xmlStream) +void caf::PdmFieldXmlCap< caf::PdmChildField >::writeFieldData(QXmlStreamWriter& xmlStream) const { if (m_field->m_fieldValue.rawPtr() == NULL) return; @@ -287,7 +287,7 @@ void caf::PdmFieldXmlCap< caf::PdmChildField >::writeFieldData(QXmlSt /// //-------------------------------------------------------------------------------------------------- template -void caf::PdmFieldXmlCap< caf::PdmChildArrayField >::writeFieldData(QXmlStreamWriter& xmlStream) +void caf::PdmFieldXmlCap< caf::PdmChildArrayField >::writeFieldData(QXmlStreamWriter& xmlStream) const { typename std::vector< PdmPointer >::iterator it; for (it = m_field->m_pointers.begin(); it != m_field->m_pointers.end(); ++it) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlFieldHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlFieldHandle.h index bf426be4a1..8db7870ca7 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlFieldHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlFieldHandle.h @@ -25,17 +25,18 @@ public: PdmXmlFieldHandle(PdmFieldHandle* owner , bool giveOwnership); virtual ~PdmXmlFieldHandle() { } - PdmFieldHandle* fieldHandle() { return m_owner; } + PdmFieldHandle* fieldHandle() { return m_owner; } + const PdmFieldHandle* fieldHandle() const { return m_owner; } - bool isIOReadable() { return m_isIOReadable; } - bool isIOWritable() { return m_isIOWritable; } - void setIOWritable(bool isWritable) { m_isIOWritable = isWritable; } - void setIOReadable(bool isReadable) { m_isIOReadable = isReadable; } + bool isIOReadable() const { return m_isIOReadable; } + bool isIOWritable() const { return m_isIOWritable; } + void setIOWritable(bool isWritable) { m_isIOWritable = isWritable; } + void setIOReadable(bool isReadable) { m_isIOReadable = isReadable; } QString childClassKeyword(); virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory) = 0; - virtual void writeFieldData(QXmlStreamWriter& xmlStream) = 0; + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const = 0; virtual void resolveReferences() { }; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp index 9bcaa193a5..99431fc596 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp @@ -108,13 +108,13 @@ void PdmXmlObjectHandle::readFields(QXmlStreamReader& xmlStream, PdmObjectFactor //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmXmlObjectHandle::writeFields(QXmlStreamWriter& xmlStream) +void PdmXmlObjectHandle::writeFields(QXmlStreamWriter& xmlStream) const { std::vector fields; m_owner->fields(fields); for (size_t it = 0; it < fields.size(); ++it) { - PdmXmlFieldHandle* field = fields[it]->xmlCapability(); + const PdmXmlFieldHandle* field = fields[it]->xmlCapability(); if (field && field->isIOWritable()) { QString keyword = field->fieldHandle()->keyword(); @@ -188,7 +188,7 @@ PdmObjectHandle* PdmXmlObjectHandle::copyByXmlSerialization(PdmObjectFactory* ob //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString PdmXmlObjectHandle::writeObjectToXmlString() +QString PdmXmlObjectHandle::writeObjectToXmlString() const { QString xmlString; QXmlStreamWriter outputStream(&xmlString); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h index 0759889f52..5616308e67 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h @@ -30,18 +30,18 @@ public: virtual ~PdmXmlObjectHandle() { } /// The classKeyword method is overridden in subclasses by the CAF_PDM_XML_HEADER_INIT macro - virtual QString classKeyword() = 0; + virtual QString classKeyword() const = 0; /// Convenience methods to serialize/de-serialize this particular object (with children) void readObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory); - QString writeObjectToXmlString(); + QString writeObjectToXmlString() const; static PdmObjectHandle* readUnknownObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory); PdmObjectHandle* copyByXmlSerialization(PdmObjectFactory* objectFactory); // Main XML serialization methods that is used internally by the document serialization system // Not supposed to be used directly. void readFields(QXmlStreamReader& inputStream, PdmObjectFactory* objectFactory); - void writeFields(QXmlStreamWriter& outputStream); + void writeFields(QXmlStreamWriter& outputStream) const; /// Check if a string is a valid Xml element name static bool isValidXmlElementName(const QString& name); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandleMacros.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandleMacros.h index a00116f2df..ecdcd13808 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandleMacros.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandleMacros.h @@ -22,7 +22,7 @@ // To be renamed CAF_PDM_XML_HEADER_INIT #define CAF_PDM_XML_HEADER_INIT \ public: \ - virtual QString classKeyword() { return classKeywordStatic(); } \ + virtual QString classKeyword() const { return classKeywordStatic(); } \ static QString classKeywordStatic(); \ \ static bool Error_You_forgot_to_add_the_macro_CAF_PDM_XML_HEADER_INIT_and_or_CAF_PDM_XML_SOURCE_INIT_to_your_cpp_file_for_this_class() From f04c56df01bdfecb0e13c0976be92bf9bba0a6d2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 9 Dec 2016 21:15:24 +0100 Subject: [PATCH 03/24] #559 Linked views : Removed obsolete storage of RimView --- ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp | 1 - ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp | 8 -------- ApplicationCode/ProjectDataModel/RimEclipseView.cpp | 1 - ApplicationCode/ProjectDataModel/RimGeoMechView.cpp | 3 --- ApplicationCode/ProjectDataModel/RimLegendConfig.cpp | 4 ++-- ApplicationCode/ProjectDataModel/RimLegendConfig.h | 4 ---- .../ProjectDataModel/RimTernaryLegendConfig.cpp | 4 ++-- ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h | 3 --- 8 files changed, 4 insertions(+), 24 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp index 0dbae8b5d4..28b0310171 100644 --- a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp @@ -90,7 +90,6 @@ RimCellEdgeColors::~RimCellEdgeColors() void RimCellEdgeColors::setReservoirView(RimEclipseView* ownerReservoirView) { m_reservoirView = ownerReservoirView; - this->m_legendConfig()->setReservoirView(ownerReservoirView); m_singleVarEdgeResultColors->setReservoirView(ownerReservoirView); } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp index 72dc13cdec..827bd2be61 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -135,7 +135,6 @@ void RimEclipseCellColors::changeLegendConfig(QString resultVarNameOfNewLegend) if (!found) { RimLegendConfig* newLegend = new RimLegendConfig; - newLegend->setReservoirView(m_reservoirView); newLegend->resultVariableName = resultVarNameOfNewLegend; m_legendConfigData.push_back(newLegend); @@ -225,13 +224,6 @@ void RimEclipseCellColors::setReservoirView(RimEclipseView* ownerReservoirView) this->setEclipseCase(ownerReservoirView->eclipseCase()); m_reservoirView = ownerReservoirView; - - for (size_t i = 0; i < m_legendConfigData.size(); i++) - { - m_legendConfigData[i]->setReservoirView(ownerReservoirView); - } - - this->ternaryLegendConfig()->setReservoirView(ownerReservoirView); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index d7d6542251..6425f5403d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -124,7 +124,6 @@ RimEclipseView::RimEclipseView() this->cellResult()->setReservoirView(this); this->cellEdgeResult()->setReservoirView(this); - this->cellEdgeResult()->legendConfig()->setReservoirView(this); this->cellEdgeResult()->legendConfig()->setColorRangeMode(RimLegendConfig::PINK_WHITE); this->faultResultSettings()->setReservoirView(this); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index 9842376684..00df52619e 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -84,9 +84,6 @@ RimGeoMechView::RimGeoMechView(void) m_propertyFilterCollection = new RimGeoMechPropertyFilterCollection(); m_propertyFilterCollection.uiCapability()->setUiHidden(true); - //this->cellResult()->setReservoirView(this); - this->cellResult()->legendConfig()->setReservoirView(this); - m_scaleTransform = new cvf::Transform(); m_vizLogic = new RivGeoMechVizLogic(this); } diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp index 6db35dbec7..320a58b700 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp @@ -193,9 +193,9 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, { viewLinker->updateCellResult(); } - } - if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw(); + view->updateCurrentTimeStepAndRedraw(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.h b/ApplicationCode/ProjectDataModel/RimLegendConfig.h index c151dfe2c1..9553b654ce 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.h @@ -57,8 +57,6 @@ public: RimLegendConfig(); virtual ~RimLegendConfig(); - void setReservoirView(RimView* ownerReservoirView) {m_reservoirView = ownerReservoirView; } - caf::PdmField resultVariableName; // Used internally to describe the variable this legend setup is used for enum RangeModeType @@ -130,8 +128,6 @@ private: void setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig); private: - caf::PdmPointer m_reservoirView; - cvf::ref m_linDiscreteScalarMapper; cvf::ref m_logDiscreteScalarMapper; cvf::ref m_logSmoothScalarMapper; diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 207163eec3..68e2e3ad93 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -164,9 +164,9 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed { viewLinker->updateCellResult(); } + + view->updateCurrentTimeStepAndRedraw(); } - - if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h index 3a3e5e7163..544a980f36 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h @@ -65,8 +65,6 @@ public: RimTernaryLegendConfig(); virtual ~RimTernaryLegendConfig(); - void setReservoirView(RimEclipseView* ownerReservoirView) {m_reservoirView = ownerReservoirView; } - void setAutomaticRanges(TernaryArrayIndex ternaryIndex, double globalMin, double globalMax, double localMin, double localMax); void ternaryRanges(double& soilLower, double& soilUpper, double& sgasLower, double& sgasUpper, double& swatLower, double& swatUpper) const; @@ -109,7 +107,6 @@ private: std::vector m_localAutoMax; std::vector m_localAutoMin; - caf::PdmPointer m_reservoirView; cvf::ref m_legend; cvf::ref m_scalarMapper; }; From 7562e7bb3053dbb3c824fc69b75c4ff3c16d74be Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 9 Dec 2016 21:16:43 +0100 Subject: [PATCH 04/24] #559 : Linked views : Use writeObjectToXmlString to copy field values --- .../ProjectDataModel/RimLegendConfig.cpp | 13 ++----------- .../ProjectDataModel/RimTernaryLegendConfig.cpp | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp index 320a58b700..2c3bd89757 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp @@ -776,17 +776,8 @@ cvf::OverlayItem* RimLegendConfig::legend() //-------------------------------------------------------------------------------------------------- void RimLegendConfig::setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig) { - this->m_numLevels = otherLegendConfig->m_numLevels; - this->m_precision = otherLegendConfig->m_precision; - this->m_tickNumberFormat = otherLegendConfig->m_tickNumberFormat; - this->m_rangeMode = otherLegendConfig->m_rangeMode; - this->m_userDefinedMaxValue = otherLegendConfig->m_userDefinedMaxValue; - this->m_userDefinedMinValue = otherLegendConfig->m_userDefinedMinValue; - this->m_colorRangeMode = otherLegendConfig->m_colorRangeMode; - this->m_mappingMode = otherLegendConfig->m_mappingMode; - - this->m_userDefinedMinValue = otherLegendConfig->m_userDefinedMinValue; - this->m_userDefinedMaxValue = otherLegendConfig->m_userDefinedMaxValue; + QString serializedObjectString = otherLegendConfig->writeObjectToXmlString(); + this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance()); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 68e2e3ad93..5f62c66811 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -250,17 +250,8 @@ void RimTernaryLegendConfig::recreateLegend() //-------------------------------------------------------------------------------------------------- void RimTernaryLegendConfig::setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig) { - this->precision = otherLegendConfig->precision; - this->rangeMode = otherLegendConfig->rangeMode; - this->userDefinedMaxValueSoil = otherLegendConfig->userDefinedMaxValueSoil; - this->userDefinedMinValueSoil = otherLegendConfig->userDefinedMinValueSoil; - this->userDefinedMaxValueSgas = otherLegendConfig->userDefinedMaxValueSgas; - this->userDefinedMinValueSgas = otherLegendConfig->userDefinedMinValueSgas; - this->userDefinedMaxValueSwat = otherLegendConfig->userDefinedMaxValueSwat; - this->userDefinedMinValueSwat = otherLegendConfig->userDefinedMinValueSwat; - this->applyLocalMinMax = otherLegendConfig->applyLocalMinMax; - this->applyGlobalMinMax = otherLegendConfig->applyGlobalMinMax; - this->applyFullRangeMinMax = otherLegendConfig->applyFullRangeMinMax; + QString serializedObjectString = otherLegendConfig->writeObjectToXmlString(); + this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance()); } //-------------------------------------------------------------------------------------------------- From 74defdc21925e516dd6ce3a7693fb2f74343a969 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 12 Dec 2016 07:29:44 +0100 Subject: [PATCH 05/24] System : Removed unnecessary use of xmlObj macro --- .../WellPathCommands/RicWellPathsImportSsihubFeature.cpp | 4 ++-- ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportSsihubFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportSsihubFeature.cpp index 68163fa9a7..b30c57449b 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportSsihubFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportSsihubFeature.cpp @@ -80,7 +80,7 @@ void RicWellPathsImportSsihubFeature::onActionTriggered(bool isChecked) // Keep a copy of the import settings, and restore if cancel is pressed in the import wizard - QString copyOfOriginalObject = xmlObj(app->project()->wellPathImport())->writeObjectToXmlString(); + QString copyOfOriginalObject = app->project()->wellPathImport()->writeObjectToXmlString(); RiuWellImportWizard wellImportwizard(app->preferences()->ssihubAddress, wellPathsFolderPath, app->project()->wellPathImport(), RiuMainWindow::instance()); @@ -111,7 +111,7 @@ void RicWellPathsImportSsihubFeature::onActionTriggered(bool isChecked) } else { - xmlObj(app->project()->wellPathImport())->readObjectFromXmlString(copyOfOriginalObject, caf::PdmDefaultObjectFactory::instance()); + app->project()->wellPathImport()->readObjectFromXmlString(copyOfOriginalObject, caf::PdmDefaultObjectFactory::instance()); } } diff --git a/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.cpp b/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.cpp index 0471ffa8b2..c5eb701e43 100644 --- a/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.cpp +++ b/ApplicationCode/WellPathImportSsihub/RiuWellImportWizard.cpp @@ -884,10 +884,10 @@ void WellSelectionPage::buildWellTreeView() RimWellPathEntry* wellPathEntry = oilField->wells[wIdx]; // Create a copy of the PdmObject, as it is not supported to have multiple parents of any objects - QString objStr = xmlObj(wellPathEntry)->writeObjectToXmlString(); + QString objStr = wellPathEntry->writeObjectToXmlString(); RimWellPathEntry* wellPathCopy = new RimWellPathEntry; - xmlObj(wellPathCopy)->readObjectFromXmlString(objStr, caf::PdmDefaultObjectFactory::instance()); + wellPathCopy->readObjectFromXmlString(objStr, caf::PdmDefaultObjectFactory::instance()); fieldGroup->objects.push_back(wellPathCopy); } From 829c775f6374d8f4f6d8520a7b96d84d85d64e6e Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Fri, 9 Dec 2016 10:15:09 +0100 Subject: [PATCH 06/24] #1025 Added Show well spheres check-box option for each well --- .../RivWellSpheresPartMgr.cpp | 91 ++++++++++--------- .../ProjectDataModel/RimEclipseWell.cpp | 6 ++ .../ProjectDataModel/RimEclipseWell.h | 1 + .../RimEclipseWellCollection.cpp | 2 +- .../RimEclipseWellCollection.h | 1 + 5 files changed, 56 insertions(+), 45 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp index 5d6d314e5b..7c162f457a 100644 --- a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp @@ -71,6 +71,7 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLis if (m_rimReservoirView.isNull()) return; if (!m_rimReservoirView->eclipseCase()) return; if (!m_rimReservoirView->eclipseCase()->reservoirData()) return; + if (!m_rimWell->showWellSpheres()) return; const RigMainGrid* mainGrid = m_rimReservoirView->eclipseCase()->reservoirData()->mainGrid(); CVF_ASSERT(mainGrid); @@ -114,51 +115,53 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLis model->addPart(part.p()); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::ref RivWellSpheresPartMgr::createSphere(double radius, const cvf::Vec3d& pos) -{ - cvf::Vec3f posFloat(pos); - - cvf::ref geo = new cvf::DrawableGeo; - - cvf::GeometryBuilderFaceList builder; - cvf::GeometryUtils::createSphere(radius, 10, 10, &builder); - - cvf::ref vertices = builder.vertices(); - - // Move sphere coordinates to the destination location - for (size_t i = 0; i < vertices->size(); i++) - { - vertices->set(i, vertices->val(i) + posFloat); - } - - cvf::ref faceList = builder.faceList(); - - geo->setVertexArray(vertices.p()); - geo->setFromFaceList(*faceList); - geo->computeNormals(); - - return geo; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::ref RivWellSpheresPartMgr::createPart(cvf::DrawableGeo* geo, const cvf::Color3f& color) -{ - cvf::ref part = new cvf::Part; - part->setDrawable(geo); - - caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(color), caf::PO_1); - cvf::ref eff = surfaceGen.generateCachedEffect(); - - part->setEffect(eff.p()); - - return part; -} +//TODO: Transparency må være linka til show cell center spheres og All On/Of for well pipes +// -------------------------------------------------------------------------------------------------- +// / +// -------------------------------------------------------------------------------------------------- +// cvf::ref RivWellSpheresPartMgr::createSphere(double radius, const cvf::Vec3d& pos) +// { +// cvf::Vec3f posFloat(pos); +// +// cvf::ref geo = new cvf::DrawableGeo; +// +// cvf::GeometryBuilderFaceList builder; +// cvf::GeometryUtils::createSphere(radius, 10, 10, &builder); +// +// cvf::ref vertices = builder.vertices(); +// +// // Move sphere coordinates to the destination location +// for (size_t i = 0; i < vertices->size(); i++) +// { +// vertices->set(i, vertices->val(i) + posFloat); +// } +// +// cvf::ref faceList = builder.faceList(); +// +// geo->setVertexArray(vertices.p()); +// geo->setFromFaceList(*faceList); +// geo->computeNormals(); +// +// return geo; +// } +// +// -------------------------------------------------------------------------------------------------- +// / +// -------------------------------------------------------------------------------------------------- +// cvf::ref RivWellSpheresPartMgr::createPart(cvf::DrawableGeo* geo, const cvf::Color3f& color) +// { +// cvf::ref part = new cvf::Part; +// part->setDrawable(geo); +// +// caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(color), caf::PO_1); +// cvf::ref eff = surfaceGen.generateCachedEffect(); +// +// part->setEffect(eff.p()); +// +// return part; +// } +// //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp index 2472ccef0f..1c9f7d2a8d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp @@ -42,6 +42,7 @@ RimEclipseWell::RimEclipseWell() CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well label", "", "", ""); CAF_PDM_InitField(&showWellPipes, "ShowWellPipe", true, "Show well pipe", "", "", ""); + CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", true, "Show well spheres", "", "", ""); CAF_PDM_InitField(&pipeRadiusScaleFactor, "WellPipeRadiusScale",1.0, "Pipe radius scale", "", "", ""); CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Well pipe color", "", "", ""); @@ -121,6 +122,10 @@ void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c { if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw(); } + else if (&showWellSpheres == changedField) + { + if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw(); + } else if (&wellPipeColor == changedField) { if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw(); @@ -244,6 +249,7 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& { caf::PdmUiGroup* pipeGroup = uiOrdering.addNewGroup("Appearance"); pipeGroup->add(&showWellPipes); + pipeGroup->add(&showWellSpheres); pipeGroup->add(&showWellLabel); pipeGroup->add(&wellPipeColor); pipeGroup->add(&pipeRadiusScaleFactor); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.h b/ApplicationCode/ProjectDataModel/RimEclipseWell.h index a3912ad7ba..244693a470 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.h @@ -71,6 +71,7 @@ public: caf::PdmField showWellCellFence; caf::PdmField showWellPipes; + caf::PdmField showWellSpheres; caf::PdmField wellPipeColor; caf::PdmField pipeRadiusScaleFactor; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp index 890d6e1da8..676de6ed08 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp @@ -109,6 +109,7 @@ RimEclipseWellCollection::RimEclipseWellCollection() CAF_PDM_InitField(&isAutoDetectingBranches, "IsAutoDetectingBranches", true, "Geometry based branch detection", "", "Toggle wether the well pipe visualization will try to detect when a part of the well \nis really a branch, and thus is starting from wellhead", ""); CAF_PDM_InitField(&showCellCenterSpheres, "showCellCenterSpheres", false, "Show sphere in cell center", "", "", ""); +// CAF_PDM_InitField(&wellSphereVisibility, "wellSphereVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well sphere visibility", "", "", ""); CAF_PDM_InitField(&cellCenterSpheresScaleFactor, "CellCenterSphereScale", 0.2, "Cell Center sphere radius", "", "", ""); CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", ""); @@ -296,7 +297,6 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi wellPipe->add(&wellPipeVisibility); wellPipe->add(&pipeRadiusScaleFactor); - //TODO: Add Well sphere group caf::PdmUiGroup* cellCenterSpheres = uiOrdering.addNewGroup("Well cell center spheres"); cellCenterSpheres->add(&showCellCenterSpheres); cellCenterSpheres->add(&cellCenterSpheresScaleFactor); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h index 093f0c4fa7..9c2afd0c8d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h @@ -103,6 +103,7 @@ public: caf::PdmField isAutoDetectingBranches; caf::PdmField showCellCenterSpheres; + //caf::PdmField wellSphereVisibility; caf::PdmField cellCenterSpheresScaleFactor; From 21a8acdb76655e2d377514c2e6769208583c83b5 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Mon, 12 Dec 2016 10:08:11 +0100 Subject: [PATCH 07/24] #1025 Replaced check-box with enum for showing cell center spheres --- .../RivReservoirWellSpheresPartMgr.cpp | 35 +++++++-- .../RivWellSpheresPartMgr.cpp | 7 +- .../RivWellSpheresPartMgr.h | 4 +- .../ProjectDataModel/RimEclipseWell.cpp | 78 +++++++++++-------- .../ProjectDataModel/RimEclipseWell.h | 4 + .../RimEclipseWellCollection.cpp | 10 +-- .../RimEclipseWellCollection.h | 5 +- 7 files changed, 91 insertions(+), 52 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp index 42132eab56..d6696066f5 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp @@ -48,9 +48,9 @@ RivReservoirWellSpheresPartMgr::~RivReservoirWellSpheresPartMgr() } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------- +// / +// -------------------------------------------------------------------------------------------------- void RivReservoirWellSpheresPartMgr::setScaleTransform(cvf::Transform * scaleTransform) { m_scaleTransform = scaleTransform; @@ -62,8 +62,8 @@ void RivReservoirWellSpheresPartMgr::setScaleTransform(cvf::Transform * scaleTra //-------------------------------------------------------------------------------------------------- void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex) { - if (!m_reservoirView->wellCollection()->showCellCenterSpheres) return; - + if (m_reservoirView->wellCollection()->wellSphereVisibility == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) return; + if (!m_reservoirView->wellCollection()->isActive()) return; if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size()) @@ -78,8 +78,33 @@ void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::Mode for (size_t i = 0; i < m_wellSpheresPartMgrs.size(); i++) { + + bool showGeo = false; + + if (m_reservoirView->wellCollection()->wells[i]->showWell()) { + + if (m_reservoirView->wellCollection->wellSphereVisibility == RimEclipseWellCollection::PIPES_FORCE_ALL_ON) + { + showGeo = true; + } + + else if (m_reservoirView->wellCollection->wellSphereVisibility == RimEclipseWellCollection::PIPES_INDIVIDUALLY && m_reservoirView->wellCollection()->wells[i]->showWellSpheres() ) + { + showGeo = true; + } + + else if (m_reservoirView->wellCollection->wellSphereVisibility == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS && m_reservoirView->wellCollection->wells[i]->visibleCellsInstersectsWell(frameIndex)) + { + showGeo = true; + } + + } + + + if (showGeo) + { m_wellSpheresPartMgrs.at(i)->appendDynamicGeometryPartsToModel(model, frameIndex); } } diff --git a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp index 7c162f457a..bd63a38b78 100644 --- a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp @@ -63,6 +63,7 @@ RivWellSpheresPartMgr::~RivWellSpheresPartMgr() } + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -71,7 +72,10 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLis if (m_rimReservoirView.isNull()) return; if (!m_rimReservoirView->eclipseCase()) return; if (!m_rimReservoirView->eclipseCase()->reservoirData()) return; - if (!m_rimWell->showWellSpheres()) return; + + + // if (!m_rimWell->showWellSpheres() ) return; //TODO: Check that all on is not on... + const RigMainGrid* mainGrid = m_rimReservoirView->eclipseCase()->reservoirData()->mainGrid(); CVF_ASSERT(mainGrid); @@ -115,7 +119,6 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLis model->addPart(part.p()); } -//TODO: Transparency må være linka til show cell center spheres og All On/Of for well pipes // -------------------------------------------------------------------------------------------------- // / diff --git a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h index 422be015aa..430e651100 100644 --- a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h @@ -59,8 +59,8 @@ public: void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); private: - static cvf::ref createSphere(double radius, const cvf::Vec3d& pos); - cvf::ref createPart(cvf::DrawableGeo* geo, const cvf::Color3f& color); +// static cvf::ref createSphere(double radius, const cvf::Vec3d& pos); +// cvf::ref createPart(cvf::DrawableGeo* geo, const cvf::Color3f& color); cvf::Color3f wellCellColor(const RigWellResultFrame& wellResultFrame, const RigWellResultPoint& wellResultPoint); cvf::ref createPart(std::vector >& centerColorPairs); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp index 1c9f7d2a8d..bd6f71b474 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp @@ -190,55 +190,65 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex) if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) { - const std::vector& visGridParts = m_reservoirView->visibleGridParts(); - cvf::cref rvMan = m_reservoirView->reservoirGridPartManager(); - for (size_t gpIdx = 0; gpIdx < visGridParts.size(); ++gpIdx) + return visibleCellsInstersectsWell(frameIndex); + } + + CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex) +{ + //TODO: lag egen funksjon her: + const std::vector& visGridParts = m_reservoirView->visibleGridParts(); + cvf::cref rvMan = m_reservoirView->reservoirGridPartManager(); + + for (size_t gpIdx = 0; gpIdx < visGridParts.size(); ++gpIdx) + { + const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex); + + // First check the wellhead: + + size_t gridIndex = wrsf.m_wellHead.m_gridIndex; + size_t gridCellIndex = wrsf.m_wellHead.m_gridCellIndex; + + if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T) { - const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex); - - // First check the wellhead: - - size_t gridIndex = wrsf.m_wellHead.m_gridIndex; - size_t gridCellIndex = wrsf.m_wellHead.m_gridCellIndex; - - if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T) + cvf::cref cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex); + if ((*cellVisibility)[gridCellIndex]) { - cvf::cref cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex); - if ((*cellVisibility)[gridCellIndex]) - { - return true; - } + return true; } + } - // Then check the rest of the well, with all the branches + // Then check the rest of the well, with all the branches - const std::vector& wellResSegments = wrsf.m_wellResultBranches; - for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx) + const std::vector& wellResSegments = wrsf.m_wellResultBranches; + for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx) + { + const std::vector& wsResCells = wellResSegments[wsIdx].m_branchResultPoints; + for (size_t cIdx = 0; cIdx < wsResCells.size(); ++cIdx) { - const std::vector& wsResCells = wellResSegments[wsIdx].m_branchResultPoints; - for (size_t cIdx = 0; cIdx < wsResCells.size(); ++ cIdx) + if (wsResCells[cIdx].isCell()) { - if (wsResCells[cIdx].isCell()) - { - gridIndex = wsResCells[cIdx].m_gridIndex; - gridCellIndex = wsResCells[cIdx].m_gridCellIndex; + gridIndex = wsResCells[cIdx].m_gridIndex; + gridCellIndex = wsResCells[cIdx].m_gridCellIndex; - cvf::cref cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex); - if ((*cellVisibility)[gridCellIndex]) - { - return true; - } + cvf::cref cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex); + if ((*cellVisibility)[gridCellIndex]) + { + return true; } } } } - - return false; } - CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? - return false; } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.h b/ApplicationCode/ProjectDataModel/RimEclipseWell.h index 244693a470..a138d76457 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.h @@ -56,6 +56,10 @@ public: bool calculateWellPipeVisibility(size_t frameIndex); + bool visibleCellsInstersectsWell(size_t frameIndex); + + //Trengs det en calculateWellGeometryVisibility?? + virtual caf::PdmFieldHandle* userDescriptionField(); virtual caf::PdmFieldHandle* objectToggleField(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp index 676de6ed08..f9f74879d7 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp @@ -108,8 +108,7 @@ RimEclipseWellCollection::RimEclipseWellCollection() CAF_PDM_InitField(&isAutoDetectingBranches, "IsAutoDetectingBranches", true, "Geometry based branch detection", "", "Toggle wether the well pipe visualization will try to detect when a part of the well \nis really a branch, and thus is starting from wellhead", ""); - CAF_PDM_InitField(&showCellCenterSpheres, "showCellCenterSpheres", false, "Show sphere in cell center", "", "", ""); -// CAF_PDM_InitField(&wellSphereVisibility, "wellSphereVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well sphere visibility", "", "", ""); + CAF_PDM_InitField(&wellSphereVisibility, "wellSphereVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well sphere visibility", "", "", ""); CAF_PDM_InitField(&cellCenterSpheresScaleFactor, "CellCenterSphereScale", 0.2, "Cell Center sphere radius", "", "", ""); CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", ""); @@ -179,7 +178,7 @@ bool RimEclipseWellCollection::hasVisibleWellCells() //-------------------------------------------------------------------------------------------------- /// Used to know if we need animation of timesteps due to the wells //-------------------------------------------------------------------------------------------------- -bool RimEclipseWellCollection::hasVisibleWellPipes() +bool RimEclipseWellCollection::hasVisibleWellPipes() { if (!this->isActive()) return false; if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF) return false; @@ -189,7 +188,6 @@ bool RimEclipseWellCollection::hasVisibleWellPipes() return true; } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -228,7 +226,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang m_reservoirView->scheduleCreateDisplayModelAndRedraw(); } } - else if ( &showCellCenterSpheres == changedField + else if ( &wellSphereVisibility == changedField || &cellCenterSpheresScaleFactor == changedField) { if (m_reservoirView) @@ -298,7 +296,7 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi wellPipe->add(&pipeRadiusScaleFactor); caf::PdmUiGroup* cellCenterSpheres = uiOrdering.addNewGroup("Well cell center spheres"); - cellCenterSpheres->add(&showCellCenterSpheres); + cellCenterSpheres->add(&wellSphereVisibility); cellCenterSpheres->add(&cellCenterSpheresScaleFactor); caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced"); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h index 9c2afd0c8d..eb767274dc 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h @@ -45,7 +45,7 @@ public: RimEclipseWellCollection(); virtual ~RimEclipseWellCollection(); - + void setReservoirView(RimEclipseView* ownerReservoirView); enum WellVisibilityType @@ -102,8 +102,7 @@ public: caf::PdmField isAutoDetectingBranches; - caf::PdmField showCellCenterSpheres; - //caf::PdmField wellSphereVisibility; + caf::PdmField wellSphereVisibility; caf::PdmField cellCenterSpheresScaleFactor; From 8e81c535204854896a64fc5544f0720a667836f1 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Mon, 12 Dec 2016 10:28:04 +0100 Subject: [PATCH 08/24] #1025 Code cean-up. Removed obsolete scaletransform for cell center spheres. --- .../RivReservoirWellSpheresPartMgr.cpp | 11 ---- .../RivReservoirWellSpheresPartMgr.h | 4 -- .../RivWellSpheresPartMgr.cpp | 52 +------------------ .../RivWellSpheresPartMgr.h | 6 --- .../ProjectDataModel/RimEclipseView.cpp | 2 - 5 files changed, 1 insertion(+), 74 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp index d6696066f5..750273451d 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp @@ -37,7 +37,6 @@ RivReservoirWellSpheresPartMgr::RivReservoirWellSpheresPartMgr(RimEclipseView* r { m_reservoirView = reservoirView; - m_scaleTransform = new cvf::Transform(); } //-------------------------------------------------------------------------------------------------- @@ -48,15 +47,6 @@ RivReservoirWellSpheresPartMgr::~RivReservoirWellSpheresPartMgr() } -// -------------------------------------------------------------------------------------------------- -// / -// -------------------------------------------------------------------------------------------------- -void RivReservoirWellSpheresPartMgr::setScaleTransform(cvf::Transform * scaleTransform) -{ - m_scaleTransform = scaleTransform; - -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -72,7 +62,6 @@ void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::Mode { RivWellSpheresPartMgr* wppmgr = new RivWellSpheresPartMgr(m_reservoirView, rimWell); m_wellSpheresPartMgrs.push_back(wppmgr); - wppmgr->setScaleTransform(m_scaleTransform.p()); } } diff --git a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.h b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.h index 68f84bb377..fd73a75783 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.h @@ -39,8 +39,6 @@ public: ~RivReservoirWellSpheresPartMgr(); - void setScaleTransform(cvf::Transform* scaleTransform); - void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); private: @@ -48,8 +46,6 @@ private: private: caf::PdmPointer m_reservoirView; - cvf::ref m_scaleTransform; - cvf::Collection< RivWellSpheresPartMgr > m_wellSpheresPartMgrs; }; diff --git a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp index bd63a38b78..786d31195c 100644 --- a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp @@ -71,11 +71,7 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLis { if (m_rimReservoirView.isNull()) return; if (!m_rimReservoirView->eclipseCase()) return; - if (!m_rimReservoirView->eclipseCase()->reservoirData()) return; - - - // if (!m_rimWell->showWellSpheres() ) return; //TODO: Check that all on is not on... - + if (!m_rimReservoirView->eclipseCase()->reservoirData()) return; const RigMainGrid* mainGrid = m_rimReservoirView->eclipseCase()->reservoirData()->mainGrid(); CVF_ASSERT(mainGrid); @@ -119,52 +115,6 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLis model->addPart(part.p()); } - -// -------------------------------------------------------------------------------------------------- -// / -// -------------------------------------------------------------------------------------------------- -// cvf::ref RivWellSpheresPartMgr::createSphere(double radius, const cvf::Vec3d& pos) -// { -// cvf::Vec3f posFloat(pos); -// -// cvf::ref geo = new cvf::DrawableGeo; -// -// cvf::GeometryBuilderFaceList builder; -// cvf::GeometryUtils::createSphere(radius, 10, 10, &builder); -// -// cvf::ref vertices = builder.vertices(); -// -// // Move sphere coordinates to the destination location -// for (size_t i = 0; i < vertices->size(); i++) -// { -// vertices->set(i, vertices->val(i) + posFloat); -// } -// -// cvf::ref faceList = builder.faceList(); -// -// geo->setVertexArray(vertices.p()); -// geo->setFromFaceList(*faceList); -// geo->computeNormals(); -// -// return geo; -// } -// -// -------------------------------------------------------------------------------------------------- -// / -// -------------------------------------------------------------------------------------------------- -// cvf::ref RivWellSpheresPartMgr::createPart(cvf::DrawableGeo* geo, const cvf::Color3f& color) -// { -// cvf::ref part = new cvf::Part; -// part->setDrawable(geo); -// -// caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(color), caf::PO_1); -// cvf::ref eff = surfaceGen.generateCachedEffect(); -// -// part->setEffect(eff.p()); -// -// return part; -// } -// //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h index 430e651100..609e14901f 100644 --- a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h @@ -52,16 +52,11 @@ public: RivWellSpheresPartMgr(RimEclipseView* reservoirView, RimEclipseWell* well); ~RivWellSpheresPartMgr(); - void setScaleTransform(cvf::Transform * scaleTransform) { m_scaleTransform = scaleTransform; scheduleGeometryRegen();} - void scheduleGeometryRegen() { m_needsTransformUpdate = true; } void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); private: -// static cvf::ref createSphere(double radius, const cvf::Vec3d& pos); -// cvf::ref createPart(cvf::DrawableGeo* geo, const cvf::Color3f& color); - cvf::Color3f wellCellColor(const RigWellResultFrame& wellResultFrame, const RigWellResultPoint& wellResultPoint); cvf::ref createPart(std::vector >& centerColorPairs); @@ -69,6 +64,5 @@ private: caf::PdmPointer m_rimReservoirView; caf::PdmPointer m_rimWell; - cvf::ref m_scaleTransform; bool m_needsTransformUpdate; }; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 6425f5403d..3cbc4177ac 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -269,8 +269,6 @@ void RimEclipseView::updateScaleTransform() this->scaleTransform()->setLocalTransform(scale); m_pipesPartManager->setScaleTransform(this->scaleTransform()); - m_wellSpheresPartManager->setScaleTransform(this->scaleTransform()); - if (m_viewer) m_viewer->updateCachedValuesInScene(); } From 277cdf79b6230f08da1e4a4ce27bc80a72b8f593 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Mon, 12 Dec 2016 11:35:44 +0100 Subject: [PATCH 09/24] #1025 Added check for valid input for visibleCellsIntersetcsWell-function. --- ApplicationCode/ProjectDataModel/RimEclipseWell.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp index bd6f71b474..2d63588097 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp @@ -190,7 +190,6 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex) if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) { - return visibleCellsInstersectsWell(frameIndex); } @@ -204,7 +203,10 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex) //-------------------------------------------------------------------------------------------------- bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex) { - //TODO: lag egen funksjon her: + if (this->wellResults() == nullptr) return false; + + if (!wellResults()->hasWellResult(frameIndex)) return false; + const std::vector& visGridParts = m_reservoirView->visibleGridParts(); cvf::cref rvMan = m_reservoirView->reservoirGridPartManager(); From 4e54c8c5efa62998c1a2de1329f436124bc1dc3a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 13 Dec 2016 08:45:39 +0100 Subject: [PATCH 10/24] #1025 Well spheres set to default off --- ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp index f9f74879d7..2cc505de8a 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp @@ -108,7 +108,7 @@ RimEclipseWellCollection::RimEclipseWellCollection() CAF_PDM_InitField(&isAutoDetectingBranches, "IsAutoDetectingBranches", true, "Geometry based branch detection", "", "Toggle wether the well pipe visualization will try to detect when a part of the well \nis really a branch, and thus is starting from wellhead", ""); - CAF_PDM_InitField(&wellSphereVisibility, "wellSphereVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well sphere visibility", "", "", ""); + CAF_PDM_InitField(&wellSphereVisibility, "wellSphereVisibility", WellVisibilityEnum(PIPES_FORCE_ALL_OFF), "Global well sphere visibility", "", "", ""); CAF_PDM_InitField(&cellCenterSpheresScaleFactor, "CellCenterSphereScale", 0.2, "Cell Center sphere radius", "", "", ""); CAF_PDM_InitFieldNoDefault(&wells, "Wells", "Wells", "", "", ""); From 5aeb737795c0ced52729c9f2ceeaed6da6907048 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 13 Dec 2016 09:35:01 +0100 Subject: [PATCH 11/24] #1025 Refactored visibility to handle both well cell pipes and well cell spheres --- .../RivCellEdgeGeometryUtils.cpp | 2 +- .../RivTernaryTextureCoordsCreator.cpp | 2 +- .../RivTextureCoordsCreator.cpp | 2 +- .../ProjectDataModel/RimEclipseWell.cpp | 55 +++++++++++++++++-- .../ProjectDataModel/RimEclipseWell.h | 1 + .../RimEclipseWellCollection.cpp | 11 ++-- .../RimEclipseWellCollection.h | 4 +- 7 files changed, 64 insertions(+), 13 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp b/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp index 55008114cd..9e063bfbe1 100644 --- a/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp +++ b/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp @@ -95,7 +95,7 @@ void RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo( if (opacityLevel < 1.0f) { - isWellPipeVisible = &(cellResultColors->reservoirView()->wellCollection()->resultWellPipeVisibilities(timeStepIndex)); + isWellPipeVisible = &(cellResultColors->reservoirView()->wellCollection()->resultWellGeometryVisibilities(timeStepIndex)); gridCellToWellindexMap = eclipseCase->gridCellToResultWellIndex(gridIndex); } diff --git a/ApplicationCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp b/ApplicationCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp index a1a1400bac..c6819e2ae1 100644 --- a/ApplicationCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp +++ b/ApplicationCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp @@ -63,7 +63,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator( m_resultAccessor->setTernaryResultAccessors(soil.p(), sgas.p(), swat.p()); cvf::ref pipeInCellEval = - new RigPipeInCellEvaluator(cellResultColors->reservoirView()->wellCollection()->resultWellPipeVisibilities(timeStepIndex), + new RigPipeInCellEvaluator(cellResultColors->reservoirView()->wellCollection()->resultWellGeometryVisibilities(timeStepIndex), eclipseCase->gridCellToResultWellIndex(gridIndex)); const RivTernaryScalarMapper* mapper = ternaryLegendConfig->scalarMapper(); diff --git a/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.cpp b/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.cpp index 1b95d89b3f..d0d8b77fe3 100644 --- a/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.cpp +++ b/ApplicationCode/ModelVisualization/RivTextureCoordsCreator.cpp @@ -46,7 +46,7 @@ RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResul m_resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, timeStepIndex, cellResultColors); cvf::ref pipeInCellEval = - new RigPipeInCellEvaluator(cellResultColors->reservoirView()->wellCollection()->resultWellPipeVisibilities(timeStepIndex), + new RigPipeInCellEvaluator(cellResultColors->reservoirView()->wellCollection()->resultWellGeometryVisibilities(timeStepIndex), eclipseCase->gridCellToResultWellIndex(gridIndex)); const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp index 2d63588097..da0654dbd7 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp @@ -198,6 +198,56 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex) return false; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimEclipseWell::calculateWellSphereVisibility(size_t frameIndex) +{ + if (m_reservoirView == NULL) return false; + if (this->wellResults() == NULL) return false; + + if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size()) + { + return false; + } + + size_t wellTimeStepIndex = this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex]; + if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T) + { + return false; + } + + if (!m_reservoirView->wellCollection()->isActive()) + return false; + + if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON) + return true; + + if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) + return false; + + if (this->showWell() == false) + return false; + + if (this->showWellSpheres() == false) + return false; + + if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY) + return true; + + if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this)) + return true; + + if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) + { + return visibleCellsInstersectsWell(frameIndex); + } + + CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? + + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -276,10 +326,7 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& //-------------------------------------------------------------------------------------------------- bool RimEclipseWell::isWellPipeVisible(size_t frameIndex) { - CVF_ASSERT(m_resultWellIndex != cvf::UNDEFINED_SIZE_T); - - // Return the possibly cached value - return m_reservoirView->wellCollection()->resultWellPipeVisibilities(frameIndex)[m_resultWellIndex]; + return calculateWellPipeVisibility(frameIndex); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.h b/ApplicationCode/ProjectDataModel/RimEclipseWell.h index a138d76457..cfe9ae2807 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.h @@ -55,6 +55,7 @@ public: bool isWellPipeVisible(size_t frameIndex); bool calculateWellPipeVisibility(size_t frameIndex); + bool calculateWellSphereVisibility(size_t frameIndex); bool visibleCellsInstersectsWell(size_t frameIndex); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp index 2cc505de8a..eb3e0738b2 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp @@ -316,9 +316,9 @@ caf::PdmFieldHandle* RimEclipseWellCollection::objectToggleField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const std::vector& RimEclipseWellCollection::resultWellPipeVisibilities(size_t frameIndex) +const std::vector& RimEclipseWellCollection::resultWellGeometryVisibilities(size_t frameIndex) { - calculateIsWellPipesVisible(frameIndex); + calculateWellGeometryVisibility(frameIndex); return m_framesOfResultWellPipeVisibilities[frameIndex]; } @@ -333,7 +333,7 @@ void RimEclipseWellCollection::scheduleIsWellPipesVisibleRecalculation() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEclipseWellCollection::calculateIsWellPipesVisible(size_t frameIndex) +void RimEclipseWellCollection::calculateWellGeometryVisibility(size_t frameIndex) { if (m_framesOfResultWellPipeVisibilities.size() > frameIndex && m_framesOfResultWellPipeVisibilities[frameIndex].size()) return; @@ -345,7 +345,10 @@ void RimEclipseWellCollection::calculateIsWellPipesVisible(size_t frameIndex) for (size_t i = 0; i < wells().size(); ++i) { - m_framesOfResultWellPipeVisibilities[frameIndex][wells[i]->resultWellIndex()] = wells[i]->calculateWellPipeVisibility(frameIndex); + bool wellPipeVisible = wells[i]->calculateWellPipeVisibility(frameIndex); + bool wellSphereVisible = wells[i]->calculateWellSphereVisibility(frameIndex); + + m_framesOfResultWellPipeVisibilities[frameIndex][wells[i]->resultWellIndex()] = wellPipeVisible || wellSphereVisible; } } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h index eb767274dc..c1a45fcac8 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.h @@ -113,7 +113,7 @@ public: bool hasVisibleWellPipes(); void sortWellsByName(); - const std::vector& resultWellPipeVisibilities(size_t frameIndex); + const std::vector& resultWellGeometryVisibilities(size_t frameIndex); void scheduleIsWellPipesVisibleRecalculation(); protected: @@ -122,7 +122,7 @@ protected: virtual caf::PdmFieldHandle* objectToggleField(); private: - void calculateIsWellPipesVisible(size_t frameIndex); + void calculateWellGeometryVisibility(size_t frameIndex); RimEclipseView* m_reservoirView; std::vector< std::vector< cvf::ubyte > > From 89278dc6c81ba082af098b90ba79713b38c26883 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 13 Dec 2016 10:02:46 +0100 Subject: [PATCH 12/24] #1025 Include well sphere visibility to show time animation control --- ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp index eb3e0738b2..c571d6c5f4 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp @@ -181,9 +181,10 @@ bool RimEclipseWellCollection::hasVisibleWellCells() bool RimEclipseWellCollection::hasVisibleWellPipes() { if (!this->isActive()) return false; - if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF) return false; + if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF && this->wellSphereVisibility() == PIPES_FORCE_ALL_OFF ) return false; if (this->wells().size() == 0 ) return false; if (this->wellPipeVisibility() == PIPES_FORCE_ALL_ON) return true; + if (this->wellSphereVisibility() == PIPES_FORCE_ALL_ON) return true; return true; } From 6583c43f1b7817944eef2ea74a4efe06dd0d3934 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Tue, 13 Dec 2016 09:52:05 +0100 Subject: [PATCH 13/24] #1018 Added fields fos specifying start/stop/direction for range filtered snapshots. Added clear functionality and defaults for new lines in table for the MultipleSnapshotsWidgets. --- .../RimMultiSnapshotDefinition.cpp | 45 +++++++++++++++- .../RimMultiSnapshotDefinition.h | 12 +++++ .../RiuExportMultipleSnapshotsWidget.cpp | 53 ++++++++++++++++++- .../RiuExportMultipleSnapshotsWidget.h | 1 + 4 files changed, 107 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.cpp b/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.cpp index 29fddf1abe..4cfeb61a67 100644 --- a/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.cpp @@ -25,6 +25,18 @@ #include "cafPdmPointer.h" +namespace caf +{ + template<> + void caf::AppEnum< RimMultiSnapshotDefinition::SnapShotDirectionEnum >::setUp() + { + addItem(RimMultiSnapshotDefinition::RANGEFILTER_I, "I", "i-direction"); + addItem(RimMultiSnapshotDefinition::RANGEFILTER_J, "J", "j-direction"); + addItem(RimMultiSnapshotDefinition::RANGEFILTER_K, "K", "k-direction"); + + setDefault(RimMultiSnapshotDefinition::RANGEFILTER_K); + } +} CAF_PDM_SOURCE_INIT(RimMultiSnapshotDefinition, "MultiSnapshotDefinition"); @@ -40,6 +52,12 @@ RimMultiSnapshotDefinition::RimMultiSnapshotDefinition() CAF_PDM_InitFieldNoDefault(&viewObject, "View", "View", "", "", ""); CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", ""); CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", ""); + + CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum(RANGEFILTER_K), "Range Filter direction", "", "", ""); + CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 0, "RangeFilter Start", "", "", ""); + CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 0, "RangeFilter End", "", "", ""); + + } @@ -69,7 +87,7 @@ QList RimMultiSnapshotDefinition::calculateValueOptions( options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), QVariant::fromValue(caf::PdmPointer(c)))); } - options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer(nullptr)))); + //options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer(nullptr)))); } else if (fieldNeedingOptions == &viewObject) { @@ -82,8 +100,31 @@ QList RimMultiSnapshotDefinition::calculateValueOptions( } } - options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer(nullptr)))); + //options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer(nullptr)))); } + else if (fieldNeedingOptions == &timeStepEnd) + { + if (caseObject()) + { + QStringList timeSteps = caseObject()->timeStepStrings(); + for (int i = 0; i < timeSteps.size(); i++) + { + options.push_back(caf::PdmOptionItemInfo(timeSteps[i], i)); + } + } + } + else if (fieldNeedingOptions == &timeStepStart) + { + if (caseObject()) + { + QStringList timeSteps = caseObject()->timeStepStrings(); + for (int i = 0; i < timeSteps.size(); i++) + { + options.push_back(caf::PdmOptionItemInfo(timeSteps[i], i)); + } + } + } + return options; } diff --git a/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.h b/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.h index 05b12ca594..fed9a336b8 100644 --- a/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.h @@ -21,6 +21,7 @@ #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPtrField.h" +#include "cafAppEnum.h" class RimCase; class RimView; @@ -42,6 +43,17 @@ public: caf::PdmField timeStepStart; caf::PdmField timeStepEnd; + enum SnapShotDirectionEnum + { + RANGEFILTER_I, + RANGEFILTER_J, + RANGEFILTER_K + }; + + caf::PdmField< caf::AppEnum< SnapShotDirectionEnum > > sliceDirection; + caf::PdmField startSliceIndex; + caf::PdmField endSliceIndex; + virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; }; diff --git a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp index d4d4d6f281..2caa01e75e 100644 --- a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp +++ b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp @@ -20,6 +20,8 @@ #include "RimMultiSnapshotDefinition.h" #include "RimProject.h" +#include "RimCase.h" +#include "RimView.h" #include "cafCmdFeatureManager.h" #include "cafPdmUiTableView.h" @@ -31,6 +33,7 @@ #include #include #include +#include "RiaApplication.h" //-------------------------------------------------------------------------------------------------- @@ -86,9 +89,14 @@ void RiuExportMultipleSnapshotsWidget::customMenuRequested(QPoint pos) QMenu menu; menu.addAction(commandManager->action("PdmListField_DeleteItem","Delete row")); - QAction* newRowAction = new QAction("Add new row", this); + QAction* newRowAction = new QAction("New row", this); connect(newRowAction, SIGNAL(triggered()), SLOT(addSnapshotItem())); menu.addAction(newRowAction); + + QAction* clearAllRows = new QAction("Clear", this); + connect(clearAllRows, SIGNAL(triggered()), SLOT(deleteAllSnapshotItems())); + menu.addAction(clearAllRows); + // Qt doc: QAbstractScrollArea and its subclasses that map the context menu event to coordinates of the viewport(). QPoint globalPos = m_pdmTableView->tableView()->viewport()->mapToGlobal(pos); @@ -96,6 +104,20 @@ void RiuExportMultipleSnapshotsWidget::customMenuRequested(QPoint pos) menu.exec(globalPos); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuExportMultipleSnapshotsWidget::deleteAllSnapshotItems() +{ + if (!m_rimProject) return; + + m_rimProject->multiSnapshotDefinitions.deleteAllChildObjects(); + + m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors(); +} + + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -104,7 +126,34 @@ void RiuExportMultipleSnapshotsWidget::addSnapshotItem() if (!m_rimProject) return; RimMultiSnapshotDefinition* multiSnapshot = new RimMultiSnapshotDefinition(); - // TODO: init with available time step from + + + //Getting default value from last entered line: + if (m_rimProject->multiSnapshotDefinitions.size() > 0) + { + RimMultiSnapshotDefinition* other = m_rimProject->multiSnapshotDefinitions[m_rimProject->multiSnapshotDefinitions.size() - 1]; + + multiSnapshot->caseObject = other->caseObject(); + multiSnapshot->viewObject = other->viewObject(); + multiSnapshot->timeStepStart = other->timeStepStart(); + multiSnapshot->timeStepEnd = other->timeStepEnd(); + + + // Variant using copy based on xml string +// QString copyOfOriginalObject = other->writeObjectToXmlString(); +// multiSnapshot->readObjectFromXmlString(copyOfOriginalObject, caf::PdmDefaultObjectFactory::instance()); + + + } + + //Getting new default values (if no earlier entry): +// TODO +// RimProject* proj = RiaApplication::instance()->project(); +// std::vector cases; +// proj->allCases(cases); +// //multiSnapshot->caseObject() = cases[0]; + + m_rimProject->multiSnapshotDefinitions.push_back(multiSnapshot); m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors(); diff --git a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h index d305932979..7ef66f7a6d 100644 --- a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h +++ b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h @@ -38,6 +38,7 @@ public: private slots: void customMenuRequested(QPoint pos); void addSnapshotItem(); + void deleteAllSnapshotItems(); private: RimProject* m_rimProject; From bd425563d8fa626f5a806fc8c0f98f0573f43f71 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Tue, 13 Dec 2016 09:58:29 +0100 Subject: [PATCH 14/24] #1018 Added function getTimeStepStrings to RimMultiSnapshotDefenition, used for both start and end timeStep --- .../RimMultiSnapshotDefinition.cpp | 34 ++++++++++--------- .../RimMultiSnapshotDefinition.h | 3 ++ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.cpp b/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.cpp index 4cfeb61a67..6e69b7b66b 100644 --- a/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.cpp @@ -104,28 +104,30 @@ QList RimMultiSnapshotDefinition::calculateValueOptions( } else if (fieldNeedingOptions == &timeStepEnd) { - if (caseObject()) - { - QStringList timeSteps = caseObject()->timeStepStrings(); - for (int i = 0; i < timeSteps.size(); i++) - { - options.push_back(caf::PdmOptionItemInfo(timeSteps[i], i)); - } - } + getTimeStepStrings(options); + } else if (fieldNeedingOptions == &timeStepStart) { - if (caseObject()) - { - QStringList timeSteps = caseObject()->timeStepStrings(); - for (int i = 0; i < timeSteps.size(); i++) - { - options.push_back(caf::PdmOptionItemInfo(timeSteps[i], i)); - } - } + getTimeStepStrings(options); } return options; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiSnapshotDefinition::getTimeStepStrings(QList &options) +{ + if (!caseObject()) return; + + QStringList timeSteps = caseObject()->timeStepStrings(); + for (int i = 0; i < timeSteps.size(); i++) + { + options.push_back(caf::PdmOptionItemInfo(timeSteps[i], i)); + } + +} + diff --git a/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.h b/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.h index fed9a336b8..11a328d7f7 100644 --- a/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimMultiSnapshotDefinition.h @@ -56,4 +56,7 @@ public: virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; + + void getTimeStepStrings(QList &options); + }; From 99d54beb4a4ae3dcd7a1c66e3c3c749319d544bc Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Tue, 13 Dec 2016 14:01:25 +0100 Subject: [PATCH 15/24] #1018 Setting default case and view when adding first line to the table in the widget for exporting multiple snapshots. --- .../RiuExportMultipleSnapshotsWidget.cpp | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp index 2caa01e75e..49915959b8 100644 --- a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp +++ b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp @@ -146,13 +146,33 @@ void RiuExportMultipleSnapshotsWidget::addSnapshotItem() } - //Getting new default values (if no earlier entry): -// TODO -// RimProject* proj = RiaApplication::instance()->project(); -// std::vector cases; -// proj->allCases(cases); -// //multiSnapshot->caseObject() = cases[0]; + else + { + RimProject* proj = RiaApplication::instance()->project(); + std::vector cases; + proj->allCases(cases); + RimCase* CaseExample = nullptr; + RimView* ViewExample = nullptr; + if (cases.size() > 0) + { + CaseExample = cases.at(0); + multiSnapshot->caseObject = CaseExample; + + std::vector viewExamples; + viewExamples = CaseExample->views(); + + if (viewExamples.size() > 0) + { + ViewExample = viewExamples.at(0); + multiSnapshot->viewObject = ViewExample; + } + } + + + } + + m_rimProject->multiSnapshotDefinitions.push_back(multiSnapshot); From b3f294c133eccc654664a534e5a99d90ce2fcbc6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 13 Dec 2016 15:17:50 +0100 Subject: [PATCH 16/24] #1018 : Added export button --- .../RiuExportMultipleSnapshotsWidget.cpp | 18 +++++++++++++++++- .../RiuExportMultipleSnapshotsWidget.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp index 49915959b8..e5b5ea4396 100644 --- a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp +++ b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp @@ -18,6 +18,8 @@ #include "RiuExportMultipleSnapshotsWidget.h" +#include "RiaApplication.h" + #include "RimMultiSnapshotDefinition.h" #include "RimProject.h" #include "RimCase.h" @@ -33,7 +35,7 @@ #include #include #include -#include "RiaApplication.h" +#include //-------------------------------------------------------------------------------------------------- @@ -66,6 +68,11 @@ RiuExportMultipleSnapshotsWidget::RiuExportMultipleSnapshotsWidget(QWidget* pare connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + QPushButton* exportButton = new QPushButton(tr("Export")); + exportButton->setDefault(true); + buttonBox->addButton(exportButton, QDialogButtonBox::ActionRole); + connect(exportButton, SIGNAL(clicked()), this, SLOT(exportSnapshots())); + dialogLayout->addWidget(buttonBox); } @@ -118,6 +125,15 @@ void RiuExportMultipleSnapshotsWidget::deleteAllSnapshotItems() } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuExportMultipleSnapshotsWidget::exportSnapshots() +{ + // TODO: wire up call of static method + // RicExportMultipleSnapshotsFeature::staticMethod() +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h index 7ef66f7a6d..69daaf588e 100644 --- a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h +++ b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h @@ -39,6 +39,7 @@ private slots: void customMenuRequested(QPoint pos); void addSnapshotItem(); void deleteAllSnapshotItems(); + void exportSnapshots(); private: RimProject* m_rimProject; From c25384b09cb26a043f114ade3ff51c519142d8e9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 13 Dec 2016 16:25:42 +0100 Subject: [PATCH 17/24] #1018 Added UI for export folder location --- .../RiuExportMultipleSnapshotsWidget.cpp | 57 ++++++++++++++++++- .../RiuExportMultipleSnapshotsWidget.h | 4 ++ 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp index e5b5ea4396..1d26658cfa 100644 --- a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp +++ b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.cpp @@ -20,22 +20,26 @@ #include "RiaApplication.h" +#include "RimCase.h" #include "RimMultiSnapshotDefinition.h" #include "RimProject.h" -#include "RimCase.h" #include "RimView.h" #include "cafCmdFeatureManager.h" #include "cafPdmUiTableView.h" #include "cafSelectionManager.h" +#include #include #include #include +#include +#include #include -#include -#include #include +#include +#include +#include //-------------------------------------------------------------------------------------------------- @@ -47,6 +51,10 @@ RiuExportMultipleSnapshotsWidget::RiuExportMultipleSnapshotsWidget(QWidget* pare { setWindowTitle("Export Multiple Snapshots"); + int nWidth = 800; + int nHeight = 300; + resize(nWidth, nHeight); + QVBoxLayout* dialogLayout = new QVBoxLayout; setLayout(dialogLayout); @@ -63,6 +71,30 @@ RiuExportMultipleSnapshotsWidget::RiuExportMultipleSnapshotsWidget(QWidget* pare dialogLayout->addWidget(m_pdmTableView); + // Export folder + { + QHBoxLayout* layout = new QHBoxLayout; + + layout->addWidget(new QLabel("Export folder")); + + // Save images in snapshot catalog relative to project directory + QString snapshotFolderName = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("snapshots"); + + m_lineEdit = new QLineEdit(snapshotFolderName); + + QToolButton* button = new QToolButton; + button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred)); + button->setText(QLatin1String("...")); + + layout->addWidget(m_lineEdit); + layout->addWidget(button); + + connect(button, SIGNAL(clicked()), this, SLOT(folderSelectionClicked())); + + dialogLayout->addLayout(layout); + } + + // Buttons QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); @@ -134,6 +166,25 @@ void RiuExportMultipleSnapshotsWidget::exportSnapshots() // RicExportMultipleSnapshotsFeature::staticMethod() } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuExportMultipleSnapshotsWidget::folderSelectionClicked() +{ + QString defaultPath = m_lineEdit->text(); + + QString directoryPath = QFileDialog::getExistingDirectory(m_lineEdit, + tr("Get existing directory"), + defaultPath, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + + if (!directoryPath.isEmpty()) + { + m_lineEdit->setText(directoryPath); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h index 69daaf588e..d5bd442f7f 100644 --- a/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h +++ b/ApplicationCode/UserInterface/RiuExportMultipleSnapshotsWidget.h @@ -27,6 +27,7 @@ namespace caf { } class QWidget; +class QLineEdit; class RiuExportMultipleSnapshotsWidget : public QDialog { @@ -41,7 +42,10 @@ private slots: void deleteAllSnapshotItems(); void exportSnapshots(); + void folderSelectionClicked(); + private: RimProject* m_rimProject; caf::PdmUiTableView* m_pdmTableView; + QLineEdit* m_lineEdit; }; From eb43c82c55b3ffafe7a626063faf2f752723b821 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 13 Dec 2016 22:04:02 +0100 Subject: [PATCH 18/24] System : Fixed issue when building without Octave --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e79c04e8bb..7f354537aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -417,7 +417,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") set(CPACK_GENERATOR ZIP) endif() -if(NOT ${RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE} EQUAL "") +if(RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE) get_filename_component(RESINSIGHT_OCTAVE_DIRECTORY ${RESINSIGHT_OCTAVE_PLUGIN_MKOCTFILE} DIRECTORY) execute_process (COMMAND octave-config -v From 2d202b1cede24e561c4ab3a30aa73cdc1c146558 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 9 Dec 2016 20:36:31 +0100 Subject: [PATCH 19/24] #559 : Linked Views: Linking legend definitions --- .../ProjectDataModel/RimLegendConfig.cpp | 31 +++++++++++ .../ProjectDataModel/RimLegendConfig.h | 2 + .../RimTernaryLegendConfig.cpp | 38 ++++++++++++-- .../ProjectDataModel/RimTernaryLegendConfig.h | 6 ++- .../ProjectDataModel/RimViewController.cpp | 52 +++++++++++++++++-- .../ProjectDataModel/RimViewController.h | 3 ++ .../ProjectDataModel/RimViewLinker.cpp | 22 +++++++- .../ProjectDataModel/RimViewLinker.h | 1 + 8 files changed, 144 insertions(+), 11 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp index d726b519e4..6db35dbec7 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp @@ -26,6 +26,7 @@ #include "RimEclipseCellColors.h" #include "RimEclipseView.h" #include "RimGeoMechResultDefinition.h" +#include "RimViewLinker.h" #include "cafCategoryLegend.h" #include "cafCategoryMapper.h" @@ -182,6 +183,18 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, updateLegend(); + RimView* view = nullptr; + this->firstAncestorOrThisOfType(view); + + if (view) + { + RimViewLinker* viewLinker = view->assosiatedViewLinker(); + if (viewLinker) + { + viewLinker->updateCellResult(); + } + } + if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw(); } @@ -758,6 +771,24 @@ cvf::OverlayItem* RimLegendConfig::legend() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimLegendConfig::setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig) +{ + this->m_numLevels = otherLegendConfig->m_numLevels; + this->m_precision = otherLegendConfig->m_precision; + this->m_tickNumberFormat = otherLegendConfig->m_tickNumberFormat; + this->m_rangeMode = otherLegendConfig->m_rangeMode; + this->m_userDefinedMaxValue = otherLegendConfig->m_userDefinedMaxValue; + this->m_userDefinedMinValue = otherLegendConfig->m_userDefinedMinValue; + this->m_colorRangeMode = otherLegendConfig->m_colorRangeMode; + this->m_mappingMode = otherLegendConfig->m_mappingMode; + + this->m_userDefinedMinValue = otherLegendConfig->m_userDefinedMinValue; + this->m_userDefinedMaxValue = otherLegendConfig->m_userDefinedMaxValue; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.h b/ApplicationCode/ProjectDataModel/RimLegendConfig.h index c71276467e..c151dfe2c1 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.h @@ -126,6 +126,8 @@ private: cvf::ref interpolateColorArray(const cvf::Color3ubArray& colorArray, cvf::uint targetColorCount); double roundToNumSignificantDigits(double value, double precision); + friend class RimViewLinker; + void setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig); private: caf::PdmPointer m_reservoirView; diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 0c107d4f2c..207163eec3 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -19,15 +19,17 @@ #include "RimTernaryLegendConfig.h" -#include "cafPdmUiPushButtonEditor.h" -#include "cafPdmUiTextEditor.h" - #include "RiaApplication.h" + #include "RimEclipseView.h" +#include "RimViewLinker.h" #include "RivTernarySaturationOverlayItem.h" #include "RivTernaryScalarMapper.h" +#include "cafPdmUiPushButtonEditor.h" +#include "cafPdmUiTextEditor.h" + #include "cvfqtUtils.h" #include @@ -152,6 +154,18 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed updateLabelText(); updateLegend(); + RimView* view = nullptr; + this->firstAncestorOrThisOfType(view); + + if (view) + { + RimViewLinker* viewLinker = view->assosiatedViewLinker(); + if (viewLinker) + { + viewLinker->updateCellResult(); + } + } + if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw(); } @@ -231,6 +245,24 @@ void RimTernaryLegendConfig::recreateLegend() updateLegend(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimTernaryLegendConfig::setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig) +{ + this->precision = otherLegendConfig->precision; + this->rangeMode = otherLegendConfig->rangeMode; + this->userDefinedMaxValueSoil = otherLegendConfig->userDefinedMaxValueSoil; + this->userDefinedMinValueSoil = otherLegendConfig->userDefinedMinValueSoil; + this->userDefinedMaxValueSgas = otherLegendConfig->userDefinedMaxValueSgas; + this->userDefinedMinValueSgas = otherLegendConfig->userDefinedMinValueSgas; + this->userDefinedMaxValueSwat = otherLegendConfig->userDefinedMaxValueSwat; + this->userDefinedMinValueSwat = otherLegendConfig->userDefinedMinValueSwat; + this->applyLocalMinMax = otherLegendConfig->applyLocalMinMax; + this->applyGlobalMinMax = otherLegendConfig->applyGlobalMinMax; + this->applyFullRangeMinMax = otherLegendConfig->applyFullRangeMinMax; +} + //-------------------------------------------------------------------------------------------------- /// Rounding the double value to given number of significant digits //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h index 321629cdec..3a3e5e7163 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h @@ -73,7 +73,7 @@ public: void recreateLegend(); RivTernarySaturationOverlayItem* legend(); - RivTernaryScalarMapper* scalarMapper(); + RivTernaryScalarMapper* scalarMapper(); protected: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue); @@ -84,7 +84,9 @@ private: void updateLegend(); void updateLabelText(); double roundToNumSignificantDigits(double value, double precision); - + + friend class RimViewLinker; + void setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig); private: caf::PdmField precision; diff --git a/ApplicationCode/ProjectDataModel/RimViewController.cpp b/ApplicationCode/ProjectDataModel/RimViewController.cpp index e016374774..da28fa0a79 100644 --- a/ApplicationCode/ProjectDataModel/RimViewController.cpp +++ b/ApplicationCode/ProjectDataModel/RimViewController.cpp @@ -66,9 +66,10 @@ RimViewController::RimViewController(void) CAF_PDM_InitFieldNoDefault(&m_managedView, "ManagedView", "Linked View", "", "", ""); m_managedView.uiCapability()->setUiTreeChildrenHidden(true); - CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", ""); - CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", ""); - CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Color Result", "", "", ""); + CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", ""); + CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", ""); + CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Result", "", "", ""); + CAF_PDM_InitField(&m_syncLegendDefinitions, "SyncLegendDefinitions", true, " Legend Definition", "", "", ""); CAF_PDM_InitField(&m_syncVisibleCells, "SyncVisibleCells", false, "Visible Cells", "", "", ""); /// We do not support this. Consider to remove sometime @@ -185,6 +186,10 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField managedGeoView()->cellResult()->updateIconState(); } } + else if (changedField == &m_syncLegendDefinitions) + { + updateLegendDefinitions(); + } else if (changedField == &m_syncRangeFilters) { if (!m_syncRangeFilters) @@ -365,6 +370,7 @@ void RimViewController::updateOptionSensitivity() { isMasterAndDependentViewDifferentType = true; } + if (geoMasterView && !managedGeoView()) { isMasterAndDependentViewDifferentType = true; @@ -374,10 +380,22 @@ void RimViewController::updateOptionSensitivity() { this->m_syncCellResult.uiCapability()->setUiReadOnly(true); this->m_syncCellResult = false; + + this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(true); + this->m_syncLegendDefinitions = false; } else { this->m_syncCellResult.uiCapability()->setUiReadOnly(false); + + if (this->m_syncCellResult) + { + this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(false); + } + else + { + this->m_syncLegendDefinitions.uiCapability()->setUiReadOnly(true); + } } if (isPropertyFilterControlPossible()) @@ -390,7 +408,6 @@ void RimViewController::updateOptionSensitivity() this->m_syncPropertyFilters = false; } - if (isRangeFilterControlPossible()) { this->m_syncRangeFilters.uiCapability()->setUiReadOnly(false); @@ -440,6 +457,7 @@ void RimViewController::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin scriptGroup->add(&m_syncCamera); scriptGroup->add(&m_syncTimeStep); scriptGroup->add(&m_syncCellResult); + scriptGroup->add(&m_syncLegendDefinitions); caf::PdmUiGroup* visibleCells = uiOrdering.addNewGroup("Link Cell Filters"); visibleCells->add(&m_syncVisibleCells); @@ -498,6 +516,17 @@ void RimViewController::updateResultColorsControl() viewLinker->updateCellResult(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimViewController::updateLegendDefinitions() +{ + if (!this->isLegendDefinitionsControlled()) return; + + RimViewLinker* viewLinker = ownerViewLinker(); + viewLinker->updateCellResult(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -714,6 +743,21 @@ bool RimViewController::isResultColorControlled() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimViewController::isLegendDefinitionsControlled() +{ + if (ownerViewLinker()->isActive() && this->m_isActive()) + { + return m_syncLegendDefinitions; + } + else + { + return false; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimViewController.h b/ApplicationCode/ProjectDataModel/RimViewController.h index 1f30e228f0..b3eb903dae 100644 --- a/ApplicationCode/ProjectDataModel/RimViewController.h +++ b/ApplicationCode/ProjectDataModel/RimViewController.h @@ -61,6 +61,7 @@ public: bool isTimeStepLinked(); bool isResultColorControlled(); + bool isLegendDefinitionsControlled(); bool isRangeFiltersControlled(); bool isVisibleCellsOveridden(); @@ -90,6 +91,7 @@ private: void updateCameraLink(); void updateTimeStepLink(); void updateResultColorsControl(); + void updateLegendDefinitions(); bool isMasterAndDepViewDifferentType(); bool isRangeFilterControlPossible(); @@ -111,6 +113,7 @@ private: // Overridden properties caf::PdmField m_syncCellResult; + caf::PdmField m_syncLegendDefinitions; caf::PdmField m_syncRangeFilters; caf::PdmField m_syncVisibleCells; diff --git a/ApplicationCode/ProjectDataModel/RimViewLinker.cpp b/ApplicationCode/ProjectDataModel/RimViewLinker.cpp index 8d1e71c6a8..c6e41d2df4 100644 --- a/ApplicationCode/ProjectDataModel/RimViewLinker.cpp +++ b/ApplicationCode/ProjectDataModel/RimViewLinker.cpp @@ -24,7 +24,6 @@ #include "RigCaseData.h" #include "RimCase.h" - #include "RimEclipseCellColors.h" #include "RimEclipseInputCase.h" #include "RimEclipseResultCase.h" @@ -34,9 +33,11 @@ #include "RimGeoMechCellColors.h" #include "RimGeoMechResultDefinition.h" #include "RimGeoMechView.h" -#include "RimViewController.h" +#include "RimLegendConfig.h" #include "RimProject.h" +#include "RimTernaryLegendConfig.h" #include "RimView.h" +#include "RimViewController.h" #include "RimViewLinkerCollection.h" #include "RiuViewer.h" @@ -147,6 +148,16 @@ void RimViewLinker::updateCellResult() eclipeView->cellResult()->setPorosityModel(eclipseCellResultDefinition->porosityModel()); eclipeView->cellResult()->setResultType(eclipseCellResultDefinition->resultType()); eclipeView->cellResult()->setResultVariable(eclipseCellResultDefinition->resultVariable()); + + if (viewLink->isLegendDefinitionsControlled()) + { + eclipeView->cellResult()->legendConfig()->setUiValuesFromLegendConfig(masterEclipseView->cellResult()->legendConfig()); + eclipeView->cellResult()->legendConfig()->updateLegend(); + + eclipeView->cellResult()->ternaryLegendConfig()->setUiValuesFromLegendConfig(masterEclipseView->cellResult()->ternaryLegendConfig()); + eclipeView->cellResult()->ternaryLegendConfig()->updateLegend(); + } + eclipeView->scheduleCreateDisplayModelAndRedraw(); } @@ -174,6 +185,13 @@ void RimViewLinker::updateCellResult() if (viewLink->isResultColorControlled()) { geoView->cellResult()->setResultAddress(geoMechResultDefinition->resultAddress()); + + if (viewLink->isLegendDefinitionsControlled()) + { + geoView->cellResult()->legendConfig()->setUiValuesFromLegendConfig(masterGeoView->cellResult()->legendConfig()); + geoView->cellResult()->legendConfig()->updateLegend(); + } + geoView->scheduleCreateDisplayModelAndRedraw(); } diff --git a/ApplicationCode/ProjectDataModel/RimViewLinker.h b/ApplicationCode/ProjectDataModel/RimViewLinker.h index 5ea734651d..b453b2a74d 100644 --- a/ApplicationCode/ProjectDataModel/RimViewLinker.h +++ b/ApplicationCode/ProjectDataModel/RimViewLinker.h @@ -66,6 +66,7 @@ public: void updateScaleZ(RimView* sourceView, double scaleZ); void updateCellResult(); + void updateRangeFilters(RimCellRangeFilter* changedRangeFilter); void applyRangeFilterCollectionByUserChoice(); From 7195455fbdda7260f55de01a05088f7558744389 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 9 Dec 2016 21:04:16 +0100 Subject: [PATCH 20/24] System : Added const to functions related to write of field data --- .../cafPdmXml/cafInternalPdmXmlFieldCapability.h | 10 +++++----- .../cafPdmXml/cafInternalPdmXmlFieldCapability.inl | 10 +++++----- .../cafPdmXml/cafPdmXmlFieldHandle.h | 13 +++++++------ .../cafPdmXml/cafPdmXmlObjectHandle.cpp | 6 +++--- .../cafPdmXml/cafPdmXmlObjectHandle.h | 6 +++--- .../cafPdmXml/cafPdmXmlObjectHandleMacros.h | 2 +- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.h index 420b115320..b904463a0a 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.h @@ -15,7 +15,7 @@ public: // Xml Serializing public: virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory); - virtual void writeFieldData(QXmlStreamWriter& xmlStream); + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const; private: FieldType* m_field; }; @@ -39,7 +39,7 @@ public: // Xml Serializing public: virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory); - virtual void writeFieldData(QXmlStreamWriter& xmlStream); + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const; virtual void resolveReferences(); private: @@ -68,7 +68,7 @@ public: // Xml Serializing public: virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory); - virtual void writeFieldData(QXmlStreamWriter& xmlStream); + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const; virtual void resolveReferences(); private: @@ -92,7 +92,7 @@ public: // Xml Serializing public: virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory); - virtual void writeFieldData(QXmlStreamWriter& xmlStream); + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const; private: FieldType* m_field; }; @@ -110,7 +110,7 @@ public: // Xml Serializing public: virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory); - virtual void writeFieldData(QXmlStreamWriter& xmlStream); + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const; private: FieldType* m_field; }; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl index 2bebe739a2..09ebeb0665 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl @@ -30,7 +30,7 @@ template /// //-------------------------------------------------------------------------------------------------- template - void caf::PdmFieldXmlCap::writeFieldData(QXmlStreamWriter& xmlStream) +void caf::PdmFieldXmlCap::writeFieldData(QXmlStreamWriter& xmlStream) const { this->assertValid(); PdmFieldWriter::writeFieldData(m_field->value(), xmlStream); @@ -79,7 +79,7 @@ template //-------------------------------------------------------------------------------------------------- template - void caf::PdmFieldXmlCap< caf::PdmPtrField >::writeFieldData(QXmlStreamWriter& xmlStream) + void caf::PdmFieldXmlCap< caf::PdmPtrField >::writeFieldData(QXmlStreamWriter& xmlStream) const { this->assertValid(); @@ -142,7 +142,7 @@ template //-------------------------------------------------------------------------------------------------- template - void caf::PdmFieldXmlCap< caf::PdmPtrArrayField >::writeFieldData(QXmlStreamWriter& xmlStream) + void caf::PdmFieldXmlCap< caf::PdmPtrArrayField >::writeFieldData(QXmlStreamWriter& xmlStream) const { this->assertValid(); @@ -264,7 +264,7 @@ void caf::PdmFieldXmlCap< caf::PdmChildField >::readFieldData(QXmlStr //-------------------------------------------------------------------------------------------------- template -void caf::PdmFieldXmlCap< caf::PdmChildField >::writeFieldData(QXmlStreamWriter& xmlStream) +void caf::PdmFieldXmlCap< caf::PdmChildField >::writeFieldData(QXmlStreamWriter& xmlStream) const { if (m_field->m_fieldValue.rawPtr() == NULL) return; @@ -287,7 +287,7 @@ void caf::PdmFieldXmlCap< caf::PdmChildField >::writeFieldData(QXmlSt /// //-------------------------------------------------------------------------------------------------- template -void caf::PdmFieldXmlCap< caf::PdmChildArrayField >::writeFieldData(QXmlStreamWriter& xmlStream) +void caf::PdmFieldXmlCap< caf::PdmChildArrayField >::writeFieldData(QXmlStreamWriter& xmlStream) const { typename std::vector< PdmPointer >::iterator it; for (it = m_field->m_pointers.begin(); it != m_field->m_pointers.end(); ++it) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlFieldHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlFieldHandle.h index bf426be4a1..8db7870ca7 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlFieldHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlFieldHandle.h @@ -25,17 +25,18 @@ public: PdmXmlFieldHandle(PdmFieldHandle* owner , bool giveOwnership); virtual ~PdmXmlFieldHandle() { } - PdmFieldHandle* fieldHandle() { return m_owner; } + PdmFieldHandle* fieldHandle() { return m_owner; } + const PdmFieldHandle* fieldHandle() const { return m_owner; } - bool isIOReadable() { return m_isIOReadable; } - bool isIOWritable() { return m_isIOWritable; } - void setIOWritable(bool isWritable) { m_isIOWritable = isWritable; } - void setIOReadable(bool isReadable) { m_isIOReadable = isReadable; } + bool isIOReadable() const { return m_isIOReadable; } + bool isIOWritable() const { return m_isIOWritable; } + void setIOWritable(bool isWritable) { m_isIOWritable = isWritable; } + void setIOReadable(bool isReadable) { m_isIOReadable = isReadable; } QString childClassKeyword(); virtual void readFieldData(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory) = 0; - virtual void writeFieldData(QXmlStreamWriter& xmlStream) = 0; + virtual void writeFieldData(QXmlStreamWriter& xmlStream) const = 0; virtual void resolveReferences() { }; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp index 9bcaa193a5..99431fc596 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp @@ -108,13 +108,13 @@ void PdmXmlObjectHandle::readFields(QXmlStreamReader& xmlStream, PdmObjectFactor //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmXmlObjectHandle::writeFields(QXmlStreamWriter& xmlStream) +void PdmXmlObjectHandle::writeFields(QXmlStreamWriter& xmlStream) const { std::vector fields; m_owner->fields(fields); for (size_t it = 0; it < fields.size(); ++it) { - PdmXmlFieldHandle* field = fields[it]->xmlCapability(); + const PdmXmlFieldHandle* field = fields[it]->xmlCapability(); if (field && field->isIOWritable()) { QString keyword = field->fieldHandle()->keyword(); @@ -188,7 +188,7 @@ PdmObjectHandle* PdmXmlObjectHandle::copyByXmlSerialization(PdmObjectFactory* ob //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString PdmXmlObjectHandle::writeObjectToXmlString() +QString PdmXmlObjectHandle::writeObjectToXmlString() const { QString xmlString; QXmlStreamWriter outputStream(&xmlString); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h index 0759889f52..5616308e67 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h @@ -30,18 +30,18 @@ public: virtual ~PdmXmlObjectHandle() { } /// The classKeyword method is overridden in subclasses by the CAF_PDM_XML_HEADER_INIT macro - virtual QString classKeyword() = 0; + virtual QString classKeyword() const = 0; /// Convenience methods to serialize/de-serialize this particular object (with children) void readObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory); - QString writeObjectToXmlString(); + QString writeObjectToXmlString() const; static PdmObjectHandle* readUnknownObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory); PdmObjectHandle* copyByXmlSerialization(PdmObjectFactory* objectFactory); // Main XML serialization methods that is used internally by the document serialization system // Not supposed to be used directly. void readFields(QXmlStreamReader& inputStream, PdmObjectFactory* objectFactory); - void writeFields(QXmlStreamWriter& outputStream); + void writeFields(QXmlStreamWriter& outputStream) const; /// Check if a string is a valid Xml element name static bool isValidXmlElementName(const QString& name); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandleMacros.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandleMacros.h index a00116f2df..ecdcd13808 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandleMacros.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandleMacros.h @@ -22,7 +22,7 @@ // To be renamed CAF_PDM_XML_HEADER_INIT #define CAF_PDM_XML_HEADER_INIT \ public: \ - virtual QString classKeyword() { return classKeywordStatic(); } \ + virtual QString classKeyword() const { return classKeywordStatic(); } \ static QString classKeywordStatic(); \ \ static bool Error_You_forgot_to_add_the_macro_CAF_PDM_XML_HEADER_INIT_and_or_CAF_PDM_XML_SOURCE_INIT_to_your_cpp_file_for_this_class() From b73cb5136c05dd8b81a8d6b453dd6b27a1037e9c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 9 Dec 2016 21:15:24 +0100 Subject: [PATCH 21/24] #559 Linked views : Removed obsolete storage of RimView --- ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp | 1 - ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp | 8 -------- ApplicationCode/ProjectDataModel/RimEclipseView.cpp | 1 - ApplicationCode/ProjectDataModel/RimGeoMechView.cpp | 3 --- ApplicationCode/ProjectDataModel/RimLegendConfig.cpp | 4 ++-- ApplicationCode/ProjectDataModel/RimLegendConfig.h | 4 ---- .../ProjectDataModel/RimTernaryLegendConfig.cpp | 4 ++-- ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h | 3 --- 8 files changed, 4 insertions(+), 24 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp index 0dbae8b5d4..28b0310171 100644 --- a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp @@ -90,7 +90,6 @@ RimCellEdgeColors::~RimCellEdgeColors() void RimCellEdgeColors::setReservoirView(RimEclipseView* ownerReservoirView) { m_reservoirView = ownerReservoirView; - this->m_legendConfig()->setReservoirView(ownerReservoirView); m_singleVarEdgeResultColors->setReservoirView(ownerReservoirView); } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp index 72dc13cdec..827bd2be61 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -135,7 +135,6 @@ void RimEclipseCellColors::changeLegendConfig(QString resultVarNameOfNewLegend) if (!found) { RimLegendConfig* newLegend = new RimLegendConfig; - newLegend->setReservoirView(m_reservoirView); newLegend->resultVariableName = resultVarNameOfNewLegend; m_legendConfigData.push_back(newLegend); @@ -225,13 +224,6 @@ void RimEclipseCellColors::setReservoirView(RimEclipseView* ownerReservoirView) this->setEclipseCase(ownerReservoirView->eclipseCase()); m_reservoirView = ownerReservoirView; - - for (size_t i = 0; i < m_legendConfigData.size(); i++) - { - m_legendConfigData[i]->setReservoirView(ownerReservoirView); - } - - this->ternaryLegendConfig()->setReservoirView(ownerReservoirView); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 4a7c8af8a7..5d53046058 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -123,7 +123,6 @@ RimEclipseView::RimEclipseView() this->cellResult()->setReservoirView(this); this->cellEdgeResult()->setReservoirView(this); - this->cellEdgeResult()->legendConfig()->setReservoirView(this); this->cellEdgeResult()->legendConfig()->setColorRangeMode(RimLegendConfig::PINK_WHITE); this->faultResultSettings()->setReservoirView(this); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index 9842376684..00df52619e 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -84,9 +84,6 @@ RimGeoMechView::RimGeoMechView(void) m_propertyFilterCollection = new RimGeoMechPropertyFilterCollection(); m_propertyFilterCollection.uiCapability()->setUiHidden(true); - //this->cellResult()->setReservoirView(this); - this->cellResult()->legendConfig()->setReservoirView(this); - m_scaleTransform = new cvf::Transform(); m_vizLogic = new RivGeoMechVizLogic(this); } diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp index 6db35dbec7..320a58b700 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp @@ -193,9 +193,9 @@ void RimLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, { viewLinker->updateCellResult(); } - } - if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw(); + view->updateCurrentTimeStepAndRedraw(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.h b/ApplicationCode/ProjectDataModel/RimLegendConfig.h index c151dfe2c1..9553b654ce 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.h @@ -57,8 +57,6 @@ public: RimLegendConfig(); virtual ~RimLegendConfig(); - void setReservoirView(RimView* ownerReservoirView) {m_reservoirView = ownerReservoirView; } - caf::PdmField resultVariableName; // Used internally to describe the variable this legend setup is used for enum RangeModeType @@ -130,8 +128,6 @@ private: void setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig); private: - caf::PdmPointer m_reservoirView; - cvf::ref m_linDiscreteScalarMapper; cvf::ref m_logDiscreteScalarMapper; cvf::ref m_logSmoothScalarMapper; diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 207163eec3..68e2e3ad93 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -164,9 +164,9 @@ void RimTernaryLegendConfig::fieldChangedByUi(const caf::PdmFieldHandle* changed { viewLinker->updateCellResult(); } + + view->updateCurrentTimeStepAndRedraw(); } - - if (m_reservoirView) m_reservoirView->updateCurrentTimeStepAndRedraw(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h index 3a3e5e7163..544a980f36 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.h @@ -65,8 +65,6 @@ public: RimTernaryLegendConfig(); virtual ~RimTernaryLegendConfig(); - void setReservoirView(RimEclipseView* ownerReservoirView) {m_reservoirView = ownerReservoirView; } - void setAutomaticRanges(TernaryArrayIndex ternaryIndex, double globalMin, double globalMax, double localMin, double localMax); void ternaryRanges(double& soilLower, double& soilUpper, double& sgasLower, double& sgasUpper, double& swatLower, double& swatUpper) const; @@ -109,7 +107,6 @@ private: std::vector m_localAutoMax; std::vector m_localAutoMin; - caf::PdmPointer m_reservoirView; cvf::ref m_legend; cvf::ref m_scalarMapper; }; From 16cc14a71d26c914d848b8184c7ac3eac47d0a18 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 9 Dec 2016 21:16:43 +0100 Subject: [PATCH 22/24] #559 : Linked views : Use writeObjectToXmlString to copy field values --- .../ProjectDataModel/RimLegendConfig.cpp | 13 ++----------- .../ProjectDataModel/RimTernaryLegendConfig.cpp | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp index 320a58b700..2c3bd89757 100644 --- a/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimLegendConfig.cpp @@ -776,17 +776,8 @@ cvf::OverlayItem* RimLegendConfig::legend() //-------------------------------------------------------------------------------------------------- void RimLegendConfig::setUiValuesFromLegendConfig(const RimLegendConfig* otherLegendConfig) { - this->m_numLevels = otherLegendConfig->m_numLevels; - this->m_precision = otherLegendConfig->m_precision; - this->m_tickNumberFormat = otherLegendConfig->m_tickNumberFormat; - this->m_rangeMode = otherLegendConfig->m_rangeMode; - this->m_userDefinedMaxValue = otherLegendConfig->m_userDefinedMaxValue; - this->m_userDefinedMinValue = otherLegendConfig->m_userDefinedMinValue; - this->m_colorRangeMode = otherLegendConfig->m_colorRangeMode; - this->m_mappingMode = otherLegendConfig->m_mappingMode; - - this->m_userDefinedMinValue = otherLegendConfig->m_userDefinedMinValue; - this->m_userDefinedMaxValue = otherLegendConfig->m_userDefinedMaxValue; + QString serializedObjectString = otherLegendConfig->writeObjectToXmlString(); + this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance()); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 68e2e3ad93..5f62c66811 100644 --- a/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -250,17 +250,8 @@ void RimTernaryLegendConfig::recreateLegend() //-------------------------------------------------------------------------------------------------- void RimTernaryLegendConfig::setUiValuesFromLegendConfig(const RimTernaryLegendConfig* otherLegendConfig) { - this->precision = otherLegendConfig->precision; - this->rangeMode = otherLegendConfig->rangeMode; - this->userDefinedMaxValueSoil = otherLegendConfig->userDefinedMaxValueSoil; - this->userDefinedMinValueSoil = otherLegendConfig->userDefinedMinValueSoil; - this->userDefinedMaxValueSgas = otherLegendConfig->userDefinedMaxValueSgas; - this->userDefinedMinValueSgas = otherLegendConfig->userDefinedMinValueSgas; - this->userDefinedMaxValueSwat = otherLegendConfig->userDefinedMaxValueSwat; - this->userDefinedMinValueSwat = otherLegendConfig->userDefinedMinValueSwat; - this->applyLocalMinMax = otherLegendConfig->applyLocalMinMax; - this->applyGlobalMinMax = otherLegendConfig->applyGlobalMinMax; - this->applyFullRangeMinMax = otherLegendConfig->applyFullRangeMinMax; + QString serializedObjectString = otherLegendConfig->writeObjectToXmlString(); + this->readObjectFromXmlString(serializedObjectString, caf::PdmDefaultObjectFactory::instance()); } //-------------------------------------------------------------------------------------------------- From 860b51931cc3091e7862464a7cbf65aa63353f43 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 14 Dec 2016 07:15:44 +0100 Subject: [PATCH 23/24] #1025 Removed unsused code and renamed to isWellPipe/SpheresVisible --- .../RivReservoirWellSpheresPartMgr.cpp | 38 ++-- .../RivReservoirWellSpheresPartMgr.h | 6 +- .../RivWellSpheresPartMgr.cpp | 4 +- .../RivWellSpheresPartMgr.h | 4 - .../ProjectDataModel/RimEclipseView.cpp | 4 +- .../ProjectDataModel/RimEclipseWell.cpp | 194 +++++++++--------- .../ProjectDataModel/RimEclipseWell.h | 8 +- .../RimEclipseWellCollection.cpp | 4 +- 8 files changed, 114 insertions(+), 148 deletions(-) diff --git a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp index 750273451d..60a707dd50 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.cpp @@ -47,6 +47,15 @@ RivReservoirWellSpheresPartMgr::~RivReservoirWellSpheresPartMgr() } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RivReservoirWellSpheresPartMgr::clearGeometryCache() +{ + m_wellSpheresPartMgrs.clear(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -58,6 +67,8 @@ void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::Mode if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size()) { + clearGeometryCache(); + for (RimEclipseWell* rimWell : m_reservoirView->wellCollection()->wells()) { RivWellSpheresPartMgr* wppmgr = new RivWellSpheresPartMgr(m_reservoirView, rimWell); @@ -67,33 +78,8 @@ void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::Mode for (size_t i = 0; i < m_wellSpheresPartMgrs.size(); i++) { - - bool showGeo = false; - - - if (m_reservoirView->wellCollection()->wells[i]->showWell()) + if (m_reservoirView->wellCollection()->wells[i]->isWellSpheresVisible(frameIndex)) { - - if (m_reservoirView->wellCollection->wellSphereVisibility == RimEclipseWellCollection::PIPES_FORCE_ALL_ON) - { - showGeo = true; - } - - else if (m_reservoirView->wellCollection->wellSphereVisibility == RimEclipseWellCollection::PIPES_INDIVIDUALLY && m_reservoirView->wellCollection()->wells[i]->showWellSpheres() ) - { - showGeo = true; - } - - else if (m_reservoirView->wellCollection->wellSphereVisibility == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS && m_reservoirView->wellCollection->wells[i]->visibleCellsInstersectsWell(frameIndex)) - { - showGeo = true; - } - - } - - - if (showGeo) - { m_wellSpheresPartMgrs.at(i)->appendDynamicGeometryPartsToModel(model, frameIndex); } } diff --git a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.h b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.h index fd73a75783..d63d430b78 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivReservoirWellSpheresPartMgr.h @@ -25,7 +25,6 @@ namespace cvf { - class Transform; class ModelBasicList; } @@ -38,14 +37,11 @@ public: RivReservoirWellSpheresPartMgr(RimEclipseView* reservoirView); ~RivReservoirWellSpheresPartMgr(); + void clearGeometryCache(); void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); -private: - - private: caf::PdmPointer m_reservoirView; cvf::Collection< RivWellSpheresPartMgr > m_wellSpheresPartMgrs; - }; diff --git a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp index 786d31195c..71d94615ca 100644 --- a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.cpp @@ -18,6 +18,8 @@ #include "RivWellSpheresPartMgr.h" +#include "RiaApplication.h" + #include "RigCaseData.h" #include "RigMainGrid.h" @@ -28,7 +30,6 @@ #include "RiuViewer.h" - #include "cafDisplayCoordTransform.h" #include "cafEffectGenerator.h" #include "cafPdmFieldCvfColor.h" @@ -44,7 +45,6 @@ #include "cvfGeometryBuilderTriangles.h" #include "cvfOpenGLResourceManager.h" #include "cvfShaderProgram.h" -#include "RiaApplication.h" //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h index 609e14901f..67b9da37b8 100644 --- a/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h +++ b/ApplicationCode/ModelVisualization/RivWellSpheresPartMgr.h @@ -52,8 +52,6 @@ public: RivWellSpheresPartMgr(RimEclipseView* reservoirView, RimEclipseWell* well); ~RivWellSpheresPartMgr(); - void scheduleGeometryRegen() { m_needsTransformUpdate = true; } - void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); private: @@ -63,6 +61,4 @@ private: private: caf::PdmPointer m_rimReservoirView; caf::PdmPointer m_rimWell; - - bool m_needsTransformUpdate; }; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 3cbc4177ac..7af603aeec 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -131,7 +131,6 @@ RimEclipseView::RimEclipseView() m_reservoirGridPartManager = new RivReservoirViewPartMgr(this); m_pipesPartManager = new RivReservoirPipesPartMgr(this); m_wellSpheresPartManager = new RivReservoirWellSpheresPartMgr(this); - m_reservoir = NULL; } @@ -666,7 +665,6 @@ void RimEclipseView::updateCurrentTimeStep() m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep); m_wellSpheresPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep); - wellPipeModelBasicList->updateBoundingBoxesRecursive(); this->removeModelByName(frameScene, wellPipeModelBasicList->name()); @@ -900,6 +898,7 @@ void RimEclipseView::scheduleReservoirGridGeometryRegen() void RimEclipseView::schedulePipeGeometryRegen() { m_pipesPartManager->scheduleGeometryRegen(); + m_wellSpheresPartManager->clearGeometryCache(); } @@ -1308,6 +1307,7 @@ void RimEclipseView::updateDisplayModelForWellResults() { m_reservoirGridPartManager->clearGeometryCache(); m_pipesPartManager->clearGeometryCache(); + m_wellSpheresPartManager->clearGeometryCache(); syncronizeWellsWithResults(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp index da0654dbd7..e9a26ce99f 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.cpp @@ -148,106 +148,6 @@ caf::PdmFieldHandle* RimEclipseWell::objectToggleField() return &showWell; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex) -{ - if (m_reservoirView == NULL) return false; - if (this->wellResults() == NULL) return false; - - if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size()) - { - return false; - } - - size_t wellTimeStepIndex = this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex]; - if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T) - { - return false; - } - - if (!m_reservoirView->wellCollection()->isActive()) - return false; - - if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON) - return true; - - if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) - return false; - - if ( this->showWell() == false ) - return false; - - if ( this->showWellPipes() == false ) - return false; - - if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY) - return true; - - if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this)) - return true; - - if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) - { - return visibleCellsInstersectsWell(frameIndex); - } - - CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimEclipseWell::calculateWellSphereVisibility(size_t frameIndex) -{ - if (m_reservoirView == NULL) return false; - if (this->wellResults() == NULL) return false; - - if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size()) - { - return false; - } - - size_t wellTimeStepIndex = this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex]; - if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T) - { - return false; - } - - if (!m_reservoirView->wellCollection()->isActive()) - return false; - - if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON) - return true; - - if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) - return false; - - if (this->showWell() == false) - return false; - - if (this->showWellSpheres() == false) - return false; - - if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY) - return true; - - if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this)) - return true; - - if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) - { - return visibleCellsInstersectsWell(frameIndex); - } - - CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? - - return false; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -326,7 +226,99 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& //-------------------------------------------------------------------------------------------------- bool RimEclipseWell::isWellPipeVisible(size_t frameIndex) { - return calculateWellPipeVisibility(frameIndex); + if (m_reservoirView == NULL) return false; + if (this->wellResults() == NULL) return false; + + if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size()) + { + return false; + } + + size_t wellTimeStepIndex = this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex]; + if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T) + { + return false; + } + + if (!m_reservoirView->wellCollection()->isActive()) + return false; + + if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON) + return true; + + if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) + return false; + + if (this->showWell() == false) + return false; + + if (this->showWellPipes() == false) + return false; + + if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY) + return true; + + if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this)) + return true; + + if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) + { + return visibleCellsInstersectsWell(frameIndex); + } + + CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex) +{ + if (m_reservoirView == NULL) return false; + if (this->wellResults() == NULL) return false; + + if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size()) + { + return false; + } + + size_t wellTimeStepIndex = this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex]; + if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T) + { + return false; + } + + if (!m_reservoirView->wellCollection()->isActive()) + return false; + + if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_ON) + return true; + + if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_FORCE_ALL_OFF) + return false; + + if (this->showWell() == false) + return false; + + if (this->showWellSpheres() == false) + return false; + + if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY) + return true; + + if (m_reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this)) + return true; + + if (m_reservoirView->wellCollection()->wellSphereVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) + { + return visibleCellsInstersectsWell(frameIndex); + } + + CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ? + + return false; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWell.h b/ApplicationCode/ProjectDataModel/RimEclipseWell.h index cfe9ae2807..ae8a05dace 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWell.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseWell.h @@ -53,13 +53,9 @@ public: size_t resultWellIndex() { return m_resultWellIndex; } bool isWellPipeVisible(size_t frameIndex); + bool isWellSpheresVisible(size_t frameIndex); - bool calculateWellPipeVisibility(size_t frameIndex); - bool calculateWellSphereVisibility(size_t frameIndex); - - bool visibleCellsInstersectsWell(size_t frameIndex); - - //Trengs det en calculateWellGeometryVisibility?? + bool visibleCellsInstersectsWell(size_t frameIndex); virtual caf::PdmFieldHandle* userDescriptionField(); virtual caf::PdmFieldHandle* objectToggleField(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp index c571d6c5f4..6194a1d2bd 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseWellCollection.cpp @@ -346,8 +346,8 @@ void RimEclipseWellCollection::calculateWellGeometryVisibility(size_t frameIndex for (size_t i = 0; i < wells().size(); ++i) { - bool wellPipeVisible = wells[i]->calculateWellPipeVisibility(frameIndex); - bool wellSphereVisible = wells[i]->calculateWellSphereVisibility(frameIndex); + bool wellPipeVisible = wells[i]->isWellPipeVisible(frameIndex); + bool wellSphereVisible = wells[i]->isWellSpheresVisible(frameIndex); m_framesOfResultWellPipeVisibilities[frameIndex][wells[i]->resultWellIndex()] = wellPipeVisible || wellSphereVisible; } From 0fc23c56101a6c2446131ef2dcf0bb793d15adae Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 14 Dec 2016 10:35:28 +0100 Subject: [PATCH 24/24] System : Manipulation of time step is now only available from RiuViewer --- ApplicationCode/ProjectDataModel/RimEclipseView.cpp | 1 - ApplicationCode/ProjectDataModel/RimGeoMechView.cpp | 1 - ApplicationCode/ProjectDataModel/RimView.h | 9 ++++++--- ApplicationCode/ProjectDataModel/RimViewLinker.cpp | 3 --- ApplicationCode/UserInterface/RiuViewer.cpp | 3 +++ 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 7af603aeec..c424846126 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -496,7 +496,6 @@ void RimEclipseView::createDisplayModel() if (frameModels.size() > 1 && this->hasUserRequestedAnimation()) { - m_viewer->animationControl()->setCurrentFrameOnly(m_currentTimeStep); m_viewer->setCurrentFrame(m_currentTimeStep); } else diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index 00df52619e..472a967cba 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -254,7 +254,6 @@ void RimGeoMechView::createDisplayModel() if (isTimeStepDependentDataVisible()) { - m_viewer->animationControl()->setCurrentFrameOnly(m_currentTimeStep); m_viewer->setCurrentFrame(m_currentTimeStep); } else diff --git a/ApplicationCode/ProjectDataModel/RimView.h b/ApplicationCode/ProjectDataModel/RimView.h index 0ed45f58c8..374f7b5b3d 100644 --- a/ApplicationCode/ProjectDataModel/RimView.h +++ b/ApplicationCode/ProjectDataModel/RimView.h @@ -137,10 +137,8 @@ public: void setScaleZAndUpdate(double scaleZ); // Animation - int currentTimeStep() { return m_currentTimeStep;} - void setCurrentTimeStep(int frameIdx); + int currentTimeStep() const { return m_currentTimeStep;} void updateCurrentTimeStepAndRedraw(); - void endAnimation(); virtual void scheduleGeometryRegen(RivCellSetEnum geometryType) = 0; void scheduleCreateDisplayModelAndRedraw(); @@ -230,6 +228,11 @@ protected: private: RimViewLinker* viewLinkerIfMasterView() const; + + friend class RiuViewer; + void setCurrentTimeStep(int frameIdx); + void endAnimation(); + private: bool m_previousGridModeMeshLinesWasFaults; caf::PdmField m_disableLighting; diff --git a/ApplicationCode/ProjectDataModel/RimViewLinker.cpp b/ApplicationCode/ProjectDataModel/RimViewLinker.cpp index c6e41d2df4..bde63a1260 100644 --- a/ApplicationCode/ProjectDataModel/RimViewLinker.cpp +++ b/ApplicationCode/ProjectDataModel/RimViewLinker.cpp @@ -44,7 +44,6 @@ #include "cvfCamera.h" #include "cvfScene.h" -#include "cafFrameAnimationControl.h" #include "cvfMatrix4.h" #include "cafPdmUiTreeOrdering.h" @@ -103,7 +102,6 @@ void RimViewLinker::updateTimeStep(RimView* sourceView, int timeStep) if (m_masterView && m_masterView->viewer() && sourceView != m_masterView) { m_masterView->viewer()->setCurrentFrame(timeStep); - m_masterView->viewer()->animationControl()->setCurrentFrameOnly(timeStep); } for (size_t i = 0; i < m_viewControllers.size(); i++) @@ -117,7 +115,6 @@ void RimViewLinker::updateTimeStep(RimView* sourceView, int timeStep) && viewLink->managedView()->viewer()) { viewLink->managedView()->viewer()->setCurrentFrame(timeStep); - viewLink->managedView()->viewer()->animationControl()->setCurrentFrameOnly(timeStep); } } } diff --git a/ApplicationCode/UserInterface/RiuViewer.cpp b/ApplicationCode/UserInterface/RiuViewer.cpp index be64e732c4..28d57bc88f 100644 --- a/ApplicationCode/UserInterface/RiuViewer.cpp +++ b/ApplicationCode/UserInterface/RiuViewer.cpp @@ -40,6 +40,7 @@ #include "cafCategoryLegend.h" #include "cafCeetronPlusNavigation.h" #include "cafEffectGenerator.h" +#include "cafFrameAnimationControl.h" #include "cvfCamera.h" #include "cvfFont.h" @@ -610,6 +611,8 @@ void RiuViewer::setCurrentFrame(int frameIndex) CVF_ASSERT(firstRendering); if (m_rimView) m_rimView->setCurrentTimeStep(frameIndex); + + animationControl()->setCurrentFrameOnly(frameIndex); caf::Viewer::slotSetCurrentFrame(frameIndex); }