#2333 Add flattened intersectino geometry. Some view modifications to move towards a final 2D view experience

This commit is contained in:
Jacob Støren 2018-01-25 17:37:22 +01:00
parent 47d8508196
commit 02f6b95959
17 changed files with 336 additions and 180 deletions

View File

@ -42,20 +42,6 @@ bool RicNewIntersectionViewFeature::isCommandEnabled()
return !objects.empty();
}
Rim2dIntersectionView* correspondingIntersectionView(RimIntersection* intersection)
{
std::vector<caf::PdmObjectHandle*> objects;
intersection->objectsWithReferringPtrFields(objects);
Rim2dIntersectionView* isectView = nullptr;
for (auto obj : objects)
{
isectView = dynamic_cast<Rim2dIntersectionView*>(obj);
if (isectView) break;
}
return isectView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -81,7 +67,7 @@ void RicNewIntersectionViewFeature::onActionTriggered(bool isChecked)
QMessageBox::warning(RiuMainWindow::instance(), "New Intersection View", text);
}
Rim2dIntersectionView* intersectionView = correspondingIntersectionView(intersection);
Rim2dIntersectionView* intersectionView = intersection->correspondingIntersectionView();
intersectionView->setVisible(true);
intersectionView->loadDataAndUpdate();

View File

@ -34,22 +34,27 @@
#include "cvfPrimitiveSetDirect.h"
#include "cvfPrimitiveSetIndexedUInt.h"
#include "cvfScalarMapper.h"
#include "cvfRay.h"
//--------------------------------------------------------------------------------------------------
///
/// isFlattened means to transform each flat section of the intersection onto the XZ plane
/// placed adjacent to each other as if they were rotated around the common extrusion line like a hinge
//--------------------------------------------------------------------------------------------------
RivIntersectionGeometryGenerator::RivIntersectionGeometryGenerator( RimIntersection* crossSection,
std::vector<std::vector<cvf::Vec3d> > &polylines,
const cvf::Vec3d& extrusionDirection,
const RivIntersectionHexGridInterface* grid)
const RivIntersectionHexGridInterface* grid,
bool isFlattened)
: m_crossSection(crossSection),
m_polyLines(polylines),
m_extrusionDirection(extrusionDirection),
m_hexGrid(grid)
m_hexGrid(grid),
m_isFlattened(isFlattened)
{
m_triangleVxes = new cvf::Vec3fArray;
m_cellBorderLineVxes = new cvf::Vec3fArray;
if (m_isFlattened) m_extrusionDirection = -cvf::Vec3d::Z_AXIS;
}
//--------------------------------------------------------------------------------------------------
@ -60,6 +65,41 @@ RivIntersectionGeometryGenerator::~RivIntersectionGeometryGenerator()
}
//--------------------------------------------------------------------------------------------------
/// Origo in the intersection of the ray P1-ExtrDir with the XY plane
/// Ez in upwards extrusionDir
/// Ey normal tio the section pplane
/// Ex in plane along p1-p2
//--------------------------------------------------------------------------------------------------
cvf::Mat4d calculateSectionLocalFlatteningCS(const cvf::Vec3d& p1, const cvf::Vec3d& p2, const cvf::Vec3d& extrusionDir)
{
using namespace cvf;
Vec3d Ez = extrusionDir.z() > 0.0 ? extrusionDir: -extrusionDir;
Vec3d sectionLineDir = p2 - p1;
sectionLineDir.normalize();
Vec3d Ey = Ez ^ sectionLineDir;
Vec3d Ex = Ey ^ Ez;
Ray extrusionRay;
extrusionRay.setOrigin(p1);
if (p1.z() > 0) extrusionRay.setDirection(-Ez);
else extrusionRay.setDirection(Ez);
Vec3d tr(Vec3d::ZERO);
extrusionRay.planeIntersect(Plane(0.0, 0.0 , 1.0, 0.0), &tr);
return Mat4d(Ex[0], Ey[0], Ez[0], tr[0],
Ex[1], Ey[1], Ez[1], tr[1],
Ex[2], Ey[2], Ez[2], tr[2],
0.0, 0.0, 0.0, 1.0);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -73,6 +113,9 @@ void RivIntersectionGeometryGenerator::calculateArrays()
cvf::Vec3d displayOffset = m_hexGrid->displayOffset();
cvf::BoundingBox gridBBox = m_hexGrid->boundingBox();
double previousSectionFlattenedEndPosX = 0.0;
cvf::Vec3d previousSectionOrigo(cvf::Vec3d::ZERO);
for (size_t pLineIdx = 0; pLineIdx < m_polyLines.size(); ++pLineIdx)
{
const std::vector<cvf::Vec3d>& m_polyLine = m_polyLines[pLineIdx];
@ -88,6 +131,11 @@ void RivIntersectionGeometryGenerator::calculateArrays()
cvf::Vec3d p1 = m_adjustedPolyline[lIdx];
cvf::Vec3d p2 = m_adjustedPolyline[lIdx+1];
cvf::Mat4d sectionLocalCS = calculateSectionLocalFlatteningCS(p1, p2, m_extrusionDirection);
if (pLineIdx == 0 && lIdx == 0) previousSectionOrigo = sectionLocalCS.translation();
previousSectionFlattenedEndPosX += (sectionLocalCS.translation() - previousSectionOrigo).length();
previousSectionOrigo = sectionLocalCS.translation();
cvf::BoundingBox sectionBBox;
sectionBBox.add(p1);
sectionBBox.add(p2);
@ -196,8 +244,12 @@ void RivIntersectionGeometryGenerator::calculateArrays()
std::vector<caf::HexGridIntersectionTools::ClipVx> clippedTriangleVxes;
std::vector<bool> isClippedTriEdgeCellContour;
caf::HexGridIntersectionTools::clipTrianglesBetweenTwoParallelPlanes(hexPlaneCutTriangleVxes, isTriangleEdgeCellContour, p1Plane, p2Plane,
&clippedTriangleVxes, &isClippedTriEdgeCellContour);
caf::HexGridIntersectionTools::clipTrianglesBetweenTwoParallelPlanes(hexPlaneCutTriangleVxes,
isTriangleEdgeCellContour,
p1Plane,
p2Plane,
&clippedTriangleVxes,
&isClippedTriEdgeCellContour);
size_t clippedTriangleCount = clippedTriangleVxes.size()/3;
@ -206,32 +258,47 @@ void RivIntersectionGeometryGenerator::calculateArrays()
uint triVxIdx = tIdx*3;
// Accumulate triangle vertices
cvf::Vec3d p0(clippedTriangleVxes[triVxIdx+0].vx);
cvf::Vec3d p1(clippedTriangleVxes[triVxIdx+1].vx);
cvf::Vec3d p2(clippedTriangleVxes[triVxIdx+2].vx);
cvf::Vec3f p0(clippedTriangleVxes[triVxIdx+0].vx - displayOffset);
cvf::Vec3f p1(clippedTriangleVxes[triVxIdx+1].vx - displayOffset);
cvf::Vec3f p2(clippedTriangleVxes[triVxIdx+2].vx - displayOffset);
if (m_isFlattened)
{
cvf::Mat4d invSectionCS = sectionLocalCS.getInverted();
cvf::Vec3d flattenedTranslation(previousSectionFlattenedEndPosX, 0.0,0.0);
triangleVertices.push_back(p0);
triangleVertices.push_back(p1);
triangleVertices.push_back(p2);
p0 = p0.getTransformedPoint(invSectionCS) + flattenedTranslation - displayOffset;
p1 = p1.getTransformedPoint(invSectionCS) + flattenedTranslation - displayOffset;
p2 = p2.getTransformedPoint(invSectionCS) + flattenedTranslation - displayOffset;
}
else
{
p0 -= displayOffset;
p1 -= displayOffset;
p2 -= displayOffset;
}
triangleVertices.emplace_back(p0);
triangleVertices.emplace_back(p1);
triangleVertices.emplace_back(p2);
// Accumulate mesh lines
if (isClippedTriEdgeCellContour[triVxIdx])
{
cellBorderLineVxes.push_back(p0);
cellBorderLineVxes.push_back(p1);
cellBorderLineVxes.emplace_back(p0);
cellBorderLineVxes.emplace_back(p1);
}
if (isClippedTriEdgeCellContour[triVxIdx+1])
{
cellBorderLineVxes.push_back(p1);
cellBorderLineVxes.push_back(p2);
cellBorderLineVxes.emplace_back(p1);
cellBorderLineVxes.emplace_back(p2);
}
if (isClippedTriEdgeCellContour[triVxIdx+2])
{
cellBorderLineVxes.push_back(p2);
cellBorderLineVxes.push_back(p0);
cellBorderLineVxes.emplace_back(p2);
cellBorderLineVxes.emplace_back(p0);
}
// Mapping to cell index
@ -267,7 +334,6 @@ void RivIntersectionGeometryGenerator::calculateArrays()
m_cellBorderLineVxes->assign(cellBorderLineVxes);
}
//--------------------------------------------------------------------------------------------------
/// Generate surface drawable geo from the specified region
///

View File

@ -49,7 +49,8 @@ public:
RivIntersectionGeometryGenerator(RimIntersection* crossSection,
std::vector<std::vector<cvf::Vec3d> > &polylines,
const cvf::Vec3d& extrusionDirection,
const RivIntersectionHexGridInterface* grid );
const RivIntersectionHexGridInterface* grid,
bool isFlattened );
~RivIntersectionGeometryGenerator();
@ -81,6 +82,7 @@ private:
cvf::cref<RivIntersectionHexGridInterface> m_hexGrid;
const std::vector<std::vector<cvf::Vec3d> > m_polyLines;
cvf::Vec3d m_extrusionDirection;
bool m_isFlattened;
// Output arrays
cvf::ref<cvf::Vec3fArray> m_triangleVxes;

View File

@ -63,9 +63,10 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivIntersectionPartMgr::RivIntersectionPartMgr(RimIntersection* rimCrossSection)
RivIntersectionPartMgr::RivIntersectionPartMgr(RimIntersection* rimCrossSection, bool isFlattened)
: m_rimCrossSection(rimCrossSection),
m_defaultColor(cvf::Color3::WHITE)
m_defaultColor(cvf::Color3::WHITE),
m_isFlattened(isFlattened)
{
CVF_ASSERT(m_rimCrossSection);
@ -790,6 +791,14 @@ void RivIntersectionPartMgr::appendPolylinePartsToModel(cvf::ModelBasicList* mod
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimIntersection* RivIntersectionPartMgr::intersection() const
{
return m_rimCrossSection.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -800,7 +809,7 @@ void RivIntersectionPartMgr::computeData()
{
cvf::Vec3d direction = m_rimCrossSection->extrusionDirection();
cvf::ref<RivIntersectionHexGridInterface> hexGrid = createHexGridInterface();
m_crossSectionGenerator = new RivIntersectionGeometryGenerator(m_rimCrossSection, polyLines, direction, hexGrid.p());
m_crossSectionGenerator = new RivIntersectionGeometryGenerator(m_rimCrossSection, polyLines, direction, hexGrid.p(), m_isFlattened);
}
}

View File

@ -24,6 +24,7 @@
#include "cvfColor4.h"
#include "cvfVector3.h"
#include "cvfArray.h"
#include "cafPdmPointer.h"
namespace cvf
@ -55,7 +56,7 @@ class RivIntersectionVertexWeights;
class RivIntersectionPartMgr : public cvf::Object
{
public:
explicit RivIntersectionPartMgr(RimIntersection* rimCrossSection);
explicit RivIntersectionPartMgr(RimIntersection* rimCrossSection, bool isFlattened = false);
void applySingleColorEffect();
void updateCellResultColor(size_t timeStepIndex);
@ -64,6 +65,8 @@ public:
void appendNativeCrossSectionFacesToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
void appendMeshLinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
void appendPolylinePartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform);
const RimIntersection* intersection() const;
private:
void updatePartEffect();
@ -105,10 +108,10 @@ public:
const RigFemResultAddress& resVarAddress,
const cvf::ScalarMapper* mapper);
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
private:
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
RimIntersection* m_rimCrossSection;
caf::PdmPointer<RimIntersection> m_rimCrossSection;
cvf::Color3f m_defaultColor;
@ -122,5 +125,7 @@ private:
cvf::ref<cvf::Part> m_highlightLineAlongExtrusionDir;
cvf::ref<cvf::Part> m_highlightPointsForExtrusionDir;
bool m_isFlattened;
};

View File

@ -28,6 +28,12 @@
#include "cvfModelBasicList.h"
#include "cvfTransform.h"
#include "cvfScene.h"
#include "RimEclipseView.h"
#include "RimEclipseCellColors.h"
#include "RimGeoMechView.h"
#include "RimGeoMechCellColors.h"
#include <QDateTime>
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(Rim2dIntersectionView, "Intersection2dView");
@ -44,6 +50,16 @@ Rim2dIntersectionView::Rim2dIntersectionView(void)
m_showWindow = false;
m_scaleTransform = new cvf::Transform();
m_intersectionVizModel = new cvf::ModelBasicList;
hasUserRequestedAnimation = true;
isPerspectiveView = false;
cvf::Mat4d mx( 1, 0, 0, 0,
0, 0, 1, 0,
0, -1, 0, 100,
0, 0, 0, 1);
((RiuViewerToViewInterface*)this)->setCameraPosition(mx );
disableGridBox();
}
//--------------------------------------------------------------------------------------------------
@ -67,10 +83,14 @@ void Rim2dIntersectionView::setVisible(bool isVisible)
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::setIntersection(RimIntersection* intersection)
{
CAF_ASSERT(intersection);
m_intersection = intersection;
Rim3dView * parentView = nullptr;
intersection->firstAncestorOrThisOfTypeAsserted(parentView);
name = parentView->name() + ": " + intersection->name();
}
//--------------------------------------------------------------------------------------------------
@ -96,6 +116,7 @@ bool Rim2dIntersectionView::isUsingFormationNames() const
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::scheduleGeometryRegen(RivCellSetEnum geometryType)
{
m_flatIntersectionPartMgr = nullptr;
}
//--------------------------------------------------------------------------------------------------
@ -109,6 +130,21 @@ RimCase* Rim2dIntersectionView::ownerCase() const
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim2dIntersectionView::isTimeStepDependentDataVisible() const
{
if ( m_intersection() )
{
RimGridView * gridView = nullptr;
m_intersection->firstAncestorOrThisOfTypeAsserted(gridView);
return gridView->isTimeStepDependentDataVisible();
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -116,21 +152,47 @@ QList<caf::PdmOptionItemInfo> Rim2dIntersectionView::calculateValueOptions(const
bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_intersection)
{
std::vector<RimIntersection*> intersections;
this->ownerCase()->descendantsIncludingThisOfType(intersections);
for (auto intersection : intersections)
{
options.push_back(caf::PdmOptionItemInfo(intersection->name(), intersection));
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool Rim2dIntersectionView::hasResults()
{
if (!m_intersection()) return false;
RimEclipseView * eclView = nullptr;
m_intersection->firstAncestorOrThisOfType(eclView);
if (eclView)
{
return (eclView->cellResult()->hasResult() || eclView->cellResult()->isTernarySaturationSelected());
}
RimGeoMechView * geoView = nullptr;
m_intersection->firstAncestorOrThisOfType(geoView);
if (geoView)
{
return geoView->cellResult()->hasResult();
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int Rim2dIntersectionView::timeStepCount()
{
if ( isTimeStepDependentDataVisible() )
{
return static_cast<int>( this->ownerCase()->timeStepDates().size());
}
return 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -163,14 +225,37 @@ void Rim2dIntersectionView::createDisplayModel()
{
if (m_viewer.isNull()) return;
if (!m_intersection()) return;
updateScaleTransform();
m_viewer->removeAllFrames();
int tsCount = this->timeStepCount();
for (int i = 0; i < tsCount; ++i)
{
m_viewer->addFrame(new cvf::Scene());
}
if ( m_flatIntersectionPartMgr.isNull() || m_intersection() != m_flatIntersectionPartMgr->intersection())
{
m_flatIntersectionPartMgr = new RivIntersectionPartMgr(m_intersection(), true);
}
m_intersectionVizModel->removeAllParts();
m_intersection()->intersectionPartMgr()->appendNativeCrossSectionFacesToModel(m_intersectionVizModel.p(), scaleTransform());
m_intersection()->intersectionPartMgr()->appendMeshLinePartsToModel(m_intersectionVizModel.p(), scaleTransform());
m_flatIntersectionPartMgr->appendNativeCrossSectionFacesToModel(m_intersectionVizModel.p(), scaleTransform());
m_flatIntersectionPartMgr->appendMeshLinePartsToModel(m_intersectionVizModel.p(), scaleTransform());
m_flatIntersectionPartMgr->applySingleColorEffect();
m_viewer->addStaticModelOnce(m_intersectionVizModel.p());
if ( this->hasUserRequestedAnimation() )
{
m_viewer->setCurrentFrame(m_currentTimeStep);
}
}
//--------------------------------------------------------------------------------------------------
@ -180,13 +265,6 @@ void Rim2dIntersectionView::createPartCollectionFromSelection(cvf::Collection<cv
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::updateDisplayModelVisibility()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -199,6 +277,14 @@ void Rim2dIntersectionView::clampCurrentTimestep()
//--------------------------------------------------------------------------------------------------
void Rim2dIntersectionView::updateCurrentTimeStep()
{
if ((this->hasUserRequestedAnimation() && this->hasResults()))
{
m_flatIntersectionPartMgr->updateCellResultColor(m_currentTimeStep);
}
else
{
m_flatIntersectionPartMgr->applySingleColorEffect();
}
}
//--------------------------------------------------------------------------------------------------
@ -242,7 +328,10 @@ cvf::Transform* Rim2dIntersectionView::scaleTransform()
void Rim2dIntersectionView::resetLegendsInViewer()
{
m_viewer->showAxisCross(false);
m_viewer->showAnimationProgress(false);
m_viewer->showAnimationProgress(true);
m_viewer->showHistogram(false);
m_viewer->showInfoText(false);
m_viewer->setMainScene(new cvf::Scene());
}

View File

@ -22,6 +22,7 @@
#include "cafPdmPtrField.h"
class RimIntersection;
class RivIntersectionPartMgr;
namespace cvf
{
@ -51,13 +52,13 @@ public:
virtual RimViewLinker* assosiatedViewLinker() const override { return nullptr; }
virtual RimViewController* viewController() const override { return nullptr; }
protected:
virtual bool isTimeStepDependentDataVisible() const override;
protected:
virtual void axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::String* zLabel) override;
virtual void createDisplayModel() override;
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) override;
virtual void updateDisplayModelVisibility() override;
virtual void clampCurrentTimestep() override;
virtual void updateCurrentTimeStep() override;
virtual void onTimeStepChanged() override;
@ -72,8 +73,12 @@ protected:
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
bool hasResults();
int timeStepCount();
caf::PdmPtrField<RimIntersection*> m_intersection;
cvf::ref<RivIntersectionPartMgr> m_flatIntersectionPartMgr;
cvf::ref<cvf::ModelBasicList> m_intersectionVizModel;
cvf::ref<cvf::Transform> m_scaleTransform;

View File

@ -35,7 +35,6 @@ Rim2dIntersectionViewCollection::Rim2dIntersectionViewCollection()
CAF_PDM_InitFieldNoDefault(&m_intersectionViews, "IntersectionViews", "Intersection Views", ":/CrossSection16x16.png", "", "");
m_intersectionViews.uiCapability()->setUiTreeHidden(true);
//m_intersectionViews.xmlCapability()->setIOWritable(false); // Temporarily until something of value are present.
}
//--------------------------------------------------------------------------------------------------

View File

@ -113,7 +113,7 @@ Rim3dView::Rim3dView(void)
CAF_PDM_InitField(&meshMode, "MeshMode", defaultMeshType, "Grid Lines", "", "", "");
CAF_PDM_InitFieldNoDefault(&surfaceMode, "SurfaceMode", "Grid Surface", "", "", "");
CAF_PDM_InitField(&showGridBox, "ShowGridBox", true, "Show Grid Box", "", "", "");
CAF_PDM_InitField(&m_showGridBox, "ShowGridBox", true, "Show Grid Box", "", "", "");
CAF_PDM_InitField(&m_disableLighting, "DisableLighting", false, "Disable Results Lighting", "", "Disable light model for scalar result colors", "");
@ -234,7 +234,7 @@ void Rim3dView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrd
caf::PdmUiGroup* viewGroup = uiOrdering.addNewGroup("Viewer");
viewGroup->add(&name);
viewGroup->add(&m_backgroundColor);
viewGroup->add(&showGridBox);
viewGroup->add(&m_showGridBox);
viewGroup->add(&isPerspectiveView);
viewGroup->add(&m_disableLighting);
@ -572,7 +572,7 @@ void Rim3dView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const
RiuMainWindow::instance()->refreshDrawStyleActions();
RiuMainWindow::instance()->refreshAnimationActions();
}
else if (changedField == &showGridBox)
else if (changedField == &m_showGridBox)
{
createHighlightAndGridBoxDisplayModelWithRedraw();
}
@ -761,7 +761,48 @@ void Rim3dView::createHighlightAndGridBoxDisplayModel()
m_viewer->addStaticModelOnce(m_highlightVizModel.p());
}
m_viewer->showGridBox(showGridBox());
m_viewer->showGridBox(m_showGridBox());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::updateDisplayModelVisibility()
{
if (m_viewer.isNull()) return;
const cvf::uint uintSurfaceBit = surfaceBit;
const cvf::uint uintMeshSurfaceBit = meshSurfaceBit;
const cvf::uint uintFaultBit = faultBit;
const cvf::uint uintMeshFaultBit = meshFaultBit;
// Initialize the mask to show everything except the the bits controlled here
unsigned int mask = 0xffffffff & ~uintSurfaceBit & ~uintFaultBit & ~uintMeshSurfaceBit & ~uintMeshFaultBit ;
// Then turn the appropriate bits on according to the user settings
if (surfaceMode == SURFACE)
{
mask |= uintSurfaceBit;
mask |= uintFaultBit;
}
else if (surfaceMode == FAULTS)
{
mask |= uintFaultBit;
}
if (meshMode == FULL_MESH)
{
mask |= uintMeshSurfaceBit;
mask |= uintMeshFaultBit;
}
else if (meshMode == FAULTS_MESH)
{
mask |= uintMeshFaultBit;
}
m_viewer->setEnableMask(mask);
m_viewer->update();
}
//--------------------------------------------------------------------------------------------------
@ -819,6 +860,14 @@ void Rim3dView::forceShowWindowOn()
m_showWindow.setValueWithFieldChanged(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dView::disableGridBox()
{
m_showGridBox = false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -66,6 +66,17 @@ namespace caf
{
class DisplayCoordTransform;
}
enum PartRenderMaskEnum
{
surfaceBit = 0x00000001,
meshSurfaceBit = 0x00000002,
faultBit = 0x00000004,
meshFaultBit = 0x00000008,
};
//==================================================================================================
///
///
@ -118,6 +129,7 @@ public:
int currentTimeStep() const { return m_currentTimeStep;}
void setCurrentTimeStep(int frameIdx);
void setCurrentTimeStepAndUpdate(int frameIdx) override;
virtual bool isTimeStepDependentDataVisible() const = 0;
// Updating
void updateCurrentTimeStepAndRedraw() override;
@ -135,7 +147,8 @@ public:
virtual RimCase* ownerCase() const = 0;
protected:
void setDefaultView();
virtual void setDefaultView();
void disableGridBox();
RimWellPathCollection* wellPathCollection();
void addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList,
@ -153,7 +166,7 @@ protected:
virtual void createDisplayModel() = 0;
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) = 0;
virtual void updateDisplayModelVisibility() = 0;
virtual void updateDisplayModelVisibility();
virtual void clampCurrentTimestep() = 0;
virtual void updateCurrentTimeStep() = 0;
@ -209,6 +222,6 @@ private:
caf::PdmField<cvf::Mat4d> m_cameraPosition;
caf::PdmField<cvf::Vec3d> m_cameraPointOfInterest;
caf::PdmField< cvf::Color3f > m_backgroundColor;
caf::PdmField<bool> showGridBox;
caf::PdmField<bool> m_showGridBox;
};

View File

@ -875,40 +875,7 @@ void RimEclipseView::updateStaticCellColors(RivCellSetEnum geometryType)
//--------------------------------------------------------------------------------------------------
void RimEclipseView::updateDisplayModelVisibility()
{
if (m_viewer.isNull()) return;
const cvf::uint uintSurfaceBit = surfaceBit;
const cvf::uint uintMeshSurfaceBit = meshSurfaceBit;
const cvf::uint uintFaultBit = faultBit;
const cvf::uint uintMeshFaultBit = meshFaultBit;
// Initialize the mask to show everything except the the bits controlled here
unsigned int mask = 0xffffffff & ~uintSurfaceBit & ~uintFaultBit & ~uintMeshSurfaceBit & ~uintMeshFaultBit ;
// Then turn the appropriate bits on according to the user settings
if (surfaceMode == SURFACE)
{
mask |= uintSurfaceBit;
mask |= uintFaultBit;
}
else if (surfaceMode == FAULTS)
{
mask |= uintFaultBit;
}
if (meshMode == FULL_MESH)
{
mask |= uintMeshSurfaceBit;
mask |= uintMeshFaultBit;
}
else if (meshMode == FAULTS_MESH)
{
mask |= uintMeshFaultBit;
}
m_viewer->setEnableMask(mask);
m_viewer->update();
Rim3dView::updateDisplayModelVisibility();
faultCollection->updateConnectedEditors();

View File

@ -69,14 +69,6 @@ namespace cvf
class OverlayItem;
}
enum PartRenderMaskEnum
{
surfaceBit = 0x00000001,
meshSurfaceBit = 0x00000002,
faultBit = 0x00000004,
meshFaultBit = 0x00000008,
};
//==================================================================================================
///
///

View File

@ -317,46 +317,6 @@ void RimGeoMechView::updateStaticCellColors()
m_vizLogic->updateStaticCellColors(-1);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechView::updateDisplayModelVisibility()
{
if (m_viewer.isNull()) return;
const cvf::uint uintSurfaceBit = surfaceBit;
const cvf::uint uintMeshSurfaceBit = meshSurfaceBit;
const cvf::uint uintFaultBit = faultBit;
const cvf::uint uintMeshFaultBit = meshFaultBit;
// Initialize the mask to show everything except the the bits controlled here
unsigned int mask = 0xffffffff & ~uintSurfaceBit & ~uintFaultBit & ~uintMeshSurfaceBit & ~uintMeshFaultBit ;
// Then turn the appropriate bits on according to the user settings
if (surfaceMode == SURFACE)
{
mask |= uintSurfaceBit;
mask |= uintFaultBit;
}
else if (surfaceMode == FAULTS)
{
mask |= uintFaultBit;
}
if (meshMode == FULL_MESH)
{
mask |= uintMeshSurfaceBit;
mask |= uintMeshFaultBit;
}
else if (meshMode == FAULTS_MESH)
{
mask |= uintMeshFaultBit;
}
m_viewer->setEnableMask(mask);
m_viewer->update();
}
//--------------------------------------------------------------------------------------------------
///
@ -477,7 +437,7 @@ void RimGeoMechView::clampCurrentTimestep()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGeoMechView::isTimeStepDependentDataVisible()
bool RimGeoMechView::isTimeStepDependentDataVisible() const
{
return this->hasUserRequestedAnimation() && (this->cellResult()->hasResult() || this->geoMechPropertyFilterCollection()->hasActiveFilters());
}

View File

@ -72,7 +72,7 @@ public:
const RimGeoMechPropertyFilterCollection* geoMechPropertyFilterCollection() const;
void setOverridePropertyFilterCollection(RimGeoMechPropertyFilterCollection* pfc);
bool isTimeStepDependentDataVisible();
bool isTimeStepDependentDataVisible() const override ;
virtual cvf::Transform* scaleTransform() override;
virtual void scheduleGeometryRegen(RivCellSetEnum geometryType) override;
@ -92,7 +92,6 @@ protected:
private:
virtual void createDisplayModel() override;
virtual void updateDisplayModelVisibility() override;
virtual void updateScaleTransform() override;
virtual void clampCurrentTimestep() override;

View File

@ -47,6 +47,7 @@
#include "cvfBoundingBox.h"
#include "cvfGeometryTools.h"
#include "cvfPlane.h"
#include "Rim2dIntersectionView.h"
namespace caf {
@ -723,6 +724,24 @@ void RimIntersection::appendPointToPolyLine(const cvf::Vec3d& point)
rebuildGeometryAndScheduleCreateDisplayModel();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim2dIntersectionView* RimIntersection::correspondingIntersectionView()
{
std::vector<caf::PdmObjectHandle*> objects;
this->objectsWithReferringPtrFields(objects);
Rim2dIntersectionView* isectView = nullptr;
for (auto obj : objects)
{
isectView = dynamic_cast<Rim2dIntersectionView*>(obj);
if (isectView) break;
}
return isectView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -851,6 +870,13 @@ void RimIntersection::rebuildGeometryAndScheduleCreateDisplayModel()
{
rimView->scheduleCreateDisplayModelAndRedraw();
}
Rim2dIntersectionView * iview = correspondingIntersectionView();
if (iview)
{
iview->scheduleGeometryRegen(RivCellSetEnum::ALL_CELLS);
iview->scheduleCreateDisplayModelAndRedraw();
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -33,6 +33,7 @@ class RimWellPath;
class RivIntersectionPartMgr;
class RimSimWellInView;
class RimSimWellInViewCollection;
class Rim2dIntersectionView;
namespace caf
{
@ -86,6 +87,7 @@ public:
std::vector< std::vector <cvf::Vec3d> > polyLines() const;
void appendPointToPolyLine(const cvf::Vec3d& point);
Rim2dIntersectionView* correspondingIntersectionView();
RivIntersectionPartMgr* intersectionPartMgr();
std::vector< std::vector <cvf::Vec3d> > polyLinesForExtrusionDirection() const;

View File

@ -742,9 +742,11 @@ void RiuMainWindow::slotRefreshViewActions()
void RiuMainWindow::refreshAnimationActions()
{
caf::FrameAnimationControl* animationControl = NULL;
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
Rim3dView * activeView = RiaApplication::instance()->activeReservoirView();
if (activeView && activeView->viewer())
{
animationControl = RiaApplication::instance()->activeReservoirView()->viewer()->animationControl();
animationControl = activeView->viewer()->animationControl();
}
m_animationToolBar->connectAnimationControl(animationControl);
@ -754,37 +756,22 @@ void RiuMainWindow::refreshAnimationActions()
int currentTimeStepIndex = 0;
bool enableAnimControls = false;
Rim3dView * activeView = RiaApplication::instance()->activeReservoirView();
if (activeView &&
activeView->viewer() &&
activeView->viewer()->frameCount())
{
enableAnimControls = true;
RimEclipseView * activeRiv = dynamic_cast<RimEclipseView*>(activeView);
if (activeRiv)
if ( activeView->isTimeStepDependentDataVisible() )
{
if (activeRiv->currentGridCellResults())
{
if (activeRiv->isTimeStepDependentDataVisible())
{
timeStepStrings = activeRiv->eclipseCase()->timeStepStrings();
}
else
{
timeStepStrings.push_back(tr("Static Property"));
}
}
timeStepStrings = activeView->ownerCase()->timeStepStrings();
}
else
{
RimGeoMechView * activeGmv = dynamic_cast<RimGeoMechView*>(activeView);
if (activeGmv)
RimEclipseView * activeRiv = dynamic_cast<RimEclipseView*>(activeView);
if ( activeRiv->currentGridCellResults() )
{
if (activeGmv->isTimeStepDependentDataVisible())
{
timeStepStrings = activeGmv->geoMechCase()->timeStepStrings();
}
timeStepStrings.push_back(tr("Static Property"));
}
}