![]() |
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 TULIPVIEWSETTINGS_H 00021 #define TULIPVIEWSETTINGS_H 00022 00023 #include <tulip/tulipconf.h> 00024 #include <tulip/Color.h> 00025 #include <tulip/Size.h> 00026 #include <tulip/Graph.h> 00027 #include <tulip/Observable.h> 00028 00029 #include <string> 00030 00031 namespace tlp { 00032 00033 class TLP_SCOPE NodeShape { 00034 00035 public: 00036 00037 enum NodeShapes { 00038 Billboard=7, 00039 ChristmasTree=28, 00040 Circle=14, 00041 Cone=3, 00042 Cross=8, 00043 Cube=0, 00044 CubeOutlined=1, 00045 CubeOutlinedTransparent=9, 00046 Cylinder=6, 00047 Diamond=5, 00048 GlowSphere=16, 00049 HalfCylinder=10, 00050 Hexagon=13, 00051 Pentagon=12, 00052 Ring=15, 00053 RoundedBox=18, 00054 Sphere=2 , 00055 Square=4, 00056 Triangle=11, 00057 Window=17, 00058 Star=19 00059 }; 00060 }; 00061 00062 class TLP_SCOPE EdgeShape { 00063 00064 public: 00065 00066 enum EdgeShapes { 00067 Polyline=0, 00068 BezierCurve=4, 00069 CatmullRomCurve=8, 00070 CubicBSplineCurve=16 00071 }; 00072 }; 00073 00074 class TLP_SCOPE EdgeExtremityShape { 00075 00076 public: 00077 00078 enum EdgeExtremityShapes { 00079 None=-1, 00080 Arrow=50, 00081 Circle=14, 00082 Cone=3, 00083 Cross=8, 00084 Cube=0, 00085 CubeOutlinedTransparent=9, 00086 Cylinder=6, 00087 Diamond=5, 00088 GlowSphere=16, 00089 Hexagon=13, 00090 Pentagon=12, 00091 Ring=15, 00092 Sphere=2 , 00093 Square=4, 00094 Star=19 00095 }; 00096 }; 00097 00098 class TLP_SCOPE LabelPosition { 00099 00100 public: 00101 00102 enum LabelPositions { 00103 Center=0, 00104 Top, 00105 Bottom, 00106 Left, 00107 Right 00108 }; 00109 }; 00110 00111 class TLP_SCOPE TulipViewSettings : public Observable { 00112 00113 public: 00114 00115 static TulipViewSettings &instance(); 00116 00117 Color defaultColor(ElementType elem) const; 00118 void setDefaultColor(ElementType elem, const Color& color); 00119 00120 Color defaultBorderColor(ElementType elem) const; 00121 void setDefaultBorderColor(ElementType elem, const Color& color); 00122 00123 float defaultBorderWidth(ElementType elem) const; 00124 void setdefaultBorderWidth(ElementType elem, float borderWidth); 00125 00126 Color defaultLabelColor() const; 00127 void setDefaultLabelColor(const Color& color); 00128 00129 Color defaultLabelBorderColor() const; 00130 void setDefaultLabelBorderColor(const Color& color); 00131 00132 float defaultLabelBorderWidth() const; 00133 void setDefaultLabelBorderWidth(float borderWidth); 00134 00135 int defaultLabelPosition() const; 00136 void setDefaultLabelPosition(int position); 00137 00138 Size defaultSize(ElementType elem) const; 00139 void setDefaultSize(ElementType elem, const Size& size); 00140 00141 int defaultShape(ElementType elem) const; 00142 void setDefaultShape(ElementType elem, int shape); 00143 00144 int defaultEdgeExtremitySrcShape() const; 00145 void setDefaultEdgeExtremitySrcShape(int shape); 00146 00147 int defaultEdgeExtremityTgtShape() const; 00148 void setDefaultEdgeExtremityTgtShape(int shape); 00149 00150 Size defaultEdgeExtremitySrcSize() const; 00151 void setDefaultEdgeExtremitySrcSize(const Size &size); 00152 00153 Size defaultEdgeExtremityTgtSize() const; 00154 void setDefaultEdgeExtremityTgtSize(const Size &size); 00155 00156 std::string defaultFontFile() const; 00157 void setDefaultFontFile(const std::string &fontFile); 00158 00159 int defaultFontSize() const; 00160 void setDefaultFontSize(int fontSize); 00161 00162 private: 00163 00164 TulipViewSettings(); 00165 00166 static TulipViewSettings *_instance; 00167 00168 Color _defaultNodeColor; 00169 Color _defaultEdgeColor; 00170 Color _defaultNodeBorderColor; 00171 Color _defaultEdgeBorderColor; 00172 Color _defaultLabelColor; 00173 Color _defaultLabelBorderColor; 00174 00175 float _defaultNodeBorderWidth; 00176 float _defaultEdgeBorderWidth; 00177 float _defaultLabelBorderWidth; 00178 00179 int _defaultLabelPosition; 00180 00181 Size _defaultNodeSize; 00182 Size _defaultEdgeSize; 00183 00184 int _defaultNodeShape; 00185 int _defaultEdgeShape; 00186 int _defaultEdgeExtremitySrcShape; 00187 int _defaultEdgeExtremityTgtShape; 00188 00189 Size _defaultEdgeExtremitySrcSize; 00190 Size _defaultEdgeExtremityTgtSize; 00191 00192 std::string _defaultFontFile; 00193 int _defaultFontSize; 00194 }; 00195 00196 class TLP_SCOPE ViewSettingsEvent : public tlp::Event { 00197 00198 public: 00199 00200 enum ViewSettingsEventType { 00201 TLP_DEFAULT_COLOR_MODIFIED, 00202 TLP_DEFAULT_SHAPE_MODIFIED, 00203 TLP_DEFAULT_SIZE_MODIFIED, 00204 TLP_DEFAULT_LABEL_COLOR_MODIFIED 00205 }; 00206 00207 ViewSettingsEvent(ElementType elem, const Color &color) : 00208 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION), 00209 _type(TLP_DEFAULT_COLOR_MODIFIED), _elem(elem), _color(color) {} 00210 00211 ViewSettingsEvent(ElementType elem, const Size &size) : 00212 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION), 00213 _type(TLP_DEFAULT_SIZE_MODIFIED), _elem(elem), _size(size) {} 00214 00215 ViewSettingsEvent(ElementType elem, int shape) : 00216 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION), 00217 _type(TLP_DEFAULT_SHAPE_MODIFIED), _elem(elem), _shape(shape) {} 00218 00219 ViewSettingsEvent(const Color &labelColor) : 00220 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION), 00221 _type(TLP_DEFAULT_LABEL_COLOR_MODIFIED), _color(labelColor) {} 00222 00223 ViewSettingsEventType getType() const { 00224 return _type; 00225 } 00226 00227 ElementType getElementType() const { 00228 return _elem; 00229 } 00230 00231 Color getColor() const { 00232 return _color; 00233 } 00234 00235 Size getSize() const { 00236 return _size; 00237 } 00238 00239 int getShape() const { 00240 return _shape; 00241 } 00242 00243 private: 00244 00245 ViewSettingsEventType _type; 00246 ElementType _elem; 00247 Color _color; 00248 Size _size; 00249 int _shape; 00250 00251 }; 00252 00253 } 00254 00255 #endif // TULIPVIEWSETTINGS_H