#2727 Legends : Add RimLegendConfig as base for Regular and Ternary

This commit is contained in:
Magne Sjaastad
2018-04-18 10:32:51 +02:00
parent 3bc85ce794
commit 71b7bd21f9
15 changed files with 215 additions and 51 deletions

View File

@@ -103,6 +103,7 @@ ${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogFileCurve.h
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogExtractionCurve.h
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogRftCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimVirtualPerforationResults.h
${CMAKE_CURRENT_LIST_DIR}/RimLegendConfig.h
)
@@ -210,6 +211,7 @@ ${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogFileCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogExtractionCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/Rim3dWellLogRftCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimVirtualPerforationResults.cpp
${CMAKE_CURRENT_LIST_DIR}/RimLegendConfig.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -338,6 +338,24 @@ bool Rim2dIntersectionView::showDefiningPoints() const
return m_showDefiningPoints;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimLegendConfig*> Rim2dIntersectionView::legendConfigs() const
{
std::vector<RimLegendConfig*> legendsIn3dView;
Rim3dView* associated3dView = nullptr;
this->firstAncestorOrThisOfType(associated3dView);
if (associated3dView)
{
legendsIn3dView = associated3dView->legendConfigs();
}
return legendsIn3dView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -68,6 +68,8 @@ public:
bool showDefiningPoints() const;
std::vector<RimLegendConfig*> legendConfigs() const override;
protected:
void updateLegends() override;

View File

@@ -38,8 +38,9 @@
#include <QPointer>
class RimCase;
class RiuViewer;
class RimLegendConfig;
class RimWellPathCollection;
class RiuViewer;
class RivWellPathsPartMgr;
namespace cvf
@@ -138,6 +139,7 @@ public:
cvf::ref<caf::DisplayCoordTransform> displayCoordTransform() const override;
virtual RimCase* ownerCase() const = 0;
virtual std::vector<RimLegendConfig*> legendConfigs() const = 0;
protected:
static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName);

View File

@@ -1729,6 +1729,24 @@ void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalV
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimLegendConfig*> RimEclipseView::legendConfigs() const
{
std::vector<RimLegendConfig*> absLegends;
absLegends.push_back(cellResult()->legendConfig());
absLegends.push_back(cellResult()->ternaryLegendConfig());
absLegends.push_back(faultResultSettings()->customFaultResult()->legendConfig());
absLegends.push_back(faultResultSettings()->customFaultResult()->ternaryLegendConfig());
absLegends.push_back(cellEdgeResult()->legendConfig());
absLegends.push_back(fractureColors()->activeLegend());
absLegends.push_back(virtualPerforationResult()->legendConfig());
return absLegends;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -138,6 +138,8 @@ public:
virtual bool isUsingFormationNames() const override;
virtual void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStep) override;
std::vector<RimLegendConfig*> legendConfigs() const override;
protected:
virtual void initAfterRead() override;

View File

@@ -517,6 +517,19 @@ RimTensorResults* RimGeoMechView::tensorResults()
return m_tensorResults;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimLegendConfig*> RimGeoMechView::legendConfigs() const
{
std::vector<RimLegendConfig*> absLegendConfigs;
absLegendConfigs.push_back(cellResult()->legendConfig());
return absLegendConfigs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -93,6 +93,8 @@ public:
const RimTensorResults* tensorResults() const;
RimTensorResults* tensorResults();
std::vector<RimLegendConfig*> legendConfigs() const override;
protected:
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
virtual void onLoadDataAndUpdate() override;

View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// 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 "RimLegendConfig.h"
// NB! Special macro for pure virtual class
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimLegendConfig, "LegendConfig");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimLegendConfig::RimLegendConfig()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimLegendConfig::~RimLegendConfig()
{
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// 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 "cafPdmField.h"
#include "cafPdmObject.h"
namespace caf
{
class TitledOverlayFrame;
}
//==================================================================================================
///
///
//==================================================================================================
class RimLegendConfig : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimLegendConfig();
virtual ~RimLegendConfig();
virtual const caf::TitledOverlayFrame* titledOverlayFrame() const = 0;
virtual caf::TitledOverlayFrame* titledOverlayFrame() = 0;
};

View File

@@ -675,6 +675,36 @@ bool RimRegularLegendConfig::showLegend() const
return m_showLegend;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::TitledOverlayFrame* RimRegularLegendConfig::titledOverlayFrame()
{
if (m_currentScalarMapper == m_categoryMapper)
{
return m_categoryLegend.p();
}
else
{
return m_scalarMapperLegend.p();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::TitledOverlayFrame* RimRegularLegendConfig::titledOverlayFrame() const
{
if (m_currentScalarMapper == m_categoryMapper)
{
return m_categoryLegend.p();
}
else
{
return m_scalarMapperLegend.p();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -19,13 +19,13 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimLegendConfig.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfArray.h"
#include "cafPdmObject.h"
#include "cafPdmField.h"
#include <tuple>
namespace cvf
@@ -53,7 +53,7 @@ class Rim3dView;
///
///
//==================================================================================================
class RimRegularLegendConfig: public caf::PdmObject
class RimRegularLegendConfig : public RimLegendConfig
{
CAF_PDM_HEADER_INIT;
public:
@@ -123,6 +123,9 @@ public:
caf::TitledOverlayFrame* legend();
bool showLegend() const;
const caf::TitledOverlayFrame* titledOverlayFrame() const override;
caf::TitledOverlayFrame* titledOverlayFrame() override;
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void initAfterRead();

View File

@@ -497,6 +497,25 @@ const RivTernaryScalarMapper* RimTernaryLegendConfig::scalarMapper() const
return m_scalarMapper.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::TitledOverlayFrame* RimTernaryLegendConfig::titledOverlayFrame() const
{
return m_legend.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::TitledOverlayFrame* RimTernaryLegendConfig::titledOverlayFrame()
{
return m_legend.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimTernaryLegendConfig::objectToggleField()
{
return &m_showLegend;

View File

@@ -19,12 +19,12 @@
#pragma once
#include "RimLegendConfig.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
class RimEclipseView;
class RivTernarySaturationOverlayItem;
@@ -41,7 +41,7 @@ namespace cvf
///
///
//==================================================================================================
class RimTernaryLegendConfig : public caf::PdmObject
class RimTernaryLegendConfig : public RimLegendConfig
{
CAF_PDM_HEADER_INIT;
@@ -79,6 +79,9 @@ public:
void setTitle(const QString& title);
const RivTernaryScalarMapper* scalarMapper() const;
const caf::TitledOverlayFrame* titledOverlayFrame() const override;
caf::TitledOverlayFrame* titledOverlayFrame() override;
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);

View File

@@ -21,6 +21,7 @@
#include "RiaApplication.h"
#include "RiaColorTables.h"
#include "RiaDefines.h"
#include "RicEclipsePropertyFilterNewExec.h"
#include "RicGeoMechPropertyFilterNewExec.h"
@@ -36,13 +37,14 @@
#include "RigMainGrid.h"
#include "RigVirtualPerforationTransmissibilities.h"
#include "RiaDefines.h"
#include "Rim2dIntersectionView.h"
#include "RimCellEdgeColors.h"
#include "RimContextCommandBuilder.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipseView.h"
#include "RimEllipseFractureTemplate.h"
#include "RimFaultInView.h"
#include "RimFaultInViewCollection.h"
#include "RimFracture.h"
@@ -51,15 +53,12 @@
#include "RimGeoMechView.h"
#include "RimIntersection.h"
#include "RimIntersectionBox.h"
#include "RimRegularLegendConfig.h"
#include "RimLegendConfig.h"
#include "RimPerforationInterval.h"
#include "RimSimWellInView.h"
#include "RimTernaryLegendConfig.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimViewController.h"
#include "RimWellPath.h"
#include "RimPerforationInterval.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimEllipseFractureTemplate.h"
#include "Rim2dIntersectionView.h"
#include "RiuMainWindow.h"
#include "RiuResultTextBuilder.h"
@@ -96,6 +95,7 @@
#include <QMenu>
#include <QMouseEvent>
#include <QStatusBar>
#include <array>
@@ -1058,48 +1058,17 @@ bool RiuViewerCommands::handleOverlayItemPicking(int winPosX, int winPosY)
if (pickedOverlayItem)
{
caf::PdmObject* objToSelect = nullptr;
std::vector<RimLegendConfig*> legendConfigs = m_reservoirView->legendConfigs();
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
if (eclipseView)
for (const auto& legendConfig : legendConfigs)
{
if (eclipseView->cellResult()->legendConfig()->legend() == pickedOverlayItem)
if (legendConfig && legendConfig->titledOverlayFrame() == pickedOverlayItem)
{
objToSelect = eclipseView->cellResult()->legendConfig();
}
else if (eclipseView->cellResult()->ternaryLegendConfig()->legend() == pickedOverlayItem)
{
objToSelect = eclipseView->cellResult()->ternaryLegendConfig();
}
else if (eclipseView->faultResultSettings()->customFaultResult()->legendConfig()->legend() == pickedOverlayItem)
{
objToSelect = eclipseView->faultResultSettings()->customFaultResult()->legendConfig();
}
else if (eclipseView->faultResultSettings()->customFaultResult()->ternaryLegendConfig()->legend() == pickedOverlayItem)
{
objToSelect = eclipseView->faultResultSettings()->customFaultResult()->ternaryLegendConfig();
}
else if (eclipseView->cellEdgeResult()->legendConfig()->legend() == pickedOverlayItem)
{
objToSelect = eclipseView->cellEdgeResult()->legendConfig();
}
}
RiuMainWindow::instance()->selectAsCurrentItem(legendConfig);
RimGeoMechView* geomView = dynamic_cast<RimGeoMechView*>(m_reservoirView.p());
if (geomView)
{
if (geomView->cellResult()->legendConfig()->legend() == pickedOverlayItem)
{
objToSelect = geomView->cellResult()->legendConfig();
return true;
}
}
if (objToSelect)
{
RiuMainWindow::instance()->selectAsCurrentItem(objToSelect);
return true;
}
}
return false;