(#657) Added option items for well path and simulation wells

This commit is contained in:
Magne Sjaastad 2015-11-18 12:16:04 +01:00
parent 13c5dbfbd2
commit 77d66f59af
6 changed files with 86 additions and 23 deletions

View File

@ -19,6 +19,14 @@
#include "RimCrossSection.h"
#include "RiaApplication.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellPath.h"
@ -49,7 +57,11 @@ RimCrossSection::RimCrossSection()
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
isActive.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&crossSectionType, "CrossSectionType", "Type", "", "", "");
CAF_PDM_InitFieldNoDefault(&wellPath, "WellPath", "Well Path", "", "", "");
CAF_PDM_InitFieldNoDefault(&simulationWell, "SimulationWell", "Simulation Well", "", "", "");
CAF_PDM_InitFieldNoDefault(&crossSectionType, "CrossSectionType", "Type", "", "", "");
uiCapability()->setUiChildrenHidden(true);
}
//--------------------------------------------------------------------------------------------------
@ -65,7 +77,23 @@ void RimCrossSection::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
void RimCrossSection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&name);
uiOrdering.add(&crossSectionType);
if (crossSectionType == CS_WELL_PATH)
{
uiOrdering.add(&wellPath);
}
else if (crossSectionType == CS_SIMULATION_WELL)
{
uiOrdering.add(&simulationWell);
}
else
{
}
uiOrdering.setForgetRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
@ -75,29 +103,46 @@ QList<caf::PdmOptionItemInfo> RimCrossSection::calculateValueOptions(const caf::
{
QList<caf::PdmOptionItemInfo> options;
if (useOptionsOnly) (*useOptionsOnly) = true;
/*
if (&gridIndex == fieldNeedingOptions)
if (fieldNeedingOptions == &wellPath)
{
for (int gIdx = 0; gIdx < parentContainer()->gridCount(); ++gIdx)
RimProject* proj = RiaApplication::instance()->project();
if (proj->activeOilField()->wellPathCollection())
{
QString gridName;
gridName += parentContainer()->gridName(gIdx);
if (gIdx == 0)
caf::PdmChildArrayField<RimWellPath*>& wellPaths = proj->activeOilField()->wellPathCollection()->wellPaths;
QIcon wellIcon(":/Well.png");
for (size_t i = 0; i < wellPaths.size(); i++)
{
if (gridName.isEmpty())
gridName += "Main Grid";
else
gridName += " (Main Grid)";
options.push_back(caf::PdmOptionItemInfo(wellPaths[i]->name(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(wellPaths[i])), false, wellIcon));
}
}
caf::PdmOptionItemInfo item(gridName, (int)gIdx);
options.push_back(item);
if (options.size() == 0)
{
options.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
}
}
*/
else if (fieldNeedingOptions == &simulationWell)
{
RimEclipseWellCollection* coll = simulationWellCollection();
if (coll)
{
caf::PdmChildArrayField<RimEclipseWell*>& eclWells = coll->wells;
QIcon simWellIcon(":/Well.png");
for (size_t i = 0; i < eclWells.size(); i++)
{
options.push_back(caf::PdmOptionItemInfo(eclWells[i]->name(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(eclWells[i])), false, simWellIcon));
}
}
if (options.size() == 0)
{
options.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
}
}
return options;
}
@ -116,3 +161,19 @@ caf::PdmFieldHandle* RimCrossSection::objectToggleField()
{
return &isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseWellCollection* RimCrossSection::simulationWellCollection()
{
RimEclipseView* eclipseView = NULL;
firstAnchestorOrThisOfType(eclipseView);
if (eclipseView)
{
return eclipseView->wellCollection;
}
return NULL;
}

View File

@ -26,6 +26,7 @@
class RimWellPath;
class RimEclipseWell;
class RimEclipseWellCollection;
//==================================================================================================
@ -65,6 +66,7 @@ protected:
// virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName);
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
private:
private:
RimEclipseWellCollection* simulationWellCollection();
};

View File

@ -20,7 +20,6 @@
#include "RimEclipseWell.h"
#include "RigSingleWellResultsData.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"

View File

@ -20,6 +20,8 @@
#pragma once
#include "RigSingleWellResultsData.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
@ -30,7 +32,6 @@
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
class RigSingleWellResultsData;
class RimEclipseView;
//==================================================================================================

View File

@ -24,7 +24,6 @@
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellLogFile.h"
#include "RimWellPathCollection.h"
#include "RimProject.h"
#include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h"

View File

@ -20,6 +20,9 @@
#pragma once
#include "RigWellPath.h"
#include "RimWellPathCollection.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
@ -29,11 +32,9 @@
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
#include "RigWellPath.h"
class RimProject;
class RivWellPathPartMgr;
class RimWellPathCollection;
class RimWellLogFile;
//==================================================================================================