#1467 Data structure for completions

This commit is contained in:
Bjørnar Grip Fjær 2017-05-10 16:52:51 +02:00
parent bf704caa16
commit 34f00b07ef
5 changed files with 304 additions and 0 deletions

View File

@ -31,6 +31,8 @@ ${CEE_CURRENT_LIST_DIR}RimEclipseWell.h
${CEE_CURRENT_LIST_DIR}RimEclipseWellCollection.h
${CEE_CURRENT_LIST_DIR}RimWellPath.h
${CEE_CURRENT_LIST_DIR}RimWellPathCollection.h
${CEE_CURRENT_LIST_DIR}RimWellPathCompletion.h
${CEE_CURRENT_LIST_DIR}RimWellPathCompletionCollection.h
${CEE_CURRENT_LIST_DIR}RimScriptCollection.h
${CEE_CURRENT_LIST_DIR}RimEclipseStatisticsCase.h
${CEE_CURRENT_LIST_DIR}RimEclipseStatisticsCaseCollection.h
@ -119,6 +121,8 @@ ${CEE_CURRENT_LIST_DIR}RimEclipseWell.cpp
${CEE_CURRENT_LIST_DIR}RimEclipseWellCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellPath.cpp
${CEE_CURRENT_LIST_DIR}RimWellPathCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellPathCompletion.cpp
${CEE_CURRENT_LIST_DIR}RimWellPathCompletionCollection.cpp
${CEE_CURRENT_LIST_DIR}RimScriptCollection.cpp
${CEE_CURRENT_LIST_DIR}RimEclipseStatisticsCase.cpp
${CEE_CURRENT_LIST_DIR}RimEclipseStatisticsCaseCollection.cpp

View File

@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathCompletion.h"
#include "RimProject.h"
#include "cafPdmUiListEditor.h"
CAF_PDM_SOURCE_INIT(RimWellPathCompletion, "WellPathCompletion");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCompletion::RimWellPathCompletion()
{
CAF_PDM_InitObject("WellPathCompletion", ":/Well.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_coordinates, "Coordinates", "Coordinates", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_measuredDepths, "MeasuredDepth", "MeasuredDepth", "", "", "");
m_measuredDepths.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
m_name.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCompletion::~RimWellPathCompletion()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletion::setCoordinates(std::vector< cvf::Vec3d > coordinates)
{
m_coordinates = coordinates;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletion::setMeasuredDepths(std::vector< double > measuredDepths)
{
m_measuredDepths = measuredDepths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletion::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
RimProject* proj;
this->firstAncestorOrThisOfType(proj);
if (proj) proj->createDisplayModelAndRedrawAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletion::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup("Geometry");
geometryGroup->add(&m_coordinates);
geometryGroup->add(&m_measuredDepths);
}

View File

@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimCheckableNamedObject.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafPdmChildField.h"
#include "cafAppEnum.h"
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfVector3.h"
//==================================================================================================
///
///
//==================================================================================================
class RimWellPathCompletion : public RimCheckableNamedObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellPathCompletion();
virtual ~RimWellPathCompletion();
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void setCoordinates(std::vector< cvf::Vec3d > coordinates);
void setMeasuredDepths(std::vector< double > measuredDepths);
std::vector< cvf::Vec3d > coordinates() { return m_coordinates(); }
std::vector< double > measuredDepths() { return m_measuredDepths(); }
private:
caf::PdmField< std::vector< cvf::Vec3d> > m_coordinates;
caf::PdmField< std::vector< double > > m_measuredDepths;
};

View File

@ -0,0 +1,108 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathCompletionCollection.h"
#include "RimEclipseWell.h"
#include "RimWellPathCompletion.h"
#include "RimView.h"
#include "RimProject.h"
#include "RigWellPath.h"
#include "RifWellPathImporter.h"
#include "RiuMainWindow.h"
CAF_PDM_SOURCE_INIT(RimWellPathCompletionCollection, "WellPathCompletionCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCompletionCollection::RimWellPathCompletionCollection()
{
CAF_PDM_InitObject("WellPathCompletions", ":/WellCollection.png", "", "");
m_name.uiCapability()->setUiHidden(true);
m_name = "Completions";
CAF_PDM_InitFieldNoDefault(&m_completions, "Completions", "WellPathCompletions", "", "", "");
m_completions.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCompletionCollection::~RimWellPathCompletionCollection()
{
m_completions.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted(proj);
proj->createDisplayModelAndRedrawAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionCollection::appendCompletion(RimWellPathCompletion* completion)
{
m_completions.push_back(completion);
updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(completion);
RimView* rimView = NULL;
firstAncestorOrThisOfType(rimView);
if (rimView)
{
rimView->scheduleCreateDisplayModelAndRedraw();
}
uiCapability()->setUiHidden(!m_completions.empty());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionCollection::importCompletionsFromFile(const QList<QString> filePaths)
{
RifWellPathImporter wellPathImporter;
foreach(const QString& filePath, filePaths) {
size_t wellDataCount = wellPathImporter.wellDataCount(filePath);
for (size_t i = 0; i < wellDataCount; ++i)
{
RifWellPathImporter::WellData wellData = wellPathImporter.readWellData(filePath, i);
RimWellPathCompletion* wellCompletion = new RimWellPathCompletion();
wellCompletion->setName(wellData.m_name);
wellCompletion->setCoordinates(wellData.m_wellPathGeometry->m_wellPathPoints);
wellCompletion->setMeasuredDepths(wellData.m_wellPathGeometry->m_measuredDepths);
appendCompletion(wellCompletion);
}
}
}

View File

@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimCheckableNamedObject.h"
#include "RimWellPathCompletion.h"
#include "cafPdmObject.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RimWellPathCompletionCollection : public RimCheckableNamedObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellPathCompletionCollection();
~RimWellPathCompletionCollection();
void appendCompletion(RimWellPathCompletion* completion);
void importCompletionsFromFile(const QList<QString> filePaths);
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
caf::PdmChildArrayField<RimWellPathCompletion*> m_completions;
};