Files
ResInsight/ApplicationCode/UserInterface/RiuViewer.h
T

153 lines
4.7 KiB
C++
Raw Normal View History

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
#include "cafViewer.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafMouseState.h"
2014-07-25 14:48:37 +02:00
#include "cvfStructGrid.h"
#include "RiuInterfaceToViewWindow.h"
2012-05-18 09:45:23 +02:00
class RicCommandFeature;
2015-04-30 10:34:15 +02:00
class RimView;
class RiuSimpleHistogramWidget;
2015-06-11 11:38:51 +02:00
class RiuViewerCommands;
2015-11-12 12:00:51 +01:00
class RivGridBoxGenerator;
class QCDEStyle;
class QLabel;
class QProgressBar;
2012-05-18 09:45:23 +02:00
namespace cvf
{
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;
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
//
//==================================================================================================
class RiuViewer : public caf::Viewer, public RiuInterfaceToViewWindow
2012-05-18 09:45:23 +02:00
{
Q_OBJECT
public:
RiuViewer(const QGLFormat& format, QWidget* parent);
~RiuViewer();
2012-05-18 09:45:23 +02:00
void setDefaultView();
cvf::Vec3d pointOfInterest();
void setPointOfInterest(cvf::Vec3d poi);
2015-04-30 10:34:15 +02:00
void setOwnerReservoirView(RimView * owner);
RimView* ownerReservoirView();
RimViewWindow* ownerViewWindow() const override;
2012-05-18 09:45:23 +02:00
void setEnableMask(unsigned int mask);
void showInfoText(bool enable);
void setInfoText(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);
2015-11-16 14:08:17 +01:00
void updateGridBoxData();
cvf::Model* gridBoxModel() const;
2015-11-12 12:00:51 +01:00
void showAnimationProgress(bool enable);
2014-04-07 13:18:39 +02:00
void removeAllColorLegends();
void addColorLegendToBottomLeftCorner(cvf::OverlayItem* legend);
2014-04-07 13:18:39 +02:00
void updateNavigationPolicy();
virtual void navigationPolicyUpdate(); // Override of caf::Viewer::navigationPolicyUpdate()
void setCurrentFrame(int frameIndex);
2015-11-20 09:12:07 +01:00
void setAxisLabels(const cvf::String& xLabel, const cvf::String& yLabel, const cvf::String& zLabel);
cvf::Vec3d lastPickPositionInDomainCoords() const;
caf::PdmObject* lastPickedObject() const;
2016-10-17 11:51:25 +02:00
cvf::OverlayItem* pickFixedPositionedLegend(int winPosX, int winPosY);
void updateParallelProjectionSettings(RiuViewer* sourceViewer);
void setCursorPosition(const cvf::Vec3d& domainCoord);
2012-05-18 09:45:23 +02:00
public slots:
virtual void slotSetCurrentFrame(int frameIndex);
virtual void slotEndAnimation();
protected:
virtual void optimizeClippingPlanes();
virtual void resizeGL(int width, int height);
virtual void mouseMoveEvent(QMouseEvent* e) override;
virtual void leaveEvent(QEvent *) override;
2015-06-11 11:38:51 +02:00
private:
void updateTextAndTickMarkColorForOverlayItems();
void updateLegendTextAndTickMarkColor(cvf::OverlayItem* legend);
cvf::Color3f computeContrastColor() const;
void updateAxisCrossTextColor();
void paintOverlayItems(QPainter* painter);
2015-06-05 15:17:02 +02:00
2015-06-11 11:38:51 +02:00
void mouseReleaseEvent(QMouseEvent* event);
void mousePressEvent(QMouseEvent* event);
2012-05-18 09:45:23 +02:00
private:
QLabel* m_infoLabel;
QRect m_infoLabelOverlayArea;
QLabel* m_versionInfoLabel;
bool m_showInfoText;
QProgressBar* m_animationProgress;
bool m_showAnimProgress;
RiuSimpleHistogramWidget* m_histogramWidget;
bool m_showHistogram;
QCDEStyle* m_progressBarStyle;
2015-11-20 09:12:07 +01:00
cvf::ref<cvf::OverlayAxisCross> m_axisCross;
cvf::Collection<cvf::OverlayItem> m_visibleLegends;
caf::PdmPointer<RimView> m_rimView;
QPoint m_lastMousePressPosition;
2012-05-18 09:45:23 +02:00
RiuViewerCommands* m_viewerCommands;
2015-11-12 12:00:51 +01:00
RivGridBoxGenerator* m_gridBoxGenerator;
cvf::Vec3d m_cursorPositionDomainCoords;
2012-05-18 09:45:23 +02:00
};
2015-06-11 11:38:51 +02:00