2020-01-03 13:49:12 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// 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
|
|
|
|
|
|
2026-05-12 14:24:43 +02:00
|
|
|
#include "cafPdmNestedCollection.h"
|
2020-01-03 13:49:12 +01:00
|
|
|
|
|
|
|
|
class RimSurface;
|
2021-08-17 13:38:12 +02:00
|
|
|
class RimEnsembleSurface;
|
2020-05-03 11:29:33 +02:00
|
|
|
class RimCase;
|
2020-01-03 13:49:12 +01:00
|
|
|
|
2026-05-12 14:24:43 +02:00
|
|
|
class RimSurfaceCollection : public caf::PdmNestedCollection<RimSurfaceCollection, RimSurface>
|
2020-01-03 13:49:12 +01:00
|
|
|
{
|
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
RimSurfaceCollection();
|
|
|
|
|
~RimSurfaceCollection() override;
|
|
|
|
|
|
2026-05-12 14:24:43 +02:00
|
|
|
// Construct the single top-level surface collection. Marks the instance as the topmost folder
|
|
|
|
|
// and applies the branded surface icon. Sub-folders use the default folder icon from the
|
|
|
|
|
// constructor.
|
|
|
|
|
static RimSurfaceCollection* createTopmost();
|
|
|
|
|
|
2020-01-03 13:49:12 +01:00
|
|
|
void addSurface( RimSurface* surface );
|
|
|
|
|
|
2021-09-23 09:59:29 +02:00
|
|
|
void addEnsembleSurface( RimEnsembleSurface* ensembleSurface );
|
|
|
|
|
std::vector<RimEnsembleSurface*> ensembleSurfaces() const;
|
2021-08-17 13:38:12 +02:00
|
|
|
|
2021-05-18 14:28:54 +02:00
|
|
|
RimSurface* importSurfacesFromFiles( const QStringList& fileNames, bool showLegend = true );
|
2021-08-17 13:38:12 +02:00
|
|
|
RimSurface* addGridCaseSurface( RimCase* sourceCase, int oneBasedSliceIndex = 1 );
|
2020-08-24 11:09:22 +02:00
|
|
|
RimSurface* copySurfaces( std::vector<RimSurface*> surfaces );
|
|
|
|
|
RimSurface* addSurfacesAtIndex( int index, std::vector<RimSurface*> surfaces );
|
2020-01-03 13:49:12 +01:00
|
|
|
|
2025-12-05 15:29:23 +01:00
|
|
|
static RimSurface* createSurfaceFromFile( const QString& fileName );
|
|
|
|
|
|
2021-05-18 14:28:54 +02:00
|
|
|
bool containsFileSurface( QString filename );
|
2020-09-18 14:43:15 +02:00
|
|
|
bool containsSurface();
|
|
|
|
|
|
2021-05-28 00:55:54 +02:00
|
|
|
void reloadSurfaces( std::vector<RimSurface*> surfaces, bool showLegend = true );
|
2020-08-24 11:09:22 +02:00
|
|
|
void removeSurface( RimSurface* surface );
|
2021-05-18 14:28:54 +02:00
|
|
|
void removeMissingFileSurfaces();
|
2020-01-06 11:30:06 +01:00
|
|
|
|
2021-09-13 10:16:09 +02:00
|
|
|
virtual void loadData();
|
2020-08-24 11:09:22 +02:00
|
|
|
|
2020-01-06 11:30:06 +01:00
|
|
|
void updateViews();
|
2021-05-18 14:28:54 +02:00
|
|
|
void updateViews( const std::vector<RimSurface*>& surfsToReload, bool showLegend = true );
|
2020-01-03 13:49:12 +01:00
|
|
|
|
2023-02-26 10:48:40 +01:00
|
|
|
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
2020-05-18 16:02:27 +02:00
|
|
|
|
2026-05-12 14:24:43 +02:00
|
|
|
std::vector<RimSurface*> surfaces() const;
|
2020-08-24 11:09:22 +02:00
|
|
|
|
2026-08-07 08:34:58 +02:00
|
|
|
// Renames the surface if another surface in this folder already carries the same name.
|
|
|
|
|
void ensureUniqueSurfaceName( RimSurface* surface );
|
|
|
|
|
|
2020-08-24 11:09:22 +02:00
|
|
|
protected:
|
2026-05-12 14:24:43 +02:00
|
|
|
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
2020-08-24 11:09:22 +02:00
|
|
|
|
2026-08-07 08:34:58 +02:00
|
|
|
// Enforces name uniqueness among sibling folders when the folder is renamed.
|
|
|
|
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
|
|
|
|
|
2020-01-08 11:56:48 +01:00
|
|
|
private:
|
2020-08-24 11:09:22 +02:00
|
|
|
void orderChanged( const caf::SignalEmitter* emitter );
|
2020-01-03 13:49:12 +01:00
|
|
|
};
|