Grid Box Generator : Improve robustness for invalid bounding box

This commit is contained in:
Magne Sjaastad
2018-06-29 16:42:18 +02:00
parent a90755c899
commit 9b302d15a3

View File

@@ -69,7 +69,7 @@ void RivGridBoxGenerator::setDisplayModelOffset(cvf::Vec3d offset)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivGridBoxGenerator::setGridBoxDomainCoordBoundingBox(const cvf::BoundingBox& bb)
void RivGridBoxGenerator::setGridBoxDomainCoordBoundingBox(const cvf::BoundingBox& incomingBB)
{
double expandFactor = 0.05;
@@ -77,6 +77,16 @@ void RivGridBoxGenerator::setGridBoxDomainCoordBoundingBox(const cvf::BoundingBo
// Expand the range for ScalarMapperDiscreteLinear until the geometry bounding box has a generated tick mark coords
// both below minimum and above maximum bounding box coords
cvf::BoundingBox bb;
if (incomingBB.isValid())
{
bb = incomingBB;
}
else
{
bb.add(cvf::Vec3d::ZERO);
}
cvf::Vec3d min = bb.min();
cvf::Vec3d max = bb.max();