(#672) Refactoring and Fix of side effects introduced by 704f4fa

This commit is contained in:
Jacob Støren
2015-12-01 12:27:19 +01:00
parent 704f4fa42b
commit ee11d4fde7
6 changed files with 21 additions and 42 deletions

View File

@@ -91,7 +91,6 @@ RimWellPath::RimWellPath()
m_wellLogFile.uiCapability()->setUiHidden(true);
m_wellPath = NULL;
m_project = NULL;
}
@@ -148,7 +147,9 @@ RivWellPathPartMgr* RimWellPath::partMgr()
{
if (m_wellPathPartMgr.isNull())
{
m_wellPathPartMgr = new RivWellPathPartMgr(m_wellPathCollection, this);
RimWellPathCollection* wpColl;
this->firstAnchestorOrThisOfType(wpColl);
if (wpColl) m_wellPathPartMgr = new RivWellPathPartMgr(wpColl, this);
}
return m_wellPathPartMgr.p();
@@ -161,7 +162,10 @@ RivWellPathPartMgr* RimWellPath::partMgr()
void RimWellPath::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
partMgr()->scheduleGeometryRegen();
if (m_project) m_project->createDisplayModelAndRedrawAllViews();
RimProject* proj;
this->firstAnchestorOrThisOfType(proj);
if (proj) proj->createDisplayModelAndRedrawAllViews();
}
@@ -177,7 +181,7 @@ caf::PdmFieldHandle* RimWellPath::objectToggleField()
//--------------------------------------------------------------------------------------------------
/// Read JSON or ascii file containing well path data
//--------------------------------------------------------------------------------------------------
bool RimWellPath::readWellPathFile(QString* errorMessage)
bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathAsciiFileReader* asciiReader)
{
QFileInfo fileInf(filepath());
@@ -189,7 +193,7 @@ bool RimWellPath::readWellPathFile(QString* errorMessage)
}
else
{
this->readAsciiWellPathFile();
this->readAsciiWellPathFile(asciiReader);
}
return true;
@@ -254,9 +258,11 @@ void RimWellPath::readJsonWellPathFile()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPath::readAsciiWellPathFile()
void RimWellPath::readAsciiWellPathFile(RifWellPathAsciiFileReader* asciiReader)
{
RifWellPathAsciiFileReader::WellData wpData = m_wellPathCollection->asciiFileReader()->readWellData(filepath(), wellPathIndexInFile());
CVF_ASSERT(asciiReader);
RifWellPathAsciiFileReader::WellData wpData = asciiReader->readWellData(filepath(), wellPathIndexInFile());
this->name = wpData.m_name;
setWellPathGeometry(wpData.m_wellPathGeometry.p());