Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ClusterGraphAttributes.h
Go to the documentation of this file.
1 
35 #pragma once
36 
39 
40 namespace ogdf {
41 
43 
47 protected:
49 
58 
59 public:
65  static const long clusterGraphics;
68 
72  static const long clusterStyle;
73 
75  static const long clusterLabel;
76 
78  static const long clusterTemplate;
79 
81  static const long all;
82 
84 
85  // Don't hide these inherited methods by overloading.
88  using GraphAttributes::x;
89  using GraphAttributes::y;
90 
92 
96 
100 
106  ClusterGraphAttributes() : GraphAttributes(), m_pClusterGraph(nullptr) { }
108 
110  explicit ClusterGraphAttributes(const ClusterGraph& cg,
111  long initAttributes = nodeGraphics | edgeGraphics | clusterGraphics);
112 
113 private:
115  using GraphAttributes::init;
116 
118 
121  void addClusterAttributes(long attr);
122 
124 
127  void destroyClusterAttributes(long attr);
128 
129 public:
131 
138  void init(ClusterGraph& cg, long attr = 0);
139 
142  void init(long attr = 0);
143 
145  void addAttributes(long attr);
146 
148  void destroyAttributes(long attr);
149 
151  const ClusterGraph& constClusterGraph() const { return *m_pClusterGraph; }
152 
159 
163  double x(cluster c) const {
164  OGDF_ASSERT(has(clusterGraphics));
165  return m_x[c];
166  }
167 
169 
172  double& x(cluster c) {
173  OGDF_ASSERT(has(clusterGraphics));
174  return m_x[c];
175  }
176 
178 
181  double y(cluster c) const {
182  OGDF_ASSERT(has(clusterGraphics));
183  return m_y[c];
184  }
185 
187 
190  double& y(cluster c) {
191  OGDF_ASSERT(has(clusterGraphics));
192  return m_y[c];
193  }
194 
196 
199  double width(cluster c) const {
200  OGDF_ASSERT(has(clusterGraphics));
201  return m_width[c];
202  }
203 
205 
208  double& width(cluster c) {
209  OGDF_ASSERT(has(clusterGraphics));
210  return m_width[c];
211  }
212 
214 
217  double height(cluster c) const {
218  OGDF_ASSERT(has(clusterGraphics));
219  return m_height[c];
220  }
221 
223 
226  double& height(cluster c) {
227  OGDF_ASSERT(has(clusterGraphics));
228  return m_height[c];
229  }
230 
232 
235  const StrokeType& strokeType(cluster c) const {
236  OGDF_ASSERT(has(clusterStyle));
237  return m_stroke[c].m_type;
238  }
239 
241 
245  OGDF_ASSERT(has(clusterStyle));
246  return m_stroke[c].m_type;
247  }
248 
250 
253  const Color& strokeColor(cluster c) const {
254  OGDF_ASSERT(has(clusterStyle));
255  return m_stroke[c].m_color;
256  }
257 
259 
263  OGDF_ASSERT(has(clusterStyle));
264  return m_stroke[c].m_color;
265  }
266 
268 
271  const float& strokeWidth(cluster c) const {
272  OGDF_ASSERT(has(clusterStyle));
273  return m_stroke[c].m_width;
274  }
275 
277 
280  float& strokeWidth(cluster c) {
281  OGDF_ASSERT(has(clusterStyle));
282  return m_stroke[c].m_width;
283  }
284 
286 
289  const FillPattern& fillPattern(cluster c) const {
290  OGDF_ASSERT(has(clusterStyle));
291  return m_fill[c].m_pattern;
292  }
293 
295 
299  OGDF_ASSERT(has(clusterStyle));
300  return m_fill[c].m_pattern;
301  }
302 
304 
307  const Color& fillColor(cluster c) const {
308  OGDF_ASSERT(has(clusterStyle));
309  return m_fill[c].m_color;
310  }
311 
313 
317  OGDF_ASSERT(has(clusterStyle));
318  return m_fill[c].m_color;
319  }
320 
322 
325  const Color& fillBgColor(cluster c) const {
326  OGDF_ASSERT(has(clusterStyle));
327  return m_fill[c].m_bgColor;
328  }
329 
331 
335  OGDF_ASSERT(has(clusterStyle));
336  return m_fill[c].m_bgColor;
337  }
338 
340 
343  const string& label(cluster c) const {
344  OGDF_ASSERT(has(clusterLabel));
345  return m_label[c];
346  }
347 
349 
352  string& label(cluster c) {
353  OGDF_ASSERT(has(clusterLabel));
354  return m_label[c];
355  }
356 
358 
361  const string& templateCluster(cluster c) const {
362  OGDF_ASSERT(has(clusterTemplate));
363  return m_clusterTemplate[c];
364  }
365 
367 
371  OGDF_ASSERT(has(clusterTemplate));
372  return m_clusterTemplate[c];
373  }
374 
384 
386 
393  virtual void scale(double sx, double sy, bool scaleNodes = true) override;
394 
396 
400  virtual void translate(double dx, double dy) override;
401 
403 
407  virtual void flipVertical(const DRect& box) override;
408 
410 
414  virtual void flipHorizontal(const DRect& box) override;
415 
417 
420 
423  virtual DRect boundingBox() const override;
424 
426  void updateClusterPositions(double boundaryDist = 1.0);
427 
429  cluster clusterOf(node v) { return m_pClusterGraph->clusterOf(v); }
430 
432 };
433 
434 }
ogdf::Color
Colors represented as RGBA values.
Definition: graphics.h:160
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:66
GraphAttributes.h
Declaration of class GraphAttributes which extends a Graph by additional attributes.
ogdf::ClusterGraphAttributes::strokeColor
const Color & strokeColor(cluster c) const
Returns the stroke color of cluster c.
Definition: ClusterGraphAttributes.h:253
ogdf::StrokeType
StrokeType
Line types of strokes.
Definition: graphics.h:46
ogdf::GraphAttributes::fillBgColor
const Color & fillBgColor(node v) const
Returns the background color of fill patterns for node v.
Definition: GraphAttributes.h:531
ogdf::GraphAttributes::fillColor
const Color & fillColor(node v) const
Returns the fill color of node v.
Definition: GraphAttributes.h:513
ogdf::GraphAttributes::fillPattern
FillPattern fillPattern(node v) const
Returns the fill pattern of node v.
Definition: GraphAttributes.h:495
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:54
ogdf::ClusterGraphAttributes::height
double height(cluster c) const
Returns the height of cluster c.
Definition: ClusterGraphAttributes.h:217
ogdf::ClusterGraphAttributes::strokeType
StrokeType & strokeType(cluster c)
Returns the stroke type of cluster c.
Definition: ClusterGraphAttributes.h:244
ogdf::ClusterGraphAttributes::label
string & label(cluster c)
Returns the label of cluster c.
Definition: ClusterGraphAttributes.h:352
ogdf::ClusterGraphAttributes::y
double & y(cluster c)
Returns the y-position of cluster c's cage (lower left corner).
Definition: ClusterGraphAttributes.h:190
ogdf::ClusterGraphAttributes::m_y
ClusterArray< double > m_y
Y-position of lower left corner.
Definition: ClusterGraphAttributes.h:51
ogdf::ClusterArrayBase
RegisteredArray for labeling the clusters of a ClusterGraph.
Definition: ClusterGraph.h:304
ogdf::GraphAttributes::x
double x(node v) const
Returns the x-coordinate of node v.
Definition: GraphAttributes.h:241
ogdf::GraphAttributes::init
virtual void init(const Graph &G, long attr)
Initializes the graph attributes for graph G.
ogdf::ClusterGraphAttributes::m_width
ClusterArray< double > m_width
Cluster width.
Definition: ClusterGraphAttributes.h:52
ogdf::ClusterGraphAttributes::height
double & height(cluster c)
Returns the height of cluster c.
Definition: ClusterGraphAttributes.h:226
ogdf::GraphAttributes::width
const NodeArray< double > & width() const
Returns a reference to the node array m_width.
Definition: GraphAttributes.h:369
ogdf::ClusterGraphAttributes::fillBgColor
const Color & fillBgColor(cluster c) const
Returns the background color of fill patterns for cluster c.
Definition: ClusterGraphAttributes.h:325
ogdf::ClusterGraphAttributes::m_pClusterGraph
const ClusterGraph * m_pClusterGraph
Only points to existing graphs.
Definition: ClusterGraphAttributes.h:48
ogdf::ClusterGraphAttributes::fillBgColor
Color & fillBgColor(cluster c)
Returns the background color of fill patterns for cluster c.
Definition: ClusterGraphAttributes.h:334
ogdf::ClusterGraphAttributes::fillColor
const Color & fillColor(cluster c) const
Returns the fill color of cluster c.
Definition: ClusterGraphAttributes.h:307
ogdf::ClusterGraphAttributes::templateCluster
string & templateCluster(cluster c)
Returns the template of cluster c.
Definition: ClusterGraphAttributes.h:370
ogdf::ClusterGraphAttributes::m_stroke
ClusterArray< Stroke > m_stroke
Stroke (style of boundary)
Definition: ClusterGraphAttributes.h:55
ogdf::GraphAttributes::height
const NodeArray< double > & height() const
Returns a reference to the node array m_height.
Definition: GraphAttributes.h:405
ogdf::ClusterGraphAttributes::strokeWidth
float & strokeWidth(cluster c)
Returns the stroke width of cluster c.
Definition: ClusterGraphAttributes.h:280
ogdf::ClusterElement
Representation of clusters in a clustered graph.
Definition: ClusterGraph.h:55
ogdf::GraphAttributes::y
double y(node v) const
Returns the y-coordinate of node v.
Definition: GraphAttributes.h:259
ogdf::ClusterGraphAttributes
Stores additional attributes of a clustered graph (like layout information).
Definition: ClusterGraphAttributes.h:46
ogdf::ClusterGraphAttributes::width
double & width(cluster c)
Returns the width of cluster c.
Definition: ClusterGraphAttributes.h:208
ogdf::ClusterGraphAttributes::y
double y(cluster c) const
Returns the y-position of cluster c's cage (lower left corner).
Definition: ClusterGraphAttributes.h:181
ogdf::ClusterGraphAttributes::m_height
ClusterArray< double > m_height
Cluster height.
Definition: ClusterGraphAttributes.h:53
ogdf::DRect
Rectangles with real coordinates.
Definition: geometry.h:791
ogdf::ClusterGraphAttributes::strokeType
const StrokeType & strokeType(cluster c) const
Returns the stroke type of cluster c.
Definition: ClusterGraphAttributes.h:235
ClusterArray.h
Declaration and implementation of ClusterArray class.
ogdf::GraphAttributes::scale
virtual void scale(double sx, double sy, bool scaleNodes=true)
Scales the layout by (sx,sy).
ogdf::ClusterGraphAttributes::fillPattern
const FillPattern & fillPattern(cluster c) const
Returns the fill pattern of cluster c.
Definition: ClusterGraphAttributes.h:289
ogdf::ClusterGraphAttributes::clusterTemplate
static const long clusterTemplate
Corresponds to cluster attribute templateCluster(cluster).
Definition: ClusterGraphAttributes.h:78
ogdf::ClusterGraphAttributes::label
const string & label(cluster c) const
Returns the label of cluster c.
Definition: ClusterGraphAttributes.h:343
ogdf::ClusterGraphAttributes::m_label
ClusterArray< string > m_label
Cluster label.
Definition: ClusterGraphAttributes.h:54
ogdf::ClusterGraphAttributes::m_clusterTemplate
ClusterArray< string > m_clusterTemplate
Name of cluster template.
Definition: ClusterGraphAttributes.h:57
ogdf::GraphAttributes::flipVertical
virtual void flipVertical()
Flips the layout vertically within its bounding box.
Definition: GraphAttributes.h:913
ogdf::ClusterGraphAttributes::width
double width(cluster c) const
Returns the width of cluster c.
Definition: ClusterGraphAttributes.h:199
ogdf::graphics::init
void init()
Definition: graphics.h:446
ogdf::ClusterGraphAttributes::x
double x(cluster c) const
Returns the x-position of cluster c's cage (lower left corner).
Definition: ClusterGraphAttributes.h:163
ogdf::ClusterGraphAttributes::constClusterGraph
const ClusterGraph & constClusterGraph() const
Returns the associated cluster graph.
Definition: ClusterGraphAttributes.h:151
ogdf::ClusterGraphAttributes::clusterLabel
static const long clusterLabel
Corresponds to cluster attribute label(cluster).
Definition: ClusterGraphAttributes.h:75
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::ClusterGraphAttributes::all
static const long all
Enables all available flags.
Definition: ClusterGraphAttributes.h:81
ogdf::ClusterGraphAttributes::templateCluster
const string & templateCluster(cluster c) const
Returns the template of cluster c.
Definition: ClusterGraphAttributes.h:361
ogdf::ClusterGraphAttributes::strokeWidth
const float & strokeWidth(cluster c) const
Returns the stroke width of cluster c.
Definition: ClusterGraphAttributes.h:271
ogdf::ClusterGraphAttributes::m_x
ClusterArray< double > m_x
X-position of lower left corner.
Definition: ClusterGraphAttributes.h:50
ogdf::ClusterGraph::clusterOf
cluster clusterOf(node v) const
Returns the cluster to which a node belongs.
Definition: ClusterGraph.h:442
ogdf::GraphAttributes::strokeColor
const Color & strokeColor(node v) const
Returns the stroke color of node v.
Definition: GraphAttributes.h:459
ogdf::ClusterGraphAttributes::clusterOf
cluster clusterOf(node v)
Returns the parent cluster of node v.
Definition: ClusterGraphAttributes.h:429
ogdf::GraphAttributes::flipHorizontal
virtual void flipHorizontal()
Flips the layout horizontally within its bounding box.
Definition: GraphAttributes.h:927
ogdf::ClusterGraphAttributes::m_fill
ClusterArray< Fill > m_fill
Fill (style of interior)
Definition: ClusterGraphAttributes.h:56
ogdf::ClusterGraphAttributes::fillPattern
FillPattern & fillPattern(cluster c)
Returns the fill pattern of cluster c.
Definition: ClusterGraphAttributes.h:298
ogdf::FillPattern
FillPattern
Fill patterns.
Definition: graphics.h:82
ogdf::ClusterGraph
Representation of clustered graphs.
Definition: ClusterGraph.h:339
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233
ogdf::ClusterGraphAttributes::clusterStyle
static const long clusterStyle
Corresponds to cluster attributes strokeColor(cluster), strokeType(cluster), strokeWidth(cluster),...
Definition: ClusterGraphAttributes.h:72
ogdf::ClusterGraphAttributes::x
double & x(cluster c)
Returns the x-position of cluster c's cage (lower left corner).
Definition: ClusterGraphAttributes.h:172
ogdf::ClusterGraphAttributes::fillColor
Color & fillColor(cluster c)
Returns the fill color of cluster c.
Definition: ClusterGraphAttributes.h:316
ogdf::ClusterGraphAttributes::strokeColor
Color & strokeColor(cluster c)
Returns the stroke color of cluster c.
Definition: ClusterGraphAttributes.h:262
ogdf::GraphAttributes::strokeType
StrokeType strokeType(node v) const
Returns the stroke type of node v.
Definition: GraphAttributes.h:441
ogdf::GraphAttributes::label
const string & label(node v) const
Returns the label of node v.
Definition: GraphAttributes.h:549
ogdf::GraphAttributes::strokeWidth
float strokeWidth(node v) const
Returns the stroke width of node v.
Definition: GraphAttributes.h:477