(#657) Create new display model when adding / deleting a cross section

This commit is contained in:
Magne Sjaastad
2015-11-19 13:40:45 +01:00
parent 29973bbcf6
commit 089c9d47da
6 changed files with 48 additions and 29 deletions

View File

@@ -21,6 +21,8 @@
#include "RimCrossSection.h"
#include "RivCrossSectionPartMgr.h"
#include "RiuMainWindow.h"
#include "RimView.h"
CAF_PDM_SOURCE_INIT(RimCrossSectionCollection, "CrossSectionCollection");
@@ -32,8 +34,8 @@ RimCrossSectionCollection::RimCrossSectionCollection()
{
CAF_PDM_InitObject("Cross Sections", ":/undefined_image.png", "", "");
CAF_PDM_InitFieldNoDefault(&crossSections, "CrossSections", "Cross Sections", "", "", "");
crossSections.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_crossSections, "CrossSections", "Cross Sections", "", "", "");
m_crossSections.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
isActive.uiCapability()->setUiHidden(true);
@@ -52,9 +54,9 @@ caf::PdmFieldHandle* RimCrossSectionCollection::objectToggleField()
//--------------------------------------------------------------------------------------------------
void RimCrossSectionCollection::applySingleColorEffect()
{
for (size_t csIdx = 0; csIdx < crossSections.size(); ++csIdx)
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
{
RimCrossSection* cs = crossSections[csIdx];
RimCrossSection* cs = m_crossSections[csIdx];
cs->crossSectionPartMgr()->applySingleColorEffect();
}
}
@@ -64,9 +66,9 @@ void RimCrossSectionCollection::applySingleColorEffect()
//--------------------------------------------------------------------------------------------------
void RimCrossSectionCollection::updateCellResultColor(size_t timeStepIndex, RimEclipseCellColors* cellResultColors)
{
for (size_t csIdx = 0; csIdx < crossSections.size(); ++csIdx)
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
{
RimCrossSection* cs = crossSections[csIdx];
RimCrossSection* cs = m_crossSections[csIdx];
cs->crossSectionPartMgr()->updateCellResultColor(timeStepIndex, cellResultColors);
}
}
@@ -76,9 +78,9 @@ void RimCrossSectionCollection::updateCellResultColor(size_t timeStepIndex, RimE
//--------------------------------------------------------------------------------------------------
void RimCrossSectionCollection::appendPartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
{
for (size_t csIdx = 0; csIdx < crossSections.size(); ++csIdx)
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
{
RimCrossSection* cs = crossSections[csIdx];
RimCrossSection* cs = m_crossSections[csIdx];
if (cs->isActive)
{
cs->crossSectionPartMgr()->appendNativeCrossSectionFacesToModel(model, scaleTransform);
@@ -86,3 +88,21 @@ void RimCrossSectionCollection::appendPartsToModel(cvf::ModelBasicList* model, c
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCrossSectionCollection::appendCrossSection(RimCrossSection* crossSection)
{
m_crossSections.push_back(crossSection);
updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(crossSection);
RimView* rimView = NULL;
firstAnchestorOrThisOfType(rimView);
if (rimView)
{
rimView->scheduleCreateDisplayModelAndRedraw();
}
}