Files
ResInsight/ApplicationLibCode/UserInterface/RiuViewerCommands.h
T

107 lines
4.0 KiB
C++
Raw Normal View History

2015-06-11 11:38:51 +02:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
2015-06-11 11:38:51 +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.
//
2015-06-11 11:38:51 +02:00
// 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>
2015-06-11 11:38:51 +02:00
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmPointer.h"
#include "cvfStructGrid.h"
2015-06-11 11:38:51 +02:00
#include <QObject>
#include <QPointer>
2015-06-11 11:38:51 +02:00
class RicDefaultPickEventHandler;
2019-02-06 09:45:30 +01:00
class Ric3dViewPickEventHandler;
class RimEclipseView;
class RimGeoMechView;
class RimExtrudedCurveIntersection;
2018-01-09 10:11:28 +01:00
class Rim3dView;
class RiuViewer;
2020-01-28 10:21:37 +01:00
class RivReservoirSurfaceIntersectionSourceInfo;
class RivBoxIntersectionSourceInfo;
class RivExtrudedCurveIntersectionSourceInfo;
class RiuPickItemInfo;
2020-01-28 10:21:37 +01:00
class RimIntersectionResultDefinition;
2015-06-11 11:38:51 +02:00
class QMouseEvent;
namespace caf
{
class PdmObject;
2019-10-29 11:45:06 +01:00
class CmdFeatureMenuBuilder;
} // namespace caf
namespace cvf
{
class HitItemCollection;
class Part;
} // namespace cvf
2015-06-11 11:38:51 +02:00
class RiuViewerCommands : public QObject
2015-06-11 11:38:51 +02:00
{
Q_OBJECT
public:
explicit RiuViewerCommands( RiuViewer* ownerViewer );
~RiuViewerCommands() override;
2015-06-11 11:38:51 +02:00
void setOwnerView( Rim3dView* owner );
void displayContextMenu( QMouseEvent* event );
void handlePickAction( int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers );
2015-06-11 11:38:51 +02:00
static void setPickEventHandler( Ric3dViewPickEventHandler* pickEventHandler );
static void removePickEventHandlerIfActive( Ric3dViewPickEventHandler* pickEventHandler );
2015-06-11 11:38:51 +02:00
cvf::Vec3d lastPickPositionInDomainCoords() const;
bool isCurrentPickInComparisonView() const;
static void findFirstItems( Rim3dView* mainOrComparisonView,
const std::vector<RiuPickItemInfo>& pickItemInfos,
size_t* indexToFirstNoneNncItem,
size_t* indexToNncItemNearFirsItem );
2020-01-28 10:21:37 +01:00
static void findCellAndGridIndex( Rim3dView* mainOrComparisonView,
RimIntersectionResultDefinition* sepInterResDef,
size_t globalCellIndex,
size_t* cellIndex,
size_t* gridIndex );
2015-06-11 11:38:51 +02:00
private:
2020-02-12 11:43:15 +01:00
void ijkFromCellIndex( Rim3dView* mainOrComparisonView, size_t gridIdx, size_t cellIndex, size_t* i, size_t* j, size_t* k );
bool handleOverlayItemPicking( int winPosX, int winPosY );
void handleTextPicking( int winPosX, int winPosY, cvf::HitItemCollection* hitItems );
2019-10-29 11:45:06 +01:00
void addCompareToViewMenu( caf::CmdFeatureMenuBuilder* menuBuilder );
static void addDefaultPickEventHandler( RicDefaultPickEventHandler* pickEventHandler );
static void removeDefaultPickEventHandler( RicDefaultPickEventHandler* pickEventHandler );
private:
size_t m_currentGridIdx;
size_t m_currentCellIndex;
cvf::StructGridInterface::FaceType m_currentFaceIndex;
cvf::Vec3d m_currentPickPositionInDomainCoords;
bool m_isCurrentPickInComparisonView;
caf::PdmPointer<Rim3dView> m_reservoirView;
QPointer<RiuViewer> m_viewer;
static Ric3dViewPickEventHandler* sm_overridingPickHandler;
static std::vector<RicDefaultPickEventHandler*> sm_defaultPickEventHandlers;
2015-06-11 11:38:51 +02:00
};