Files
ResInsight/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.h
T
Magne Sjaastad c8023e8803 #1044 Contour maps in 3d views: wire the contour map collection into Eclipse and GeoMech 3d views
Give RimGridView a RimContourMapInViewCollection and let RimEclipseView and RimGeoMechView build their 3d model from it. A dedicated contour map view (RimEclipseContourMapView/RimStatisticsContourMapView) shows its own contour map and returns no collection of its own, so it is unaffected. Adjust RimSurfaceInViewCollection so surfaces and contour maps coexist in the same 3d view without z-fighting.
2026-09-07 09:32:04 +02:00

111 lines
4.0 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor 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 "RimCheckableNamedObject.h"
#include "RimSurfaceInView.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
#include "cafPdmPtrField.h"
#include <expected>
namespace cvf
{
class ModelBasicList;
class Transform;
class ScalarMapper;
} // namespace cvf
class RimSurfaceInView;
class RimSurface;
class RimSurfaceCollection;
class RimEnsembleSurface;
class RimRegularLegendConfig;
class RiuViewer;
class RivIntersectionGeometryGeneratorInterface;
class RimSurfaceInViewCollection : public RimCheckableNamedObject
{
CAF_PDM_HEADER_INIT;
using SurfaceColorMode = RimSurfaceInView::SurfaceColorMode;
public:
RimSurfaceInViewCollection();
~RimSurfaceInViewCollection() override;
QString name() const override;
SurfaceColorMode surfaceColorMode() const;
RimSurfaceCollection* surfaceCollection() const;
void setSurfaceCollection( RimSurfaceCollection* surfcoll );
void updateFromSurfaceCollection();
bool setSurfaceVisible( RimSurface* surface, bool visible );
std::expected<void, QString> setSurfaceProperty( RimSurface* surface, const QString& propertyName );
bool isSurfaceVisible( const RimSurface* surface ) const;
QString surfaceProperty( const RimSurface* surface ) const;
void loadData( int timeStep );
void clearGeometry();
void appendPartsToModel( cvf::ModelBasicList* surfaceVizModel, cvf::Transform* scaleTransform, bool onlyNativeParts = false );
void updateCellResultColor( bool hasGeneralCellResult, int timeStepIndex );
void applySingleColorEffect();
bool hasAnyActiveSeparateResults();
void updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, bool isUsingOverrideViewer );
std::vector<RimRegularLegendConfig*> legendConfigs();
// The surfaces this collection contributes to the scene, recursing into the checked sub collections
std::vector<RimSurfaceInView*> visibleSurfacesInView() const;
std::vector<const RivIntersectionGeometryGeneratorInterface*> intersectionGeometryGenerators() const;
protected:
void initAfterRead() override;
caf::PdmFieldHandle* userDescriptionField() override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
RimSurfaceInView* getSurfaceInViewForSurface( const RimSurface* surf ) const;
RimSurfaceInView* findSurfaceInView( const RimSurface* surface ) const;
RimSurfaceInViewCollection* getCollectionInViewForCollection( const RimSurfaceCollection* coll ) const;
void updateAllViewItems();
void syncCollectionsWithView();
void syncSurfacesWithView();
private:
caf::PdmProxyValueField<QString> m_collectionName;
caf::PdmChildArrayField<RimSurfaceInView*> m_surfacesInView;
caf::PdmChildArrayField<RimSurfaceInViewCollection*> m_collectionsInView;
caf::PdmPtrField<RimSurfaceCollection*> m_surfaceCollection;
caf::PdmField<caf::AppEnum<SurfaceColorMode>> m_surfaceColorMode;
};