#5317, #5318 Refactored RimIntersection, prepare to use as base class for RimSurfaceInView as well

This commit is contained in:
Jacob Støren 2020-01-14 14:57:23 +01:00
parent cdba7d2104
commit 2fa27f8718
6 changed files with 70 additions and 33 deletions

View File

@ -55,6 +55,8 @@ RimBoxIntersection::RimBoxIntersection()
{
CAF_PDM_InitObject( "Intersection Box", ":/IntersectionBox16x16.png", "", "" );
CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" );
CAF_PDM_InitField( &m_singlePlaneState,
"singlePlaneState",
caf::AppEnum<SinglePlaneState>( SinglePlaneState::PLANE_STATE_NONE ),
@ -100,6 +102,30 @@ RimBoxIntersection::~RimBoxIntersection()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimBoxIntersection::userDescriptionField()
{
return &m_name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimBoxIntersection::name() const
{
return m_name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimBoxIntersection::setName( const QString& newName )
{
m_name = newName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -62,6 +62,9 @@ public:
RimBoxIntersection();
~RimBoxIntersection() override;
QString name() const override;
void setName( const QString& newName );
cvf::Mat4d boxOrigin() const;
cvf::Vec3d boxSize() const;
SinglePlaneState singlePlaneState() const;
@ -76,6 +79,8 @@ public:
void setToDefaultSizeSlice( SinglePlaneState plane, const cvf::Vec3d& position );
protected:
caf::PdmFieldHandle* userDescriptionField() override final;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
@ -105,6 +110,8 @@ private:
RiuViewer* viewer();
private:
caf::PdmField<QString> m_name;
caf::PdmField<caf::AppEnum<SinglePlaneState>> m_singlePlaneState;
caf::PdmField<double> m_minXCoord;

View File

@ -83,6 +83,7 @@ CAF_PDM_SOURCE_INIT( RimExtrudedCurveIntersection, "CrossSection" );
RimExtrudedCurveIntersection::RimExtrudedCurveIntersection()
{
CAF_PDM_InitObject( "Intersection", ":/CrossSection16x16.png", "", "" );
CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" );
CAF_PDM_InitFieldNoDefault( &type, "Type", "Type", "", "", "" );
CAF_PDM_InitFieldNoDefault( &direction, "Direction", "Direction", "", "", "" );
@ -139,6 +140,30 @@ RimExtrudedCurveIntersection::RimExtrudedCurveIntersection()
//--------------------------------------------------------------------------------------------------
RimExtrudedCurveIntersection::~RimExtrudedCurveIntersection() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimExtrudedCurveIntersection::userDescriptionField()
{
return &m_name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimExtrudedCurveIntersection::name() const
{
return m_name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::setName( const QString& newName )
{
m_name = newName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -81,6 +81,9 @@ public:
caf::PdmField<bool> inputExtrusionPointsFromViewerEnabled;
caf::PdmField<bool> inputTwoAzimuthPointsFromViewerEnabled;
QString name() const override;
void setName( const QString& newName );
std::vector<std::vector<cvf::Vec3d>> polyLines( cvf::Vec3d* flattenedPolylineStartPoint = nullptr ) const;
void appendPointToPolyLine( const cvf::Vec3d& point );
@ -106,6 +109,7 @@ public:
void rebuildGeometryAndScheduleCreateDisplayModel();
protected:
caf::PdmFieldHandle* userDescriptionField() override final;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
@ -117,6 +121,8 @@ protected:
bool* useOptionsOnly ) override;
private:
caf::PdmField<QString> m_name;
caf::PdmField<int> m_branchIndex;
caf::PdmField<double> m_extentLength;
caf::PdmField<double> m_azimuthAngle;

View File

@ -31,14 +31,13 @@
#include "RimIntersectionResultsDefinitionCollection.h"
#include "RivHexGridIntersectionTools.h"
CAF_PDM_SOURCE_INIT( RimIntersection, "RimIntersectionHandle" );
CAF_PDM_ABSTRACT_SOURCE_INIT( RimIntersection, "RimIntersectionHandle" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersection::RimIntersection()
{
CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" );
CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" );
m_isActive.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "" );
@ -51,22 +50,6 @@ RimIntersection::RimIntersection()
//--------------------------------------------------------------------------------------------------
RimIntersection::~RimIntersection() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimIntersection::name() const
{
return m_name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersection::setName( const QString& newName )
{
m_name = newName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -137,14 +120,6 @@ QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions( const caf:
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimIntersection::userDescriptionField()
{
return &m_name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -35,8 +35,8 @@ public:
RimIntersection();
~RimIntersection() override;
QString name() const;
void setName( const QString& newName );
virtual QString name() const = 0;
bool isActive() const;
void setActive( bool isActive );
bool isInactiveCellsVisible() const;
@ -45,7 +45,6 @@ public:
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
protected:
caf::PdmFieldHandle* userDescriptionField() override final;
caf::PdmFieldHandle* objectToggleField() override final;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
@ -54,7 +53,6 @@ protected:
void defineSeparateDataSourceUi( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
void updateDefaultSeparateDataSource();
caf::PdmField<QString> m_name;
caf::PdmField<bool> m_isActive;
caf::PdmField<bool> m_showInactiveCells;
caf::PdmField<bool> m_useSeparateDataSource;