#814 New project tree items Intersection Boxes and Intersection Box. Support for add, toggle and delete

This commit is contained in:
Magne Sjaastad
2016-09-20 12:03:26 +02:00
parent ae6397c5c6
commit 45952e59d3
19 changed files with 670 additions and 24 deletions

View File

@@ -91,6 +91,8 @@ ${CEE_CURRENT_LIST_DIR}RimSummaryCaseCollection.h
${CEE_CURRENT_LIST_DIR}RimPlotCurve.h
${CEE_CURRENT_LIST_DIR}RimSummaryCurveAppearanceCalculator.h
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.h
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.h
${CEE_CURRENT_LIST_DIR}RimIntersectionBoxCollection.h
)
set (SOURCE_GROUP_SOURCE_FILES
@@ -180,6 +182,8 @@ ${CEE_CURRENT_LIST_DIR}RimSummaryCaseCollection.cpp
${CEE_CURRENT_LIST_DIR}RimPlotCurve.cpp
${CEE_CURRENT_LIST_DIR}RimSummaryCurveAppearanceCalculator.cpp
${CEE_CURRENT_LIST_DIR}RimEclipseInputCaseOpm.cpp
${CEE_CURRENT_LIST_DIR}RimIntersectionBox.cpp
${CEE_CURRENT_LIST_DIR}RimIntersectionBoxCollection.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@@ -42,6 +42,8 @@
#include "RimGeoMechPropertyFilterCollection.h"
#include "RimGeoMechView.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimIntersectionBox.h"
#include "RimIntersectionBoxCollection.h"
#include "RimScriptCollection.h"
#include "RimSummaryCase.h"
#include "RimSummaryCurve.h"
@@ -307,6 +309,16 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "Separator";
commandIds << "RicDeleteItemFeature";
}
else if (dynamic_cast<RimIntersectionBoxCollection*>(uiItem))
{
commandIds << "RicAppendIntersectionBoxFeature";
}
else if (dynamic_cast<RimIntersectionBox*>(uiItem))
{
commandIds << "RicAppendIntersectionBoxFeature";
commandIds << "Separator";
commandIds << "RicDeleteItemFeature";
}
else if (dynamic_cast<RimEclipseWell*>(uiItem))
{
commandIds << "RicNewSimWellCrossSectionFeature";

View File

@@ -25,6 +25,7 @@
#include "RigCaseCellResultsData.h"
#include "RigCaseData.h"
#include "RigFormationNames.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
@@ -41,6 +42,7 @@
#include "RimEclipseWellCollection.h"
#include "RimFaultCollection.h"
#include "RimGridCollection.h"
#include "RimIntersectionBoxCollection.h"
#include "RimLegendConfig.h"
#include "RimOilField.h"
#include "RimProject.h"
@@ -74,7 +76,6 @@
#include <QMessageBox>
#include <limits.h>
#include "RigFormationNames.h"
@@ -1342,6 +1343,7 @@ void RimEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
uiTreeOrdering.add(m_rangeFilterCollection());
uiTreeOrdering.add(m_propertyFilterCollection());
uiTreeOrdering.add(intersectionBoxCollection());
uiTreeOrdering.setForgetRemainingFields(true);
}

View File

@@ -25,6 +25,7 @@
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
#include "RigFemPartResultsCollection.h"
#include "RigFormationNames.h"
#include "RigGeoMechCaseData.h"
#include "Rim3dOverlayInfoConfig.h"
@@ -35,6 +36,7 @@
#include "RimGeoMechCellColors.h"
#include "RimGeoMechPropertyFilterCollection.h"
#include "RimGridCollection.h"
#include "RimIntersectionBoxCollection.h"
#include "RimLegendConfig.h"
#include "RimViewLinker.h"
@@ -61,7 +63,6 @@
#include "cvfqtUtils.h"
#include <QMessageBox>
#include "RigFormationNames.h"
CAF_PDM_SOURCE_INIT(RimGeoMechView, "GeoMechView");
@@ -677,7 +678,9 @@ void RimGeoMechView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
uiTreeOrdering.add(m_rangeFilterCollection());
uiTreeOrdering.add(m_propertyFilterCollection());
uiTreeOrdering.add(intersectionBoxCollection());
uiTreeOrdering.setForgetRemainingFields(true);
}

View File

@@ -0,0 +1,165 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimIntersectionBox.h"
#include "RimView.h"
#include "cafPdmUiSliderEditor.h"
CAF_PDM_SOURCE_INIT(RimIntersectionBox, "IntersectionBox");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionBox::RimIntersectionBox()
{
CAF_PDM_InitObject("Intersection Box", ":/IntersectionBox16x16.png", "", "");
CAF_PDM_InitField(&name, "UserDescription", QString("Intersection Name"), "Name", "", "", "");
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
isActive.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&minXCoord, "MinXCoord", 0.0, "MinXCoord", "", "", "");
minXCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&maxXCoord, "MaxXCoord", 0.0, "MaxXCoord", "", "", "");
maxXCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&minYCoord, "MinYCoord", 0.0, "MinYCoord", "", "", "");
minYCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&maxYCoord, "MaxYCoord", 0.0, "MaxYCoord", "", "", "");
maxYCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&minZCoord, "MinZCoord", 0.0, "MinZCoord", "", "", "");
minZCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&maxZCoord, "MaxZCoord", 0.0, "MaxZCoord", "", "", "");
maxZCoord.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionBox::~RimIntersectionBox()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::setModelBoundingBox(cvf::BoundingBox& boundingBox)
{
m_boundingBox = boundingBox;
minXCoord = cvf::Math::floor(boundingBox.min().x());
minYCoord = cvf::Math::floor(boundingBox.min().y());
minZCoord = cvf::Math::floor(boundingBox.min().z());
maxXCoord = cvf::Math::ceil(boundingBox.max().x());
maxYCoord = cvf::Math::ceil(boundingBox.max().y());
maxZCoord = cvf::Math::ceil(boundingBox.max().z());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &isActive)
{
rebuildGeometryAndScheduleCreateDisplayModel();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
{
caf::PdmUiSliderEditorAttribute* myAttr = static_cast<caf::PdmUiSliderEditorAttribute*>(attribute);
if (myAttr)
{
if (field == &minXCoord || field == &maxXCoord)
{
myAttr->m_minimum = cvf::Math::floor(m_boundingBox.min().x());
myAttr->m_maximum = cvf::Math::ceil(m_boundingBox.max().x());
}
else if (field == &minYCoord || field == &maxYCoord)
{
myAttr->m_minimum = cvf::Math::floor(m_boundingBox.min().y());
myAttr->m_maximum = cvf::Math::ceil(m_boundingBox.max().y());
}
else if (field == &minZCoord || field == &maxZCoord)
{
myAttr->m_minimum = cvf::Math::floor(m_boundingBox.min().z());
myAttr->m_maximum = cvf::Math::ceil(m_boundingBox.max().z());
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&name);
/*
uiOrdering.add(&minXCoord);
uiOrdering.add(&maxXCoord);
uiOrdering.setForgetRemainingFields(true);
*/
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimIntersectionBox::userDescriptionField()
{
return &name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimIntersectionBox::objectToggleField()
{
return &isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox::rebuildGeometryAndScheduleCreateDisplayModel()
{
RimView* rimView = NULL;
this->firstAnchestorOrThisOfType(rimView);
if (rimView)
{
rimView->scheduleCreateDisplayModelAndRedraw();
}
}

View File

@@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmObject.h"
#include "cafPdmField.h"
#include "cvfBoundingBox.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RimIntersectionBox : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimIntersectionBox();
~RimIntersectionBox();
// Fields
caf::PdmField<QString> name;
caf::PdmField<bool> isActive;
void setModelBoundingBox(cvf::BoundingBox& boundingBox);
protected:
virtual caf::PdmFieldHandle* userDescriptionField() override;
virtual caf::PdmFieldHandle* objectToggleField() override;
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
void rebuildGeometryAndScheduleCreateDisplayModel();
private:
caf::PdmField<double> minXCoord;
caf::PdmField<double> minYCoord;
caf::PdmField<double> minZCoord;
caf::PdmField<double> maxXCoord;
caf::PdmField<double> maxYCoord;
caf::PdmField<double> maxZCoord;
cvf::BoundingBox m_boundingBox;
};

View File

@@ -0,0 +1,181 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimIntersectionBoxCollection.h"
#include "RimCase.h"
#include "RimIntersectionBox.h"
#include "RimView.h"
#include "RiuMainWindow.h"
#include "cvfBoundingBox.h"
CAF_PDM_SOURCE_INIT(RimIntersectionBoxCollection, "IntersectionBoxCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionBoxCollection::RimIntersectionBoxCollection()
{
CAF_PDM_InitObject("Intersection Boxes", ":/IntersectionBoxes16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_intersectionBoxes, "IntersectionBoxes", "IntersectionBoxes", "", "", "");
m_intersectionBoxes.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
isActive.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionBoxCollection::~RimIntersectionBoxCollection()
{
m_intersectionBoxes.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimIntersectionBoxCollection::objectToggleField()
{
return &isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBoxCollection::applySingleColorEffect()
{
for (size_t csIdx = 0; csIdx < m_intersectionBoxes.size(); ++csIdx)
{
RimIntersectionBox* cs = m_intersectionBoxes[csIdx];
if (cs->isActive)
{
// cs->crossSectionPartMgr()->applySingleColorEffect();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBoxCollection::updateCellResultColor(size_t timeStepIndex)
{
for (size_t csIdx = 0; csIdx < m_intersectionBoxes.size(); ++csIdx)
{
RimIntersectionBox* cs = m_intersectionBoxes[csIdx];
if (cs->isActive)
{
// cs->crossSectionPartMgr()->updateCellResultColor(timeStepIndex);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBoxCollection::appendPartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
{
if (!isActive) return;
for (size_t csIdx = 0; csIdx < m_intersectionBoxes.size(); ++csIdx)
{
RimIntersectionBox* cs = m_intersectionBoxes[csIdx];
if (cs->isActive)
{
// cs->crossSectionPartMgr()->appendNativeCrossSectionFacesToModel(model, scaleTransform);
// cs->crossSectionPartMgr()->appendMeshLinePartsToModel(model, scaleTransform);
// if (cs->inputFromViewerEnabled)
// {
// // cs->crossSectionPartMgr()->appendPolylinePartsToModel(model, scaleTransform);
// }
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBoxCollection::appendIntersectionBox()
{
RimIntersectionBox* intersectionBox = new RimIntersectionBox();
intersectionBox->name = QString("Intersection Box");
RimCase* rimCase = NULL;
firstAnchestorOrThisOfType(rimCase);
if (rimCase)
{
intersectionBox->setModelBoundingBox(rimCase->activeCellsBoundingBox());
}
m_intersectionBoxes.push_back(intersectionBox);
updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(intersectionBox);
RimView* rimView = NULL;
firstAnchestorOrThisOfType(rimView);
if (rimView)
{
rimView->scheduleCreateDisplayModelAndRedraw();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBoxCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &isActive)
{
RimView* rimView = NULL;
firstAnchestorOrThisOfType(rimView);
if (rimView)
{
rimView->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimIntersectionBoxCollection::hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const
{
if (!isActive) return false;
/*
for (size_t csIdx = 0; csIdx < m_intersectionBoxes.size(); ++csIdx)
{
RimIntersectionBox* cs = m_intersectionBoxes[csIdx];
if (cs->isActive &&
cs->type() == RimIntersectionBox::CS_SIMULATION_WELL &&
cs->simulationWell() == eclipseWell)
{
return true;
}
}
*/
return true;
}

View File

@@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmObject.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
class RimIntersectionBox;
class RimEclipseCellColors;
class RimEclipseWell;
namespace cvf {
class ModelBasicList;
class Transform;
}
//==================================================================================================
//
//
//
//==================================================================================================
class RimIntersectionBoxCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimIntersectionBoxCollection();
~RimIntersectionBoxCollection();
caf::PdmField<bool> isActive;
void appendIntersectionBox();
bool hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const;
// Visualization interface
void applySingleColorEffect();
void updateCellResultColor(size_t timeStepIndex);
void appendPartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual caf::PdmFieldHandle* objectToggleField();
private:
caf::PdmChildArrayField<RimIntersectionBox*> m_intersectionBoxes;
};

View File

@@ -11,6 +11,7 @@
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimGridCollection.h"
#include "RimIntersectionBoxCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimPropertyFilterCollection.h"
@@ -126,6 +127,10 @@ RimView::RimView(void)
crossSectionCollection.uiCapability()->setUiHidden(true);
crossSectionCollection = new RimCrossSectionCollection();
CAF_PDM_InitFieldNoDefault(&intersectionBoxCollection, "IntersectionBoxes", "Intersection Boxes", "", "", "");
intersectionBoxCollection.uiCapability()->setUiHidden(true);
intersectionBoxCollection = new RimIntersectionBoxCollection();
CAF_PDM_InitFieldNoDefault(&m_gridCollection, "GridCollection", "GridCollection", "", "", "");
m_gridCollection.uiCapability()->setUiHidden(true);
m_gridCollection = new RimGridCollection();
@@ -178,6 +183,7 @@ RimView::~RimView(void)
delete m_rangeFilterCollection;
delete m_overrideRangeFilterCollection;
delete intersectionBoxCollection;
delete crossSectionCollection;
delete m_gridCollection;
}

View File

@@ -43,9 +43,10 @@
class Rim3dOverlayInfoConfig;
class RimCase;
class RimCellRangeFilter;
class RimGridCollection;
class RimCellRangeFilterCollection;
class RimCrossSectionCollection;
class RimGridCollection;
class RimIntersectionBoxCollection;
class RimPropertyFilterCollection;
class RimViewController;
class RimViewLinker;
@@ -97,6 +98,7 @@ public:
caf::PdmChildField<RimCrossSectionCollection*> crossSectionCollection;
caf::PdmChildField<RimIntersectionBoxCollection*> intersectionBoxCollection;
// Draw style