mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4999 Fixed well target manipulators not sensitive sometimes
This commit is contained in:
parent
25b97c9cca
commit
6850a37c11
@ -48,6 +48,7 @@ RicPointTangentManipulatorPartMgr::RicPointTangentManipulatorPartMgr()
|
|||||||
, m_originOnStartManipulation( cvf::Vec3d::UNDEFINED )
|
, m_originOnStartManipulation( cvf::Vec3d::UNDEFINED )
|
||||||
, m_activeHandle( NONE )
|
, m_activeHandle( NONE )
|
||||||
, m_handleSize( 1.0 )
|
, m_handleSize( 1.0 )
|
||||||
|
, m_isGeometryUpdateNeeded( true )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ void RicPointTangentManipulatorPartMgr::setOrigin( const cvf::Vec3d& origin )
|
|||||||
m_origin = origin;
|
m_origin = origin;
|
||||||
if ( m_originOnStartManipulation.isUndefined() ) m_originOnStartManipulation = origin;
|
if ( m_originOnStartManipulation.isUndefined() ) m_originOnStartManipulation = origin;
|
||||||
|
|
||||||
clearAllGeometryAndParts();
|
m_isGeometryUpdateNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -79,7 +80,7 @@ void RicPointTangentManipulatorPartMgr::setTangent( const cvf::Vec3d& tangent )
|
|||||||
m_tangent = tangent;
|
m_tangent = tangent;
|
||||||
if ( m_tangentOnStartManipulation.isUndefined() ) m_tangentOnStartManipulation = m_tangent;
|
if ( m_tangentOnStartManipulation.isUndefined() ) m_tangentOnStartManipulation = m_tangent;
|
||||||
|
|
||||||
clearAllGeometryAndParts();
|
m_isGeometryUpdateNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -88,6 +89,8 @@ void RicPointTangentManipulatorPartMgr::setTangent( const cvf::Vec3d& tangent )
|
|||||||
void RicPointTangentManipulatorPartMgr::setHandleSize( double handleSize )
|
void RicPointTangentManipulatorPartMgr::setHandleSize( double handleSize )
|
||||||
{
|
{
|
||||||
m_handleSize = handleSize;
|
m_handleSize = handleSize;
|
||||||
|
|
||||||
|
m_isGeometryUpdateNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -117,6 +120,11 @@ void RicPointTangentManipulatorPartMgr::appendPartsToModel( cvf::ModelBasicList*
|
|||||||
recreateAllGeometryAndParts();
|
recreateAllGeometryAndParts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( m_isGeometryUpdateNeeded )
|
||||||
|
{
|
||||||
|
createGeometryOnly();
|
||||||
|
}
|
||||||
|
|
||||||
for ( auto& idPartIt : m_handleParts )
|
for ( auto& idPartIt : m_handleParts )
|
||||||
{
|
{
|
||||||
model->addPart( idPartIt.second.p() );
|
model->addPart( idPartIt.second.p() );
|
||||||
@ -193,7 +201,7 @@ void RicPointTangentManipulatorPartMgr::updateManipulatorFromRay( const cvf::Ray
|
|||||||
}
|
}
|
||||||
// m_tangent = newTangent;
|
// m_tangent = newTangent;
|
||||||
|
|
||||||
clearAllGeometryAndParts();
|
m_isGeometryUpdateNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -204,32 +212,13 @@ void RicPointTangentManipulatorPartMgr::endManipulator()
|
|||||||
m_activeHandle = NONE;
|
m_activeHandle = NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicPointTangentManipulatorPartMgr::clearAllGeometryAndParts()
|
|
||||||
{
|
|
||||||
m_handleParts.clear();
|
|
||||||
m_activeDragModeParts.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicPointTangentManipulatorPartMgr::recreateAllGeometryAndParts()
|
void RicPointTangentManipulatorPartMgr::recreateAllGeometryAndParts()
|
||||||
{
|
{
|
||||||
createAllHandleParts();
|
createHorizontalPlaneHandle();
|
||||||
}
|
createVerticalAxisHandle();
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicPointTangentManipulatorPartMgr::clearGeometryOnly()
|
|
||||||
{
|
|
||||||
for ( auto& idPartIt : m_handleParts )
|
|
||||||
{
|
|
||||||
idPartIt.second->setDrawable( nullptr );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -237,16 +226,8 @@ void RicPointTangentManipulatorPartMgr::clearGeometryOnly()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicPointTangentManipulatorPartMgr::createGeometryOnly()
|
void RicPointTangentManipulatorPartMgr::createGeometryOnly()
|
||||||
{
|
{
|
||||||
// m_handleParts[]
|
m_handleParts[HORIZONTAL_PLANE]->setDrawable( createHorizontalPlaneGeo().p() );
|
||||||
}
|
m_handleParts[VERTICAL_AXIS]->setDrawable( createVerticalAxisGeo().p() );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicPointTangentManipulatorPartMgr::createAllHandleParts()
|
|
||||||
{
|
|
||||||
createHorizontalPlaneHandle();
|
|
||||||
createVerticalAxisHandle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -297,7 +278,7 @@ cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createHorizontalPl
|
|||||||
void RicPointTangentManipulatorPartMgr::createVerticalAxisHandle()
|
void RicPointTangentManipulatorPartMgr::createVerticalAxisHandle()
|
||||||
{
|
{
|
||||||
using namespace cvf;
|
using namespace cvf;
|
||||||
cvf::ref<cvf::DrawableGeo> geo = createVertexAxisGeo();
|
cvf::ref<cvf::DrawableGeo> geo = createVerticalAxisGeo();
|
||||||
|
|
||||||
HandleType handleId = VERTICAL_AXIS;
|
HandleType handleId = VERTICAL_AXIS;
|
||||||
cvf::Color4f color = cvf::Color4f( 0.0f, 0.2f, 0.8f, 0.5f );
|
cvf::Color4f color = cvf::Color4f( 0.0f, 0.2f, 0.8f, 0.5f );
|
||||||
@ -309,7 +290,7 @@ void RicPointTangentManipulatorPartMgr::createVerticalAxisHandle()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createVertexAxisGeo()
|
cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createVerticalAxisGeo()
|
||||||
{
|
{
|
||||||
using namespace cvf;
|
using namespace cvf;
|
||||||
|
|
||||||
|
@ -72,18 +72,14 @@ public:
|
|||||||
void appendPartsToModel( cvf::ModelBasicList* model );
|
void appendPartsToModel( cvf::ModelBasicList* model );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clearGeometryOnly();
|
|
||||||
void createGeometryOnly();
|
void createGeometryOnly();
|
||||||
|
|
||||||
void createAllHandleParts();
|
|
||||||
void clearAllGeometryAndParts();
|
|
||||||
void recreateAllGeometryAndParts();
|
void recreateAllGeometryAndParts();
|
||||||
|
|
||||||
void createHorizontalPlaneHandle();
|
void createHorizontalPlaneHandle();
|
||||||
cvf::ref<cvf::DrawableGeo> createHorizontalPlaneGeo();
|
cvf::ref<cvf::DrawableGeo> createHorizontalPlaneGeo();
|
||||||
|
|
||||||
void createVerticalAxisHandle();
|
void createVerticalAxisHandle();
|
||||||
cvf::ref<cvf::DrawableGeo> createVertexAxisGeo();
|
cvf::ref<cvf::DrawableGeo> createVerticalAxisGeo();
|
||||||
|
|
||||||
void addHandlePart( cvf::DrawableGeo* geo, const cvf::Color4f& color, HandleType handleId, const cvf::String& partName );
|
void addHandlePart( cvf::DrawableGeo* geo, const cvf::Color4f& color, HandleType handleId, const cvf::String& partName );
|
||||||
|
|
||||||
@ -98,13 +94,16 @@ private:
|
|||||||
static cvf::ref<cvf::Part> createPart( cvf::DrawableGeo* geo, const cvf::Color4f& color, const cvf::String& partName );
|
static cvf::ref<cvf::Part> createPart( cvf::DrawableGeo* geo, const cvf::Color4f& color, const cvf::String& partName );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HandleType m_activeHandle;
|
|
||||||
std::map<HandleType, cvf::ref<cvf::Part>> m_handleParts; // These arrays have the same length
|
std::map<HandleType, cvf::ref<cvf::Part>> m_handleParts; // These arrays have the same length
|
||||||
cvf::Collection<cvf::Part> m_activeDragModeParts;
|
cvf::Collection<cvf::Part> m_activeDragModeParts;
|
||||||
cvf::Vec3d m_origin;
|
|
||||||
cvf::Vec3d m_tangent;
|
cvf::Vec3d m_origin;
|
||||||
double m_handleSize;
|
cvf::Vec3d m_tangent;
|
||||||
cvf::Vec3d m_initialPickPoint;
|
double m_handleSize;
|
||||||
cvf::Vec3d m_tangentOnStartManipulation;
|
bool m_isGeometryUpdateNeeded;
|
||||||
cvf::Vec3d m_originOnStartManipulation;
|
|
||||||
|
HandleType m_activeHandle;
|
||||||
|
cvf::Vec3d m_initialPickPoint;
|
||||||
|
cvf::Vec3d m_tangentOnStartManipulation;
|
||||||
|
cvf::Vec3d m_originOnStartManipulation;
|
||||||
};
|
};
|
||||||
|
@ -92,13 +92,17 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName )
|
|||||||
if ( m_manipulator.isNull() )
|
if ( m_manipulator.isNull() )
|
||||||
{
|
{
|
||||||
m_manipulator = new RicPointTangentManipulator( ownerRiuViewer );
|
m_manipulator = new RicPointTangentManipulator( ownerRiuViewer );
|
||||||
|
|
||||||
QObject::connect( m_manipulator,
|
QObject::connect( m_manipulator,
|
||||||
SIGNAL( notifyUpdate( const cvf::Vec3d&, const cvf::Vec3d& ) ),
|
SIGNAL( notifyUpdate( const cvf::Vec3d&, const cvf::Vec3d& ) ),
|
||||||
this,
|
this,
|
||||||
SLOT( slotUpdated( const cvf::Vec3d&, const cvf::Vec3d& ) ) );
|
SLOT( slotUpdated( const cvf::Vec3d&, const cvf::Vec3d& ) ) );
|
||||||
|
|
||||||
QObject::connect( m_manipulator, SIGNAL( notifySelected() ), this, SLOT( slotSelectedIn3D() ) );
|
QObject::connect( m_manipulator, SIGNAL( notifySelected() ), this, SLOT( slotSelectedIn3D() ) );
|
||||||
QObject::connect( m_manipulator, SIGNAL( notifyDragFinished() ), this, SLOT( slotDragFinished() ) );
|
QObject::connect( m_manipulator, SIGNAL( notifyDragFinished() ), this, SLOT( slotDragFinished() ) );
|
||||||
|
|
||||||
m_cvfModel = new cvf::ModelBasicList;
|
m_cvfModel = new cvf::ModelBasicList;
|
||||||
|
|
||||||
ownerRiuViewer->addStaticModelOnce( m_cvfModel.p() );
|
ownerRiuViewer->addStaticModelOnce( m_cvfModel.p() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,6 +117,7 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName )
|
|||||||
m_manipulator->setOrigin( dispXf->transformToDisplayCoord( target->targetPointXYZ() + geomDef->referencePointXyz() ) );
|
m_manipulator->setOrigin( dispXf->transformToDisplayCoord( target->targetPointXYZ() + geomDef->referencePointXyz() ) );
|
||||||
m_manipulator->setTangent( target->tangent() );
|
m_manipulator->setTangent( target->tangent() );
|
||||||
m_manipulator->setHandleSize( handleSize );
|
m_manipulator->setHandleSize( handleSize );
|
||||||
|
|
||||||
m_cvfModel->removeAllParts();
|
m_cvfModel->removeAllParts();
|
||||||
m_manipulator->appendPartsToModel( m_cvfModel.p() );
|
m_manipulator->appendPartsToModel( m_cvfModel.p() );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user