///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2022 Equinor 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 "RimSeismicDataInterface.h" #include "RiaSeismicDefines.h" #include "cafFilePath.h" #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" #include "cafPdmField.h" class RimGenericParameter; class RifSeismicReader; class RimSeismicData : public RimSeismicDataInterface { CAF_PDM_HEADER_INIT; public: RimSeismicData(); ~RimSeismicData() override; void setFileName( QString filename ); QString fileName() const; std::string userDescription() const override; void setUserDescription( QString description ); double zMin() const override; double zMax() const override; double zStep() const override; int inlineMin() const override; int inlineMax() const override; int inlineStep() const override; int xlineMin() const override; int xlineMax() const override; int xlineStep() const override; std::vector worldOutline() const override; cvf::Vec3d convertToWorldCoords( int iLine, int xLine, double depth ) override; std::pair convertToInlineXline( cvf::Vec3d worldCoords ) override; std::shared_ptr sliceData( RiaDefines::SeismicSliceDirection direction, int sliceNumber, double zMin, double zMax ) override; std::shared_ptr sliceData( double worldX1, double worldY1, double worldX2, double worldY2, double zMin, double zMax ) override; float valueAt( cvf::Vec3d worldCoord ) override; std::pair dataRangeMinMax() const override; protected: void updateMetaData(); void initAfterRead() override; caf::PdmFieldHandle* userDescriptionField() override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) 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; private: void updateDataRange( bool updatePlot ); bool openFileIfNotOpen(); void logError( QString msg ); int toInlineIndex( int inLine ) const; int toXlineIndex( int xLine ) const; int toZIndex( double z ) const; private: caf::PdmField m_filename; caf::PdmField m_userDescription; caf::PdmChildArrayField m_metadata; double m_zStep; cvf::Vec3i m_inlineInfo; cvf::Vec3i m_xlineInfo; std::vector m_worldOutline; std::pair m_activeDataRange; std::pair m_fileDataRange; std::shared_ptr m_filereader; int m_nErrorsLogged; };