mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-13 08:52:14 -05:00
Bugfix - make show contour label checkbox work for contour plots
This commit is contained in:
1 parent
a630f7710a
commit
6b3b76fc9d
3 files changed
+62
-42
No files matched your search
@@ -127,8 +127,12 @@ void RivContourMapProjectionPartMgr::appendContourLinesToModel( const cvf::Camer
|
|||||||
cvf::ScalarMapper* mapper = m_contourMapProjection->legendConfig()->scalarMapper();
|
cvf::ScalarMapper* mapper = m_contourMapProjection->legendConfig()->scalarMapper();
|
||||||
|
|
||||||
std::vector<std::vector<cvf::BoundingBox>> labelBBoxes;
|
std::vector<std::vector<cvf::BoundingBox>> labelBBoxes;
|
||||||
std::vector<cvf::ref<cvf::Drawable>> labelDrawables =
|
std::vector<cvf::ref<cvf::Drawable>> labelDrawables;
|
||||||
createContourLabels( camera, displayCoordTransform, &labelBBoxes );
|
|
||||||
|
if ( m_contourMapProjection->showContourLabels() )
|
||||||
|
{
|
||||||
|
labelDrawables = createContourLabels( camera, displayCoordTransform, &labelBBoxes );
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::vector<cvf::ref<cvf::Drawable>>> contourDrawablesForAllLevels =
|
std::vector<std::vector<cvf::ref<cvf::Drawable>>> contourDrawablesForAllLevels =
|
||||||
createContourPolygons( displayCoordTransform, labelBBoxes );
|
createContourPolygons( displayCoordTransform, labelBBoxes );
|
||||||
@@ -163,14 +167,18 @@ void RivContourMapProjectionPartMgr::appendContourLinesToModel( const cvf::Camer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ( auto labelDrawableRef : labelDrawables )
|
|
||||||
|
if ( m_contourMapProjection->showContourLabels() )
|
||||||
{
|
{
|
||||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
for ( auto labelDrawableRef : labelDrawables )
|
||||||
part->setDrawable( labelDrawableRef.p() );
|
{
|
||||||
part->setEffect( m_labelEffect.p() );
|
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||||
part->setPriority( RivPartPriority::Text );
|
part->setDrawable( labelDrawableRef.p() );
|
||||||
part->setSourceInfo( new RivMeshLinesSourceInfo( m_contourMapProjection.p() ) );
|
part->setEffect( m_labelEffect.p() );
|
||||||
model->addPart( part.p() );
|
part->setPriority( RivPartPriority::Text );
|
||||||
|
part->setSourceInfo( new RivMeshLinesSourceInfo( m_contourMapProjection.p() ) );
|
||||||
|
model->addPart( part.p() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,46 +303,49 @@ std::vector<std::vector<cvf::ref<cvf::Drawable>>>
|
|||||||
lineBBox.add( displayVertex2 );
|
lineBBox.add( displayVertex2 );
|
||||||
|
|
||||||
bool addOriginalSegment = true;
|
bool addOriginalSegment = true;
|
||||||
for ( const cvf::BoundingBox& existingBBox : labelBBoxes[i] )
|
if ( labelBBoxes.size() > 0 )
|
||||||
{
|
{
|
||||||
if ( lineBBox.intersects( existingBBox ) )
|
for ( const cvf::BoundingBox& existingBBox : labelBBoxes[i] )
|
||||||
{
|
{
|
||||||
if ( existingBBox.contains( displayVertex1 ) && existingBBox.contains( displayVertex2 ) )
|
if ( lineBBox.intersects( existingBBox ) )
|
||||||
{
|
{
|
||||||
addOriginalSegment = false;
|
if ( existingBBox.contains( displayVertex1 ) && existingBBox.contains( displayVertex2 ) )
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cvf::Vec3d dir = displayVertex2 - displayVertex1;
|
|
||||||
|
|
||||||
cvf::Ray ray;
|
|
||||||
ray.setOrigin( displayVertex1 );
|
|
||||||
ray.setDirection( dir.getNormalized() );
|
|
||||||
ray.setMaximumDistance( dir.length() );
|
|
||||||
|
|
||||||
if ( !existingBBox.contains( displayVertex1 ) )
|
|
||||||
{
|
{
|
||||||
cvf::Vec3d intersection;
|
addOriginalSegment = false;
|
||||||
bool hit = ray.boxIntersect( existingBBox, &intersection );
|
|
||||||
if ( hit )
|
|
||||||
{
|
|
||||||
displayLines.push_back( cvf::Vec3f( displayVertex1 ) );
|
|
||||||
displayLines.push_back( cvf::Vec3f( intersection ) );
|
|
||||||
addOriginalSegment = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if ( !existingBBox.contains( displayVertex2 ) )
|
|
||||||
{
|
{
|
||||||
ray.setOrigin( displayVertex2 );
|
cvf::Vec3d dir = displayVertex2 - displayVertex1;
|
||||||
ray.setDirection( -ray.direction() );
|
|
||||||
cvf::Vec3d intersection;
|
cvf::Ray ray;
|
||||||
bool hit = ray.boxIntersect( existingBBox, &intersection );
|
ray.setOrigin( displayVertex1 );
|
||||||
if ( hit )
|
ray.setDirection( dir.getNormalized() );
|
||||||
|
ray.setMaximumDistance( dir.length() );
|
||||||
|
|
||||||
|
if ( !existingBBox.contains( displayVertex1 ) )
|
||||||
{
|
{
|
||||||
displayLines.push_back( cvf::Vec3f( intersection ) );
|
cvf::Vec3d intersection;
|
||||||
displayLines.push_back( cvf::Vec3f( displayVertex2 ) );
|
bool hit = ray.boxIntersect( existingBBox, &intersection );
|
||||||
addOriginalSegment = false;
|
if ( hit )
|
||||||
|
{
|
||||||
|
displayLines.push_back( cvf::Vec3f( displayVertex1 ) );
|
||||||
|
displayLines.push_back( cvf::Vec3f( intersection ) );
|
||||||
|
addOriginalSegment = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !existingBBox.contains( displayVertex2 ) )
|
||||||
|
{
|
||||||
|
ray.setOrigin( displayVertex2 );
|
||||||
|
ray.setDirection( -ray.direction() );
|
||||||
|
cvf::Vec3d intersection;
|
||||||
|
bool hit = ray.boxIntersect( existingBBox, &intersection );
|
||||||
|
if ( hit )
|
||||||
|
{
|
||||||
|
displayLines.push_back( cvf::Vec3f( intersection ) );
|
||||||
|
displayLines.push_back( cvf::Vec3f( displayVertex2 ) );
|
||||||
|
addOriginalSegment = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,6 +239,14 @@ bool RimContourMapProjection::showContourLines() const
|
|||||||
return m_showContourLines();
|
return m_showContourLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimContourMapProjection::showContourLabels() const
|
||||||
|
{
|
||||||
|
return m_showContourLabels();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public:
|
|||||||
double sampleSpacingFactor() const;
|
double sampleSpacingFactor() const;
|
||||||
void setSampleSpacingFactor( double spacingFactor );
|
void setSampleSpacingFactor( double spacingFactor );
|
||||||
bool showContourLines() const;
|
bool showContourLines() const;
|
||||||
|
bool showContourLabels() const;
|
||||||
|
|
||||||
QString resultAggregationText() const;
|
QString resultAggregationText() const;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user