Tulip
4.6.0
Better Visualization Through Research
|
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 00020 #ifndef TULIP_SIZES_H 00021 #define TULIP_SIZES_H 00022 00023 #include <tulip/tuliphash.h> 00024 #include <tulip/PropertyTypes.h> 00025 #include <tulip/AbstractProperty.h> 00026 #include <tulip/PropertyAlgorithm.h> 00027 00028 namespace tlp { 00029 00030 class PropertyContext; 00031 00032 typedef AbstractProperty<tlp::SizeType, tlp::SizeType> AbstractSizeProperty; 00033 00034 /** 00035 * @ingroup Graph 00036 * @brief A graph property that maps a tlp::Size value to graph elements. 00037 */ 00038 class TLP_SCOPE SizeProperty:public AbstractSizeProperty { 00039 00040 public : 00041 SizeProperty (Graph *, const std::string& n=""); 00042 00043 Size getMax(Graph *sg=NULL); 00044 Size getMin(Graph *sg=NULL); 00045 void scale( const tlp::Vector<float,3>&, Graph *sg=NULL ); 00046 void scale( const tlp::Vector<float,3>&, Iterator<node> *, Iterator<edge> *); 00047 00048 // redefinition of some PropertyInterface methods 00049 PropertyInterface* clonePrototype(Graph *, const std::string& ); 00050 static const std::string propertyTypename; 00051 const std::string& getTypename() const { 00052 return propertyTypename; 00053 } 00054 00055 00056 // redefinition of some AbstractProperty methods 00057 virtual void setNodeValue(const node n, const Size &v); 00058 virtual void setAllNodeValue(const Size &v); 00059 00060 int compare(const node n1, const node n2)const; 00061 00062 protected: 00063 void resetMinMax(); 00064 00065 private: 00066 TLP_HASH_MAP<unsigned int, Size> max,min; 00067 TLP_HASH_MAP<unsigned int, bool> minMaxOk; 00068 void computeMinMax(Graph * sg=NULL); 00069 }; 00070 00071 /** 00072 * @ingroup Graph 00073 * @brief A graph property that maps a std::vector<tlp::Size> value to graph elements. 00074 */ 00075 class TLP_SCOPE SizeVectorProperty:public AbstractVectorProperty<tlp::SizeVectorType, tlp::SizeType> { 00076 public : 00077 SizeVectorProperty(Graph *g, const std::string& n=""):AbstractVectorProperty<SizeVectorType, SizeType>(g, n) {} 00078 00079 // redefinition of some PropertyInterface methods 00080 PropertyInterface* clonePrototype(Graph *, const std::string& ); 00081 static const std::string propertyTypename; 00082 const std::string& getTypename() const { 00083 return propertyTypename; 00084 } 00085 00086 }; 00087 00088 00089 } 00090 #endif