Prototype for use of texture on quad

This commit is contained in:
Magne Sjaastad
2025-02-20 09:02:31 +01:00
parent 4d6c1d5e86
commit 319d459d13
5 changed files with 293 additions and 13 deletions

View File

@@ -110,6 +110,8 @@ RimContourMapProjection::RimContourMapProjection()
CAF_PDM_InitField( &m_showContourLines, "ContourLines", true, "Show Contour Lines" );
CAF_PDM_InitField( &m_showContourLabels, "ContourLabels", true, "Show Contour Labels" );
CAF_PDM_InitField( &m_smoothContourLines, "SmoothContourLines", true, "Smooth Contour Lines" );
CAF_PDM_InitField( &m_showTextureImage, "ShowImage", false, "Show Texture Image" );
CAF_PDM_InitField( &m_showTrianglesWithColor, "ShowTrianglesWithColor", true, "Show Triangles with Color" );
auto defaultValue = caf::AppEnum<RimIntersectionFilterEnum>( RimIntersectionFilterEnum::INTERSECT_FILTER_NONE );
CAF_PDM_InitField( &m_valueFilterType, "ValueFilterType", defaultValue, "Value Filter" );
@@ -208,13 +210,16 @@ void RimContourMapProjection::generateGeometryIfNecessary()
}
}
m_trianglesWithVertexValues = RigContourMapTrianglesGenerator::generateTrianglesWithVertexValues( *m_contourMapGrid,
*m_contourMapProjection,
m_contourPolygons,
contourLevels,
m_contourLevelCumulativeAreas,
discrete,
sampleSpacing() );
if ( showTrianglesWithColor() )
{
m_trianglesWithVertexValues = RigContourMapTrianglesGenerator::generateTrianglesWithVertexValues( *m_contourMapGrid,
*m_contourMapProjection,
m_contourPolygons,
contourLevels,
m_contourLevelCumulativeAreas,
discrete,
sampleSpacing() );
}
}
progress.setProgress( 100 );
}
@@ -268,6 +273,22 @@ bool RimContourMapProjection::showContourLabels() const
return m_showContourLabels();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimContourMapProjection::showImage() const
{
return m_showTextureImage();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimContourMapProjection::showTrianglesWithColor() const
{
return m_showTrianglesWithColor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -615,6 +636,8 @@ void RimContourMapProjection::defineUiOrdering( QString uiConfigName, caf::PdmUi
legendConfig()->uiOrdering( "NumLevelsOnly", *mainGroup );
mainGroup->add( &m_resolution );
mainGroup->add( &m_showTextureImage );
mainGroup->add( &m_showTrianglesWithColor );
mainGroup->add( &m_showContourLines );
mainGroup->add( &m_showContourLabels );
m_showContourLabels.uiCapability()->setUiReadOnly( !m_showContourLines() );

View File

@@ -68,6 +68,8 @@ public:
bool showContourLines() const;
bool showContourLabels() const;
bool showImage() const;
bool showTrianglesWithColor() const;
// k layer filter, only consider kLayers in the given set (0-based index)
void useKLayers( std::set<int> kLayers );
@@ -150,6 +152,8 @@ protected:
caf::PdmField<bool> m_showContourLines;
caf::PdmField<bool> m_showContourLabels;
caf::PdmField<bool> m_smoothContourLines;
caf::PdmField<bool> m_showTextureImage;
caf::PdmField<bool> m_showTrianglesWithColor;
caf::PdmField<FloodingType> m_oilFloodingType;
caf::PdmField<FloodingType> m_gasFloodingType;

View File

@@ -345,12 +345,30 @@ void RimEclipseContourMapView::appendContourMapProjectionToModel()
cvf::ref<caf::DisplayCoordTransform> transForm = displayCoordTransform();
m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(),
transForm.p(),
m_contourMapProjection->trianglesWithVertexValues(),
*m_contourMapProjection->mapGrid(),
backgroundColor(),
m_contourMapProjection->legendConfig()->scalarMapper() );
if ( m_contourMapProjection->showTrianglesWithColor() )
{
m_contourMapProjectionPartMgr->appendProjectionToModel( contourMapProjectionModelBasicList.p(),
transForm.p(),
m_contourMapProjection->trianglesWithVertexValues(),
*m_contourMapProjection->mapGrid(),
backgroundColor(),
m_contourMapProjection->legendConfig()->scalarMapper() );
}
if ( m_contourMapProjection->showImage() )
{
/*
auto image = RicCreateContourMapPolygonTools::createImage( m_contourMapProjection->mapProjection(),
m_contourMapProjection->legendConfig()->scalarMapper()
); QString fileName = "f:/scratch/contour-map.png"; image.save( fileName );
*/
m_contourMapProjectionPartMgr->appendProjectionAsTexturedQuad( contourMapProjectionModelBasicList.p(),
transForm.p(),
m_contourMapProjection->legendConfig()->scalarMapper(),
*m_contourMapProjection->mapProjection(),
*m_contourMapProjection->mapGrid() );
}
contourMapProjectionModelBasicList->updateBoundingBoxesRecursive();
frameScene->addModel( contourMapProjectionModelBasicList.p() );