CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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>

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.

Constructor & Destructor Documentation

FWColorManager::FWColorManager ( FWModelChangeManager iManager)

Definition at line 186 of file FWColorManager.cc.

References kFWMuonBarrelLineColorIndex, kFWMuonEndcapLineColorIndex, kFWPixelBarrelColorIndex, kFWPixelEndcapColorIndex, kFWTrackerBarrelColorIndex, kFWTrackerEndcapColorIndex, and m_geomColor.

186  :
187  m_gammaOff(0),
188  m_background(kBlack),
189  m_foreground(kWhite),
190  m_changeManager(iManager),
195 {
198 
201 
204 }
Char_t m_geomTransparency2D
FWModelChangeManager * m_changeManager
Char_t m_geomTransparency3D
Color_t m_numColorIndices
Color_t m_foreground
Color_t m_geomColor[kFWGeomColorSize]
Color_t m_startColorIndex
Color_t m_background
FWColorManager::~FWColorManager ( )
virtual

Definition at line 206 of file FWColorManager.cc.

207 {
208 }
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().

Color_t m_numColorIndices
Color_t m_startColorIndex
int FWColorManager::brightness ( )

Definition at line 263 of file FWColorManager.cc.

References m_gammaOff.

264 {
265  return TMath::FloorNint(-m_gammaOff*10);
266 }
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().

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

Definition at line 269 of file FWColorManager.cc.

References m_gammaOff, and updateColors().

270 {
271  m_gammaOff = 0;
272  updateColors();
273 }
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().

55 {return m_foreground;}
Color_t 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().

40 { return s_defaultStartColorIndex; }
static const Color_t s_defaultStartColorIndex
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.

215 {
216  // Save default ROOT colors.
217  TEveUtil::SetColorBrightness(0, kFALSE);
218 
221 
222  unsigned int index = m_startColorIndex;
223  //std::cout <<"start color index "<<m_startColorIndex<<std::endl;
224 
225  const float(* itEnd)[3] = s_forBlack+s_size;
226  for(const float(* it)[3] = s_forBlack;
227  it != itEnd;
228  ++it) {
229  //NOTE: this constructor automatically places this color into the gROOT color list
230  //std::cout <<" color "<< index <<" "<<(*it)[0]<<" "<<(*it)[1]<<" "<<(*it)[2]<<std::endl;
231  new TColor(index++,(*it)[0],(*it)[1],(*it)[2]);
232  }
233 }
static const unsigned int s_size
static const float s_forBlack[][3]
Color_t m_numColorIndices
static const Color_t s_defaultStartColorIndex
Color_t m_startColorIndex
Bool_t FWColorManager::isColorSetDark ( ) const
inline
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.

59 {return m_numColorIndices;}
Color_t m_numColorIndices
int FWColorManager::offsetOfLimitedColors ( ) const
inline

Definition at line 60 of file FWColorManager.h.

References m_startColorIndex.

60 {return m_startColorIndex;}
Color_t 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().

378 {
379  if (version < 3)
380  {
381  if(0==m_oldColorToIndexMap.get()) {
382  m_oldColorToIndexMap = boost::shared_ptr<std::map<Color_t,Color_t> >(new std::map<Color_t,Color_t>());
383  (*m_oldColorToIndexMap)[kRed]=kFWRed;
384  (*m_oldColorToIndexMap)[kBlue]=kFWBlue;
385  (*m_oldColorToIndexMap)[kYellow]=kFWYellow;
386  (*m_oldColorToIndexMap)[kGreen]=kFWGreen;
387  (*m_oldColorToIndexMap)[kCyan]=kFWCyan;
388  (*m_oldColorToIndexMap)[kTeal]=kFWCyan;
389  (*m_oldColorToIndexMap)[kMagenta]=kFWMagenta;
390  (*m_oldColorToIndexMap)[kViolet]=kFWMagenta;
391  (*m_oldColorToIndexMap)[kOrange]=kFWOrange;
392  (*m_oldColorToIndexMap)[3]=kFWGreen;
393 
394  }
395  return (*m_oldColorToIndexMap)[iColor];
396  }
397  else if (version == 3)
398  {
399  return iColor+ 1000;
400  }
401  else
402  {
403  const static unsigned int s_version45offset = 5;
404  return iColor < 1011 ? iColor : iColor + s_version45offset ;
405  }
406 }
static boost::shared_ptr< std::map< Color_t, Color_t > > m_oldColorToIndexMap
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().

298 {
299  m_gammaOff = -b*0.1f;
300  setBackgroundColorIndex(iIndex);
301 }
void setBackgroundColorIndex(BackgroundColorIndex)
double b
Definition: hdecay.h:120
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().

255 {
256  // Called from CmsShowBrightnessPopup slider where range is set
257  // to: -15, 15.
258  m_gammaOff = -b*0.1f;
259  updateColors();
260 }
double b
Definition: hdecay.h:120
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(), FWTrackHitsDetailView::setBackgroundColor(), and FWEveView::setBackgroundColor().

305 {
306  if ( (iColor == kBlackIndex && !v->IsColorSetDark()) ||
307  (iColor == kWhiteIndex && v->IsColorSetDark()) )
308  {
309  v->SwitchColorSet();
310  return kTRUE;
311  }
312  return kFALSE;
313 }
mathSSE::Vec4< T > v
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().

317 {
318  // printf("set geom color %d \n", iColor);
319  m_geomColor[idx] = iColor;
321  gEve->Redraw3D();
322 }
sigc::signal< void > geomColorsHaveChanged_
Color_t m_geomColor[kFWGeomColorSize]
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().

325 {
326  if (projectedType)
327  m_geomTransparency2D = iTransp;
328  else
329  m_geomTransparency3D = iTransp;
330 
331  geomTransparencyHaveChanged_.emit(projectedType);
332 
333  gEve->Redraw3D();
334 }
sigc::signal< void, bool > geomTransparencyHaveChanged_
Char_t m_geomTransparency2D
Char_t m_geomTransparency3D
void FWColorManager::switchBackground ( )
void FWColorManager::updateColors ( )
private

Definition at line 235 of file FWColorManager.cc.

References backgroundColorIndex(), colorsHaveChanged_, colorsHaveChangedFinished_, kBlackIndex, m_changeManager, m_gammaOff, m_startColorIndex, resetColors(), s_forBlack, s_forWhite, and s_size.

Referenced by defaultBrightness(), setBackgroundColorIndex(), and setBrightness().

236 {
238  {
240  TEveUtil::SetColorBrightness(1.666*m_gammaOff);
241  }
242  else
243  {
245  TEveUtil::SetColorBrightness(1.666*m_gammaOff - 2.5);
246  }
250 }
static void resetColors(const float(*iColors)[3], unsigned int iSize, unsigned int iStart, float gammaOff)
static const float s_forWhite[][3]
static const unsigned int s_size
FWModelChangeManager * m_changeManager
static const float s_forBlack[][3]
sigc::signal< void > colorsHaveChangedFinished_
BackgroundColorIndex backgroundColorIndex() const
Color_t m_startColorIndex
sigc::signal< void > colorsHaveChanged_

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
FWModelChangeManager* FWColorManager::m_changeManager
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().

Char_t FWColorManager::m_geomTransparency2D
private

Definition at line 120 of file FWColorManager.h.

Referenced by geomTransparency(), and setGeomTransparency().

Char_t FWColorManager::m_geomTransparency3D
private

Definition at line 121 of file FWColorManager.h.

Referenced by geomTransparency(), and setGeomTransparency().

Color_t FWColorManager::m_numColorIndices
private
Color_t FWColorManager::m_startColorIndex
private
const Color_t FWColorManager::s_defaultStartColorIndex = 1000
staticprivate

Definition at line 123 of file FWColorManager.h.

Referenced by getDefaultStartColorIndex(), and initialize().