2018-12-07 02:11:03 -06:00
|
|
|
#include "RimPolylineTarget.h"
|
|
|
|
#include "RimModeledWellPath.h"
|
|
|
|
|
|
|
|
#include "RimUserDefinedPolylinesAnnotation.h"
|
|
|
|
#include "cafPdmUiCheckBoxEditor.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include <cmath>
|
2018-12-07 02:11:03 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_SOURCE_INIT( RimPolylineTarget, "PolylineTarget" );
|
2018-12-07 02:11:03 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimPolylineTarget::RimPolylineTarget()
|
2019-09-06 03:40:57 -05:00
|
|
|
: m_isFullUpdateEnabled( true )
|
2018-12-07 02:11:03 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_InitField( &m_isEnabled, "IsEnabled", true, "", "", "", "" );
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_targetPointXyd, "TargetPointXyd", "Point", "", "", "" );
|
2018-12-07 02:11:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
RimPolylineTarget::~RimPolylineTarget()
|
|
|
|
{
|
|
|
|
}
|
2018-12-07 02:11:03 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimPolylineTarget::isEnabled() const
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return m_isEnabled;
|
2018-12-07 02:11:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimPolylineTarget::setAsPointTargetXYD( const cvf::Vec3d& point )
|
2018-12-07 02:11:03 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_targetPointXyd = point;
|
2018-12-07 02:11:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimPolylineTarget::setAsPointXYZ( const cvf::Vec3d& point )
|
2018-12-07 02:11:03 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_targetPointXyd = cvf::Vec3d( point.x(), point.y(), -point.z() );
|
2018-12-07 02:11:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
cvf::Vec3d RimPolylineTarget::targetPointXYZ() const
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
cvf::Vec3d xyzPoint( m_targetPointXyd() );
|
2018-12-07 02:11:03 -06:00
|
|
|
xyzPoint.z() = -xyzPoint.z();
|
|
|
|
return xyzPoint;
|
|
|
|
}
|
|
|
|
|
2018-12-11 04:50:52 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
caf::PdmUiFieldHandle* RimPolylineTarget::targetPointUiCapability()
|
|
|
|
{
|
|
|
|
return m_targetPointXyd.uiCapability();
|
|
|
|
}
|
|
|
|
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimPolylineTarget::enableFullUpdate( bool enable )
|
2018-12-07 02:11:03 -06:00
|
|
|
{
|
|
|
|
m_isFullUpdateEnabled = enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> RimPolylineTarget::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
|
|
|
bool* useOptionsOnly )
|
2018-12-07 02:11:03 -06:00
|
|
|
{
|
|
|
|
QList<caf::PdmOptionItemInfo> options;
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimPolylineTarget::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue )
|
2018-12-07 02:11:03 -06:00
|
|
|
{
|
|
|
|
RimUserDefinedPolylinesAnnotation* polyline;
|
2019-09-06 03:40:57 -05:00
|
|
|
firstAncestorOrThisOfTypeAsserted( polyline );
|
2018-12-07 02:11:03 -06:00
|
|
|
polyline->updateVisualization();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-12-07 02:11:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimPolylineTarget::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
2018-12-07 02:11:03 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_targetPointXyd.uiCapability()->setUiReadOnly( m_isEnabled() );
|
2018-12-07 02:11:03 -06:00
|
|
|
}
|