Bugfix - make show contour label checkbox work for contour plots

This commit is contained in:
Jon Jenssen
2020-11-04 15:21:17 +01:00
committed by Magne Sjaastad
parent a630f7710a
commit 6b3b76fc9d
3 changed files with 62 additions and 42 deletions

View File

@@ -127,8 +127,12 @@ void RivContourMapProjectionPartMgr::appendContourLinesToModel( const cvf::Camer
cvf::ScalarMapper* mapper = m_contourMapProjection->legendConfig()->scalarMapper();
std::vector<std::vector<cvf::BoundingBox>> labelBBoxes;
std::vector<cvf::ref<cvf::Drawable>> labelDrawables =
createContourLabels( camera, displayCoordTransform, &labelBBoxes );
std::vector<cvf::ref<cvf::Drawable>> labelDrawables;
if ( m_contourMapProjection->showContourLabels() )
{
labelDrawables = createContourLabels( camera, displayCoordTransform, &labelBBoxes );
}
std::vector<std::vector<cvf::ref<cvf::Drawable>>> contourDrawablesForAllLevels =
createContourPolygons( displayCoordTransform, labelBBoxes );
@@ -163,6 +167,9 @@ void RivContourMapProjectionPartMgr::appendContourLinesToModel( const cvf::Camer
}
}
}
if ( m_contourMapProjection->showContourLabels() )
{
for ( auto labelDrawableRef : labelDrawables )
{
cvf::ref<cvf::Part> part = new cvf::Part;
@@ -174,6 +181,7 @@ void RivContourMapProjectionPartMgr::appendContourLinesToModel( const cvf::Camer
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
@@ -295,6 +303,8 @@ std::vector<std::vector<cvf::ref<cvf::Drawable>>>
lineBBox.add( displayVertex2 );
bool addOriginalSegment = true;
if ( labelBBoxes.size() > 0 )
{
for ( const cvf::BoundingBox& existingBBox : labelBBoxes[i] )
{
if ( lineBBox.intersects( existingBBox ) )
@@ -340,6 +350,7 @@ std::vector<std::vector<cvf::ref<cvf::Drawable>>>
}
}
}
}
if ( addOriginalSegment )
{
displayLines.push_back( cvf::Vec3f( displayVertex1 ) );

View File

@@ -239,6 +239,14 @@ bool RimContourMapProjection::showContourLines() const
return m_showContourLines();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimContourMapProjection::showContourLabels() const
{
return m_showContourLabels();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -89,6 +89,7 @@ public:
double sampleSpacingFactor() const;
void setSampleSpacingFactor( double spacingFactor );
bool showContourLines() const;
bool showContourLabels() const;
QString resultAggregationText() const;