From 3a7a8a260a4c0729e2b9942fcffa563d3a90c48c Mon Sep 17 00:00:00 2001
From: Zack Galbreath <zack.galbreath@kitware.com>
Date: Thu, 18 Apr 2013 15:37:36 -0400
Subject: [PATCH] better support for comparing identical trees

we now treat this as a special case to make sure that the difference
tree is visualized all in grey.

Change-Id: I3718a8e1989ffd7060a5bcce599e010941572dda
---
 Views/Infovis/vtkTreeHeatmapItem.cxx | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/Views/Infovis/vtkTreeHeatmapItem.cxx b/Views/Infovis/vtkTreeHeatmapItem.cxx
index 6604283d018..c0c6393a561 100644
--- a/Views/Infovis/vtkTreeHeatmapItem.cxx
+++ b/Views/Infovis/vtkTreeHeatmapItem.cxx
@@ -1398,8 +1398,11 @@ void vtkTreeHeatmapItem::SetTreeColorArray(const char *arrayName)
     return;
     }
 
+  this->ColorTree = true;
+
   double minDifference = VTK_DOUBLE_MAX;
   double maxDifference = VTK_DOUBLE_MIN;
+
   for (vtkIdType id = 0; id < this->TreeColorArray->GetNumberOfTuples(); ++id)
     {
     double d = this->TreeColorArray->GetValue(id);
@@ -1413,6 +1416,15 @@ void vtkTreeHeatmapItem::SetTreeColorArray(const char *arrayName)
       }
     }
 
+  // special case when there is no difference.  Without this, all the
+  // edges would be drawn in either red or blue.
+  if (minDifference == maxDifference)
+    {
+    this->TreeLookupTable->SetNumberOfTableValues(1);
+    this->TreeLookupTable->SetTableValue(10, 0.60, 0.60, 0.60);
+    return;
+    }
+
   // how much we vary the colors from step to step
   double inc = 0.06;
 
@@ -1439,8 +1451,6 @@ void vtkTreeHeatmapItem::SetTreeColorArray(const char *arrayName)
     this->TreeLookupTable->SetTableValue(i,
       0.85 - inc * (i - 10), 0.85 - inc * (i - 10), 1.0);
     }
-
-  this->ColorTree = true;
 }
 
 //-----------------------------------------------------------------------------
-- 
GitLab