Skip to content

Commit

Permalink
Update collection when adding new contour map.
Browse files Browse the repository at this point in the history
  • Loading branch information
kriben committed Apr 3, 2024
1 parent dd75471 commit 78689a3
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
13 changes: 10 additions & 3 deletions ApplicationLibCode/Commands/RicNewContourMapViewFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@

#include "Rim3dView.h"
#include "RimCellEdgeColors.h"
#include "RimCellFilterCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseContourMapProjection.h"
#include "RimEclipseContourMapView.h"
#include "RimEclipseContourMapViewCollection.h"
#include "RimEclipseView.h"
#include "RimFaultInViewCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechContourMapView.h"
#include "RimGeoMechContourMapViewCollection.h"
#include "RimGeoMechView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimRegularLegendConfig.h"

#include "RimCellFilterCollection.h"
#include "RimFaultInViewCollection.h"
#include "RimSimWellInViewCollection.h"
#include "RimSurfaceInViewCollection.h"

Expand Down Expand Up @@ -146,6 +147,12 @@ void RicNewContourMapViewFeature::onActionTriggered( bool isChecked )
eclipseContourMap->createDisplayModelAndRedraw();
eclipseContourMap->zoomAll();

RimProject* project = RimProject::current();

RimOilField* oilField = project->activeOilField();

oilField->eclipseContourMapCollection()->updateConnectedEditors();

Riu3DMainWindowTools::setExpanded( eclipseContourMap );
}
else if ( geoMechContourMap )
Expand Down
7 changes: 5 additions & 2 deletions ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,15 @@ void RimEclipseCase::initAfterRead()
m_reservoirViews_OBSOLETE.clearWithoutDelete();

// Move contour maps
auto mapViewColl = contourMapCollection();
for ( RimEclipseContourMapView* contourMap : m_contourMapCollection_OBSOLETE->views() )
{
contourMap->setEclipseCase( this );

// TODO: move to root collection
m_contourMapCollection_OBSOLETE->removeChild( contourMap );
mapViewColl->push_back( contourMap );
}

m_contourMapCollection_OBSOLETE->clearWithoutDelete();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,19 @@ void RimEclipseContourMapViewCollection::onChildDeleted( caf::PdmChildArrayField
auto eclipseCase = firstAncestorOrThisOfType<RimEclipseCase>();
if ( eclipseCase ) eclipseCase->updateConnectedEditors();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseContourMapViewCollection::clearWithoutDelete()
{
m_contourMapViews.clearWithoutDelete();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseContourMapViewCollection::removeChild( RimEclipseContourMapView* contourMap )
{
m_contourMapViews.removeChild( contourMap );
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class RimEclipseContourMapViewCollection : public caf::PdmObject

void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;

void clearWithoutDelete();
void removeChild( RimEclipseContourMapView* contourMap );

private:
caf::PdmChildArrayField<RimEclipseContourMapView*> m_contourMapViews;
};

0 comments on commit 78689a3

Please sign in to comment.