#3741 Make it possible to enable/disable all well path components in plots and 3d view.

* Add check box to casing design and update of plot
* Add isEnabled() method to component interface which controls plotting.
This commit is contained in:
Gaute Lindkvist 2018-11-22 12:57:11 +01:00
parent 132408ab6f
commit ae8cb9d210
17 changed files with 166 additions and 67 deletions

View File

@ -177,59 +177,62 @@ void RivWellPathPartMgr::appendWellPathAttributesToModel(cvf::ModelBasicList*
for (RimWellPathAttribute* attribute : attributes)
{
if (attribute->componentType() == RiaDefines::CASING)
if (attribute->isEnabled())
{
double wellPathRadius = this->wellPathRadius(characteristicCellSize, this->wellPathCollection());
double endMD = attribute->endMD();
double shoeLength = wellPathRadius;
double shoeStartMD = endMD - shoeLength;
std::vector<cvf::Vec3d> displayCoords;
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(shoeStartMD)));
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD)));
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD)));
std::vector<double> radii;
radii.push_back(wellPathRadius);
radii.push_back(wellPathRadius * 2.5);
radii.push_back(wellPathRadius * 1.1);
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(attribute);
cvf::Collection<cvf::Part> parts;
geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, attribute->defaultComponentColor());
for (auto part : parts)
if (attribute->componentType() == RiaDefines::CASING)
{
part->setSourceInfo(objectSourceInfo.p());
model->addPart(part.p());
double wellPathRadius = this->wellPathRadius(characteristicCellSize, this->wellPathCollection());
double endMD = attribute->endMD();
double shoeLength = wellPathRadius;
double shoeStartMD = endMD - shoeLength;
std::vector<cvf::Vec3d> displayCoords;
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(shoeStartMD)));
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD)));
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD)));
std::vector<double> radii;
radii.push_back(wellPathRadius);
radii.push_back(wellPathRadius * 2.5);
radii.push_back(wellPathRadius * 1.1);
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(attribute);
cvf::Collection<cvf::Part> parts;
geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, attribute->defaultComponentColor());
for (auto part : parts)
{
part->setSourceInfo(objectSourceInfo.p());
model->addPart(part.p());
}
}
}
else if (attribute->componentType() == RiaDefines::PACKER)
{
double wellPathRadius = this->wellPathRadius(characteristicCellSize, this->wellPathCollection());
double startMD = attribute->startMD();
double endMD = attribute->endMD();
std::vector<cvf::Vec3d> displayCoords;
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(startMD)));
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(startMD)));
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD)));
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD)));
std::vector<double> radii;
radii.push_back(wellPathRadius);
radii.push_back(wellPathRadius * 2.5);
radii.push_back(wellPathRadius * 2.5);
radii.push_back(wellPathRadius);
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(attribute);
cvf::Collection<cvf::Part> parts;
geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, attribute->defaultComponentColor());
for (auto part : parts)
else if (attribute->componentType() == RiaDefines::PACKER)
{
part->setSourceInfo(objectSourceInfo.p());
model->addPart(part.p());
double wellPathRadius = this->wellPathRadius(characteristicCellSize, this->wellPathCollection());
double startMD = attribute->startMD();
double endMD = attribute->endMD();
std::vector<cvf::Vec3d> displayCoords;
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(startMD)));
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(startMD)));
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD)));
displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD)));
std::vector<double> radii;
radii.push_back(wellPathRadius);
radii.push_back(wellPathRadius * 2.5);
radii.push_back(wellPathRadius * 2.5);
radii.push_back(wellPathRadius);
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo(attribute);
cvf::Collection<cvf::Part> parts;
geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, attribute->defaultComponentColor());
for (auto part : parts)
{
part->setSourceInfo(objectSourceInfo.p());
model->addPart(part.p());
}
}
}
}

View File

@ -632,6 +632,17 @@ cvf::BoundingBox RimFishbonesMultipleSubs::boundingBoxInDomainCoords() const
return bb;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFishbonesMultipleSubs::isEnabled() const
{
RimFishbonesCollection* collection;
this->firstAncestorOrThisOfTypeAsserted(collection);
return collection->isChecked() && isActive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -110,6 +110,7 @@ public:
cvf::BoundingBox boundingBoxInDomainCoords() const override;
// Overrides from RimWellPathCompletionsInterface
bool isEnabled() const override;
RiaDefines::WellPathComponentType componentType() const override;
QString componentLabel() const override;
QString componentTypeLabel() const override;

View File

@ -39,6 +39,7 @@
#include "RimReservoirCellResultsStorage.h"
#include "RimStimPlanColors.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimWellPathFractureCollection.h"
#include "RivWellFracturePartMgr.h"
@ -286,6 +287,16 @@ void RimFracture::clearCachedNonDarcyProperties()
m_cachedFractureProperties = NonDarcyData();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFracture::isEnabled() const
{
RimWellPathFractureCollection* fractureCollection = nullptr;
this->firstAncestorOrThisOfTypeAsserted(fractureCollection);
return fractureCollection->isChecked() && isChecked();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -129,6 +129,7 @@ public:
friend class RimFractureTemplate;
// RimWellPathCompletionsInterface overrides.
bool isEnabled() const override;
RiaDefines::WellPathComponentType componentType() const override;
QString componentLabel() const override;
QString componentTypeLabel() const override;

View File

@ -23,6 +23,7 @@
#include "RigCaseCellResultsData.h"
#include "RigWellPath.h"
#include "RimPerforationCollection.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathValve.h"
@ -232,6 +233,16 @@ std::vector<RimWellPathValve*> RimPerforationInterval::valves() const
return allValves;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPerforationInterval::isEnabled() const
{
RimPerforationCollection* perforationCollection;
this->firstAncestorOrThisOfTypeAsserted(perforationCollection);
return perforationCollection->isChecked() && isChecked();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -70,6 +70,7 @@ public:
std::vector<RimWellPathValve*> valves() const;
// RimWellPathCompletionInterface overrides
bool isEnabled() const override;
RiaDefines::WellPathComponentType componentType() const override;
QString componentLabel() const override;
QString componentTypeLabel() const override;

View File

@ -31,6 +31,7 @@
class RimWellPathComponentInterface
{
public:
virtual bool isEnabled() const = 0;
virtual RiaDefines::WellPathComponentType componentType() const = 0;
virtual QString componentLabel() const = 0;
virtual QString componentTypeLabel() const = 0;

View File

@ -103,6 +103,16 @@ std::vector<double> RimWellPathValve::valveLocations() const
return valveDepths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPathValve::isEnabled() const
{
RimPerforationInterval* perforationInterval = nullptr;
this->firstAncestorOrThisOfType(perforationInterval);
return perforationInterval->isEnabled() && isChecked();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -46,6 +46,7 @@ public:
std::vector<double> valveLocations() const;
// Overrides from RimWellPathCompletionInterface
bool isEnabled() const override;
RiaDefines::WellPathComponentType componentType() const override;
QString componentLabel() const override;
QString componentTypeLabel() const override;

View File

@ -1799,7 +1799,6 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
m_wellPathAttributePlotObjects.push_back(std::unique_ptr<RiuWellPathComponentPlotItem>(new RiuWellPathComponentPlotItem(wellPathAttributeSource())));
}
if (m_showWellPathAttributes)
{
if (m_wellPathAttributeCollection)
@ -1813,13 +1812,16 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
std::set<QString> attributesAssignedToLegend;
for (RimWellPathAttribute* attribute : attributes)
{
std::unique_ptr<RiuWellPathComponentPlotItem> plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), attribute));
QString legendTitle = plotItem->legendTitle();
bool contributeToLegend = m_wellPathAttributesInLegend() &&
!attributesAssignedToLegend.count(legendTitle);
plotItem->setContributeToLegend(contributeToLegend);
m_wellPathAttributePlotObjects.push_back(std::move(plotItem));
attributesAssignedToLegend.insert(legendTitle);
if (attribute->isEnabled())
{
std::unique_ptr<RiuWellPathComponentPlotItem> plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), attribute));
QString legendTitle = plotItem->legendTitle();
bool contributeToLegend = m_wellPathAttributesInLegend() &&
!attributesAssignedToLegend.count(legendTitle);
plotItem->setContributeToLegend(contributeToLegend);
m_wellPathAttributePlotObjects.push_back(std::move(plotItem));
attributesAssignedToLegend.insert(legendTitle);
}
}
}
}
@ -1831,13 +1833,16 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
std::set<QString> completionsAssignedToLegend;
for (const RimWellPathComponentInterface* completion : allCompletions)
{
std::unique_ptr<RiuWellPathComponentPlotItem> plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), completion));
QString legendTitle = plotItem->legendTitle();
bool contributeToLegend = m_wellPathCompletionsInLegend() &&
!completionsAssignedToLegend.count(legendTitle);
plotItem->setContributeToLegend(contributeToLegend);
m_wellPathAttributePlotObjects.push_back(std::move(plotItem));
completionsAssignedToLegend.insert(legendTitle);
if (completion->isEnabled())
{
std::unique_ptr<RiuWellPathComponentPlotItem> plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), completion));
QString legendTitle = plotItem->legendTitle();
bool contributeToLegend = m_wellPathCompletionsInLegend() &&
!completionsAssignedToLegend.count(legendTitle);
plotItem->setContributeToLegend(contributeToLegend);
m_wellPathAttributePlotObjects.push_back(std::move(plotItem));
completionsAssignedToLegend.insert(legendTitle);
}
}
}

View File

@ -188,6 +188,14 @@ double RimWellPath::wellPathRadiusScaleFactor() const
return m_wellPathRadiusScaleFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPath::isEnabled() const
{
return m_showWellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -124,6 +124,7 @@ public:
// RimWellPathComponentInterface overrides
bool isEnabled() const override;
RiaDefines::WellPathComponentType componentType() const override;
QString componentLabel() const override;
QString componentTypeLabel() const override;

View File

@ -91,6 +91,16 @@ void RimWellPathAttribute::setDepthsFromWellPath(const RimWellPath* wellPath)
m_endMD = wellPath->wellPathGeometry()->measureDepths().back();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPathAttribute::isEnabled() const
{
RimWellPathAttributeCollection* collection = nullptr;
this->firstAncestorOrThisOfTypeAsserted(collection);
return collection->isChecked();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -46,6 +46,7 @@ public:
void setDepthsFromWellPath(const RimWellPath* wellPath);
// Overrides from RimWellPathCompletionInterface
bool isEnabled() const override;
RiaDefines::WellPathComponentType componentType() const override;
QString componentLabel() const override;
QString componentTypeLabel() const override;
@ -54,9 +55,9 @@ public:
double endMD() const override;
private:
bool isDiameterSupported() const;
bool isDiameterSupported() const;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
static QString generateInchesLabel(double diameter);
static QString generateInchesLabel(double diameter);
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;

View File

@ -17,6 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathAttributeCollection.h"
#include "RimProject.h"
#include "RimWellPathAttribute.h"
#include "RimWellLogTrack.h"
@ -37,6 +38,7 @@ RimWellPathAttributeCollection::RimWellPathAttributeCollection()
m_attributes.uiCapability()->setUiEditorTypeName(caf::PdmUiTableViewEditor::uiEditorTypeName());
m_attributes.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
m_attributes.uiCapability()->setCustomContextMenuEnabled(true);
this->setName("Casing Design");
}
//--------------------------------------------------------------------------------------------------
@ -157,3 +159,20 @@ void RimWellPathAttributeCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering
{
uiTreeOrdering.skipRemainingChildren(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathAttributeCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
if (changedField == this->objectToggleField())
{
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted(proj);
proj->scheduleCreateDisplayModelAndRedrawAllViews();
this->updateAllReferringTracks();
}
}

View File

@ -17,6 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimCheckableNamedObject.h"
#include "cafAppEnum.h"
#include "cvfBase.h"
#include "cafPdmChildArrayField.h"
@ -25,7 +27,7 @@
class RimWellPathAttribute;
class RimWellPathAttributeCollection : public caf::PdmObject
class RimWellPathAttributeCollection : public RimCheckableNamedObject
{
CAF_PDM_HEADER_INIT;
public:
@ -37,11 +39,13 @@ public:
void insertAttribute(RimWellPathAttribute* insertBefore, RimWellPathAttribute* attribute);
void deleteAttribute(RimWellPathAttribute* attributeToDelete);
void deleteAllAttributes();
protected:
void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
caf::PdmChildArrayField<RimWellPathAttribute*> m_attributes;