#1230 Added StimPlan legend configuration object

This commit is contained in:
Magne Sjaastad 2017-02-17 09:28:46 +01:00
parent 65498e5aec
commit aef913739c
4 changed files with 153 additions and 1 deletions

View File

@ -94,7 +94,7 @@ ${CEE_CURRENT_LIST_DIR}RimSimWellFractureCollection.h
${CEE_CURRENT_LIST_DIR}RimFractureExportSettings.h
${CEE_CURRENT_LIST_DIR}RimFractureTemplate.h
${CEE_CURRENT_LIST_DIR}RimStimPlanFractureTemplate.h
${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -187,6 +187,7 @@ ${CEE_CURRENT_LIST_DIR}RimSimWellFractureCollection.cpp
${CEE_CURRENT_LIST_DIR}RimFractureExportSettings.cpp
${CEE_CURRENT_LIST_DIR}RimFractureTemplate.cpp
${CEE_CURRENT_LIST_DIR}RimStimPlanFractureTemplate.cpp
${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.cpp
)

View File

@ -121,7 +121,10 @@ public:
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void initAfterRead();
friend class RimStimPlanLegendConfig;
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
private:

View File

@ -0,0 +1,93 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 - 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 "RimStimPlanLegendConfig.h"
#include "RimLegendConfig.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT(RimStimPlanLegendConfig, "RimStimPlanLegendConfig");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimStimPlanLegendConfig::RimStimPlanLegendConfig()
{
CAF_PDM_InitObject("StimPlan Legend Definition", ":/Legend.png", "", "");
CAF_PDM_InitField(&m_name, "Name", QString("StimPlan Legend"), "Name", "", "", "");
m_name.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitFieldNoDefault(&m_legend, "Legend", "Legend", "", "", "");
m_legend = new RimLegendConfig;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimStimPlanLegendConfig::~RimStimPlanLegendConfig()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimStimPlanLegendConfig::name() const
{
return m_name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanLegendConfig::setName(const QString& name)
{
m_name = name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimStimPlanLegendConfig::userDescriptionField()
{
return &m_name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanLegendConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_name);
m_legend->defineUiOrdering(uiConfigName, uiOrdering);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanLegendConfig::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
{
uiTreeOrdering.setForgetRemainingFields(true);
}

View File

@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 - 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 "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmChildField.h"
class RimLegendConfig;
//==================================================================================================
///
///
//==================================================================================================
class RimStimPlanLegendConfig : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimStimPlanLegendConfig();
virtual ~RimStimPlanLegendConfig();
QString name() const;
void setName(const QString& name);
virtual caf::PdmFieldHandle* userDescriptionField() override;
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
private:
caf::PdmField<QString> m_name;
caf::PdmChildField<RimLegendConfig*> m_legend;
};