CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes

FWColorManager Class Reference

#include <Fireworks/Core/interface/FWColorManager.h>

List of all members.

Public Types

enum  BackgroundColorIndex { kWhiteIndex = kWhite, kBlackIndex = kBlack }

Public Member Functions

Color_t background () const
BackgroundColorIndex backgroundColorIndex () const
int borderOfLimitedColors () const
int brightness ()
bool colorHasIndex (Color_t) const
void defaultBrightness ()
void fillLimitedColors (std::vector< Color_t > &cv) const
Color_t foreground () const
 FWColorManager (FWModelChangeManager *)
Color_t geomColor (FWGeomColorIndex) const
Color_t geomTransparency (bool projected) const
void initialize ()
Bool_t isColorSetDark () const
Bool_t isColorSetLight () const
int numberOfLimitedColors () const
int offsetOfLimitedColors () const
Color_t oldColorToIndex (Color_t, int version) const
void setBackgroundAndBrightness (BackgroundColorIndex, int)
void setBackgroundColorIndex (BackgroundColorIndex)
void setBrightness (int)
void setGeomColor (FWGeomColorIndex, Color_t)
void setGeomTransparency (Color_t idx, bool projectedType)
void switchBackground ()
virtual ~FWColorManager ()

Static Public Member Functions

static Color_t getDefaultStartColorIndex ()
static Bool_t setColorSetViewer (TGLViewer *, Color_t)

Public Attributes

sigc::signal< void > colorsHaveChanged_
sigc::signal< void > colorsHaveChangedFinished_
sigc::signal< void > geomColorsHaveChanged_
sigc::signal< void, bool > geomTransparencyHaveChanged_

Private Member Functions

 FWColorManager (const FWColorManager &)
const FWColorManageroperator= (const FWColorManager &)
void updateColors ()

Private Attributes

Color_t m_background
FWModelChangeManagerm_changeManager
Color_t m_foreground
Float_t m_gammaOff
Color_t m_geomColor [kFWGeomColorSize]
Char_t m_geomTransparency2D
Char_t m_geomTransparency3D
Color_t m_numColorIndices
Color_t m_startColorIndex

Static Private Attributes

static const Color_t s_defaultStartColorIndex = 1000

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 45 of file FWColorManager.h.


Member Enumeration Documentation

Enumerator:
kWhiteIndex 
kBlackIndex 

Definition at line 72 of file FWColorManager.h.

{ kWhiteIndex = kWhite, kBlackIndex = kBlack };

Constructor & Destructor Documentation

FWColorManager::FWColorManager ( FWModelChangeManager iManager)
FWColorManager::~FWColorManager ( ) [virtual]

Definition at line 206 of file FWColorManager.cc.

{
}
FWColorManager::FWColorManager ( const FWColorManager ) [private]

Member Function Documentation

Color_t FWColorManager::background ( ) const [inline]
FWColorManager::BackgroundColorIndex FWColorManager::backgroundColorIndex ( ) const
int FWColorManager::borderOfLimitedColors ( ) const [inline]

Definition at line 61 of file FWColorManager.h.

References m_numColorIndices, and m_startColorIndex.

Referenced by fillLimitedColors().

int FWColorManager::brightness ( )

Definition at line 263 of file FWColorManager.cc.

References m_gammaOff.

{
  return TMath::FloorNint(-m_gammaOff*10);
}
bool FWColorManager::colorHasIndex ( Color_t  iColor) const

Definition at line 361 of file FWColorManager.cc.

References m_numColorIndices, and m_startColorIndex.

Referenced by FWEventItemsManager::add().

{
   return iColor > 0 && iColor < m_startColorIndex + m_numColorIndices;
}
void FWColorManager::defaultBrightness ( )

Definition at line 269 of file FWColorManager.cc.

References m_gammaOff, and updateColors().

void FWColorManager::fillLimitedColors ( std::vector< Color_t > &  cv) const
Color_t FWColorManager::foreground ( ) const [inline]

Definition at line 55 of file FWColorManager.h.

References m_foreground.

Referenced by FWTableView::resetColors().

{return m_foreground;}
Color_t FWColorManager::geomColor ( FWGeomColorIndex  iIndex) const
Color_t FWColorManager::geomTransparency ( bool  projected) const [inline]
Color_t FWColorManager::getDefaultStartColorIndex ( ) [static]

Definition at line 40 of file FWColorManager.cc.

References s_defaultStartColorIndex.

Referenced by FWEventItemsManager::add().

void FWColorManager::initialize ( )

Definition at line 214 of file FWColorManager.cc.

References getHLTprescales::index, m_numColorIndices, m_startColorIndex, s_defaultStartColorIndex, s_forBlack, and s_size.

{
  // Save default ROOT colors.
  TEveUtil::SetColorBrightness(0, kFALSE);

  m_startColorIndex = s_defaultStartColorIndex;
  m_numColorIndices = s_size;

  unsigned int index = m_startColorIndex;
  //std::cout <<"start color index "<<m_startColorIndex<<std::endl;
   
  const float(* itEnd)[3] = s_forBlack+s_size;
  for(const float(* it)[3] = s_forBlack;
      it != itEnd;
      ++it) {
    //NOTE: this constructor automatically places this color into the gROOT color list
    //std::cout <<" color "<< index <<" "<<(*it)[0]<<" "<<(*it)[1]<<" "<<(*it)[2]<<std::endl;
    new TColor(index++,(*it)[0],(*it)[1],(*it)[2]);
  }
}
Bool_t FWColorManager::isColorSetDark ( ) const [inline]

Definition at line 56 of file FWColorManager.h.

References kBlackIndex, and m_background.

Referenced by FWEveLegoView::setContext(), and switchBackground().

Bool_t FWColorManager::isColorSetLight ( ) const [inline]

Definition at line 57 of file FWColorManager.h.

References kWhiteIndex, and m_background.

Referenced by FWSummaryManager::colorsChanged().

int FWColorManager::numberOfLimitedColors ( ) const [inline]

Definition at line 59 of file FWColorManager.h.

References m_numColorIndices.

int FWColorManager::offsetOfLimitedColors ( ) const [inline]

Definition at line 60 of file FWColorManager.h.

References m_startColorIndex.

Color_t FWColorManager::oldColorToIndex ( Color_t  iColor,
int  version 
) const

Definition at line 377 of file FWColorManager.cc.

References kFWBlue, kFWCyan, kFWGreen, kFWMagenta, kFWOrange, kFWRed, and kFWYellow.

Referenced by FWEventItemsManager::setFrom().

{
   if (version < 3)
   {
      if(0==m_oldColorToIndexMap.get()) {
         m_oldColorToIndexMap = boost::shared_ptr<std::map<Color_t,Color_t> >(new std::map<Color_t,Color_t>());
         (*m_oldColorToIndexMap)[kRed]=kFWRed;
         (*m_oldColorToIndexMap)[kBlue]=kFWBlue;
         (*m_oldColorToIndexMap)[kYellow]=kFWYellow;
         (*m_oldColorToIndexMap)[kGreen]=kFWGreen;
         (*m_oldColorToIndexMap)[kCyan]=kFWCyan;
         (*m_oldColorToIndexMap)[kTeal]=kFWCyan;
         (*m_oldColorToIndexMap)[kMagenta]=kFWMagenta;
         (*m_oldColorToIndexMap)[kViolet]=kFWMagenta;
         (*m_oldColorToIndexMap)[kOrange]=kFWOrange;
         (*m_oldColorToIndexMap)[3]=kFWGreen;
      
      }
      return (*m_oldColorToIndexMap)[iColor];
   }
   else if (version == 3)
   {
      return iColor+ 1000;
   }
   else
   {
      static unsigned int s_version45offset = 5;
      return iColor < 1011 ? iColor : iColor + s_version45offset ;
   }
}
const FWColorManager& FWColorManager::operator= ( const FWColorManager ) [private]
void FWColorManager::setBackgroundAndBrightness ( BackgroundColorIndex  iIndex,
int  b 
)

Definition at line 297 of file FWColorManager.cc.

References m_gammaOff, and setBackgroundColorIndex().

Referenced by CmsShowCommon::setFrom().

{
   m_gammaOff = -b*0.1f;
   setBackgroundColorIndex(iIndex);
}
void FWColorManager::setBackgroundColorIndex ( BackgroundColorIndex  iIndex)
void FWColorManager::setBrightness ( int  b)

Definition at line 254 of file FWColorManager.cc.

References m_gammaOff, and updateColors().

Referenced by CmsShowCommon::setGamma().

{
   // Called from CmsShowBrightnessPopup slider where range is set
   // to: -15, 15.
   m_gammaOff = -b*0.1f;
   updateColors();
}
Bool_t FWColorManager::setColorSetViewer ( TGLViewer *  v,
Color_t  iColor 
) [static]

Definition at line 304 of file FWColorManager.cc.

References kBlackIndex, and kWhiteIndex.

Referenced by FWEveViewManager::finishViewCreate(), FWEveView::setBackgroundColor(), FWConvTrackHitsDetailView::setBackgroundColor(), and FWTrackHitsDetailView::setBackgroundColor().

{
  if ( (iColor == kBlackIndex && !v->IsColorSetDark()) ||
       (iColor == kWhiteIndex && v->IsColorSetDark()) )
   { 
      v->SwitchColorSet();
      return kTRUE;
   }
   return kFALSE;
}
void FWColorManager::setGeomColor ( FWGeomColorIndex  idx,
Color_t  iColor 
)

Definition at line 316 of file FWColorManager.cc.

References geomColorsHaveChanged_, and m_geomColor.

Referenced by CmsShowCommon::setFrom(), and CmsShowCommon::setGeomColor().

{
   // printf("set geom color %d \n", iColor);
   m_geomColor[idx] = iColor;
   geomColorsHaveChanged_();
   gEve->Redraw3D();
}
void FWColorManager::setGeomTransparency ( Color_t  idx,
bool  projectedType 
)

Definition at line 324 of file FWColorManager.cc.

References geomTransparencyHaveChanged_, m_geomTransparency2D, and m_geomTransparency3D.

Referenced by FW3DViewBase::setFrom(), CmsShowCommon::setFrom(), and CmsShowCommon::setGeomTransparency().

{
   if (projectedType)
      m_geomTransparency2D = iTransp;
   else
      m_geomTransparency3D = iTransp;

   geomTransparencyHaveChanged_.emit(projectedType);

   gEve->Redraw3D();
}
void FWColorManager::switchBackground ( )
void FWColorManager::updateColors ( ) [private]

Member Data Documentation

sigc::signal<void> FWColorManager::colorsHaveChanged_ [mutable]
sigc::signal<void> FWColorManager::colorsHaveChangedFinished_ [mutable]

Definition at line 100 of file FWColorManager.h.

Referenced by FWGUIManager::FWGUIManager(), and updateColors().

sigc::signal<void> FWColorManager::geomColorsHaveChanged_ [mutable]

Definition at line 96 of file FWColorManager.h.

Referenced by FWViewGeometryList::FWViewGeometryList(), and setGeomColor().

sigc::signal<void, bool> FWColorManager::geomTransparencyHaveChanged_ [mutable]

Definition at line 97 of file FWColorManager.h.

Referenced by FWViewGeometryList::FWViewGeometryList(), and setGeomTransparency().

Color_t FWColorManager::m_background [private]

Definition at line 114 of file FWColorManager.h.

Referenced by updateColors().

Color_t FWColorManager::m_foreground [private]

Definition at line 113 of file FWColorManager.h.

Referenced by foreground(), and setBackgroundColorIndex().

Float_t FWColorManager::m_gammaOff [private]
Color_t FWColorManager::m_geomColor[kFWGeomColorSize] [private]

Definition at line 119 of file FWColorManager.h.

Referenced by FWColorManager(), geomColor(), and setGeomColor().

Definition at line 120 of file FWColorManager.h.

Referenced by geomTransparency(), and setGeomTransparency().

Definition at line 121 of file FWColorManager.h.

Referenced by geomTransparency(), and setGeomTransparency().

const Color_t FWColorManager::s_defaultStartColorIndex = 1000 [static, private]

Definition at line 123 of file FWColorManager.h.

Referenced by getDefaultStartColorIndex(), and initialize().