SoFCColorGradient.h
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 #ifndef GUI_SOFCCOLORGRADIENT_H
00025 #define GUI_SOFCCOLORGRADIENT_H
00026 
00027 #include <Inventor/nodes/SoSeparator.h>
00028 #include "SoFCColorBar.h"
00029 #include <App/ColorModel.h>
00030 #include <vector>
00031 
00032 class SoCoordinate3;
00033 class SoMFString;
00034 class SbVec2s;
00035 
00036 namespace Gui {
00037 
00038 class GuiExport SoFCColorGradient : public SoFCColorBarBase {
00039   typedef SoFCColorBarBase inherited;
00040 
00041   SO_NODE_HEADER(Gui::SoFCColorGradient);
00042 
00043 public:
00044   static void initClass(void);
00045   static void finish(void);
00046   SoFCColorGradient(void);
00047 
00052   void setRange( float fMin, float fMax, int prec=3 );
00056   App::Color getColor (float fVal) const { return _cColGrad.getColor(fVal); }
00057   void setOutsideGrayed (bool bVal) { _cColGrad.setOutsideGrayed(bVal); }
00063   bool isVisible (float fVal) const;
00065   float getMinValue (void) const { return _cColGrad.getMinValue(); }
00067   float getMaxValue (void) const { return _cColGrad.getMaxValue(); }
00072   bool customize();
00074   const char* getColorBarName() const { return "Color Gradient"; }
00075 
00076 protected:
00080   void setViewportSize( const SbVec2s& size );
00081 
00082   virtual ~SoFCColorGradient();
00087   void setColorModel (App::ColorGradient::TColorModel tModel);
00092   void setColorStyle (App::ColorGradient::TStyle tStyle);
00094   void rebuildGradient();
00096   std::vector<float> getMarkerValues(float fMin, float fMax, int count) const;
00097 
00098 private:
00100   void setMarkerLabel( const SoMFString& label );
00101 
00102 private:
00103   SoCoordinate3* coords;
00104   SoSeparator* labels;
00105   float _fMaxX, _fMinX, _fMaxY, _fMinY;
00106   bool  _bOutInvisible;
00107   int _precision;
00108   App::ColorGradient _cColGrad;
00109 };
00110 
00111 } 
00112 
00113 
00114 #endif // GUI_SOFCCOLORGRADIENT_H
00115