2015-06-11 11:38:51 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions 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
|
2015-11-26 16:00:08 +01:00
|
|
|
|
|
|
|
|
#include "cvfStructGrid.h"
|
|
|
|
|
#include "cafPdmPointer.h"
|
|
|
|
|
|
2015-06-11 11:38:51 +02:00
|
|
|
#include <QObject>
|
2015-11-26 16:00:08 +01:00
|
|
|
#include <QPointer>
|
2015-06-11 11:38:51 +02:00
|
|
|
|
2018-08-30 13:22:28 +02:00
|
|
|
class RicDefaultPickEventHandler;
|
2019-02-06 09:45:30 +01:00
|
|
|
class Ric3dViewPickEventHandler;
|
2015-06-30 15:37:53 +02:00
|
|
|
class RimEclipseView;
|
|
|
|
|
class RimGeoMechView;
|
2016-09-26 10:35:59 +02:00
|
|
|
class RimIntersection;
|
2018-01-09 10:11:28 +01:00
|
|
|
class Rim3dView;
|
2015-11-26 16:00:08 +01:00
|
|
|
class RiuViewer;
|
2016-09-26 10:35:59 +02:00
|
|
|
class RivIntersectionBoxSourceInfo;
|
2016-09-21 10:40:08 +02:00
|
|
|
class RivIntersectionSourceInfo;
|
2018-08-27 14:27:33 +02:00
|
|
|
class RiuPickItemInfo;
|
2015-06-30 15:37:53 +02:00
|
|
|
|
2015-06-11 11:38:51 +02:00
|
|
|
class QMouseEvent;
|
|
|
|
|
|
2016-09-27 11:59:06 +02:00
|
|
|
namespace caf {
|
|
|
|
|
class PdmObject;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-11 11:38:51 +02:00
|
|
|
namespace cvf {
|
|
|
|
|
class HitItemCollection;
|
|
|
|
|
class Part;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class RiuViewerCommands: public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2017-03-06 11:19:51 +01:00
|
|
|
explicit RiuViewerCommands(RiuViewer* ownerViewer);
|
2018-10-18 19:45:57 +02:00
|
|
|
~RiuViewerCommands() override;
|
2015-06-11 11:38:51 +02:00
|
|
|
|
2018-01-09 10:11:28 +01:00
|
|
|
void setOwnerView(Rim3dView * owner);
|
2015-06-11 11:38:51 +02:00
|
|
|
|
|
|
|
|
void displayContextMenu(QMouseEvent* event);
|
2015-11-05 12:32:29 +01:00
|
|
|
void handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers);
|
2015-06-11 11:38:51 +02:00
|
|
|
|
2019-02-06 09:45:30 +01:00
|
|
|
static void setPickEventHandler(Ric3dViewPickEventHandler* pickEventHandler);
|
|
|
|
|
static void removePickEventHandlerIfActive(Ric3dViewPickEventHandler* pickEventHandler);
|
2018-08-29 15:44:47 +02:00
|
|
|
|
|
|
|
|
cvf::Vec3d lastPickPositionInDomainCoords() const;
|
2015-06-11 11:38:51 +02:00
|
|
|
private:
|
2016-09-26 10:35:59 +02:00
|
|
|
void findCellAndGridIndex(const RivIntersectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
|
|
|
|
|
void findCellAndGridIndex(const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
|
|
|
|
|
|
2015-06-11 11:38:51 +02:00
|
|
|
void ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size_t* i, size_t* j, size_t* k);
|
2018-08-27 14:27:33 +02:00
|
|
|
|
|
|
|
|
void findFirstItems(const std::vector<RiuPickItemInfo> & pickItemInfos,
|
|
|
|
|
size_t* indexToFirstNoneNncItem,
|
|
|
|
|
size_t* indexToNncItemNearFirsItem);
|
2015-06-30 15:37:53 +02:00
|
|
|
|
2015-12-07 09:59:19 +01:00
|
|
|
bool handleOverlayItemPicking(int winPosX, int winPosY);
|
|
|
|
|
|
2018-08-30 13:22:28 +02:00
|
|
|
static void addDefaultPickEventHandler(RicDefaultPickEventHandler* pickEventHandler);
|
|
|
|
|
static void removeDefaultPickEventHandler(RicDefaultPickEventHandler* pickEventHandler);
|
|
|
|
|
|
2018-02-24 09:17:02 +01:00
|
|
|
private:
|
|
|
|
|
size_t m_currentGridIdx;
|
|
|
|
|
size_t m_currentCellIndex;
|
|
|
|
|
cvf::StructGridInterface::FaceType m_currentFaceIndex;
|
|
|
|
|
cvf::Vec3d m_currentPickPositionInDomainCoords;
|
|
|
|
|
caf::PdmPointer<Rim3dView> m_reservoirView;
|
|
|
|
|
QPointer<RiuViewer> m_viewer;
|
2018-08-30 13:22:28 +02:00
|
|
|
|
2019-02-12 08:21:01 +01:00
|
|
|
static Ric3dViewPickEventHandler* sm_overridingPickHandler;
|
2018-08-30 13:22:28 +02:00
|
|
|
static std::vector<RicDefaultPickEventHandler*> sm_defaultPickEventHandlers;
|
2018-12-03 10:53:40 +01:00
|
|
|
void handleTextPicking(int winPosX, int winPosY, cvf::HitItemCollection* hitItems);
|
2015-06-11 11:38:51 +02:00
|
|
|
};
|