mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3987 Fix picking on Geo Mech contour maps
This commit is contained in:
parent
d9f7e68739
commit
796c6a0e0a
@ -379,21 +379,21 @@ size_t RimContourMapProjection::numberOfVertices() const
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimContourMapProjection::checkForMapIntersection(const cvf::Vec3d& localPoint3d,
|
||||
cvf::Vec2d* contourMapPoint,
|
||||
double* valueAtPoint) const
|
||||
cvf::Vec2d* contourMapPoint,
|
||||
double* valueAtPoint) const
|
||||
{
|
||||
CVF_TIGHT_ASSERT(contourMapPoint);
|
||||
CVF_TIGHT_ASSERT(valueAtPoint);
|
||||
|
||||
cvf::Vec3d localPos3d(localPoint3d.x() + gridEdgeOffset(), localPoint3d.y() + gridEdgeOffset(), 0.0);
|
||||
cvf::Vec2d gridPos2d(localPos3d.x(), localPos3d.y());
|
||||
cvf::Vec3d mapPos3d = localPoint3d - m_expandedBoundingBox.min() + m_gridBoundingBox.min();
|
||||
cvf::Vec2d mapPos2d(mapPos3d.x(), mapPos3d.y());
|
||||
cvf::Vec2d gridorigin(m_expandedBoundingBox.min().x(), m_expandedBoundingBox.min().y());
|
||||
|
||||
double value = interpolateValue(gridPos2d);
|
||||
double value = interpolateValue(mapPos2d);
|
||||
if (value != std::numeric_limits<double>::infinity())
|
||||
{
|
||||
*valueAtPoint = value;
|
||||
*contourMapPoint = gridPos2d + gridorigin;
|
||||
*contourMapPoint = mapPos2d + gridorigin;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1058,7 +1058,7 @@ void RimContourMapProjection::generateContourPolygons()
|
||||
{
|
||||
std::vector<ContourPolygons> contourPolygons;
|
||||
|
||||
const double areaTreshold = (m_sampleSpacing * m_sampleSpacing) / (sampleSpacingFactor() * sampleSpacingFactor());
|
||||
const double areaTreshold = 1.5 * (m_sampleSpacing * m_sampleSpacing) / (sampleSpacingFactor() * sampleSpacingFactor());
|
||||
|
||||
std::vector<double> contourLevels;
|
||||
if (legendConfig()->mappingMode() != RimRegularLegendConfig::CATEGORY_INTEGER)
|
||||
|
@ -182,13 +182,15 @@ void RimGeoMechContourMapProjection::updateGridInformation()
|
||||
m_sampleSpacing = m_relativeSampleSpacing * geoMechCase->characteristicCellSize();
|
||||
m_femPart->ensureIntersectionSearchTreeIsBuilt();
|
||||
|
||||
m_gridBoundingBox = geoMechCase->activeCellsBoundingBox();
|
||||
|
||||
if (m_limitToPorePressureRegions)
|
||||
{
|
||||
m_gridBoundingBox = calculateExpandedPorBarBBox(view()->currentTimeStep());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gridBoundingBox = geoMechCase->activeCellsBoundingBox();
|
||||
m_expandedBoundingBox = m_gridBoundingBox;
|
||||
}
|
||||
cvf::Vec3d minExpandedPoint = m_gridBoundingBox.min() - cvf::Vec3d(gridEdgeOffset(), gridEdgeOffset(), 0.0);
|
||||
cvf::Vec3d maxExpandedPoint = m_gridBoundingBox.max() + cvf::Vec3d(gridEdgeOffset(), gridEdgeOffset(), 0.0);
|
||||
@ -213,22 +215,27 @@ std::vector<bool> RimGeoMechContourMapProjection::getMapCellVisibility()
|
||||
std::vector<std::vector<unsigned int>> distanceImage (nCellsIJ.x(), std::vector<unsigned int>(nCellsIJ.y(), 0u));
|
||||
|
||||
std::vector<bool> mapCellVisibility;
|
||||
RigFemResultAddress porBarAddr(RigFemResultPosEnum::RIG_ELEMENT_NODAL, "POR-Bar", "");
|
||||
std::vector<double> cellResults = generateResultsFromAddress(porBarAddr, mapCellVisibility, view()->currentTimeStep());
|
||||
|
||||
mapCellVisibility.resize(numberOfCells(), true);
|
||||
CVF_ASSERT(mapCellVisibility.size() == cellResults.size());
|
||||
RigFemResultAddress resAddr = view()->cellResult()->resultAddress();
|
||||
|
||||
if (m_limitToPorePressureRegions)
|
||||
{
|
||||
cvf::BoundingBox validPorBoundingBox;
|
||||
resAddr = RigFemResultAddress(RigFemResultPosEnum::RIG_ELEMENT_NODAL, "POR-Bar", "");
|
||||
}
|
||||
|
||||
std::vector<double> cellResults = generateResultsFromAddress(resAddr, mapCellVisibility, view()->currentTimeStep());
|
||||
|
||||
mapCellVisibility.resize(numberOfCells(), true);
|
||||
CVF_ASSERT(mapCellVisibility.size() == cellResults.size());
|
||||
|
||||
{
|
||||
cvf::BoundingBox validResBoundingBox;
|
||||
for (size_t cellIndex = 0; cellIndex < cellResults.size(); ++cellIndex)
|
||||
{
|
||||
cvf::Vec2ui ij = ijFromCellIndex(cellIndex);
|
||||
validPorBoundingBox.add(cvf::Vec3d(cellCenterPosition(ij.x(), ij.y()), 0.0));
|
||||
if (cellResults[cellIndex] != std::numeric_limits<double>::infinity())
|
||||
{
|
||||
distanceImage[ij.x()][ij.y()] = 1u;
|
||||
validResBoundingBox.add(cvf::Vec3d(cellCenterPosition(ij.x(), ij.y()), 0.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -236,11 +243,11 @@ std::vector<bool> RimGeoMechContourMapProjection::getMapCellVisibility()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_paddingAroundPorePressureRegion > 0.0)
|
||||
if (m_limitToPorePressureRegions && m_paddingAroundPorePressureRegion > 0.0)
|
||||
{
|
||||
RiaImageTools::distanceTransform2d(distanceImage);
|
||||
|
||||
cvf::Vec3d porExtent = validPorBoundingBox.extent();
|
||||
cvf::Vec3d porExtent = validResBoundingBox.extent();
|
||||
double radius = std::max(porExtent.x(), porExtent.y()) * 0.25;
|
||||
double expansion = m_paddingAroundPorePressureRegion * radius;
|
||||
size_t cellPadding = std::ceil(expansion / m_sampleSpacing);
|
||||
|
Loading…
Reference in New Issue
Block a user