Tulip  4.6.0
Better Visualization Through Research
library/tulip-gui/include/tulip/GraphPropertiesSelectionWidget.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 
00022 #ifndef GRAPHPROPERTYSELECTIONWIDGET_H_
00023 #define GRAPHPROPERTYSELECTIONWIDGET_H_
00024 
00025 #include "StringsListSelectionWidget.h"
00026 
00027 namespace tlp {
00028 
00029 class Graph;
00030 /** \brief A widget which allows the user to select a subset of graph properties
00031  *
00032  *  This widget allows the user to select a subset of graph properties. The properties
00033  *  to select can be filtered according to their datatypes.
00034  */
00035 class TLP_QT_SCOPE GraphPropertiesSelectionWidget : public StringsListSelectionWidget {
00036 
00037 public :
00038 
00039   /**
00040    * Default Constructor (usefull for qt designer)
00041    */
00042   GraphPropertiesSelectionWidget(QWidget *parent = NULL, const StringsListSelectionWidget::ListType &listType = StringsListSelectionWidget::SIMPLE_LIST,
00043                                  const unsigned int maxNbSelectedProperties = 0);
00044 
00045   /**
00046    *  Constructor which creates a GraphPropertiesSelectionWidget for a given graph
00047    *
00048    *  \param graph The graph on which we want to select properties
00049    *  \param propertiesType To select properties with particular datatypes, fill a vector of string with the wanted datatypes name and passed it as parameter of this constructor. The datatypes name must be the same as those returned by the getTypename method of the PropertyInterface class (e.g. "int", "double", "string"). If the vector is empty, there is no restriction on property datatypes.
00050    *  \param includeViewProperties If true, the view properties (e.g. "viewLabel", "viewMetric") will be selectable
00051    */
00052   GraphPropertiesSelectionWidget(Graph *graph, QWidget *parent = NULL, const StringsListSelectionWidget::ListType &listType = StringsListSelectionWidget::SIMPLE_LIST,
00053                                  const unsigned int maxNbSelectedProperties = 0, const std::vector<std::string> &propertiesTypes = std::vector<std::string>(),
00054                                  const bool includeViewProperties = false);
00055 
00056   /**
00057    * Method to set the widget parameters
00058    *
00059    * \param graph The graph on which we want to select properties
00060    * \param propertiesType To select properties with particular datatypes, fill a vector of string with the wanted datatypes name and passed it as parameter of this constructor. The datatypes name must be the same as those returned by the getTypename method of the PropertyInterface class (e.g. "int", "double", "string"). If the vector is empty, there is no restriction on property datatypes.
00061    * \param includeViewProperties If true, the view properties (e.g. "viewLabel", "viewMetric") will be selectable
00062    */
00063   void setWidgetParameters(Graph *graph, const std::vector<std::string> &propertiesTypes = std::vector<std::string>(), const bool includeViewProperties = false);
00064 
00065   /**
00066    * Method to set the input graph properties list
00067    * If there is datatypes restriction, the types of properties are checked before inserting them in the input list
00068    * \param inputPropertiesList A vector containing input properties names
00069    */
00070   void setInputPropertiesList(std::vector<std::string> &inputPropertiesList);
00071 
00072   /**
00073    * Method to set the output graph properties list
00074    * If there is datatypes restriction, the types of properties are checked before inserting them in the output list
00075    * \param outputPropertiesList A vector containing output properties names
00076    */
00077   void setOutputPropertiesList(std::vector<std::string> &outputPropertiesList);
00078 
00079   /**
00080    * Method which returns the names of the graph properties selected by the user
00081    */
00082   std::vector<std::string> getSelectedProperties() const;
00083 
00084 
00085   /**
00086    *  Method which clears the content of the input list and the output list
00087    */
00088   void clearLists();
00089 
00090 private :
00091 
00092   void initWidget();
00093   bool propertySelectable(const std::string &propertyName);
00094 
00095   Graph *graph;
00096   std::vector<std::string> propertiesTypes;
00097   bool includeViewProperties;
00098 
00099 };
00100 
00101 }
00102 
00103 #endif /* GRAPHPROPERTYSELECTIONWIDGET_H_ */
00104 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties