mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Start on getting the Metadata into the GUI
This commit is contained in:
parent
4e9f91274c
commit
1522fe2514
@ -80,7 +80,6 @@ bool RimGeoMechCase::openGeoMechCase()
|
||||
|
||||
if (this->m_geoMechCaseData.notNull()) return true;
|
||||
|
||||
cvf::ref<RifGeoMechReaderInterface> readerInterface;
|
||||
|
||||
if (!QFile::exists(m_caseFileName()))
|
||||
{
|
||||
@ -89,10 +88,10 @@ bool RimGeoMechCase::openGeoMechCase()
|
||||
|
||||
|
||||
#ifdef USE_ODB_API
|
||||
readerInterface = new RifOdbReader;
|
||||
m_readerInterface = new RifOdbReader;
|
||||
|
||||
m_geoMechCaseData = new RigGeoMechCaseData;
|
||||
if (readerInterface->readFemParts(m_caseFileName().toStdString(), m_geoMechCaseData->femParts()))
|
||||
if (m_readerInterface->readFemParts(m_caseFileName().toStdString(), m_geoMechCaseData->femParts()))
|
||||
{
|
||||
|
||||
// Todo: Default Results stuff, if needed
|
||||
@ -105,3 +104,11 @@ bool RimGeoMechCase::openGeoMechCase()
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifGeoMechReaderInterface* RimGeoMechCase::readerInterface()
|
||||
{
|
||||
return m_readerInterface.p();
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
class RimGeoMechView;
|
||||
class RigGeoMechCaseData;
|
||||
class RifGeoMechReaderInterface;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -47,7 +49,7 @@ public:
|
||||
RimGeoMechView* createAndAddReservoirView();
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
|
||||
RifGeoMechReaderInterface* readerInterface();
|
||||
// Fields:
|
||||
caf::PdmField<QString> caseUserDescription;
|
||||
caf::PdmPointersField<RimGeoMechView*> geoMechViews;
|
||||
@ -55,4 +57,6 @@ public:
|
||||
private:
|
||||
cvf::ref<RigGeoMechCaseData> m_geoMechCaseData;
|
||||
caf::PdmField<QString> m_caseFileName;
|
||||
|
||||
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
|
||||
};
|
||||
|
@ -21,8 +21,20 @@
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimDefines.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RifGeoMechReaderInterface.h"
|
||||
|
||||
namespace caf {
|
||||
|
||||
template<>
|
||||
void caf::AppEnum< RimGeoMechResultSlot::ResultPositionEnum >::setUp()
|
||||
{
|
||||
addItem(RimGeoMechResultSlot::NODAL, "NODAL", "Nodal");
|
||||
addItem(RimGeoMechResultSlot::ELEMENT_NODAL, "ELEMENT_NODAL", "Element Nodal");
|
||||
addItem(RimGeoMechResultSlot::INTEGRATION_POINT,"INTEGRATION_POINT","Integration Point");
|
||||
setDefault(RimGeoMechResultSlot::NODAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimGeoMechResultSlot, "GeoMechResultSlot");
|
||||
@ -39,7 +51,9 @@ RimGeoMechResultSlot::RimGeoMechResultSlot(void)
|
||||
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", "", "", "");
|
||||
this->legendConfig = new RimLegendConfig();
|
||||
|
||||
CAF_PDM_InitField(&m_resultVariable, "ResultVariable", RimDefines::undefinedResultName(), "Variable", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultPositionType, "ResultPositionType" , "Result Position", "", "", "");
|
||||
CAF_PDM_InitField(&m_resultFieldName, "ResultFieldName", RimDefines::undefinedResultName(), "Field Name", "", "", "");
|
||||
CAF_PDM_InitField(&m_resultComponentName, "ResultComponentName", RimDefines::undefinedResultName(), "Component", "", "", "");
|
||||
|
||||
}
|
||||
|
||||
@ -60,17 +74,41 @@ QList<caf::PdmOptionItemInfo> RimGeoMechResultSlot::calculateValueOptions(const
|
||||
|
||||
if (m_reservoirView)
|
||||
{
|
||||
// RimGeoMechCase* gmCase = m_reservoirView->geoMechCase();
|
||||
|
||||
}
|
||||
|
||||
if (&m_resultVariable == fieldNeedingOptions)
|
||||
RimGeoMechCase* gmCase = m_reservoirView->geoMechCase();
|
||||
cvf::ref<RifGeoMechReaderInterface> reader = gmCase->readerInterface();
|
||||
if (reader.notNull())
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("Von Mises", QString("VonMises")) );
|
||||
options.push_back(caf::PdmOptionItemInfo("Sigma XX", QString("SIGXX")) );
|
||||
options.push_back(caf::PdmOptionItemInfo("Sigma YY", QString("SIGYY")) );
|
||||
std::map<std::string, std::vector<std::string> > fieldCompNames;
|
||||
|
||||
if (m_resultPositionType == NODAL)
|
||||
{
|
||||
fieldCompNames = reader->scalarNodeFieldAndComponentNames();
|
||||
}
|
||||
|
||||
if (&m_resultFieldName == fieldNeedingOptions)
|
||||
{
|
||||
for (auto it = fieldCompNames.begin(); it != fieldCompNames.end(); ++it)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(it->first), QString::fromStdString(it->first)));
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_resultComponentName == fieldNeedingOptions)
|
||||
{
|
||||
auto fieldIt = fieldCompNames.find(m_resultFieldName().toAscii().data());
|
||||
if (fieldIt != fieldCompNames.end())
|
||||
{
|
||||
for (auto compIt = fieldIt->second.begin(); compIt != fieldIt->second.end(); ++compIt)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(*compIt), QString::fromStdString(*compIt)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.size()) options.push_back(caf::PdmOptionItemInfo("Undefined", "Undefined"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
class RimLegendConfig;
|
||||
class RimGeoMechView;
|
||||
@ -42,13 +43,20 @@ public:
|
||||
|
||||
caf::PdmField<RimLegendConfig*> legendConfig;
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
|
||||
enum ResultPositionEnum {
|
||||
NODAL,
|
||||
ELEMENT_NODAL,
|
||||
INTEGRATION_POINT
|
||||
};
|
||||
|
||||
private:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
|
||||
caf::PdmField<QString> m_resultType;
|
||||
caf::PdmField<QString> m_resultVariable;
|
||||
caf::PdmField<QString> m_componentName;
|
||||
|
||||
caf::PdmField<caf::AppEnum<ResultPositionEnum> > m_resultPositionType;
|
||||
caf::PdmField<QString> m_resultFieldName;
|
||||
caf::PdmField<QString> m_resultComponentName;
|
||||
|
||||
caf::PdmPointer<RimGeoMechView> m_reservoirView;
|
||||
};
|
||||
|
@ -87,7 +87,7 @@ RimGeoMechView::RimGeoMechView(void)
|
||||
CAF_PDM_InitField(&meshMode, "MeshMode", defaultMeshType, "Grid lines", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&surfaceMode, "SurfaceMode", "Grid surface", "", "", "");
|
||||
|
||||
//this->cellResult()->setReservoirView(this);
|
||||
this->cellResult()->setReservoirView(this);
|
||||
this->cellResult()->legendConfig()->setPosition(cvf::Vec2ui(10, 120));
|
||||
this->cellResult()->legendConfig()->setReservoirView(this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user