2012-05-18 09:45:23 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2014-09-23 15:04:57 +02:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2012-05-18 09:45:23 +02:00
|
|
|
//
|
|
|
|
|
// 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
|
|
|
|
|
|
2018-01-11 12:59:52 +01:00
|
|
|
#include "RiuViewerToViewInterface.h"
|
2019-03-22 15:55:51 +01:00
|
|
|
#include "RiuInterfaceToViewWindow.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2019-03-22 15:55:51 +01:00
|
|
|
#include "cafMouseState.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
#include "cafPdmObject.h"
|
|
|
|
|
#include "cafPdmPointer.h"
|
2018-01-11 12:59:52 +01:00
|
|
|
#include "cafPdmInterfacePointer.h"
|
2019-03-22 15:55:51 +01:00
|
|
|
#include "cafViewer.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2014-07-25 14:48:37 +02:00
|
|
|
#include "cvfStructGrid.h"
|
2019-03-22 15:55:51 +01:00
|
|
|
|
|
|
|
|
#include <memory>
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2015-11-27 17:18:30 +01:00
|
|
|
class RicCommandFeature;
|
2018-01-09 10:11:28 +01:00
|
|
|
class Rim3dView;
|
2012-09-11 09:22:36 +02:00
|
|
|
class RiuSimpleHistogramWidget;
|
2015-06-11 11:38:51 +02:00
|
|
|
class RiuViewerCommands;
|
2015-11-12 12:00:51 +01:00
|
|
|
class RivGridBoxGenerator;
|
2018-02-08 19:42:34 +01:00
|
|
|
class RivWindowEdgeAxesOverlayItem;
|
2015-11-12 12:00:51 +01:00
|
|
|
|
|
|
|
|
class QLabel;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2018-04-05 15:25:33 +02:00
|
|
|
namespace caf
|
|
|
|
|
{
|
2018-11-15 11:24:09 +01:00
|
|
|
class OverlayScaleLegend;
|
2018-04-05 15:25:33 +02:00
|
|
|
class TitledOverlayFrame;
|
2018-11-26 21:50:46 +01:00
|
|
|
class PdmUiSelection3dEditorVisualizer;
|
2019-04-05 19:10:46 +02:00
|
|
|
class QStyledProgressBar;
|
2018-04-05 15:25:33 +02:00
|
|
|
}
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
namespace cvf
|
|
|
|
|
{
|
2015-11-23 13:31:01 +01:00
|
|
|
class Color3f;
|
2015-11-16 14:08:17 +01:00
|
|
|
class Model;
|
2014-04-07 13:18:39 +02:00
|
|
|
class OverlayItem;
|
2015-11-16 14:08:17 +01:00
|
|
|
class Part;
|
2015-11-20 09:12:07 +01:00
|
|
|
class OverlayAxisCross;
|
2018-01-11 12:59:52 +01:00
|
|
|
class BoundingBox;
|
2012-05-18 09:45:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
//
|
2013-03-22 17:30:50 +01:00
|
|
|
// RiuViewer
|
2012-05-18 09:45:23 +02:00
|
|
|
//
|
|
|
|
|
//==================================================================================================
|
2017-03-31 09:17:49 +02:00
|
|
|
class RiuViewer : public caf::Viewer, public RiuInterfaceToViewWindow
|
2012-05-18 09:45:23 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2013-03-22 17:17:56 +01:00
|
|
|
RiuViewer(const QGLFormat& format, QWidget* parent);
|
2018-10-18 19:45:57 +02:00
|
|
|
~RiuViewer() override;
|
2018-11-27 17:04:55 +01:00
|
|
|
void clearRimView();
|
2012-05-18 09:45:23 +02:00
|
|
|
void setDefaultView();
|
|
|
|
|
cvf::Vec3d pointOfInterest();
|
|
|
|
|
void setPointOfInterest(cvf::Vec3d poi);
|
2018-01-11 12:59:52 +01:00
|
|
|
void setOwnerReservoirView(RiuViewerToViewInterface * owner);
|
|
|
|
|
RiuViewerToViewInterface* ownerReservoirView();
|
2017-03-31 09:17:49 +02:00
|
|
|
RimViewWindow* ownerViewWindow() const override;
|
2012-05-18 09:45:23 +02:00
|
|
|
void setEnableMask(unsigned int mask);
|
2012-09-11 09:22:36 +02:00
|
|
|
|
|
|
|
|
void showInfoText(bool enable);
|
2019-02-20 14:40:25 +01:00
|
|
|
void showVersionInfo(bool enable);
|
2012-09-11 09:22:36 +02:00
|
|
|
void setInfoText(QString text);
|
2018-12-10 13:03:53 +01:00
|
|
|
|
2018-12-13 13:20:49 +01:00
|
|
|
void hideZScaleCheckbox(bool hide);
|
2018-12-10 13:03:53 +01:00
|
|
|
void showZScaleLabel(bool enable);
|
|
|
|
|
void setZScale(int scale);
|
|
|
|
|
|
2012-09-11 09:22:36 +02:00
|
|
|
void showHistogram(bool enable);
|
|
|
|
|
void setHistogram(double min, double max, const std::vector<size_t>& histogram);
|
2012-10-23 12:08:46 +02:00
|
|
|
void setHistogramPercentiles(double pmin, double pmax, double mean);
|
2012-09-11 09:22:36 +02:00
|
|
|
|
2018-01-11 12:59:52 +01:00
|
|
|
void showGridBox(bool enable);
|
|
|
|
|
void updateGridBoxData(double scaleZ,
|
|
|
|
|
const cvf::Vec3d& displayModelOffset,
|
|
|
|
|
const cvf::Color3f& backgroundColor,
|
|
|
|
|
const cvf::BoundingBox& domainCoordBoundingBox);
|
2018-10-31 12:13:04 +01:00
|
|
|
void showEdgeTickMarksXY(bool enable, bool showAxisLines = false);
|
|
|
|
|
void showEdgeTickMarksXZ(bool enable, bool showAxisLines = false);
|
2015-11-12 12:00:51 +01:00
|
|
|
|
2017-11-08 09:02:21 +01:00
|
|
|
void updateAnnotationItems();
|
|
|
|
|
|
2012-09-11 09:22:36 +02:00
|
|
|
void showAnimationProgress(bool enable);
|
2014-04-07 13:18:39 +02:00
|
|
|
|
2014-07-30 10:54:46 +02:00
|
|
|
void removeAllColorLegends();
|
2018-04-09 11:51:30 +02:00
|
|
|
void addColorLegendToBottomLeftCorner(caf::TitledOverlayFrame* legend);
|
2014-04-07 13:18:39 +02:00
|
|
|
|
2018-01-26 14:33:32 +01:00
|
|
|
void enableNavigationRotation(bool disable);
|
2015-07-02 12:44:57 +02:00
|
|
|
void updateNavigationPolicy();
|
2015-08-28 21:32:51 +02:00
|
|
|
|
2018-09-21 12:24:08 +02:00
|
|
|
void navigationPolicyUpdate() override;
|
2015-08-28 21:32:51 +02:00
|
|
|
|
2015-09-01 17:14:22 +02:00
|
|
|
void setCurrentFrame(int frameIndex);
|
|
|
|
|
|
2018-01-11 12:59:52 +01:00
|
|
|
void showAxisCross(bool enable);
|
2015-11-20 09:12:07 +01:00
|
|
|
void setAxisLabels(const cvf::String& xLabel, const cvf::String& yLabel, const cvf::String& zLabel);
|
|
|
|
|
|
2016-09-23 16:12:19 +02:00
|
|
|
cvf::Vec3d lastPickPositionInDomainCoords() const;
|
|
|
|
|
|
2016-10-17 11:51:25 +02:00
|
|
|
cvf::OverlayItem* pickFixedPositionedLegend(int winPosX, int winPosY);
|
|
|
|
|
|
2016-12-15 18:20:43 +01:00
|
|
|
void setCursorPosition(const cvf::Vec3d& domainCoord);
|
|
|
|
|
|
2018-09-21 12:57:49 +02:00
|
|
|
std::vector<cvf::ref<cvf::Part>> visibleParts();
|
|
|
|
|
|
2018-11-15 11:24:09 +01:00
|
|
|
void showScaleLegend(bool show);
|
|
|
|
|
|
2019-03-22 15:55:51 +01:00
|
|
|
static void setHoverCursor(const QCursor& cursor);
|
|
|
|
|
static void clearHoverCursor();
|
|
|
|
|
|
2019-04-10 12:49:20 +02:00
|
|
|
void updateFonts();
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
public slots:
|
2018-09-21 12:24:08 +02:00
|
|
|
void slotSetCurrentFrame(int frameIndex) override;
|
|
|
|
|
void slotEndAnimation() override;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2015-11-16 10:01:50 +01:00
|
|
|
protected:
|
2018-09-21 12:24:08 +02:00
|
|
|
void optimizeClippingPlanes() override;
|
|
|
|
|
void resizeGL(int width, int height) override;
|
2019-03-26 09:14:09 +01:00
|
|
|
void mouseMoveEvent(QMouseEvent* e) override;
|
|
|
|
|
void enterEvent(QEvent* e) override;
|
|
|
|
|
void leaveEvent(QEvent*) override;
|
2015-11-16 10:01:50 +01:00
|
|
|
|
2015-06-11 11:38:51 +02:00
|
|
|
private:
|
2018-05-04 13:32:41 +02:00
|
|
|
void updateLegendLayout();
|
2015-11-23 13:31:01 +01:00
|
|
|
void updateTextAndTickMarkColorForOverlayItems();
|
|
|
|
|
void updateLegendTextAndTickMarkColor(cvf::OverlayItem* legend);
|
|
|
|
|
|
|
|
|
|
cvf::Color3f computeContrastColor() const;
|
|
|
|
|
|
|
|
|
|
void updateAxisCrossTextColor();
|
2019-04-07 18:16:31 +02:00
|
|
|
void updateOverlayItemsStyle();
|
2015-11-23 13:31:01 +01:00
|
|
|
|
2018-09-21 12:24:08 +02:00
|
|
|
void paintOverlayItems(QPainter* painter) override;
|
2015-06-05 15:17:02 +02:00
|
|
|
|
2018-09-21 12:24:08 +02:00
|
|
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
|
|
|
|
void mousePressEvent(QMouseEvent* event) override;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2015-11-16 10:01:50 +01:00
|
|
|
private:
|
2015-12-07 09:59:19 +01:00
|
|
|
QLabel* m_infoLabel;
|
|
|
|
|
QRect m_infoLabelOverlayArea;
|
|
|
|
|
|
2015-06-24 13:44:42 +02:00
|
|
|
QLabel* m_versionInfoLabel;
|
2019-02-20 14:40:25 +01:00
|
|
|
bool m_showInfoText;
|
|
|
|
|
bool m_showVersionInfo;
|
2012-09-11 09:22:36 +02:00
|
|
|
|
2018-12-10 13:03:53 +01:00
|
|
|
QLabel* m_zScaleLabel;
|
|
|
|
|
bool m_showZScaleLabel;
|
2018-12-13 13:20:49 +01:00
|
|
|
bool m_hideZScaleCheckbox;
|
2018-12-10 13:03:53 +01:00
|
|
|
|
2019-04-05 19:10:46 +02:00
|
|
|
caf::QStyledProgressBar* m_animationProgress;
|
2012-09-11 09:22:36 +02:00
|
|
|
bool m_showAnimProgress;
|
|
|
|
|
RiuSimpleHistogramWidget* m_histogramWidget;
|
|
|
|
|
bool m_showHistogram;
|
|
|
|
|
|
2015-11-20 09:12:07 +01:00
|
|
|
cvf::ref<cvf::OverlayAxisCross> m_axisCross;
|
2018-02-09 13:30:18 +01:00
|
|
|
bool m_showAxisCross;
|
2018-04-05 15:25:33 +02:00
|
|
|
cvf::Collection<caf::TitledOverlayFrame> m_visibleLegends;
|
2013-02-28 11:58:31 +01:00
|
|
|
|
2018-01-11 12:59:52 +01:00
|
|
|
caf::PdmInterfacePointer<RiuViewerToViewInterface> m_rimView;
|
2015-11-16 07:16:30 +01:00
|
|
|
QPoint m_lastMousePressPosition;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2015-11-16 07:16:30 +01:00
|
|
|
RiuViewerCommands* m_viewerCommands;
|
2015-11-12 12:00:51 +01:00
|
|
|
|
2015-11-16 07:16:30 +01:00
|
|
|
RivGridBoxGenerator* m_gridBoxGenerator;
|
2018-02-08 19:42:34 +01:00
|
|
|
cvf::ref<RivWindowEdgeAxesOverlayItem> m_windowEdgeAxisOverlay;
|
2018-02-09 13:30:18 +01:00
|
|
|
bool m_showWindowEdgeAxes;
|
2016-12-15 18:20:43 +01:00
|
|
|
|
2018-11-26 21:50:46 +01:00
|
|
|
caf::PdmUiSelection3dEditorVisualizer* m_selectionVisualizerManager;
|
2018-10-02 16:29:58 +02:00
|
|
|
|
2016-12-15 18:20:43 +01:00
|
|
|
cvf::Vec3d m_cursorPositionDomainCoords;
|
2018-01-26 14:33:32 +01:00
|
|
|
bool m_isNavigationRotationEnabled;
|
2018-11-15 11:24:09 +01:00
|
|
|
|
|
|
|
|
cvf::ref<caf::OverlayScaleLegend> m_scaleLegend;
|
2019-03-22 15:55:51 +01:00
|
|
|
|
|
|
|
|
static std::unique_ptr<QCursor> s_hoverCursor;
|
2012-05-18 09:45:23 +02:00
|
|
|
};
|
2015-06-11 11:38:51 +02:00
|
|
|
|