Files
ResInsight/ApplicationLibCode/UserInterface/RiuViewer.h
T
Jørgen Herje c49f298a7d [ri-cloud-api]: Add grid data from sumo using api (#14653)
Add grid data from Sumo using ri-cloud-api

Load Eclipse grid data (roff) from Sumo as RimReservoirGridEnsemble, one case per realization, with async fetch of grid properties per timestep.

- New: RiaSumoGrid (transport), RifReaderSumoGridProperty (lazy property reader), RimReservoirGridEnsembleSumo, RimRoffCaseSumo, and a "Create Reservoir Grid Ensemble" command.
- Shared grid: IJK dimensions compared before download; one RigMainGrid is reused across the ensemble when they match, each realization still parses its own ACTNUM before releasing geometry.
- Rename folders: Summary/Sumo -> Summary/Cloud, RimSumoDataSource -> Cloud/ (PDM keywords unchanged, old project files still load).
- UI: cloud data sources also shown in the 3D window's Data Sources dock.
- Fix: realizations no longer lost on project reload; realizations missing data are now reported instead of silently skipped.
2026-09-10 10:33:58 +02:00

231 lines
7.4 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// 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 "RiuInterfaceToViewWindow.h"
#include "RiuViewerToViewInterface.h"
#include "cafPdmInterfacePointer.h"
#include "cafViewer.h"
#include <memory>
class RicCommandFeature;
class Rim3dView;
class RiuSimpleHistogramWidget;
class RiuViewerCommands;
class RivGridBoxGenerator;
class RivWindowEdgeAxesOverlayItem;
class RiuComparisonViewMover;
class QLabel;
namespace caf
{
class OverlayScaleLegend;
class TitledOverlayFrame;
class PdmUiSelection3dEditorVisualizer;
class QStyledProgressBar;
} // namespace caf
namespace cvf
{
class Color3f;
class Model;
class OverlayItem;
class Part;
class OverlayAxisCross;
class BoundingBox;
} // namespace cvf
//==================================================================================================
//
// RiuViewer
//
//==================================================================================================
class RiuViewer : public caf::Viewer, public RiuInterfaceToViewWindow
{
Q_OBJECT
public:
RiuViewer( QWidget* parent );
~RiuViewer() override;
RiuViewer( const RiuViewer& ) = delete;
void clearRimView();
void setDefaultView( const cvf::Vec3d& dir, const cvf::Vec3d& up );
cvf::Vec3d pointOfInterest();
void setPointOfInterest( cvf::Vec3d poi );
void setOwnerReservoirView( RiuViewerToViewInterface* owner );
RiuViewerToViewInterface* ownerReservoirView();
RimViewWindow* ownerViewWindow() const override;
void showInfoText( bool enable );
void showVersionInfo( bool enable );
void setInfoText( QString text );
QString infoText() const;
void hideZScaleCheckbox( bool hide );
void showZScaleLabel( bool enable );
void setZScale( double scale );
void showFilterLabel( bool enable );
void setFilterText( const QString& text );
// A banner across the top of the view, for telling the user data is on its way. Deliberately not the
// info text, which is small, in a corner, and can be switched off.
void showLoadingLabel( bool enable );
void setLoadingText( const QString& text );
void showHistogram( bool enable );
void setHistogram( double min, double max, const std::vector<size_t>& histogram );
void setHistogramPercentiles( double pmin, double pmax, double mean );
void showGridBox( bool enable );
void updateGridBoxData( double scaleZ,
const cvf::Vec3d& displayModelOffset,
const cvf::Color3f& backgroundColor,
const cvf::BoundingBox& domainCoordBoundingBox,
int fontPointSize );
void showEdgeTickMarksXY( bool enable, bool showAxisLines = false );
void showEdgeTickMarksXZ( bool enable, bool showAxisLines = false );
void updateAnnotationItems();
void showAnimationProgress( bool enable );
void removeAllColorLegends();
void addColorLegendToBottomLeftCorner( caf::TitledOverlayFrame* legend, bool isForComparisonView );
void removeColorLegend( caf::TitledOverlayFrame* legend );
void enableNavigationRotation( bool disable );
void updateNavigationPolicy();
void navigationPolicyUpdate() override;
void setCurrentFrame( int frameIndex );
void showAxisCross( bool enable );
void setAxisLabels( const cvf::String& xLabel, const cvf::String& yLabel, const cvf::String& zLabel );
RiuViewerCommands* viewerCommands() const;
cvf::OverlayItem* pickFixedPositionedLegend( int winPosX, int winPosY );
bool isMousePosWithinInfoBox( int winPosX, int winPosY ) const;
void setCursorPosition( const cvf::Vec3d& domainCoord );
std::vector<cvf::ref<cvf::Part>> visibleParts();
void showScaleLegend( bool show );
static void setHoverCursor( const QCursor& cursor );
static void clearHoverCursor();
void updateFonts( int fontPointSize );
public slots:
void slotSetCurrentFrame( int frameIndex ) override;
void slotEndAnimation() override;
protected:
void optimizeClippingPlanes() override;
void mouseMoveEvent( QMouseEvent* e ) override;
void enterEvent( QEnterEvent* e ) override;
void leaveEvent( QEvent* ) override;
void mousePressEvent( QMouseEvent* e ) override;
private:
void updateLegendLayout();
void updateTextAndTickMarkColorForOverlayItems();
void updateLegendTextAndTickMarkColor( cvf::OverlayItem* legend );
cvf::Color3f computeContrastColor() const;
void updateAxisCrossTextColor();
void updateOverlayItemsStyle();
void paintOverlayItems( QPainter* painter ) override;
void mouseReleaseEvent( QMouseEvent* event ) override;
void mouseDoubleClickEvent( QMouseEvent* event ) override;
private:
QLabel* m_infoLabel;
QRect m_infoPickArea;
QRect m_infoPickAreaCompView;
QLabel* m_shortInfoLabel; // Used when in comparison view mode
QLabel* m_shortInfoLabelCompView;
QLabel* m_versionInfoLabel;
bool m_showInfoText;
bool m_showVersionInfo;
QLabel* m_zScaleLabel;
bool m_showZScaleLabel;
bool m_hideZScaleCheckbox;
double m_zScale;
int m_fontSize;
QLabel* m_filterLabel;
bool m_showFilterLabel;
QLabel* m_loadingLabel;
bool m_showLoadingLabel;
caf::QStyledProgressBar* m_animationProgress;
caf::QStyledProgressBar* m_animationProgressCompView;
bool m_showAnimProgress;
RiuSimpleHistogramWidget* m_histogramWidget;
bool m_showHistogram;
cvf::ref<cvf::OverlayAxisCross> m_axisCross;
bool m_showAxisCross;
cvf::Collection<caf::TitledOverlayFrame> m_visibleLegends;
cvf::Collection<caf::TitledOverlayFrame> m_visibleComparisonLegends;
caf::PdmInterfacePointer<RiuViewerToViewInterface> m_rimView;
QPoint m_lastMousePressPosition;
RiuViewerCommands* m_viewerCommands;
RivGridBoxGenerator* m_gridBoxGenerator;
RivGridBoxGenerator* m_comparisonGridBoxGenerator;
cvf::ref<RivWindowEdgeAxesOverlayItem> m_windowEdgeAxisOverlay;
bool m_showWindowEdgeAxes;
caf::PdmUiSelection3dEditorVisualizer* m_selectionVisualizerManager;
cvf::Vec3d m_cursorPositionDomainCoords;
bool m_isNavigationRotationEnabled;
cvf::ref<caf::OverlayScaleLegend> m_scaleLegend;
static std::unique_ptr<QCursor> s_hoverCursor;
RiuComparisonViewMover* m_comparisonWindowMover;
};