mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3595 Implement auto naming for contour maps
This commit is contained in:
@@ -21,9 +21,11 @@
|
||||
#include "RivContourMapProjectionPartMgr.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RimContourMapProjection.h"
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimContourMapNameConfig.h"
|
||||
#include "RimContourMapProjection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
@@ -58,9 +60,13 @@ RimContourMapView::RimContourMapView()
|
||||
wellCollection()->isActive = false;
|
||||
faultCollection()->showFaultCollection = false;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", "");
|
||||
m_nameConfig = new RimContourMapNameConfig(this);
|
||||
|
||||
m_contourMapProjectionPartMgr = new RivContourMapProjectionPartMgr(contourMapProjection(), this);
|
||||
|
||||
((RiuViewerToViewInterface*)this)->setCameraPosition(defaultViewMatrix);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -71,6 +77,50 @@ RimContourMapProjection* RimContourMapView::contourMapProjection() const
|
||||
return m_contourMapProjection().p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimContourMapView::createAutoName() const
|
||||
{
|
||||
QStringList autoName;
|
||||
|
||||
if (!m_nameConfig->customName().isEmpty())
|
||||
{
|
||||
autoName.push_back(m_nameConfig->customName());
|
||||
}
|
||||
|
||||
QStringList generatedAutoTags;
|
||||
|
||||
RimCase* ownerCase = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(ownerCase);
|
||||
|
||||
if (m_nameConfig->addCaseName())
|
||||
{
|
||||
generatedAutoTags.push_back(ownerCase->caseUserDescription());
|
||||
}
|
||||
|
||||
if (m_nameConfig->addAggregationType())
|
||||
{
|
||||
generatedAutoTags.push_back(contourMapProjection()->resultAggregationText());
|
||||
}
|
||||
|
||||
if (m_nameConfig->addProperty() && !contourMapProjection()->isColumnResult())
|
||||
{
|
||||
generatedAutoTags.push_back(cellResult()->resultVariable());
|
||||
}
|
||||
|
||||
if (m_nameConfig->addSampleSpacing())
|
||||
{
|
||||
generatedAutoTags.push_back(QString("%1").arg(contourMapProjection()->sampleSpacingFactor(), 3, 'f', 2));
|
||||
}
|
||||
|
||||
if (!generatedAutoTags.empty())
|
||||
{
|
||||
autoName.push_back(generatedAutoTags.join(", "));
|
||||
}
|
||||
return autoName.join(": ");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -106,6 +156,8 @@ void RimContourMapView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
viewGroup->add(this->userDescriptionField());
|
||||
viewGroup->add(this->backgroundColorField());
|
||||
viewGroup->add(&m_showAxisLines);
|
||||
|
||||
m_nameConfig()->createUiGroup(uiConfigName, uiOrdering);
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
}
|
||||
|
||||
@@ -240,3 +292,11 @@ void RimContourMapView::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|
||||
scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimContourMapView::userDescriptionField()
|
||||
{
|
||||
return m_nameConfig()->nameField();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user