Tulip  4.6.0
Better Visualization Through Research
library/tulip-gui/include/tulip/CaptionItem.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 ///@cond DOXYGEN_HIDDEN
00020 
00021 #ifndef CAPTIONITEM_H
00022 #define CAPTIONITEM_H
00023 
00024 #include <QObject>
00025 
00026 #include <tulip/Color.h>
00027 #include <tulip/Observable.h>
00028 
00029 class QGradient;
00030 
00031 namespace tlp {
00032 
00033 class View;
00034 class CaptionGraphicsBackgroundItem;
00035 class CaptionGraphicsItem;
00036 class Graph;
00037 class ColorProperty;
00038 class DoubleProperty;
00039 class SizeProperty;
00040 
00041 class CaptionItem : public QObject, public Observable {
00042 
00043   Q_OBJECT
00044 
00045 public:
00046 
00047   enum CaptionType {
00048     NodesColorCaption=1,
00049     NodesSizeCaption=2,
00050     EdgesColorCaption=3,
00051     EdgesSizeCaption=4
00052   };
00053 
00054   CaptionItem(View *view);
00055   ~CaptionItem();
00056 
00057   void create(CaptionType captionType);
00058 
00059   void initCaption();
00060 
00061   void generateColorCaption(CaptionType captionType);
00062 
00063   void generateSizeCaption(CaptionType captionType);
00064 
00065   CaptionGraphicsBackgroundItem *captionGraphicsItem();
00066 
00067   void treatEvents(const std::vector<Event> &ev);
00068 
00069 signals :
00070 
00071   void filtering(bool);
00072 
00073 public slots :
00074 
00075   void removeObservation(bool);
00076 
00077   void applyNewFilter(float begin,float end);
00078   void selectedPropertyChanged(std::string propertyName);
00079 
00080 private :
00081 
00082   void clearObservers();
00083 
00084   void generateGradients(const std::vector<std::pair <double,Color> > &metricToColorFiltered, QGradient &activeGradient, QGradient &hideGradient);
00085 
00086   View *view;
00087 
00088   CaptionType _captionType;
00089   CaptionGraphicsItem *_captionGraphicsItem;
00090 
00091   Graph *_graph;
00092   DoubleProperty *_metricProperty;
00093   ColorProperty *_colorProperty;
00094   SizeProperty *_sizeProperty;
00095   ColorProperty *_backupColorProperty;
00096   ColorProperty *_backupBorderColorProperty;
00097 };
00098 
00099 }
00100 
00101 #endif // CAPTIONITEM_H
00102 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties