mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Remove regions/fields present on project file but not present on SSIHUB
Set UTM input fields enabled/disabled based on UTM mode p4#: 22344
This commit is contained in:
parent
bb2af8269e
commit
76e2afb846
@ -29,17 +29,6 @@ namespace caf {
|
|||||||
setDefault(RimWellPathImport::UTM_FILTER_PROJECT);
|
setDefault(RimWellPathImport::UTM_FILTER_PROJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
template<>
|
|
||||||
void caf::AppEnum< RimWellPathImport::WellTypeEnum >::setUp()
|
|
||||||
{
|
|
||||||
addItem(RimWellPathImport::WELL_ALL, "WELL_ALL", "All");
|
|
||||||
addItem(RimWellPathImport::WELL_SURVEY, "WELL_SURVEY", "Survey");
|
|
||||||
addItem(RimWellPathImport::WELL_PLAN, "WELL_PLAN", "Plan");
|
|
||||||
setDefault(RimWellPathImport::WELL_ALL);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
} // End namespace caf
|
} // End namespace caf
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +45,6 @@ RimWellPathImport::RimWellPathImport()
|
|||||||
|
|
||||||
CAF_PDM_InitField(&wellTypeSurvey, "WellTypeSurvey", true, "Survey", "", "", "");
|
CAF_PDM_InitField(&wellTypeSurvey, "WellTypeSurvey", true, "Survey", "", "", "");
|
||||||
CAF_PDM_InitField(&wellTypePlans, "WellTypePlans", true, "Plans", "", "", "");
|
CAF_PDM_InitField(&wellTypePlans, "WellTypePlans", true, "Plans", "", "", "");
|
||||||
CAF_PDM_InitField(&wellTypeAll, "WellTypeAll", true, "All", "", "", "");
|
|
||||||
|
|
||||||
caf::AppEnum<RimWellPathImport::UtmFilterEnum> defaultUtmMode = UTM_FILTER_OFF;
|
caf::AppEnum<RimWellPathImport::UtmFilterEnum> defaultUtmMode = UTM_FILTER_OFF;
|
||||||
CAF_PDM_InitField(&utmFilterMode, "UtmMode", defaultUtmMode, "Utm filter", "", "", "");
|
CAF_PDM_InitField(&utmFilterMode, "UtmMode", defaultUtmMode, "Utm filter", "", "", "");
|
||||||
@ -76,10 +64,48 @@ void RimWellPathImport::updateRegions(const QStringList& regionStrings, const QS
|
|||||||
{
|
{
|
||||||
assert(regionStrings.size() == fieldStrings.size() && regionStrings.size() == edmIds.size());
|
assert(regionStrings.size() == fieldStrings.size() && regionStrings.size() == edmIds.size());
|
||||||
|
|
||||||
|
std::vector<RimOilRegionEntry*> regionsToRemove;
|
||||||
|
|
||||||
|
// Remove regions and fields not present in last request
|
||||||
|
for (size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++)
|
||||||
|
{
|
||||||
|
if (!regionStrings.contains(this->regions[regionIdx]->name))
|
||||||
|
{
|
||||||
|
regionsToRemove.push_back(this->regions[regionIdx]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::vector<RimOilFieldEntry*> fieldsToRemove;
|
||||||
|
|
||||||
|
for (size_t fIdx = 0; fIdx < this->regions[regionIdx]->fields.size(); fIdx++)
|
||||||
|
{
|
||||||
|
if (!fieldStrings.contains(this->regions[regionIdx]->fields[fIdx]->name))
|
||||||
|
{
|
||||||
|
fieldsToRemove.push_back(this->regions[regionIdx]->fields[fIdx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < fieldsToRemove.size(); i++)
|
||||||
|
{
|
||||||
|
this->regions[regionIdx]->fields.removeChildObject(fieldsToRemove[i]);
|
||||||
|
|
||||||
|
delete fieldsToRemove[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < regionsToRemove.size(); i++)
|
||||||
|
{
|
||||||
|
this->regions.removeChildObject(regionsToRemove[i]);
|
||||||
|
|
||||||
|
delete regionsToRemove[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < regionStrings.size(); i++)
|
for (int i = 0; i < regionStrings.size(); i++)
|
||||||
{
|
{
|
||||||
RimOilRegionEntry* oilRegionEntry = NULL;
|
RimOilRegionEntry* oilRegionEntry = NULL;
|
||||||
bool edmIdFound = false;
|
RimOilFieldEntry* oilFieldEntry = NULL;
|
||||||
|
|
||||||
for (size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++)
|
for (size_t regionIdx = 0; regionIdx < this->regions.size(); regionIdx++)
|
||||||
{
|
{
|
||||||
@ -91,14 +117,12 @@ void RimWellPathImport::updateRegions(const QStringList& regionStrings, const QS
|
|||||||
{
|
{
|
||||||
if (this->regions[regionIdx]->fields[fIdx]->edmId == edmIds[i])
|
if (this->regions[regionIdx]->fields[fIdx]->edmId == edmIds[i])
|
||||||
{
|
{
|
||||||
edmIdFound = true;
|
oilFieldEntry = this->regions[regionIdx]->fields[fIdx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!edmIdFound)
|
|
||||||
{
|
|
||||||
if (!oilRegionEntry)
|
if (!oilRegionEntry)
|
||||||
{
|
{
|
||||||
oilRegionEntry = new RimOilRegionEntry;
|
oilRegionEntry = new RimOilRegionEntry;
|
||||||
@ -107,6 +131,10 @@ void RimWellPathImport::updateRegions(const QStringList& regionStrings, const QS
|
|||||||
this->regions.push_back(oilRegionEntry);
|
this->regions.push_back(oilRegionEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(oilRegionEntry);
|
||||||
|
|
||||||
|
if (!oilFieldEntry)
|
||||||
|
{
|
||||||
RimOilFieldEntry* oilFieldEntry = new RimOilFieldEntry;
|
RimOilFieldEntry* oilFieldEntry = new RimOilFieldEntry;
|
||||||
oilFieldEntry->name = fieldStrings[i];
|
oilFieldEntry->name = fieldStrings[i];
|
||||||
oilFieldEntry->edmId = edmIds[i];
|
oilFieldEntry->edmId = edmIds[i];
|
||||||
@ -116,3 +144,43 @@ void RimWellPathImport::updateRegions(const QStringList& regionStrings, const QS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellPathImport::initAfterRead()
|
||||||
|
{
|
||||||
|
updateFieldVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellPathImport::updateFieldVisibility()
|
||||||
|
{
|
||||||
|
if (utmFilterMode == UTM_FILTER_OFF)
|
||||||
|
{
|
||||||
|
north.setUiReadOnly(true);
|
||||||
|
south.setUiReadOnly(true);
|
||||||
|
east.setUiReadOnly(true);
|
||||||
|
west.setUiReadOnly(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
north.setUiReadOnly(false);
|
||||||
|
south.setUiReadOnly(false);
|
||||||
|
east.setUiReadOnly(false);
|
||||||
|
west.setUiReadOnly(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellPathImport::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if (changedField == &utmFilterMode)
|
||||||
|
{
|
||||||
|
updateFieldVisibility();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ public:
|
|||||||
|
|
||||||
caf::PdmField<bool> wellTypeSurvey;
|
caf::PdmField<bool> wellTypeSurvey;
|
||||||
caf::PdmField<bool> wellTypePlans;
|
caf::PdmField<bool> wellTypePlans;
|
||||||
caf::PdmField<bool> wellTypeAll;
|
|
||||||
|
|
||||||
caf::PdmField< caf::AppEnum< UtmFilterEnum > > utmFilterMode;
|
caf::PdmField< caf::AppEnum< UtmFilterEnum > > utmFilterMode;
|
||||||
caf::PdmField<double> north;
|
caf::PdmField<double> north;
|
||||||
@ -55,5 +54,12 @@ public:
|
|||||||
caf::PdmPointersField<RimOilRegionEntry*> regions;
|
caf::PdmPointersField<RimOilRegionEntry*> regions;
|
||||||
|
|
||||||
void updateRegions(const QStringList& regions, const QStringList& fields, const QStringList& edmIds);
|
void updateRegions(const QStringList& regions, const QStringList& fields, const QStringList& edmIds);
|
||||||
|
|
||||||
|
virtual void initAfterRead();
|
||||||
|
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
||||||
|
|
||||||
|
//private:
|
||||||
|
void updateFieldVisibility();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -119,9 +119,6 @@ void RiuWellImportWizard::downloadFields()
|
|||||||
QFile::remove(wellFileName);
|
QFile::remove(wellFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_wellPathImportObject->regions.deleteAllChildObjects();
|
|
||||||
m_wellPathImportObject->updateConnectedEditors();
|
|
||||||
|
|
||||||
QString completeUrlText = m_webServiceAddress + "/resinsight/projects";
|
QString completeUrlText = m_webServiceAddress + "/resinsight/projects";
|
||||||
QString destinationFileName = jsonFieldsFilePath();
|
QString destinationFileName = jsonFieldsFilePath();
|
||||||
|
|
||||||
@ -701,7 +698,6 @@ FieldSelectionPage::FieldSelectionPage(RimWellPathImport* wellPathImport, QWidge
|
|||||||
layout->addWidget(propertyView);
|
layout->addWidget(propertyView);
|
||||||
propertyView->showProperties(wellPathImport);
|
propertyView->showProperties(wellPathImport);
|
||||||
|
|
||||||
|
|
||||||
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
|
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user