#817 #815 Improved commands for xyz - slices intersection boxes.

This commit is contained in:
Jacob Støren 2016-09-28 12:39:43 +02:00
parent c84b7ab6d9
commit fa6a6b4f08
10 changed files with 89 additions and 147 deletions

View File

@ -56,15 +56,10 @@ void RicAppendIntersectionBoxFeature::onActionTriggered(bool isChecked)
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = QString("Intersection Box");
RimCase* rimCase = NULL;
coll->firstAnchestorOrThisOfType(rimCase);
if (rimCase)
{
intersectionBox->setModelBoundingBox(rimCase->activeCellsBoundingBox());
}
coll->appendIntersectionBox(intersectionBox);
intersectionBox->setToDefaultSizeBox();
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);

View File

@ -59,26 +59,11 @@ void RicIntersectionBoxXSliceFeature::onActionTriggered(bool isChecked)
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = QString("X-slice (Intersection box)");
RimCase* rimCase = NULL;
coll->firstAnchestorOrThisOfType(rimCase);
if (rimCase)
{
intersectionBox->setModelBoundingBox(rimCase->activeCellsBoundingBox());
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
if (!domainCoord.isUndefined())
{
intersectionBox->setXSlice(domainCoord.x());
}
else
{
intersectionBox->setXSlice(rimCase->activeCellsBoundingBox().center().x());
}
}
coll->appendIntersectionBox(intersectionBox);
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_X, domainCoord);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);

View File

@ -59,26 +59,11 @@ void RicIntersectionBoxYSliceFeature::onActionTriggered(bool isChecked)
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = QString("Y-slice (Intersection box)");
RimCase* rimCase = NULL;
coll->firstAnchestorOrThisOfType(rimCase);
if (rimCase)
{
intersectionBox->setModelBoundingBox(rimCase->activeCellsBoundingBox());
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
if (!domainCoord.isUndefined())
{
intersectionBox->setYSlice(domainCoord.y());
}
else
{
intersectionBox->setYSlice(rimCase->activeCellsBoundingBox().center().y());
}
}
coll->appendIntersectionBox(intersectionBox);
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Y, domainCoord);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);

View File

@ -59,25 +59,9 @@ void RicIntersectionBoxZSliceFeature::onActionTriggered(bool isChecked)
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = QString("Z-slice (Intersection box)");
RimCase* rimCase = NULL;
coll->firstAnchestorOrThisOfType(rimCase);
if (rimCase)
{
intersectionBox->setModelBoundingBox(rimCase->activeCellsBoundingBox());
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
if (!domainCoord.isUndefined())
{
intersectionBox->setZSlice(domainCoord.z());
}
else
{
intersectionBox->setZSlice(rimCase->activeCellsBoundingBox().center().z());
}
}
coll->appendIntersectionBox(intersectionBox);
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
intersectionBox->setToDefaultSizeSlice(RimIntersectionBox::PLANE_STATE_Z, domainCoord);
coll->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);

View File

@ -706,8 +706,6 @@ void RimEclipseView::loadDataAndUpdate()
this->faultCollection()->setReservoirView(this);
this->faultCollection()->syncronizeFaults();
this->intersectionBoxCollection()->initialize();
m_reservoirGridPartManager->clearGeometryCache();
syncronizeWellsWithResults();

View File

@ -164,8 +164,6 @@ void RimGeoMechView::loadDataAndUpdate()
this->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
this->intersectionBoxCollection()->initialize();
this->scheduleCreateDisplayModelAndRedraw();
progress.incrementProgress();

View File

@ -24,6 +24,7 @@
#include "cafPdmUiSliderEditor.h"
#include "RimCase.h"
#include "cafPdmUiDoubleSliderEditor.h"
#include "RimEclipseView.h"
namespace caf
@ -111,76 +112,74 @@ RimIntersectionBox::SinglePlaneState RimIntersectionBox::singlePlaneState() cons
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::setModelBoundingBox(cvf::BoundingBox& boundingBox)
void RimIntersectionBox::setToDefaultSizeBox()
{
m_boundingBox = boundingBox;
cvf::BoundingBox boundingBox = currentCellBoundingBox();
cvf::Vec3d center = boundingBox.center();
double defaultWidthFactor = 0.5;
m_minXCoord = boundingBox.min().x() + boundingBox.extent().x() / 4.0;
m_minYCoord = boundingBox.min().y() + boundingBox.extent().y() / 4.0;
m_minZCoord = boundingBox.min().z() + boundingBox.extent().z() / 4.0;
m_maxXCoord = boundingBox.max().x() - boundingBox.extent().x() / 4.0;
m_maxYCoord = boundingBox.max().y() - boundingBox.extent().y() / 4.0;
m_maxZCoord = boundingBox.max().z() - boundingBox.extent().z() / 4.0;
updateLabelsFromBoundingBox();
m_minXCoord = center.x() - 0.5 * boundingBox.extent().x() * defaultWidthFactor;
m_minYCoord = center.y() - 0.5 * boundingBox.extent().y() * defaultWidthFactor;
m_minZCoord = center.z() - 0.5 * boundingBox.extent().z() * defaultWidthFactor;
m_maxXCoord = center.x() + 0.5 * boundingBox.extent().x() * defaultWidthFactor;
m_maxYCoord = center.y() + 0.5 * boundingBox.extent().y() * defaultWidthFactor;
m_maxZCoord = center.z() + 0.5 * boundingBox.extent().z() * defaultWidthFactor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::setXSlice(double xValue)
void RimIntersectionBox::setToDefaultSizeSlice(SinglePlaneState plane, const cvf::Vec3d& position)
{
m_singlePlaneState = PLANE_STATE_X;
m_minXCoord = xValue;
m_maxXCoord = xValue;
m_singlePlaneState = plane;
cvf::BoundingBox boundingBox = currentCellBoundingBox();
cvf::Vec3d center = position;
if (center.isUndefined()) center = boundingBox.center();
double defaultWidthFactor = 0.5;
m_minXCoord = center[0] - 0.5 * boundingBox.extent().x() * defaultWidthFactor;
m_minYCoord = center[1] - 0.5 * boundingBox.extent().y() * defaultWidthFactor;
m_minZCoord = center[2] - 0.5 * boundingBox.extent().z() * defaultWidthFactor;
m_maxXCoord = center[0] + 0.5 * boundingBox.extent().x() * defaultWidthFactor;
m_maxYCoord = center[1] + 0.5 * boundingBox.extent().y() * defaultWidthFactor;
m_maxZCoord = center[2] + 0.5 * boundingBox.extent().z() * defaultWidthFactor;
switch (plane)
{
case PLANE_STATE_X: m_minXCoord = m_maxXCoord = center[0]; break;
case PLANE_STATE_Y: m_minYCoord = m_maxYCoord = center[1]; break;
case PLANE_STATE_Z: m_minZCoord = m_maxZCoord = center[2]; break;
}
updateVisibility();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::setYSlice(double yValue)
{
m_singlePlaneState = PLANE_STATE_Y;
m_minYCoord = yValue;
m_maxYCoord = yValue;
updateVisibility();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::setZSlice(double zValue)
{
m_singlePlaneState = PLANE_STATE_Z;
m_minZCoord = zValue;
m_maxZCoord = zValue;
updateVisibility();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::updateLabelsFromBoundingBox()
{
cvf::BoundingBox cellsBoundingBox = currentCellBoundingBox();
{
QString range = QString(" [%1 - %2]").arg(m_boundingBox.min().x()).arg(m_boundingBox.max().x());
QString range = QString(" [%1 - %2]").arg(cellsBoundingBox.min().x()).arg(cellsBoundingBox.max().x());
m_minXCoord.uiCapability()->setUiName(QString("Min X") + range);
m_maxXCoord.uiCapability()->setUiName(QString("Max X") + range);
}
{
QString range = QString(" [%1 - %2]").arg(m_boundingBox.min().y()).arg(m_boundingBox.max().y());
QString range = QString(" [%1 - %2]").arg(cellsBoundingBox.min().y()).arg(cellsBoundingBox.max().y());
m_minYCoord.uiCapability()->setUiName(QString("Min Y") + range);
m_maxYCoord.uiCapability()->setUiName(QString("Max Y") + range);
}
{
QString range = QString(" [%1 - %2]").arg(m_boundingBox.min().z()).arg(m_boundingBox.max().z());
QString range = QString(" [%1 - %2]").arg(cellsBoundingBox.min().z()).arg(cellsBoundingBox.max().z());
m_minZCoord.uiCapability()->setUiName(QString("Min Z") + range);
m_maxZCoord.uiCapability()->setUiName(QString("Max Z") + range);
}
@ -196,21 +195,6 @@ RivIntersectionBoxPartMgr* RimIntersectionBox::intersectionBoxPartMgr()
return m_intersectionBoxPartMgr.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::initialize()
{
RimCase* rimCase = NULL;
firstAnchestorOrThisOfType(rimCase);
if (rimCase)
{
m_boundingBox = rimCase->activeCellsBoundingBox();
}
updateLabelsFromBoundingBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -265,20 +249,21 @@ void RimIntersectionBox::defineEditorAttribute(const caf::PdmFieldHandle* field,
if (myAttr)
{
cvf::BoundingBox cellsBoundingBox = currentCellBoundingBox();
if (field == &m_minXCoord || field == &m_maxXCoord)
{
myAttr->m_minimum = m_boundingBox.min().x();
myAttr->m_maximum = m_boundingBox.max().x();
myAttr->m_minimum = cellsBoundingBox.min().x();
myAttr->m_maximum = cellsBoundingBox.max().x();
}
else if (field == &m_minYCoord || field == &m_maxYCoord)
{
myAttr->m_minimum = m_boundingBox.min().y();
myAttr->m_maximum = m_boundingBox.max().y();
myAttr->m_minimum = cellsBoundingBox.min().y();
myAttr->m_maximum = cellsBoundingBox.max().y();
}
else if (field == &m_minZCoord || field == &m_maxZCoord)
{
myAttr->m_minimum = m_boundingBox.min().z();
myAttr->m_maximum = m_boundingBox.max().z();
myAttr->m_minimum = cellsBoundingBox.min().z();
myAttr->m_maximum = cellsBoundingBox.max().z();
}
}
}
@ -308,6 +293,8 @@ void RimIntersectionBox::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderi
group->add(&m_minZCoord);
group->add(&m_maxZCoord);
}
updateLabelsFromBoundingBox();
}
//--------------------------------------------------------------------------------------------------
@ -391,3 +378,29 @@ void RimIntersectionBox::clampSinglePlaneValues()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RimIntersectionBox::currentCellBoundingBox()
{
RimCase* rimCase = NULL;
this->firstAnchestorOrThisOfType(rimCase);
CVF_ASSERT(rimCase);
RimEclipseView* eclView = nullptr;
this->firstAnchestorOrThisOfType(eclView);
bool useAllCells = true;
if (eclView)
{
useAllCells = eclView->showInactiveCells();
}
if(false)//useAllCells) // For now, only use the active CellsBBox.
return rimCase->allCellsBoundingBox();
else
return rimCase->activeCellsBoundingBox();
}

View File

@ -57,13 +57,8 @@ public:
RivIntersectionBoxPartMgr* intersectionBoxPartMgr();
void initialize();
void setModelBoundingBox(cvf::BoundingBox& boundingBox);
void setXSlice(double xValue);
void setYSlice(double yValue);
void setZSlice(double zValue);
void updateLabelsFromBoundingBox();
void setToDefaultSizeBox();
void setToDefaultSizeSlice(SinglePlaneState plane, const cvf::Vec3d& position);
protected:
virtual caf::PdmFieldHandle* userDescriptionField() override;
@ -77,6 +72,7 @@ protected:
private:
void rebuildGeometryAndScheduleCreateDisplayModel();
void updateVisibility();
void updateLabelsFromBoundingBox();
void clampSinglePlaneValues();
private:
@ -91,7 +87,7 @@ private:
caf::PdmField<double> m_maxZCoord;
cvf::BoundingBox m_boundingBox;
cvf::BoundingBox currentCellBoundingBox();
cvf::ref<RivIntersectionBoxPartMgr> m_intersectionBoxPartMgr;
};

View File

@ -161,13 +161,3 @@ bool RimIntersectionBoxCollection::hasActiveCrossSectionForSimulationWell(RimEcl
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBoxCollection::initialize()
{
for (auto intersectionBox : m_intersectionBoxes())
{
intersectionBox->initialize();
}
}

View File

@ -50,8 +50,6 @@ public:
bool hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const;
void initialize();
// Visualization interface
void applySingleColorEffect();