mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5832 Add color legend data with import from LYR file.
This commit is contained in:
committed by
Kristian Bendiksen
parent
3e5c77e79e
commit
6cb86d4792
@@ -153,6 +153,10 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellDiskConfig.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimElementVectorResult.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimColorLegendCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimColorLegend.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimColorLegendItem.h
|
||||
|
||||
)
|
||||
|
||||
|
||||
@@ -310,6 +314,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellDiskConfig.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimElementVectorResult.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimColorLegendCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimColorLegend.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimColorLegendItem.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
75
ApplicationCode/ProjectDataModel/RimColorLegend.cpp
Normal file
75
ApplicationCode/ProjectDataModel/RimColorLegend.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 Equinor 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 "RimColorLegend.h"
|
||||
#include "RimColorLegendItem.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimColorLegend, "ColorLegend" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegend::RimColorLegend()
|
||||
{
|
||||
CAF_PDM_InitObject( "ColorLegend", ":/Legend.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_colorLegendName, "ColorLegendName", QString( "" ), "Color Legend Name", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_colorLegendItems, "ColorLegendItems", "", "", "", "" );
|
||||
m_colorLegendItems.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegend::~RimColorLegend()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimColorLegend::userDescriptionField()
|
||||
{
|
||||
return &m_colorLegendName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimColorLegend::setColorLegendName( const QString& colorLegendName )
|
||||
{
|
||||
m_colorLegendName = colorLegendName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimColorLegend::appendColorLegendItem( RimColorLegendItem* colorLegendItem )
|
||||
{
|
||||
m_colorLegendItems.push_back( colorLegendItem );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimColorLegend::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
}
|
||||
56
ApplicationCode/ProjectDataModel/RimColorLegend.h
Normal file
56
ApplicationCode/ProjectDataModel/RimColorLegend.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 Equinor 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimColorLegendItem;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmUiEditorAttribute;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimColorLegend : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimColorLegend();
|
||||
~RimColorLegend() override;
|
||||
|
||||
public:
|
||||
void setColorLegendName( const QString& colorLegendName );
|
||||
void appendColorLegendItem( RimColorLegendItem* colorLegendItem );
|
||||
|
||||
public:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_colorLegendName;
|
||||
caf::PdmChildArrayField<RimColorLegendItem*> m_colorLegendItems;
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 Equinor 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 "RimColorLegendCollection.h"
|
||||
#include "RimColorLegend.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimColorLegendCollection, "ColorLegendCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegendCollection::RimColorLegendCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "ColorLegendCollection", ":/Formations16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_colorLegends, "ColorLegends", "", "", "", "" );
|
||||
m_colorLegends.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegendCollection::~RimColorLegendCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimColorLegendCollection::appendColorLegend( RimColorLegend* colorLegend )
|
||||
{
|
||||
m_colorLegends.push_back( colorLegend );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimColorLegendCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
}
|
||||
51
ApplicationCode/ProjectDataModel/RimColorLegendCollection.h
Normal file
51
ApplicationCode/ProjectDataModel/RimColorLegendCollection.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 Equinor 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimColorLegend;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmUiEditorAttribute;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimColorLegendCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimColorLegendCollection();
|
||||
~RimColorLegendCollection() override;
|
||||
|
||||
public:
|
||||
void appendColorLegend( RimColorLegend* colorLegend );
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimColorLegend*> m_colorLegends;
|
||||
};
|
||||
86
ApplicationCode/ProjectDataModel/RimColorLegendItem.cpp
Normal file
86
ApplicationCode/ProjectDataModel/RimColorLegendItem.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 Equinor 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 "RimColorLegendItem.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QString>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimColorLegendItem, "ColorLegendItem" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegendItem::RimColorLegendItem()
|
||||
{
|
||||
CAF_PDM_InitObject( "ColorLegendItem", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_color, "Color", "Color", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_categoryValue, "CategoryValue", 0, "Category Value", "", "", "" );
|
||||
CAF_PDM_InitField( &m_categoryName, "CategoryName", QString( "" ), "Category Name", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy", "", "", "" );
|
||||
m_nameProxy.registerGetMethod( this, &RimColorLegendItem::extractColorItemName );
|
||||
m_nameProxy.uiCapability()->setUiHidden( true );
|
||||
m_nameProxy.xmlCapability()->disableIO();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegendItem::~RimColorLegendItem()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimColorLegendItem::setValues( const QString& categoryName, int categoryValue, const cvf::Color3f& color )
|
||||
{
|
||||
m_categoryName = categoryName;
|
||||
m_categoryValue = categoryValue;
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimColorLegendItem::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimColorLegendItem::userDescriptionField()
|
||||
{
|
||||
return &m_nameProxy;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// "stringify" category value and name; category value with leading zeros presupposing max 2 digits
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimColorLegendItem::extractColorItemName() const
|
||||
{
|
||||
return QString( "%1" ).arg( m_categoryValue, 2, 10, QChar( '0' ) ) + " " + m_categoryName;
|
||||
}
|
||||
59
ApplicationCode/ProjectDataModel/RimColorLegendItem.h
Normal file
59
ApplicationCode/ProjectDataModel/RimColorLegendItem.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 Equinor 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmUiEditorAttribute;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimColorLegendItem : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimColorLegendItem();
|
||||
~RimColorLegendItem() override;
|
||||
|
||||
void setValues( const QString& categoryName, int categoryValue, const cvf::Color3f& color );
|
||||
|
||||
public:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
QString extractColorItemName() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<cvf::Color3f> m_color;
|
||||
caf::PdmField<int> m_categoryValue;
|
||||
caf::PdmField<QString> m_categoryName;
|
||||
|
||||
caf::PdmProxyValueField<QString> m_nameProxy;
|
||||
};
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimColorLegendCollection.h"
|
||||
#include "RimCorrelationMatrixPlot.h"
|
||||
#include "RimCorrelationPlot.h"
|
||||
#include "RimCorrelationPlotCollection.h"
|
||||
@@ -782,6 +783,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
menuBuilder << "RicExportCompletionsForVisibleSimWellsFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimColorLegendCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicImportColorCategories";
|
||||
}
|
||||
else if ( dynamic_cast<RimFormationNames*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicImportFormationNamesFeature";
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "RimCalcScript.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimColorLegendCollection.h"
|
||||
#include "RimCommandObject.h"
|
||||
#include "RimCompletionTemplateCollection.h"
|
||||
#include "RimContextCommandBuilder.h"
|
||||
@@ -129,6 +130,9 @@ RimProject::RimProject( void )
|
||||
CAF_PDM_InitFieldNoDefault( &oilFields, "OilFields", "Oil Fields", "", "", "" );
|
||||
oilFields.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &colorLegendCollection, "ColorLegendCollection", "Color Legend Collection", "", "", "" );
|
||||
colorLegendCollection = new RimColorLegendCollection();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &scriptCollection, "ScriptCollection", "Octave Scripts", ":/octave.png", "", "" );
|
||||
scriptCollection.uiCapability()->setUiHidden( true );
|
||||
scriptCollection.xmlCapability()->disableIO();
|
||||
@@ -1457,6 +1461,7 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
if ( oilField->annotationCollection() ) uiTreeOrdering.add( oilField->annotationCollection() );
|
||||
}
|
||||
|
||||
uiTreeOrdering.add( colorLegendCollection() );
|
||||
uiTreeOrdering.add( scriptCollection() );
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ class RimMeasurement;
|
||||
class RimAdvancedSnapshotExportDefinition;
|
||||
class RimObservedSummaryData;
|
||||
class RimOilField;
|
||||
class RimColorLegendCollection;
|
||||
class RimScriptCollection;
|
||||
class RimSummaryCase;
|
||||
class RimSummaryCaseCollection;
|
||||
@@ -93,6 +94,7 @@ public:
|
||||
static RimProject* current();
|
||||
|
||||
caf::PdmChildArrayField<RimOilField*> oilFields;
|
||||
caf::PdmChildField<RimColorLegendCollection*> colorLegendCollection;
|
||||
caf::PdmChildField<RimScriptCollection*> scriptCollection;
|
||||
caf::PdmChildField<RimWellPathImport*> wellPathImport;
|
||||
caf::PdmChildField<RimMainPlotCollection*> mainPlotCollection;
|
||||
|
||||
Reference in New Issue
Block a user