///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2016- Statoil ASA // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "cafPdmObject.h" #include "cafPdmField.h" #include "cvfBase.h" #include "cvfVector3.h" #include "cvfBoundingBox.h" #include #include class RicBoxManipulatorEventHandler; class RiuViewer; class RivIntersectionBoxPartMgr; namespace cvf { class ModelBasicList; } //================================================================================================== // // // //================================================================================================== class RimIntersectionBox : public QObject, public caf::PdmObject { Q_OBJECT; CAF_PDM_HEADER_INIT; public: enum SinglePlaneState { PLANE_STATE_NONE, PLANE_STATE_X, PLANE_STATE_Y, PLANE_STATE_Z }; public: RimIntersectionBox(); ~RimIntersectionBox() override; // Fields caf::PdmField name; caf::PdmField isActive; caf::PdmField showInactiveCells; cvf::Mat4d boxOrigin() const; cvf::Vec3d boxSize() const; SinglePlaneState singlePlaneState() const; bool show3dManipulator() const; RivIntersectionBoxPartMgr* intersectionBoxPartMgr(); void appendManipulatorPartsToModel(cvf::ModelBasicList* model); void rebuildGeometry(); void setToDefaultSizeBox(); void setToDefaultSizeSlice(SinglePlaneState plane, const cvf::Vec3d& position); protected: caf::PdmFieldHandle* userDescriptionField() override; caf::PdmFieldHandle* objectToggleField() override; void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override; void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void initAfterRead() override; protected slots: void slotScheduleRedraw(); void slotUpdateGeometry(const cvf::Vec3d& origin, const cvf::Vec3d& size); private: friend class RimIntersectionCollection; void updateBoxManipulatorGeometry(); void rebuildGeometryAndScheduleCreateDisplayModel(); void updateVisibility(); void clampSinglePlaneValues(); void switchSingelPlaneState(); void setFromOriginAndSize(const cvf::Vec3d& origin, const cvf::Vec3d& size); cvf::BoundingBox currentCellBoundingBox(); RiuViewer* viewer(); private: caf::PdmField > m_singlePlaneState; caf::PdmField m_minXCoord; caf::PdmField m_minYCoord; caf::PdmField m_minDepth; caf::PdmField m_maxXCoord; caf::PdmField m_maxYCoord; caf::PdmField m_maxDepth; caf::PdmField m_xySliderStepSize; caf::PdmField m_depthSliderStepSize; caf::PdmField m_show3DManipulator; cvf::ref m_intersectionBoxPartMgr; QPointer m_boxManipulator; };