2018-10-16 02:53:30 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "RimCheckableNamedObject.h"
|
|
|
|
#include "RimRegularLegendConfig.h"
|
|
|
|
|
|
|
|
#include "cafDisplayCoordTransform.h"
|
|
|
|
#include "cafPdmChildField.h"
|
|
|
|
#include "cafPdmField.h"
|
|
|
|
#include "cafPdmObject.h"
|
|
|
|
|
2018-10-31 10:09:14 -05:00
|
|
|
#include "cvfBoundingBox.h"
|
2018-10-16 02:53:30 -05:00
|
|
|
#include "cvfGeometryBuilderFaceList.h"
|
|
|
|
#include "cvfVector2.h"
|
|
|
|
|
|
|
|
class RigMainGrid;
|
2018-10-23 09:32:40 -05:00
|
|
|
class RigResultAccessor;
|
2018-11-14 05:38:20 -06:00
|
|
|
class RimContourMapView;
|
2018-10-16 02:53:30 -05:00
|
|
|
class RimEclipseResultCase;
|
2018-11-09 08:25:35 -06:00
|
|
|
class RimEclipseResultDefinition;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
2018-11-09 02:04:40 -06:00
|
|
|
class RimContourMapProjection : public RimCheckableNamedObject
|
2018-10-16 02:53:30 -05:00
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
public:
|
|
|
|
enum ResultAggregationEnum
|
|
|
|
{
|
2018-11-01 09:21:35 -05:00
|
|
|
RESULTS_TOP_VALUE,
|
|
|
|
RESULTS_MEAN_VALUE,
|
|
|
|
RESULTS_GEOM_VALUE,
|
|
|
|
RESULTS_HARM_VALUE,
|
2018-10-16 02:53:30 -05:00
|
|
|
RESULTS_MIN_VALUE,
|
2018-11-01 09:21:35 -05:00
|
|
|
RESULTS_MAX_VALUE,
|
2018-11-13 07:22:34 -06:00
|
|
|
RESULTS_VOLUME_SUM,
|
2018-11-05 07:31:07 -06:00
|
|
|
RESULTS_SUM,
|
|
|
|
RESULTS_OIL_COLUMN,
|
|
|
|
RESULTS_GAS_COLUMN,
|
|
|
|
RESULTS_HC_COLUMN
|
2018-10-16 02:53:30 -05:00
|
|
|
};
|
|
|
|
typedef caf::AppEnum<ResultAggregationEnum> ResultAggregation;
|
2018-12-19 06:14:36 -06:00
|
|
|
typedef std::vector<std::vector<cvf::ref<cvf::Vec3fArray>>> ClosedContourPolygons;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2018-11-09 02:04:40 -06:00
|
|
|
RimContourMapProjection();
|
|
|
|
~RimContourMapProjection() override;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
void generateVertices(cvf::Vec3fArray* vertices, const caf::DisplayCoordTransform* displayCoordTransform);
|
2018-12-19 06:14:36 -06:00
|
|
|
ClosedContourPolygons generateContourPolygons(const caf::DisplayCoordTransform* displayCoordTransform);
|
2018-11-15 14:40:10 -06:00
|
|
|
cvf::ref<cvf::Vec3fArray> generatePickPointPolygon(const caf::DisplayCoordTransform* displayCoordTransform);
|
2018-10-17 08:46:47 -05:00
|
|
|
void generateResults();
|
2018-11-21 02:32:04 -06:00
|
|
|
|
|
|
|
ResultAggregation resultAggregation() const;
|
|
|
|
double sampleSpacing() const;
|
|
|
|
double sampleSpacingFactor() const;
|
|
|
|
bool showContourLines() const;
|
|
|
|
|
|
|
|
QString resultAggregationText() const;
|
|
|
|
QString resultDescriptionText() const;
|
|
|
|
QString weightingParameter() const;
|
|
|
|
|
2018-10-16 02:53:30 -05:00
|
|
|
double maxValue() const;
|
|
|
|
double minValue() const;
|
2018-11-06 05:47:54 -06:00
|
|
|
double meanValue() const;
|
|
|
|
double sumAllValues() const;
|
2018-11-15 14:40:10 -06:00
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
cvf::Vec2ui numberOfElementsIJ() const;
|
|
|
|
cvf::Vec2ui numberOfVerticesIJ() const;
|
2018-11-05 09:19:04 -06:00
|
|
|
|
2018-11-06 06:23:24 -06:00
|
|
|
bool isColumnResult() const;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2018-11-15 14:40:10 -06:00
|
|
|
double valueAtVertex(uint i, uint j) const;
|
|
|
|
bool hasResultAtVertex(uint i, uint j) const;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
|
|
|
RimRegularLegendConfig* legendConfig() const;
|
2018-10-17 08:46:47 -05:00
|
|
|
void updateLegend();
|
2018-10-17 06:26:15 -05:00
|
|
|
|
2018-11-15 14:40:10 -06:00
|
|
|
uint numberOfCells() const;
|
|
|
|
uint numberOfValidCells() const;
|
2018-11-21 02:32:04 -06:00
|
|
|
size_t numberOfVertices() const;
|
2018-11-15 14:40:10 -06:00
|
|
|
|
2018-11-09 08:25:35 -06:00
|
|
|
void updatedWeightingResult();
|
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
bool checkForMapIntersection(const cvf::Vec3d& localPoint3d, cvf::Vec2d* contourMapPoint, cvf::Vec2ui* contourMapCell, double* valueAtPoint) const;
|
|
|
|
void setPickPoint(cvf::Vec2d pickedPoint);
|
2018-11-14 05:38:20 -06:00
|
|
|
|
2018-10-16 02:53:30 -05:00
|
|
|
protected:
|
2018-10-18 12:45:57 -05:00
|
|
|
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
2018-11-21 02:32:04 -06:00
|
|
|
void defineEditorAttribute(const caf::PdmFieldHandle* field,
|
|
|
|
QString uiConfigName,
|
|
|
|
caf::PdmUiEditorAttribute* attribute) override;
|
2018-11-09 08:25:35 -06:00
|
|
|
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
2018-10-18 12:45:57 -05:00
|
|
|
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
2018-11-21 02:32:04 -06:00
|
|
|
void initAfterRead() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef std::pair<size_t, double> CellIndexAndResult;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void generateGridMapping();
|
|
|
|
|
|
|
|
double valueInCell(uint i, uint j) const;
|
|
|
|
bool hasResultInCell(uint i, uint j) const;
|
|
|
|
|
|
|
|
double calculateValueInCell(uint i, uint j) const;
|
|
|
|
double calculateValueAtVertex(uint i, uint j) const;
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<CellIndexAndResult> cellsAtIJ(uint i, uint j) const;
|
|
|
|
|
|
|
|
std::vector<CellIndexAndResult> visibleCellsAndOverlapVolumeFrom2dPoint(const cvf::Vec2d& globalPos2d, const std::vector<double>* weightingResultValues = nullptr) const;
|
|
|
|
std::vector<CellIndexAndResult> visibleCellsAndLengthInCellFrom2dPoint(const cvf::Vec2d& globalPos2d, const std::vector<double>* weightingResultValues = nullptr) const;
|
|
|
|
double findColumnResult(ResultAggregation resultAggregation, size_t cellGlobalIdx) const;
|
|
|
|
|
|
|
|
bool isMeanResult() const;
|
|
|
|
bool isSummationResult() const;
|
|
|
|
bool isStraightSummationResult() const;
|
|
|
|
static bool isStraightSummationResult(ResultAggregationEnum aggregationType);
|
|
|
|
|
|
|
|
size_t cellIndexFromIJ(uint i, uint j) const;
|
|
|
|
size_t vertexIndexFromIJ(uint i, uint j) const;
|
|
|
|
|
|
|
|
cvf::Vec2ui ijFromVertexIndex(size_t gridIndex) const;
|
|
|
|
cvf::Vec2ui ijFromCellIndex(size_t mapIndex) const;
|
|
|
|
cvf::Vec2ui ijFromLocalPos(const cvf::Vec2d& localPos2d) const;
|
|
|
|
cvf::Vec2d globalCellCenterPosition(uint i, uint j) const;
|
|
|
|
|
|
|
|
std::vector<double> xVertexPositions() const;
|
|
|
|
std::vector<double> yVertexPositions() const;
|
|
|
|
|
|
|
|
bool getLegendRangeFrom3dGrid() const;
|
|
|
|
void updateGridInformation();
|
|
|
|
cvf::Vec2ui calculateMapSize() const;
|
|
|
|
|
|
|
|
RimEclipseResultCase* eclipseCase() const;
|
|
|
|
RimContourMapView* view() const;
|
2018-11-15 14:40:10 -06:00
|
|
|
|
2018-10-16 02:53:30 -05:00
|
|
|
protected:
|
2018-11-21 02:32:04 -06:00
|
|
|
caf::PdmField<double> m_relativeSampleSpacing;
|
|
|
|
caf::PdmField<ResultAggregation> m_resultAggregation;
|
|
|
|
caf::PdmField<bool> m_showContourLines;
|
|
|
|
caf::PdmField<bool> m_weightByParameter;
|
|
|
|
caf::PdmChildField<RimEclipseResultDefinition*> m_weightingResult;
|
|
|
|
cvf::ref<cvf::UByteArray> m_cellGridIdxVisibility;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
std::vector<double> m_aggregatedResults;
|
|
|
|
std::vector<double> m_aggregatedVertexResults;
|
2018-11-15 14:40:10 -06:00
|
|
|
|
2018-11-08 03:18:49 -06:00
|
|
|
std::vector<std::vector<std::pair<size_t, double>>> m_projected3dGridIndices;
|
2018-10-16 02:53:30 -05:00
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
cvf::ref<RigResultAccessor> m_resultAccessor;
|
2018-11-15 14:40:10 -06:00
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
cvf::Vec2d m_pickPoint;
|
2018-11-15 14:40:10 -06:00
|
|
|
|
2018-11-21 02:32:04 -06:00
|
|
|
caf::PdmPointer<RimEclipseResultCase> m_eclipseCase;
|
|
|
|
cvf::ref<RigMainGrid> m_mainGrid;
|
|
|
|
cvf::Vec2ui m_mapSize;
|
|
|
|
cvf::BoundingBox m_fullBoundingBox;
|
|
|
|
double m_sampleSpacing;
|
2018-10-16 02:53:30 -05:00
|
|
|
};
|