mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3447, #3207, #3448 Polished the target table. Improved insert target commands, Add icons to editable wellpaths and target list.
This commit is contained in:
parent
1dfad4f01d
commit
d9e8537974
@ -57,18 +57,50 @@ bool RicNewWellPathListTargetFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellPathListTargetFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellPathTarget*> targets;
|
||||
caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::FIRST_LEVEL);
|
||||
if (targets.size() > 0)
|
||||
std::vector<RimWellPathTarget*> selectedTargets;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedTargets, caf::SelectionManager::FIRST_LEVEL);
|
||||
if (selectedTargets.size() > 0)
|
||||
{
|
||||
auto firstTarget = targets.front();
|
||||
auto firstTarget = selectedTargets.front();
|
||||
RimWellPathGeometryDef* wellGeomDef = nullptr;
|
||||
firstTarget->firstAncestorOrThisOfTypeAsserted(wellGeomDef);
|
||||
|
||||
RimWellPathTarget* duplicate = dynamic_cast<RimWellPathTarget*>(firstTarget->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
wellGeomDef->insertTarget(firstTarget, duplicate);
|
||||
auto afterBeforePair = wellGeomDef->findActiveTargetsAroundInsertionPoint(firstTarget);
|
||||
|
||||
cvf::Vec3d newPos = cvf::Vec3d::ZERO;
|
||||
|
||||
if (!afterBeforePair.first && afterBeforePair.second)
|
||||
{
|
||||
newPos = afterBeforePair.second->targetPointXYZ();
|
||||
newPos.z() = -wellGeomDef->referencePointXyz().z();
|
||||
}
|
||||
else if (afterBeforePair.first && afterBeforePair.second)
|
||||
{
|
||||
newPos = 0.5*(afterBeforePair.first->targetPointXYZ() + afterBeforePair.second->targetPointXYZ());
|
||||
}
|
||||
else if (afterBeforePair.first && !afterBeforePair.second)
|
||||
{
|
||||
std::vector<RimWellPathTarget*> activeTargets = wellGeomDef->activeWellTargets();
|
||||
size_t targetCount = activeTargets.size();
|
||||
if (targetCount > 1)
|
||||
{
|
||||
newPos = activeTargets[targetCount-1]->targetPointXYZ();
|
||||
cvf::Vec3d nextLastToLast = newPos - activeTargets[targetCount-2]->targetPointXYZ();
|
||||
newPos += 0.5*nextLastToLast;
|
||||
}
|
||||
else
|
||||
{
|
||||
newPos = afterBeforePair.first->targetPointXYZ() + cvf::Vec3d(0, 0, 200);
|
||||
}
|
||||
}
|
||||
|
||||
RimWellPathTarget* newTarget = new RimWellPathTarget;
|
||||
newTarget->setAsPointTargetXYD({ newPos[0], newPos[1], -newPos[2] });
|
||||
|
||||
wellGeomDef->insertTarget(firstTarget, newTarget);
|
||||
wellGeomDef->updateConnectedEditors();
|
||||
wellGeomDef->updateWellPathVisualization();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -77,8 +109,34 @@ void RicNewWellPathListTargetFeature::onActionTriggered(bool isChecked)
|
||||
if (geomDefs.size() > 0)
|
||||
{
|
||||
RimWellPathGeometryDef* wellGeomDef = geomDefs[0];
|
||||
std::vector<RimWellPathTarget*> activeTargets = wellGeomDef->activeWellTargets();
|
||||
|
||||
size_t targetCount = activeTargets.size();
|
||||
|
||||
if ( targetCount == 0 )
|
||||
{
|
||||
wellGeomDef->appendTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::Vec3d newPos = cvf::Vec3d::ZERO;
|
||||
|
||||
if ( targetCount > 1 )
|
||||
{
|
||||
newPos = activeTargets[targetCount-1]->targetPointXYZ();
|
||||
cvf::Vec3d nextLastToLast = newPos - activeTargets[targetCount-2]->targetPointXYZ();
|
||||
newPos += 0.5*nextLastToLast;
|
||||
}
|
||||
else if ( targetCount > 0 )
|
||||
{
|
||||
newPos = activeTargets[targetCount-1]->targetPointXYZ() + cvf::Vec3d(0, 0, 200);
|
||||
}
|
||||
|
||||
RimWellPathTarget* newTarget = new RimWellPathTarget;
|
||||
newTarget->setAsPointTargetXYD({ newPos[0], newPos[1], -newPos[2] });
|
||||
wellGeomDef->insertTarget(nullptr, newTarget);
|
||||
}
|
||||
|
||||
wellGeomDef->appendTarget();
|
||||
wellGeomDef->updateConnectedEditors();
|
||||
wellGeomDef->updateWellPathVisualization();
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT(RimModeledWellPath, "ModeledWellPath");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimModeledWellPath::RimModeledWellPath()
|
||||
{
|
||||
CAF_PDM_InitObject("Modeled WellPath", ":/Well.png", "", "");
|
||||
CAF_PDM_InitObject("Modeled WellPath", ":/EditableWell.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_geometryDefinition, "WellPathGeometryDef", "Trajectory", "", "", "");
|
||||
m_geometryDefinition = new RimWellPathGeometryDef;
|
||||
|
@ -58,7 +58,7 @@ CAF_PDM_SOURCE_INIT(RimWellPathGeometryDef, "WellPathGeometryDef");
|
||||
RimWellPathGeometryDef::RimWellPathGeometryDef()
|
||||
: m_pickTargetsEventHandler(new RicCreateWellTargetsPickEventHandler(this))
|
||||
{
|
||||
CAF_PDM_InitObject("Well Targets", ":/Well.png", "", "");
|
||||
CAF_PDM_InitObject("Well Targets", ":/WellTargets.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_referencePointUtmXyd, "ReferencePosUtmXyd", cvf::Vec3d(0,0,0), "UTM Reference Point", "", "", "");
|
||||
|
||||
@ -164,6 +164,31 @@ void RimWellPathGeometryDef::updateWellPathVisualization()
|
||||
modWellPath->updateWellPathVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<RimWellPathTarget*, RimWellPathTarget*>
|
||||
RimWellPathGeometryDef::findActiveTargetsAroundInsertionPoint(const RimWellPathTarget* targetToInsertBefore)
|
||||
{
|
||||
RimWellPathTarget* before = nullptr;
|
||||
RimWellPathTarget* after = nullptr;
|
||||
|
||||
bool foundTarget = false;
|
||||
for (const auto& wt : m_wellTargets)
|
||||
{
|
||||
if ( wt == targetToInsertBefore )
|
||||
{
|
||||
foundTarget = true;
|
||||
}
|
||||
|
||||
if ( wt->isEnabled() && !after && foundTarget ) after = wt;
|
||||
|
||||
if ( wt->isEnabled() && !foundTarget ) before = wt;
|
||||
}
|
||||
|
||||
return { before, after};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
cvf::ref<RigWellPath> createWellPathGeometry();
|
||||
|
||||
void updateWellPathVisualization();
|
||||
std::pair<RimWellPathTarget*, RimWellPathTarget*> findActiveTargetsAroundInsertionPoint(const RimWellPathTarget* targetToInsertBefore);
|
||||
|
||||
void insertTarget(const RimWellPathTarget* targetToInsertBefore,
|
||||
RimWellPathTarget* targetToInsert);
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <cmath>
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellPathTarget, "WellPathTarget");
|
||||
|
||||
@ -28,13 +29,16 @@ RimWellPathTarget::RimWellPathTarget()
|
||||
{
|
||||
|
||||
CAF_PDM_InitField(&m_isEnabled, "IsEnabled", true, "", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_targetType, "TargetType", "Type", "", "", "");
|
||||
//m_targetType.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitField(&m_dogleg1, "Dogleg1", 3.0, "DLS 1", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_targetPoint, "TargetPoint", "Point", "", "", "");
|
||||
CAF_PDM_InitField(&m_dogleg1, "Dogleg1", 3.0, "DLh", "", "", "");
|
||||
CAF_PDM_InitField(&m_dogleg2, "Dogleg2", 3.0, "DLl", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_targetType, "TargetType", "Type", "", "", "");
|
||||
m_targetType.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitField(&m_hasTangentConstraintUiField, "HasTangentConstraint", false, "Dir", "", "", "");
|
||||
m_hasTangentConstraintUiField.xmlCapability()->disableIO();
|
||||
CAF_PDM_InitField(&m_azimuth, "Azimuth", 0.0, "Azi(deg)", "", "", "");
|
||||
CAF_PDM_InitField(&m_inclination, "Inclination", 0.0, "Inc(deg)", "", "", "");
|
||||
CAF_PDM_InitField(&m_dogleg2, "Dogleg2", 3.0, "DLS 2", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -252,8 +256,8 @@ QList<caf::PdmOptionItemInfo> RimWellPathTarget::calculateValueOptions(const caf
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
if (fieldNeedingOptions == & m_targetType)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("o->",RimWellPathTarget::POINT_AND_TANGENT, false, QIcon(":/WellTargetPointTangent16x16.png") ));
|
||||
options.push_back(caf::PdmOptionItemInfo("o", RimWellPathTarget::POINT, false, QIcon(":/WellTargetPoint16x16.png")));
|
||||
options.push_back(caf::PdmOptionItemInfo("o->",RimWellPathTarget::POINT_AND_TANGENT));//, false, QIcon(":/WellTargetPointTangent16x16.png") ));
|
||||
options.push_back(caf::PdmOptionItemInfo("o", RimWellPathTarget::POINT));//, false, QIcon(":/WellTargetPoint16x16.png")));
|
||||
}
|
||||
return options;
|
||||
}
|
||||
@ -263,6 +267,12 @@ QList<caf::PdmOptionItemInfo> RimWellPathTarget::calculateValueOptions(const caf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathTarget::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_hasTangentConstraintUiField)
|
||||
{
|
||||
if (m_hasTangentConstraintUiField) m_targetType = POINT_AND_TANGENT;
|
||||
else m_targetType = POINT;
|
||||
}
|
||||
|
||||
RimModeledWellPath* wellPath;
|
||||
firstAncestorOrThisOfTypeAsserted(wellPath);
|
||||
wellPath->updateWellPathVisualization();
|
||||
@ -270,6 +280,7 @@ void RimWellPathTarget::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|
||||
{
|
||||
wellPath->scheduleUpdateOfDependentVisualization();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -277,9 +288,11 @@ void RimWellPathTarget::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathTarget::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
m_hasTangentConstraintUiField = (m_targetType == POINT_AND_TANGENT);
|
||||
|
||||
if (m_isEnabled())
|
||||
{
|
||||
|
||||
m_hasTangentConstraintUiField.uiCapability()->setUiReadOnly(false);
|
||||
m_targetType.uiCapability()->setUiReadOnly(false);
|
||||
m_targetPoint.uiCapability()->setUiReadOnly(false);
|
||||
m_dogleg2.uiCapability()->setUiReadOnly(false);
|
||||
@ -318,5 +331,6 @@ void RimWellPathTarget::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
m_azimuth.uiCapability()->setUiReadOnly(true);
|
||||
m_inclination.uiCapability()->setUiReadOnly(true);
|
||||
m_dogleg2.uiCapability()->setUiReadOnly(true);
|
||||
m_hasTangentConstraintUiField.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ private:
|
||||
caf::PdmField<double> m_inclination;
|
||||
caf::PdmField<double> m_dogleg1;
|
||||
caf::PdmField<double> m_dogleg2;
|
||||
caf::PdmField<bool> m_hasTangentConstraintUiField;
|
||||
|
||||
};
|
||||
|
||||
|
BIN
ApplicationCode/Resources/EditableWell.png
Normal file
BIN
ApplicationCode/Resources/EditableWell.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 466 B |
@ -18,6 +18,8 @@
|
||||
<file>Minus.png</file>
|
||||
<file>Save.png</file>
|
||||
<file>Well.png</file>
|
||||
<file>EditableWell.png</file>
|
||||
<file>WellTargets.png</file>
|
||||
<file>WellCollection.png</file>
|
||||
<file>octave.png</file>
|
||||
<file>OctaveScriptFile16x16.png</file>
|
||||
|
BIN
ApplicationCode/Resources/WellTargets.png
Normal file
BIN
ApplicationCode/Resources/WellTargets.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 241 B |
Loading…
Reference in New Issue
Block a user