mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3723 Annotations. User editable polyline, both in in view and in property editor
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "RimUserDefinedPolylinesAnnotation.h"
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimPolylineTarget, "PolylineTarget");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineTarget::RimPolylineTarget()
|
||||
: m_isFullUpdateEnabled(true)
|
||||
{
|
||||
|
||||
CAF_PDM_InitField(&m_isEnabled, "IsEnabled", true, "", "", "", "");
|
||||
//m_targetType.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault(&m_targetPoint, "TargetPoint", "Point", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPolylineTarget::~RimPolylineTarget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolylineTarget::isEnabled() const
|
||||
{
|
||||
return m_isEnabled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::setAsPointTargetXYD(const cvf::Vec3d& point)
|
||||
{
|
||||
m_targetPoint = point;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::setAsPointXYZAndTangentTarget(const cvf::Vec3d& point,
|
||||
double azimuth,
|
||||
double inclination)
|
||||
{
|
||||
m_targetPoint = cvf::Vec3d(point.x(), point.y(), -point.z());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimPolylineTarget::targetPointXYZ() const
|
||||
{
|
||||
cvf::Vec3d xyzPoint(m_targetPoint());
|
||||
xyzPoint.z() = -xyzPoint.z();
|
||||
return xyzPoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::enableFullUpdate(bool enable)
|
||||
{
|
||||
m_isFullUpdateEnabled = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimPolylineTarget::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimUserDefinedPolylinesAnnotation* polyline;
|
||||
firstAncestorOrThisOfTypeAsserted(polyline);
|
||||
polyline->updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolylineTarget::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
m_targetPoint.uiCapability()->setUiReadOnly(m_isEnabled());
|
||||
}
|
||||
Reference in New Issue
Block a user