///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) Statoil ASA // Copyright (C) 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "cafPdmPointer.h" #include "RivIntersectionGeometryGeneratorInterface.h" #include "cvfArray.h" #include "cvfBoundingBox.h" #include "cvfObject.h" #include "cvfVector3.h" #include #include class RigMainGrid; class RigActiveCellInfo; class RigResultAccessor; class RivIntersectionHexGridInterface; class RimSurface; namespace cvf { class ScalarMapper; class DrawableGeo; } // namespace cvf struct PolylineSegmentMeshData { // Naming things? FenceMeshSection/PolylineMeshSection? cvf::Vec2fArray vertexArrayUZ; // Consider std::vector instead, as access methods of Vec2f is .x() and .y() std::vector polygonIndices; // Not needed when vertices/nodes are not shared between polygons? std::vector verticesPerPolygon; std::vector polygonToCellIndexMap; cvf::Vec2d startUtmXY; cvf::Vec2d endUtmXY; }; // TODO: Remove inheritance from RivIntersectionGeometryGeneratorInterface? As we do not use triangles class RivPolylineIntersectionGeometryGenerator : public cvf::Object, public RivIntersectionGeometryGeneratorInterface { public: RivPolylineIntersectionGeometryGenerator( std::vector& polylineUtm, RivIntersectionHexGridInterface* grid ); ~RivPolylineIntersectionGeometryGenerator() override; void generateIntersectionGeometry( cvf::UByteArray* visibleCells ); const cvf::Vec3fArray* polygonVxes() const; const std::vector& vertiesPerPolygon() const; const std::vector& polygonToCellIndex() const; const std::vector& polylineSegmentsMeshData() const; // GeomGen Interface bool isAnyGeometryPresent() const override; const std::vector& triangleToCellIndex() const override; const std::vector& triangleVxToCellCornerInterpolationWeights() const override; const cvf::Vec3fArray* triangleVxes() const override; private: void calculateArrays( cvf::UByteArray* visibleCells ); static std::vector createPolylineSegmentCellCandidates( const RivIntersectionHexGridInterface& hexGrid, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint, const cvf::Vec3d& heightVector, const double topDepth, const double bottomDepth ); private: cvf::ref m_hexGrid; const std::vector m_polylineUtm; // Output arrays std::vector m_polygonToCellIdxMap; cvf::ref m_polygonVertices; std::vector m_verticesPerPolygon; std::vector m_polylineSegmentsMeshData; // Dummy vectors for GeomGen Interface const std::vector m_emptyTriangleToCellIdxMap = {}; const std::vector m_emptyTriVxToCellCornerWeights = {}; };