mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor view id
This commit is contained in:
@@ -139,7 +139,9 @@ QString RicSavePlotTemplateFeature::createTextFromObject( RimSummaryPlot* summar
|
|||||||
QString objectAsText = summaryPlot->writeObjectToXmlString();
|
QString objectAsText = summaryPlot->writeObjectToXmlString();
|
||||||
|
|
||||||
caf::PdmObjectHandle* obj =
|
caf::PdmObjectHandle* obj =
|
||||||
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText, caf::PdmDefaultObjectFactory::instance() );
|
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText,
|
||||||
|
caf::PdmDefaultObjectFactory::instance(),
|
||||||
|
true );
|
||||||
|
|
||||||
RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>( obj );
|
RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>( obj );
|
||||||
if ( newSummaryPlot )
|
if ( newSummaryPlot )
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ RimSummaryPlot* RicSummaryPlotTemplateTools::createPlotFromTemplateFile( const Q
|
|||||||
QString objectAsText = stream.readAll();
|
QString objectAsText = stream.readAll();
|
||||||
|
|
||||||
caf::PdmObjectHandle* obj =
|
caf::PdmObjectHandle* obj =
|
||||||
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText, caf::PdmDefaultObjectFactory::instance() );
|
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText,
|
||||||
|
caf::PdmDefaultObjectFactory::instance(),
|
||||||
|
true );
|
||||||
|
|
||||||
RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>( obj );
|
RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>( obj );
|
||||||
if ( newSummaryPlot )
|
if ( newSummaryPlot )
|
||||||
|
|||||||
@@ -333,7 +333,8 @@ void RicDeleteItemExec::undo()
|
|||||||
{
|
{
|
||||||
caf::PdmObjectHandle* obj =
|
caf::PdmObjectHandle* obj =
|
||||||
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( m_commandData->m_deletedObjectAsXml(),
|
caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( m_commandData->m_deletedObjectAsXml(),
|
||||||
caf::PdmDefaultObjectFactory::instance() );
|
caf::PdmDefaultObjectFactory::instance(),
|
||||||
|
false );
|
||||||
|
|
||||||
listField->insertAt( m_commandData->m_indexToObject, obj );
|
listField->insertAt( m_commandData->m_indexToObject, obj );
|
||||||
|
|
||||||
|
|||||||
@@ -123,6 +123,14 @@ RimFlowCharacteristicsPlot::~RimFlowCharacteristicsPlot()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// TODO: implement properly
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RimFlowCharacteristicsPlot::id() const
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -721,6 +729,11 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// TODO: implement properly
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFlowCharacteristicsPlot::assignIdIfNecessary() {}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -790,7 +803,7 @@ QString RimFlowCharacteristicsPlot::curveDataAsText() const
|
|||||||
|
|
||||||
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
|
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
|
||||||
|
|
||||||
std::vector<double> storageCapacitySamplingValues = {0.08, 0.1, 0.2, 0.3, 0.4};
|
std::vector<double> storageCapacitySamplingValues = { 0.08, 0.1, 0.2, 0.3, 0.4 };
|
||||||
size_t sampleCount = storageCapacitySamplingValues.size();
|
size_t sampleCount = storageCapacitySamplingValues.size();
|
||||||
|
|
||||||
for ( const auto& timeIndex : m_currentlyPlottedTimeSteps )
|
for ( const auto& timeIndex : m_currentlyPlottedTimeSteps )
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ public:
|
|||||||
RimFlowCharacteristicsPlot();
|
RimFlowCharacteristicsPlot();
|
||||||
~RimFlowCharacteristicsPlot() override;
|
~RimFlowCharacteristicsPlot() override;
|
||||||
|
|
||||||
|
int id() const final;
|
||||||
|
|
||||||
void setFromFlowSolution( RimFlowDiagSolution* flowSolution );
|
void setFromFlowSolution( RimFlowDiagSolution* flowSolution );
|
||||||
void updateCurrentTimeStep();
|
void updateCurrentTimeStep();
|
||||||
|
|
||||||
@@ -97,6 +99,9 @@ protected:
|
|||||||
caf::PdmUiEditorAttribute* attribute ) override;
|
caf::PdmUiEditorAttribute* attribute ) override;
|
||||||
void onLoadDataAndUpdate() override;
|
void onLoadDataAndUpdate() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void assignIdIfNecessary() final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
|
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
|
||||||
|
|||||||
@@ -76,6 +76,14 @@ RimTofAccumulatedPhaseFractionsPlot::~RimTofAccumulatedPhaseFractionsPlot()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// TODO: implement properly
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RimTofAccumulatedPhaseFractionsPlot::id() const
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -190,6 +198,11 @@ QString RimTofAccumulatedPhaseFractionsPlot::description() const
|
|||||||
return m_userName();
|
return m_userName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// TODO: Implement properly
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimTofAccumulatedPhaseFractionsPlot::assignIdIfNecessary() {}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ public:
|
|||||||
RimTofAccumulatedPhaseFractionsPlot();
|
RimTofAccumulatedPhaseFractionsPlot();
|
||||||
~RimTofAccumulatedPhaseFractionsPlot() override;
|
~RimTofAccumulatedPhaseFractionsPlot() override;
|
||||||
|
|
||||||
|
int id() const final;
|
||||||
|
|
||||||
void setDescription( const QString& description );
|
void setDescription( const QString& description );
|
||||||
QString description() const;
|
QString description() const;
|
||||||
|
|
||||||
@@ -73,7 +75,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// RimViewWindow overrides
|
// RimViewWindow overrides
|
||||||
|
void assignIdIfNecessary() final;
|
||||||
void onLoadDataAndUpdate() override;
|
void onLoadDataAndUpdate() override;
|
||||||
QImage snapshotWindowContent() override;
|
QImage snapshotWindowContent() override;
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// TODO: implement properly
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RimTotalWellAllocationPlot::id() const
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -104,6 +112,11 @@ void RimTotalWellAllocationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// TODO: Implement properly
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimTotalWellAllocationPlot::assignIdIfNecessary() {}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ public:
|
|||||||
RimTotalWellAllocationPlot();
|
RimTotalWellAllocationPlot();
|
||||||
~RimTotalWellAllocationPlot() override;
|
~RimTotalWellAllocationPlot() override;
|
||||||
|
|
||||||
|
int id() const final;
|
||||||
|
|
||||||
void setDescription( const QString& description );
|
void setDescription( const QString& description );
|
||||||
QString description() const;
|
QString description() const;
|
||||||
QString totalAllocationAsText() const;
|
QString totalAllocationAsText() const;
|
||||||
@@ -82,6 +84,9 @@ protected:
|
|||||||
const QVariant& oldValue,
|
const QVariant& oldValue,
|
||||||
const QVariant& newValue ) override;
|
const QVariant& newValue ) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void assignIdIfNecessary() final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> m_showPlotTitle;
|
caf::PdmField<bool> m_showPlotTitle;
|
||||||
caf::PdmField<QString> m_userName;
|
caf::PdmField<QString> m_userName;
|
||||||
|
|||||||
@@ -149,6 +149,14 @@ RimWellAllocationPlot::~RimWellAllocationPlot()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// TODO: implement properly
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RimWellAllocationPlot::id() const
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -552,6 +560,11 @@ QString RimWellAllocationPlot::wellStatusTextForTimeStep( const QString&
|
|||||||
return statusText;
|
return statusText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// TODO: Implement properly
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellAllocationPlot::assignIdIfNecessary() {}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ public:
|
|||||||
RimWellAllocationPlot();
|
RimWellAllocationPlot();
|
||||||
~RimWellAllocationPlot() override;
|
~RimWellAllocationPlot() override;
|
||||||
|
|
||||||
|
int id() const final;
|
||||||
void setFromSimulationWell( RimSimWellInView* simWell );
|
void setFromSimulationWell( RimSimWellInView* simWell );
|
||||||
|
|
||||||
void setDescription( const QString& description );
|
void setDescription( const QString& description );
|
||||||
@@ -126,6 +127,7 @@ private:
|
|||||||
size_t timeStep );
|
size_t timeStep );
|
||||||
|
|
||||||
// RimViewWindow overrides
|
// RimViewWindow overrides
|
||||||
|
void assignIdIfNecessary() final;
|
||||||
|
|
||||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||||
void deleteViewWidget() override;
|
void deleteViewWidget() override;
|
||||||
|
|||||||
@@ -86,6 +86,12 @@ Rim3dView::Rim3dView( void )
|
|||||||
RiaPreferences* preferences = app->preferences();
|
RiaPreferences* preferences = app->preferences();
|
||||||
CVF_ASSERT( preferences );
|
CVF_ASSERT( preferences );
|
||||||
|
|
||||||
|
RICF_InitField( &m_id, "ViewId", -1, "View ID", "", "", "" );
|
||||||
|
m_id.uiCapability()->setUiReadOnly( true );
|
||||||
|
m_id.uiCapability()->setUiHidden( true );
|
||||||
|
m_id.capability<RicfFieldHandle>()->setIOWriteable( false );
|
||||||
|
m_id.xmlCapability()->setCopyable( false );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
|
||||||
m_nameConfig = new RimViewNameConfig();
|
m_nameConfig = new RimViewNameConfig();
|
||||||
|
|
||||||
@@ -168,6 +174,14 @@ Rim3dView::~Rim3dView( void )
|
|||||||
m_viewer = nullptr;
|
m_viewer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int Rim3dView::id() const
|
||||||
|
{
|
||||||
|
return m_id;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -306,6 +320,27 @@ void Rim3dView::initAfterRead()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void Rim3dView::setId( int id )
|
||||||
|
{
|
||||||
|
m_id = id;
|
||||||
|
QString viewIdTooltip = QString( "View id: %1" ).arg( m_id );
|
||||||
|
this->setUiToolTip( viewIdTooltip );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void Rim3dView::assignIdIfNecessary()
|
||||||
|
{
|
||||||
|
if ( m_id == -1 )
|
||||||
|
{
|
||||||
|
RiaApplication::instance()->project()->assignViewIdToView( this );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ public:
|
|||||||
Rim3dView( void );
|
Rim3dView( void );
|
||||||
~Rim3dView( void ) override;
|
~Rim3dView( void ) override;
|
||||||
|
|
||||||
|
int id() const final;
|
||||||
|
|
||||||
// Public fields:
|
// Public fields:
|
||||||
|
|
||||||
caf::PdmField<double> scaleZ;
|
caf::PdmField<double> scaleZ;
|
||||||
@@ -250,6 +252,11 @@ protected:
|
|||||||
cvf::ref<RivWellPathsPartMgr> m_wellPathsPartManager;
|
cvf::ref<RivWellPathsPartMgr> m_wellPathsPartManager;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class RimProject;
|
||||||
|
|
||||||
|
void setId( int id );
|
||||||
|
void assignIdIfNecessary() final;
|
||||||
|
|
||||||
void updateMdiWindowTitle() override;
|
void updateMdiWindowTitle() override;
|
||||||
void deleteViewWidget() override;
|
void deleteViewWidget() override;
|
||||||
QWidget* viewWidget() override;
|
QWidget* viewWidget() override;
|
||||||
@@ -287,7 +294,7 @@ private:
|
|||||||
bool m_isCallingUpdateDisplayModelForCurrentTimestepAndRedraw; // To avoid infinite recursion if comparison views are pointing to each other.
|
bool m_isCallingUpdateDisplayModelForCurrentTimestepAndRedraw; // To avoid infinite recursion if comparison views are pointing to each other.
|
||||||
|
|
||||||
// Fields
|
// Fields
|
||||||
|
caf::PdmField<int> m_id;
|
||||||
caf::PdmField<QString> m_name_OBSOLETE;
|
caf::PdmField<QString> m_name_OBSOLETE;
|
||||||
caf::PdmChildField<RimViewNameConfig*> m_nameConfig;
|
caf::PdmChildField<RimViewNameConfig*> m_nameConfig;
|
||||||
caf::PdmField<bool> m_disableLighting;
|
caf::PdmField<bool> m_disableLighting;
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
#include "RiaPreferences.h"
|
#include "RiaPreferences.h"
|
||||||
|
|
||||||
|
#include "RicfCommandObject.h"
|
||||||
|
|
||||||
|
#include "RimProject.h"
|
||||||
|
|
||||||
#include "cafPdmUiComboBoxEditor.h"
|
#include "cafPdmUiComboBoxEditor.h"
|
||||||
|
|
||||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not use. Abstract class
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not use. Abstract class
|
||||||
@@ -31,6 +35,12 @@ RimPlotWindow::RimPlotWindow()
|
|||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "PlotWindow", "", "", "" );
|
CAF_PDM_InitObject( "PlotWindow", "", "", "" );
|
||||||
|
|
||||||
|
RICF_InitField( &m_id, "ViewId", -1, "View ID", "", "", "" );
|
||||||
|
m_id.uiCapability()->setUiReadOnly( true );
|
||||||
|
m_id.uiCapability()->setUiHidden( true );
|
||||||
|
m_id.capability<RicfFieldHandle>()->setIOWriteable( false );
|
||||||
|
m_id.xmlCapability()->setCopyable( false );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" );
|
CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" );
|
||||||
CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation", "", "", "" );
|
CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation", "", "", "" );
|
||||||
m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||||
@@ -50,6 +60,14 @@ RimPlotWindow::RimPlotWindow()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimPlotWindow::~RimPlotWindow() {}
|
RimPlotWindow::~RimPlotWindow() {}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RimPlotWindow::id() const
|
||||||
|
{
|
||||||
|
return m_id;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -199,3 +217,24 @@ void RimPlotWindow::uiOrderingForLegendSettings( QString uiConfigName, caf::PdmU
|
|||||||
uiOrdering.add( &m_plotLegendsHorizontal );
|
uiOrdering.add( &m_plotLegendsHorizontal );
|
||||||
uiOrdering.add( &m_legendFontSize );
|
uiOrdering.add( &m_legendFontSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotWindow::setId( int id )
|
||||||
|
{
|
||||||
|
m_id = id;
|
||||||
|
QString viewIdTooltip = QString( "Plot id: %1" ).arg( m_id );
|
||||||
|
this->setUiToolTip( viewIdTooltip );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotWindow::assignIdIfNecessary()
|
||||||
|
{
|
||||||
|
if ( m_id == -1 )
|
||||||
|
{
|
||||||
|
RiaApplication::instance()->project()->assignPlotIdToPlotWindow( this );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
#include "cafPdmFieldHandle.h"
|
#include "cafPdmFieldHandle.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
|
class RimProject;
|
||||||
class QwtPlotCurve;
|
class QwtPlotCurve;
|
||||||
|
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
|
|
||||||
class RimPlotWindow : public RimViewWindow
|
class RimPlotWindow : public RimViewWindow
|
||||||
@@ -35,6 +37,8 @@ public:
|
|||||||
RimPlotWindow();
|
RimPlotWindow();
|
||||||
~RimPlotWindow() override;
|
~RimPlotWindow() override;
|
||||||
|
|
||||||
|
int id() const final;
|
||||||
|
|
||||||
RimPlotWindow& operator=( RimPlotWindow&& rhs );
|
RimPlotWindow& operator=( RimPlotWindow&& rhs );
|
||||||
|
|
||||||
virtual QString description() const = 0;
|
virtual QString description() const = 0;
|
||||||
@@ -62,7 +66,14 @@ protected:
|
|||||||
private:
|
private:
|
||||||
virtual void performLayoutUpdate() {}
|
virtual void performLayoutUpdate() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class RimProject;
|
||||||
|
void setId( int id );
|
||||||
|
|
||||||
|
void assignIdIfNecessary() final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
caf::PdmField<int> m_id;
|
||||||
caf::PdmField<bool> m_showPlotLegends;
|
caf::PdmField<bool> m_showPlotLegends;
|
||||||
caf::PdmField<bool> m_plotLegendsHorizontal;
|
caf::PdmField<bool> m_plotLegendsHorizontal;
|
||||||
caf::PdmField<int> m_legendFontSize;
|
caf::PdmField<int> m_legendFontSize;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
#include "RimObservedDataCollection.h"
|
#include "RimObservedDataCollection.h"
|
||||||
#include "RimObservedSummaryData.h"
|
#include "RimObservedSummaryData.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
|
#include "RimPlotWindow.h"
|
||||||
#include "RimPltPlotCollection.h"
|
#include "RimPltPlotCollection.h"
|
||||||
#include "RimPolylinesFromFileAnnotation.h"
|
#include "RimPolylinesFromFileAnnotation.h"
|
||||||
#include "RimRftPlotCollection.h"
|
#include "RimRftPlotCollection.h"
|
||||||
@@ -104,6 +105,7 @@ RimProject::RimProject( void )
|
|||||||
: m_nextValidCaseId( 1 )
|
: m_nextValidCaseId( 1 )
|
||||||
, m_nextValidCaseGroupId( 1 )
|
, m_nextValidCaseGroupId( 1 )
|
||||||
, m_nextValidViewId( 1 )
|
, m_nextValidViewId( 1 )
|
||||||
|
, m_nextValidPlotId( 1 )
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Project", "", "", "" );
|
CAF_PDM_InitObject( "Project", "", "", "" );
|
||||||
|
|
||||||
@@ -247,9 +249,10 @@ void RimProject::close()
|
|||||||
plotWindowCurrentModelIndexPath = "";
|
plotWindowCurrentModelIndexPath = "";
|
||||||
plotWindowTreeViewState = "";
|
plotWindowTreeViewState = "";
|
||||||
|
|
||||||
m_nextValidCaseId = 0;
|
m_nextValidCaseId = 1;
|
||||||
m_nextValidCaseGroupId = 0;
|
m_nextValidCaseGroupId = 1;
|
||||||
m_nextValidViewId = 0;
|
m_nextValidViewId = 1;
|
||||||
|
m_nextValidPlotId = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -507,14 +510,14 @@ void RimProject::assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimProject::assignViewIdToView( RimViewWindow* view )
|
void RimProject::assignViewIdToView( Rim3dView* view )
|
||||||
{
|
{
|
||||||
if ( view )
|
if ( view )
|
||||||
{
|
{
|
||||||
std::vector<RimViewWindow*> viewWindows;
|
std::vector<Rim3dView*> views;
|
||||||
this->descendantsIncludingThisOfType( viewWindows );
|
this->descendantsIncludingThisOfType( views );
|
||||||
|
|
||||||
for ( RimViewWindow* existingView : viewWindows )
|
for ( Rim3dView* existingView : views )
|
||||||
{
|
{
|
||||||
m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 );
|
m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 );
|
||||||
}
|
}
|
||||||
@@ -523,6 +526,25 @@ void RimProject::assignViewIdToView( RimViewWindow* view )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimProject::assignPlotIdToPlotWindow( RimPlotWindow* plotWindow )
|
||||||
|
{
|
||||||
|
if ( plotWindow )
|
||||||
|
{
|
||||||
|
std::vector<RimPlotWindow*> plotWindows;
|
||||||
|
this->descendantsIncludingThisOfType( plotWindows );
|
||||||
|
|
||||||
|
for ( RimPlotWindow* existingPlotWindow : plotWindows )
|
||||||
|
{
|
||||||
|
m_nextValidPlotId = std::max( m_nextValidPlotId, existingPlotWindow->id() + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
plotWindow->setId( m_nextValidPlotId++ );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class RimSummaryCaseCollection;
|
|||||||
class RimSummaryCaseMainCollection;
|
class RimSummaryCaseMainCollection;
|
||||||
class Rim3dView;
|
class Rim3dView;
|
||||||
class RimGridView;
|
class RimGridView;
|
||||||
|
class RimPlotWindow;
|
||||||
class RimViewLinker;
|
class RimViewLinker;
|
||||||
class RimViewLinkerCollection;
|
class RimViewLinkerCollection;
|
||||||
class RimViewWindow;
|
class RimViewWindow;
|
||||||
@@ -116,7 +117,8 @@ public:
|
|||||||
|
|
||||||
void assignCaseIdToCase( RimCase* reservoirCase );
|
void assignCaseIdToCase( RimCase* reservoirCase );
|
||||||
void assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup );
|
void assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup );
|
||||||
void assignViewIdToView( RimViewWindow* view );
|
void assignViewIdToView( Rim3dView* view );
|
||||||
|
void assignPlotIdToPlotWindow( RimPlotWindow* plotWindow );
|
||||||
|
|
||||||
void allCases( std::vector<RimCase*>& cases ) const;
|
void allCases( std::vector<RimCase*>& cases ) const;
|
||||||
|
|
||||||
@@ -204,6 +206,7 @@ private:
|
|||||||
int m_nextValidCaseId;
|
int m_nextValidCaseId;
|
||||||
int m_nextValidCaseGroupId;
|
int m_nextValidCaseGroupId;
|
||||||
int m_nextValidViewId;
|
int m_nextValidViewId;
|
||||||
|
int m_nextValidPlotId;
|
||||||
|
|
||||||
caf::PdmChildArrayField<RimEclipseCase*> casesObsolete; // obsolete
|
caf::PdmChildArrayField<RimEclipseCase*> casesObsolete; // obsolete
|
||||||
caf::PdmChildArrayField<RimIdenticalGridCaseGroup*> caseGroupsObsolete; // obsolete
|
caf::PdmChildArrayField<RimIdenticalGridCaseGroup*> caseGroupsObsolete; // obsolete
|
||||||
|
|||||||
@@ -999,7 +999,8 @@ void RimViewController::updateRangeFilterOverrides( RimCellRangeFilter* changedR
|
|||||||
QString xmlRangeFilterCollCopy = sourceFilterCollection->writeObjectToXmlString();
|
QString xmlRangeFilterCollCopy = sourceFilterCollection->writeObjectToXmlString();
|
||||||
PdmObjectHandle* objectCopy =
|
PdmObjectHandle* objectCopy =
|
||||||
PdmXmlObjectHandle::readUnknownObjectFromXmlString( xmlRangeFilterCollCopy,
|
PdmXmlObjectHandle::readUnknownObjectFromXmlString( xmlRangeFilterCollCopy,
|
||||||
caf::PdmDefaultObjectFactory::instance() );
|
caf::PdmDefaultObjectFactory::instance(),
|
||||||
|
true );
|
||||||
RimCellRangeFilterCollection* overrideRangeFilterColl = dynamic_cast<RimCellRangeFilterCollection*>( objectCopy );
|
RimCellRangeFilterCollection* overrideRangeFilterColl = dynamic_cast<RimCellRangeFilterCollection*>( objectCopy );
|
||||||
|
|
||||||
// Convert the range filter to fit in the managed view if needed
|
// Convert the range filter to fit in the managed view if needed
|
||||||
|
|||||||
@@ -49,21 +49,12 @@ RimViewWindow::RimViewWindow( void )
|
|||||||
m_windowController.uiCapability()->setUiHidden( true );
|
m_windowController.uiCapability()->setUiHidden( true );
|
||||||
m_windowController.uiCapability()->setUiTreeChildrenHidden( true );
|
m_windowController.uiCapability()->setUiTreeChildrenHidden( true );
|
||||||
|
|
||||||
RICF_InitField( &m_viewId, "ViewId", -1, "View ID", "", "", "" );
|
|
||||||
m_viewId.uiCapability()->setUiReadOnly( true );
|
|
||||||
m_viewId.uiCapability()->setUiHidden( true );
|
|
||||||
m_viewId.capability<RicfFieldHandle>()->setIOWriteable( false );
|
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_showWindow, "ShowWindow", true, "Show Window", "", "", "" );
|
CAF_PDM_InitField( &m_showWindow, "ShowWindow", true, "Show Window", "", "", "" );
|
||||||
m_showWindow.uiCapability()->setUiHidden( true );
|
m_showWindow.uiCapability()->setUiHidden( true );
|
||||||
|
|
||||||
// Obsolete field
|
// Obsolete field
|
||||||
CAF_PDM_InitFieldNoDefault( &obsoleteField_windowGeometry, "WindowGeometry", "", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &obsoleteField_windowGeometry, "WindowGeometry", "", "", "", "" );
|
||||||
RiaFieldhandleTools::disableWriteAndSetFieldHidden( &obsoleteField_windowGeometry );
|
RiaFieldhandleTools::disableWriteAndSetFieldHidden( &obsoleteField_windowGeometry );
|
||||||
|
|
||||||
RiaApplication::instance()->project()->assignViewIdToView( this );
|
|
||||||
QString viewIdTooltip = QString( "View id: %1" ).arg( m_viewId );
|
|
||||||
this->setUiToolTip( viewIdTooltip );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -74,22 +65,6 @@ RimViewWindow::~RimViewWindow( void )
|
|||||||
if ( m_windowController() ) delete m_windowController();
|
if ( m_windowController() ) delete m_windowController();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
int RimViewWindow::id() const
|
|
||||||
{
|
|
||||||
return m_viewId;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimViewWindow::setId( int id )
|
|
||||||
{
|
|
||||||
m_viewId = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -111,6 +86,7 @@ void RimViewWindow::setShowWindow( bool showWindow )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimViewWindow::loadDataAndUpdate()
|
void RimViewWindow::loadDataAndUpdate()
|
||||||
{
|
{
|
||||||
|
assignIdIfNecessary();
|
||||||
onLoadDataAndUpdate();
|
onLoadDataAndUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,8 +328,8 @@ void RimViewWindow::defineObjectEditorAttribute( QString uiConfigName, caf::PdmU
|
|||||||
caf::PdmUiTreeViewItemAttribute* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute );
|
caf::PdmUiTreeViewItemAttribute* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute );
|
||||||
if ( treeItemAttribute && RiaApplication::instance()->preferences()->showViewIdInProjectTree() )
|
if ( treeItemAttribute && RiaApplication::instance()->preferences()->showViewIdInProjectTree() )
|
||||||
{
|
{
|
||||||
treeItemAttribute->tag = QString( "%1" ).arg( m_viewId );
|
treeItemAttribute->tag = QString( "%1" ).arg( id() );
|
||||||
cvf::Color3f viewColor = RiaColorTables::contrastCategoryPaletteColors().cycledColor3f( (size_t)m_viewId );
|
cvf::Color3f viewColor = RiaColorTables::contrastCategoryPaletteColors().cycledColor3f( (size_t)id() );
|
||||||
cvf::Color3f viewTextColor = RiaColorTools::contrastColor( viewColor );
|
cvf::Color3f viewTextColor = RiaColorTools::contrastColor( viewColor );
|
||||||
treeItemAttribute->bgColor = QColor( RiaColorTools::toQColor( viewColor ) );
|
treeItemAttribute->bgColor = QColor( RiaColorTools::toQColor( viewColor ) );
|
||||||
treeItemAttribute->fgColor = QColor( RiaColorTools::toQColor( viewTextColor ) );
|
treeItemAttribute->fgColor = QColor( RiaColorTools::toQColor( viewTextColor ) );
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ public:
|
|||||||
RimViewWindow( void );
|
RimViewWindow( void );
|
||||||
~RimViewWindow( void ) override;
|
~RimViewWindow( void ) override;
|
||||||
|
|
||||||
int id() const;
|
virtual int id() const = 0;
|
||||||
void setId( int id );
|
|
||||||
|
|
||||||
bool showWindow() const;
|
bool showWindow() const;
|
||||||
void setShowWindow( bool showWindow );
|
void setShowWindow( bool showWindow );
|
||||||
@@ -111,6 +110,7 @@ protected:
|
|||||||
virtual void updateMdiWindowTitle(); // Has real default implementation
|
virtual void updateMdiWindowTitle(); // Has real default implementation
|
||||||
virtual void deleteViewWidget() = 0;
|
virtual void deleteViewWidget() = 0;
|
||||||
virtual void onLoadDataAndUpdate() = 0;
|
virtual void onLoadDataAndUpdate() = 0;
|
||||||
|
virtual void assignIdIfNecessary() = 0;
|
||||||
virtual void onViewNavigationChanged();
|
virtual void onViewNavigationChanged();
|
||||||
virtual bool isWindowVisible() const; // Virtual To allow special visibility control
|
virtual bool isWindowVisible() const; // Virtual To allow special visibility control
|
||||||
//////////
|
//////////
|
||||||
@@ -127,6 +127,8 @@ protected:
|
|||||||
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class RimProject;
|
||||||
|
|
||||||
void setAsMdiWindow( int mainWindowID );
|
void setAsMdiWindow( int mainWindowID );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -134,7 +136,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmChildField<RimMdiWindowController*> m_windowController;
|
caf::PdmChildField<RimMdiWindowController*> m_windowController;
|
||||||
caf::PdmField<int> m_viewId;
|
|
||||||
|
|
||||||
// Obsoleted field
|
// Obsoleted field
|
||||||
caf::PdmField<std::vector<int>> obsoleteField_windowGeometry;
|
caf::PdmField<std::vector<int>> obsoleteField_windowGeometry;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ void CmdDeleteItemExec::undo()
|
|||||||
PdmChildArrayFieldHandle* listField = dynamic_cast<PdmChildArrayFieldHandle*>(field);
|
PdmChildArrayFieldHandle* listField = dynamic_cast<PdmChildArrayFieldHandle*>(field);
|
||||||
if (listField)
|
if (listField)
|
||||||
{
|
{
|
||||||
PdmObjectHandle* obj = PdmXmlObjectHandle::readUnknownObjectFromXmlString(m_commandData->m_deletedObjectAsXml(), PdmDefaultObjectFactory::instance());
|
PdmObjectHandle* obj = PdmXmlObjectHandle::readUnknownObjectFromXmlString(m_commandData->m_deletedObjectAsXml(), PdmDefaultObjectFactory::instance(), false);
|
||||||
|
|
||||||
listField->insertAt(m_commandData->m_indexToObject, obj);
|
listField->insertAt(m_commandData->m_indexToObject, obj);
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void PdmDocument::readFile(QIODevice* xmlFile)
|
|||||||
// Error: This is not a Ceetron Pdm based xml document
|
// Error: This is not a Ceetron Pdm based xml document
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
readFields(xmlStream, PdmDefaultObjectFactory::instance());
|
readFields(xmlStream, PdmDefaultObjectFactory::instance(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ void caf::PdmFieldXmlCap< caf::PdmChildField<DataType*> >::readFieldData(QXmlStr
|
|||||||
|
|
||||||
// Everything seems ok, so read the contents of the object:
|
// Everything seems ok, so read the contents of the object:
|
||||||
|
|
||||||
xmlObject->readFields(xmlStream, objectFactory);
|
xmlObject->readFields(xmlStream, objectFactory, false);
|
||||||
|
|
||||||
// Make stream point to endElement of this field
|
// Make stream point to endElement of this field
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ void caf::PdmFieldXmlCap< caf::PdmChildArrayField<DataType*> >::readFieldData(QX
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlObject->readFields(xmlStream, objectFactory);
|
xmlObject->readFields(xmlStream, objectFactory, false);
|
||||||
|
|
||||||
m_field->m_pointers.push_back(PdmPointer<DataType>());
|
m_field->m_pointers.push_back(PdmPointer<DataType>());
|
||||||
m_field->m_pointers.back().setRawPtr(obj);
|
m_field->m_pointers.back().setRawPtr(obj);
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ bool PdmXmlFieldHandle::assertValid() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
PdmXmlFieldHandle::PdmXmlFieldHandle(PdmFieldHandle* owner, bool giveOwnership) : m_isIOReadable(true), m_isIOWritable(true)
|
PdmXmlFieldHandle::PdmXmlFieldHandle(PdmFieldHandle* owner, bool giveOwnership)
|
||||||
|
: m_isIOReadable(true), m_isIOWritable(true), m_isCopyable(true)
|
||||||
{
|
{
|
||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
owner->addCapability(this, giveOwnership);
|
owner->addCapability(this, giveOwnership);
|
||||||
@@ -47,6 +48,7 @@ void PdmXmlFieldHandle::disableIO()
|
|||||||
{
|
{
|
||||||
setIOReadable(false);
|
setIOReadable(false);
|
||||||
setIOWritable(false);
|
setIOWritable(false);
|
||||||
|
setCopyable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -30,10 +30,12 @@ public:
|
|||||||
|
|
||||||
bool isIOReadable() const { return m_isIOReadable; }
|
bool isIOReadable() const { return m_isIOReadable; }
|
||||||
bool isIOWritable() const { return m_isIOWritable; }
|
bool isIOWritable() const { return m_isIOWritable; }
|
||||||
|
bool isCopyable() const { return m_isCopyable;}
|
||||||
|
|
||||||
void disableIO();
|
void disableIO();
|
||||||
void setIOWritable(bool isWritable) { m_isIOWritable = isWritable; }
|
void setIOWritable(bool isWritable) { m_isIOWritable = isWritable; }
|
||||||
void setIOReadable(bool isReadable) { m_isIOReadable = isReadable; }
|
void setIOReadable(bool isReadable) { m_isIOReadable = isReadable; }
|
||||||
|
void setCopyable(bool isCopyable) { m_isCopyable = isCopyable; }
|
||||||
|
|
||||||
QString childClassKeyword();
|
QString childClassKeyword();
|
||||||
|
|
||||||
@@ -51,6 +53,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
bool m_isIOReadable;
|
bool m_isIOReadable;
|
||||||
bool m_isIOWritable;
|
bool m_isIOWritable;
|
||||||
|
bool m_isCopyable;
|
||||||
|
|
||||||
PdmFieldHandle* m_owner;
|
PdmFieldHandle* m_owner;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ PdmXmlObjectHandle* xmlObj(PdmObjectHandle* obj)
|
|||||||
/// This makes attribute based field storage possible.
|
/// This makes attribute based field storage possible.
|
||||||
/// Leaves the xmlStream pointing to the EndElement of the PdmObject.
|
/// Leaves the xmlStream pointing to the EndElement of the PdmObject.
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmXmlObjectHandle::readFields(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory)
|
void PdmXmlObjectHandle::readFields(QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory, bool isCopyOperation)
|
||||||
{
|
{
|
||||||
bool isObjectFinished = false;
|
bool isObjectFinished = false;
|
||||||
QXmlStreamReader::TokenType type;
|
QXmlStreamReader::TokenType type;
|
||||||
@@ -60,7 +60,12 @@ void PdmXmlObjectHandle::readFields(QXmlStreamReader& xmlStream, PdmObjectFactor
|
|||||||
if (fieldHandle && fieldHandle->xmlCapability())
|
if (fieldHandle && fieldHandle->xmlCapability())
|
||||||
{
|
{
|
||||||
PdmXmlFieldHandle* xmlFieldHandle = fieldHandle->xmlCapability();
|
PdmXmlFieldHandle* xmlFieldHandle = fieldHandle->xmlCapability();
|
||||||
if (xmlFieldHandle->isIOReadable())
|
bool readable = xmlFieldHandle->isIOReadable();
|
||||||
|
if (isCopyOperation && !xmlFieldHandle->isCopyable())
|
||||||
|
{
|
||||||
|
readable = false;
|
||||||
|
}
|
||||||
|
if (readable)
|
||||||
{
|
{
|
||||||
// readFieldData assumes that the xmlStream points to first token of field content.
|
// readFieldData assumes that the xmlStream points to first token of field content.
|
||||||
// After reading, the xmlStream is supposed to point to the first token after the field content.
|
// After reading, the xmlStream is supposed to point to the first token after the field content.
|
||||||
@@ -153,13 +158,13 @@ void PdmXmlObjectHandle::readObjectFromXmlString(const QString& xmlString, PdmO
|
|||||||
QString classKeyword = inputStream.name().toString();
|
QString classKeyword = inputStream.name().toString();
|
||||||
CAF_ASSERT(classKeyword == this->classKeyword());
|
CAF_ASSERT(classKeyword == this->classKeyword());
|
||||||
|
|
||||||
this->readFields(inputStream, objectFactory);
|
this->readFields(inputStream, objectFactory, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
PdmObjectHandle* PdmXmlObjectHandle::readUnknownObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory)
|
PdmObjectHandle* PdmXmlObjectHandle::readUnknownObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory, bool isCopyOperation)
|
||||||
{
|
{
|
||||||
QXmlStreamReader inputStream(xmlString);
|
QXmlStreamReader inputStream(xmlString);
|
||||||
|
|
||||||
@@ -171,7 +176,7 @@ PdmObjectHandle* PdmXmlObjectHandle::readUnknownObjectFromXmlString(const QStrin
|
|||||||
|
|
||||||
if (!newObject) return nullptr;
|
if (!newObject) return nullptr;
|
||||||
|
|
||||||
xmlObj(newObject)->readFields(inputStream, objectFactory);
|
xmlObj(newObject)->readFields(inputStream, objectFactory, isCopyOperation);
|
||||||
|
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
@@ -185,7 +190,7 @@ PdmObjectHandle* PdmXmlObjectHandle::copyByXmlSerialization(PdmObjectFactory* ob
|
|||||||
|
|
||||||
QString xmlString = this->writeObjectToXmlString();
|
QString xmlString = this->writeObjectToXmlString();
|
||||||
|
|
||||||
PdmObjectHandle* objectCopy = PdmXmlObjectHandle::readUnknownObjectFromXmlString(xmlString, objectFactory);
|
PdmObjectHandle* objectCopy = PdmXmlObjectHandle::readUnknownObjectFromXmlString(xmlString, objectFactory, true);
|
||||||
if (!objectCopy) return nullptr;
|
if (!objectCopy) return nullptr;
|
||||||
|
|
||||||
objectCopy->xmlCapability()->initAfterReadRecursively();
|
objectCopy->xmlCapability()->initAfterReadRecursively();
|
||||||
@@ -213,7 +218,9 @@ caf::PdmObjectHandle* PdmXmlObjectHandle::copyAndCastByXmlSerialization(const QS
|
|||||||
QString classKeyword = inputStream.name().toString();
|
QString classKeyword = inputStream.name().toString();
|
||||||
CAF_ASSERT(classKeyword == sourceClassKeyword);
|
CAF_ASSERT(classKeyword == sourceClassKeyword);
|
||||||
|
|
||||||
xmlObj(upgradedObject)->readFields(inputStream, objectFactory);
|
xmlObj(upgradedObject)->readFields(inputStream, objectFactory, true);
|
||||||
|
|
||||||
|
xmlObj(upgradedObject)->initAfterReadRecursively();
|
||||||
|
|
||||||
return upgradedObject;
|
return upgradedObject;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
/// Convenience methods to serialize/de-serialize this particular object (with children)
|
/// Convenience methods to serialize/de-serialize this particular object (with children)
|
||||||
void readObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory);
|
void readObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory);
|
||||||
QString writeObjectToXmlString() const;
|
QString writeObjectToXmlString() const;
|
||||||
static PdmObjectHandle* readUnknownObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory);
|
static PdmObjectHandle* readUnknownObjectFromXmlString(const QString& xmlString, PdmObjectFactory* objectFactory, bool isCopyOperation);
|
||||||
PdmObjectHandle* copyByXmlSerialization(PdmObjectFactory* objectFactory);
|
PdmObjectHandle* copyByXmlSerialization(PdmObjectFactory* objectFactory);
|
||||||
PdmObjectHandle* copyAndCastByXmlSerialization(const QString& destinationClassKeyword,
|
PdmObjectHandle* copyAndCastByXmlSerialization(const QString& destinationClassKeyword,
|
||||||
const QString& sourceClassKeyword,
|
const QString& sourceClassKeyword,
|
||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
|
|
||||||
// Main XML serialization methods that is used internally by the document serialization system
|
// Main XML serialization methods that is used internally by the document serialization system
|
||||||
// Not supposed to be used directly.
|
// Not supposed to be used directly.
|
||||||
void readFields(QXmlStreamReader& inputStream, PdmObjectFactory* objectFactory);
|
void readFields(QXmlStreamReader& inputStream, PdmObjectFactory* objectFactory, bool isCopyOperation);
|
||||||
void writeFields(QXmlStreamWriter& outputStream) const;
|
void writeFields(QXmlStreamWriter& outputStream) const;
|
||||||
|
|
||||||
/// Check if a string is a valid Xml element name
|
/// Check if a string is a valid Xml element name
|
||||||
|
|||||||
Reference in New Issue
Block a user