ENH: correct histogram color for 1 band display
authorEmmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Fri Jun 26 10:25:54 2009 +0800 (14 months ago)
changeset 1491553599cad543
parent 1490 3f2e0513da29
child 1492 7061e2cbda26
ENH: correct histogram color for 1 band display
ViewerManager/View/otbImageViewerManagerViewGUI.cxx
ViewerManager/View/otbImageViewerManagerViewGUI.h
     1.1 --- a/ViewerManager/View/otbImageViewerManagerViewGUI.cxx	Fri Jun 26 10:11:26 2009 +0800
     1.2 +++ b/ViewerManager/View/otbImageViewerManagerViewGUI.cxx	Fri Jun 26 10:25:54 2009 +0800
     1.3 @@ -64,6 +64,7 @@
     1.4    m_Red.Fill(0);
     1.5    m_Green.Fill(0);
     1.6    m_Blue.Fill(0);
     1.7 +  m_Grey.Fill(0.5);
     1.8    m_Red[0]  = 1.;   m_Red[3]   = 0.5;
     1.9    m_Green[1]= 1.;   m_Green[3] = 0.5;
    1.10    m_Blue[2] = 1.;   m_Blue[3]  = 0.5;
    1.11 @@ -437,33 +438,41 @@
    1.12     //First get the histogram list
    1.13     RenderingFunctionType::Pointer pRenderingFuntion = m_ImageViewerManagerModel->GetObjectList().at(selectedItem-1).pRenderFuntion;
    1.14  
    1.15 -   HistogramCurveType::Pointer rhistogram = HistogramCurveType::New();
    1.16 -   HistogramCurveType::Pointer ghistogram = HistogramCurveType::New();
    1.17 -   HistogramCurveType::Pointer bhistogram = HistogramCurveType::New();
    1.18  
    1.19  
    1.20 -   ghistogram->SetHistogramColor(m_Green);
    1.21 -   ghistogram->SetLabelColor(m_Green);
    1.22 -   bhistogram->SetHistogramColor(m_Blue);
    1.23 -   bhistogram->SetLabelColor(m_Blue);
    1.24 -   rhistogram->SetHistogramColor(m_Red);
    1.25 -   rhistogram->SetLabelColor(m_Red);
    1.26 +
    1.27  
    1.28     curveWidget->ClearAllCurves();
    1.29  
    1.30     if (pRenderingFuntion->GetPixelRepresentationSize() >=3)
    1.31     {
    1.32 +     HistogramCurveType::Pointer bhistogram = HistogramCurveType::New();
    1.33 +     bhistogram->SetHistogramColor(m_Blue);
    1.34 +     bhistogram->SetLabelColor(m_Blue);
    1.35       bhistogram->SetHistogram(m_ImageViewerManagerModel->GetObjectList().at(selectedItem-1).pLayer->GetHistogramList()->GetNthElement(2));
    1.36       curveWidget->AddCurve(bhistogram);
    1.37     }
    1.38  
    1.39     if (pRenderingFuntion->GetPixelRepresentationSize() >=2)
    1.40     {
    1.41 +     HistogramCurveType::Pointer ghistogram = HistogramCurveType::New();
    1.42 +     ghistogram->SetHistogramColor(m_Green);
    1.43 +     ghistogram->SetLabelColor(m_Green);
    1.44       ghistogram->SetHistogram(m_ImageViewerManagerModel->GetObjectList().at(selectedItem-1).pLayer->GetHistogramList()->GetNthElement(1));
    1.45       curveWidget->AddCurve(ghistogram);
    1.46     }
    1.47  
    1.48 -
    1.49 +   HistogramCurveType::Pointer rhistogram = HistogramCurveType::New();
    1.50 +   if (pRenderingFuntion->GetPixelRepresentationSize() == 1)
    1.51 +   {
    1.52 +     rhistogram->SetHistogramColor(m_Grey);
    1.53 +     rhistogram->SetLabelColor(m_Grey);
    1.54 +   }
    1.55 +   else
    1.56 +   {
    1.57 +     rhistogram->SetHistogramColor(m_Red);
    1.58 +     rhistogram->SetLabelColor(m_Red);
    1.59 +   }
    1.60     rhistogram->SetHistogram(m_ImageViewerManagerModel->GetObjectList().at(selectedItem-1).pLayer->GetHistogramList()->GetNthElement(0));
    1.61     curveWidget->AddCurve(rhistogram);
    1.62  
     2.1 --- a/ViewerManager/View/otbImageViewerManagerViewGUI.h	Fri Jun 26 10:11:26 2009 +0800
     2.2 +++ b/ViewerManager/View/otbImageViewerManagerViewGUI.h	Fri Jun 26 10:25:54 2009 +0800
     2.3 @@ -229,6 +229,7 @@
     2.4    HistogramCurveType::ColorType                 m_Red;
     2.5    HistogramCurveType::ColorType                 m_Green;
     2.6    HistogramCurveType::ColorType                 m_Blue;
     2.7 +  HistogramCurveType::ColorType                 m_Grey;
     2.8  
     2.9    /** Store the component number of a pixel*/
    2.10    unsigned int                                  m_DiaporamaCurrentIndex;