(#668) Autmatically change itersection name when changing well or branch

This commit is contained in:
Jacob Støren 2015-11-27 10:13:29 +01:00
parent eb4fefce7c
commit 5c0c18ca30
2 changed files with 57 additions and 30 deletions

View File

@ -109,6 +109,15 @@ void RimCrossSection::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
updateWellCenterline();
m_branchIndex = -1;
}
if (changedField == &simulationWell
|| changedField == &wellPath
|| changedField == &m_branchIndex)
{
updateName();
}
}
//--------------------------------------------------------------------------------------------------
@ -394,3 +403,23 @@ void RimCrossSection::updateWellExtentDefaultValue()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCrossSection::updateName()
{
if (type == CS_SIMULATION_WELL && simulationWell())
{
name = simulationWell()->name();
if (m_branchIndex() != -1)
{
name = name() + " Branch " + QString::number(m_branchIndex() + 1);
}
}
else if (type() == CS_WELL_PATH && wellPath())
{
name = wellPath()->name();
}
}

View File

@ -59,41 +59,39 @@ public:
public:
RimCrossSection();
caf::PdmField<QString> name;
caf::PdmField<bool> isActive;
caf::PdmField<QString> name;
caf::PdmField<bool> isActive;
caf::PdmField< caf::AppEnum< CrossSectionEnum > > type;
caf::PdmField< caf::AppEnum< CrossSectionDirEnum > > direction;
caf::PdmPtrField<RimWellPath*> wellPath;
caf::PdmPtrField<RimEclipseWell*> simulationWell;
caf::PdmPtrField<RimWellPath*> wellPath;
caf::PdmPtrField<RimEclipseWell*> simulationWell;
std::vector< std::vector <cvf::Vec3d> > polyLines() const;
void addExtents(std::vector<cvf::Vec3d> &polyLine) const;
RivCrossSectionPartMgr* crossSectionPartMgr();
std::vector< std::vector <cvf::Vec3d> > polyLines() const;
RivCrossSectionPartMgr* crossSectionPartMgr();
protected:
virtual caf::PdmFieldHandle* userDescriptionField();
virtual caf::PdmFieldHandle* objectToggleField();
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
private:
caf::PdmField<int> m_branchIndex;
caf::PdmField<double> m_extentLength;
RimEclipseWellCollection* simulationWellCollection();
void updateWellCenterline() const;
void updateWellExtentDefaultValue();
private:
cvf::ref<RivCrossSectionPartMgr> m_crossSectionPartMgr;
mutable std::vector< std::vector <cvf::Vec3d> > m_wellBranchCenterlines;
virtual caf::PdmFieldHandle* userDescriptionField();
virtual caf::PdmFieldHandle* objectToggleField();
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
private:
caf::PdmField<int> m_branchIndex;
caf::PdmField<double> m_extentLength;
RimEclipseWellCollection* simulationWellCollection();
void updateWellCenterline() const;
void updateWellExtentDefaultValue();
void addExtents(std::vector<cvf::Vec3d> &polyLine) const;
void updateName();
private:
cvf::ref<RivCrossSectionPartMgr> m_crossSectionPartMgr;
mutable
std::vector< std::vector <cvf::Vec3d> > m_wellBranchCenterlines;
};