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