SoFCColorGradient.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2005 Werner Mayer <wmayer[at]users.sourceforge.net>     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
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 } // namespace Gui
00112 
00113 
00114 #endif // GUI_SOFCCOLORGRADIENT_H
00115 

Generated on Wed Nov 23 19:00:39 2011 for FreeCAD by  doxygen 1.6.1