Wellcollection can control if well head label is positioned at top active cell for IJ column or top Z of active cells bounding box

p4#: 22190
This commit is contained in:
Magne Sjaastad 2013-08-22 07:55:21 +02:00
parent cbbc5ae80b
commit 627211685d
3 changed files with 53 additions and 6 deletions

View File

@ -110,18 +110,44 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
// Compute well head based on the z position of the top of the K column the well head is part of
cvf::Vec3d whEndPos = whStartPos;
if (m_rimReservoirView->wellCollection()->wellHeadPosition() == RimWellCollection::WELLHEAD_POS_TOP_COLUMN)
{
// Position well head at top active cell of IJ-column
size_t i, j, k;
rigReservoir->mainGrid()->ijkFromCellIndex(whCell.mainGridCellIndex(), &i, &j, &k);
size_t topCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, 0);
const RigCell& topCell = rigReservoir->mainGrid()->cell(topCellIndex);
cvf::Vec3d topCellPos = topCell.faceCenter(cvf::StructGridInterface::NEG_K);
size_t kIndexWellHeadCell = k;
k = 0;
size_t topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
while(k < kIndexWellHeadCell && !m_rimReservoirView->currentActiveCellInfo()->isActive(topActiveCellIndex))
{
k++;
topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
}
const RigCell& topActiveCell = rigReservoir->mainGrid()->cell(topActiveCellIndex);
cvf::Vec3d topCellPos = topActiveCell.faceCenter(cvf::StructGridInterface::NEG_K);
topCellPos -= rigReservoir->mainGrid()->displayModelOffset();
topCellPos.transformPoint(m_scaleTransform->worldTransform());
whEndPos.z() = topCellPos.z();
// Modify position if top active cell is closer to sea than well head
if (kIndexWellHeadCell > k)
{
whEndPos.z() = topCellPos.z() + characteristicCellSize;
}
}
else
{
// Position well head at top of active cells bounding box
cvf::Vec3d activeCellsBoundingBoxMax = m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max();
activeCellsBoundingBoxMax -= rigReservoir->mainGrid()->displayModelOffset();
activeCellsBoundingBoxMax.transformPoint(m_scaleTransform->worldTransform());
whEndPos.z() = activeCellsBoundingBoxMax.z();
}
cvf::Vec3d arrowPosition = whEndPos;

View File

@ -66,6 +66,16 @@ namespace caf
}
}
namespace caf
{
template<>
void RimWellCollection::WellHeadPositionEnum::setUp()
{
addItem(RimWellCollection::WELLHEAD_POS_ACTIVE_CELLS_BB, "WELLHEAD_POS_ACTIVE_CELLS_BB", "Top of active cells BB");
addItem(RimWellCollection::WELLHEAD_POS_TOP_COLUMN, "WELLHEAD_POS_TOP_COLUMN", "Top of active cells IJ-column");
setDefault(RimWellCollection::WELLHEAD_POS_TOP_COLUMN);
}
}
CAF_PDM_SOURCE_INIT(RimWellCollection, "Wells");
@ -82,6 +92,7 @@ RimWellCollection::RimWellCollection()
CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well heads", "", "", "");
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well labels", "", "", "");
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well head scale", "", "", "");
CAF_PDM_InitField(&wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum(WELLHEAD_POS_TOP_COLUMN), "Well head position", "", "", "");
CAF_PDM_InitField(&wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well pipe visibility", "", "", "");
@ -231,7 +242,8 @@ void RimWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|| &pipeRadiusScaleFactor == changedField
|| &wellHeadScaleFactor == changedField
|| &showWellHead == changedField
|| &isAutoDetectingBranches == changedField)
|| &isAutoDetectingBranches == changedField
|| &wellHeadPosition == changedField)
{
if (m_reservoirView)
{

View File

@ -67,6 +67,14 @@ public:
};
typedef caf::AppEnum<RimWellCollection::WellFenceType> WellFenceEnum;
enum WellHeadPositionType
{
WELLHEAD_POS_ACTIVE_CELLS_BB,
WELLHEAD_POS_TOP_COLUMN
};
typedef caf::AppEnum<RimWellCollection::WellHeadPositionType> WellHeadPositionEnum;
caf::PdmField<bool> showWellLabel;
caf::PdmField<bool> isActive;
@ -81,6 +89,7 @@ public:
caf::PdmField<double> wellHeadScaleFactor;
caf::PdmField<bool> showWellHead;
caf::PdmField<WellHeadPositionEnum> wellHeadPosition;
caf::PdmField<bool> isAutoDetectingBranches;