Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

HypergraphAttributes.h
Go to the documentation of this file.
1 
33 #pragma once
34 
38 
39 namespace ogdf {
40 
55 {
56 protected:
57 
60 
63 
66 
69 
72 
75 
78 
79 public:
80 
83  : m_hypergraph(nullptr)
84  {
85  }
86 
89  : m_hypergraph(&H)
90  {
91  m_x.init(H, 0.0);
92  m_y.init(H, 0.0);
93  m_width .init(H,10.0);
94  m_height.init(H,10.0);
95  m_label.init(H);
96  m_shape.init(H, static_cast<int>(Shape::Ellipse));
97  }
98 
101  {
102  }
103 
104  const Hypergraph & constHypergraph() const
105  {
106  return *m_hypergraph;
107  }
108 
110  const double &x(hypernode v)
111  {
112  return m_x[v];
113  }
114 
116  void setX(hypernode v, double pX)
117  {
118  m_x[v] = pX;
119  }
120 
122  const double &y(hypernode v) {
123  return m_y[v];
124  }
125 
127  void setY(hypernode v, double pY)
128  {
129  m_y[v] = pY;
130  }
131 
133  const double &width(hypernode v)
134  {
135  return m_width[v];
136  }
137 
139  void setWidth(hypernode v, int pWidth)
140  {
141  m_width[v] = pWidth;
142  }
143 
145  const double &height(hypernode v)
146  {
147  return m_height[v];
148  }
149 
151  void setHeight(hypernode v, int pHeight)
152  {
153  m_height[v] = pHeight;
154  }
155 
158  {
159  return m_shape[v];
160  }
161 
163  string &label(hypernode v)
164  {
165  return m_label[v];
166  }
167 
168 };
169 
183 {
184 private:
185 
188 
191 
194 
195 public:
196 
199  : m_repGA(nullptr), m_repG(nullptr)
200  {
201  }
202 
206  {
207  m_repG = new EdgeStandardRep(pH, pType);
208 
209  m_repGA = new GraphAttributes(m_repG->constGraph(),
212 
213  m_repGA->directed() = true;
214  }
215 
218  {
219  delete m_repGA;
220  delete m_repG;
221  }
222 
224  {
225  return m_type;
226  }
227 
228  const Graph & repGraph() const
229  {
230  return m_repG->constGraph();
231  }
232 
233  const GraphAttributes & repGA() const
234  {
235  return *m_repGA;
236  }
237 
240  {
241  return v->type();
242  }
243 
246  {
247  if (m_repG->hypernodeMap(v))
248  return m_repG->hypernodeMap(v)->type();
249  else
251  }
252 
254  const double &x(node v)
255  {
256  return m_repGA->x(v);
257  }
258 
260  void setX(node v, double pX)
261  {
262  if (m_repG->hypernodeMap(v))
263  setX(m_repG->hypernodeMap(v), pX);
264  else
265  m_repGA->x(v) = pX;
266  }
267 
269  void setX(hypernode v, double pX)
270  {
271  m_x[v] = pX;
272  m_repGA->x(m_repG->nodeMap(v)) = pX;
273  }
274 
276  const double &y(node v)
277  {
278  return m_repGA->y(v);
279  }
280 
282  void setY(hypernode v, double pY)
283  {
284  m_y[v] = pY;
285  m_repGA->y(m_repG->nodeMap(v)) = pY;
286  }
287 
289  void setY(node v, double pY)
290  {
291  if (m_repG->hypernodeMap(v))
292  setY(m_repG->hypernodeMap(v), pY);
293  else
294  m_repGA->y(v) = pY;
295  }
296 
298  const double &width(node v)
299  {
300  return m_repGA->width(v);
301  }
302 
304  void setWidth(hypernode v, double pWidth)
305  {
306  m_width[v] = pWidth;
307  m_repGA->width(m_repG->nodeMap(v)) = pWidth;
308  }
309 
311  void setWidth(node v, double pWidth)
312  {
313  if (m_repG->hypernodeMap(v))
314  setWidth(m_repG->hypernodeMap(v), pWidth);
315  else
316  m_repGA->width(v) = pWidth;
317  }
318 
320  const double &height(node v)
321  {
322  return m_repGA->height(v);
323  }
324 
326  void setHeight(hypernode v, double pHeight)
327  {
328  m_height[v] = pHeight;
329  m_repGA->height(m_repG->nodeMap(v)) = pHeight;
330  }
331 
333  void setHeight(node v, double pHeight)
334  {
335  if (m_repG->hypernodeMap(v))
336  setHeight(m_repG->hypernodeMap(v), pHeight);
337  else
338  m_repGA->height(v) = pHeight;
339  }
340 
343  {
344  return m_repGA->bends(e);
345  }
346 
347 #if 0
348  void writeSVG(ostream &os, int fontSize, const string &fontColor) const
350  {
351  m_repGA->writeSVG(os, fontSize, fontColor);
352  }
353 
355  void writeSVG(const char *fileName, int fontSize, const string &fontColor) const
356  {
357  m_repGA->writeSVG(fileName, fontSize, fontColor);
358  }
359 #endif
360 
362  {
363  m_repGA->clearAllBends();
364  }
365 
368  {
369  m_repGA->removeUnnecessaryBendsHV();
370  }
371 
373  const DRect boundingBox() const
374  {
375  return m_repGA->boundingBox();
376  }
377 
378 };
379 
380 } // end namespace ogdf
HypernodeArray< double > m_x
Coordinate x of a hypernod.e.
EdgeStandardType
Enumeration class of possible edge standard representations.
double width(node v) const
Returns the width of the bounding box of node v.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
void setX(node v, double pX)
Sets the x-coordinate of a representation node v.
Type type() const
Returns the type of hypernode.
Definition: Hypergraph.h:339
DPolyline & bends(edge e)
Returns the list of bend points of edge e.
HypernodeElement::Type type(hypernode v)
Returns the type of representation node v.
static const int edgeGraphics
Corresponds to edge attribute bends(edge).
HypernodeArray< int > m_shape
Shape of a hypernode.
Stores additional attributes of edge standard representation of a hypergraph.
EdgeStandardType m_type
The type of of edge standard representation.
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
const double & width(hypernode v)
Returns the width of the bounding box of hypernode v.
Rectangles with real coordinates.
Definition: geometry.h:515
void setY(node v, double pY)
Sets the y-coordinate of a representation node v.
void init(const Hypergraph &H)
Reinitializes the array. Associates the array with H.
Polylines with real coordinates.
Definition: geometry.h:350
static const int nodeGraphics
Corresponds to node attributes x(node), y(node), width(node), height(node), and shape(node).
HypergraphAttributesES(const Hypergraph &pH, EdgeStandardType pType=EdgeStandardType::star)
Initializes new instance of class HypergraphAttributes.
EdgeStandardType type() const
void setHeight(hypernode v, double pHeight)
Sets the the height of hypernode v.
const GraphAttributes & repGA() const
bool directed() const
Returns if the graph is directed.
void removeUnnecessaryBendsHV()
Removes unnecessary bend points in orthogonal segements.
const DPolyline & bends(edge e) const
Returns the list of bend points of edge e.
HypernodeElement::Type type(node v)
Returns the type of representation node v.
const double & x(hypernode v)
Returns the x-coordinate of hypernode v.
const double & y(hypernode v)
Returns the y-coordinate of hypernode v.
const double & y(node v)
Returns the y-coordinate of a representation node v.
HypergraphAttributesES()
Initializes new instance of class HypergraphAttributes.
void setHeight(node v, double pHeight)
Sets the the height of a representation node v.
double height(node v) const
Returns the height of the bounding box of node v.
HypernodeArray< double > m_height
Height of a hypernodes bounding box.
for every hyperedge e = {v_1, ..., v_l} a single new dummy node v_e is introduced, moreover, v_e becomes the center of a new star connecting all hypernodes incident with e (ie. {v_1, v_e}, ..., {v_l, v_e} are added)
void setY(hypernode v, double pY)
Sets the x-coordinate of hypernode v.
void setWidth(hypernode v, double pWidth)
Sets the the width of hypernode v.
node nodeMap(hypernode v)
Returns the node associated with the hypernode.
virtual ~HypergraphAttributes()
Destructor.
double y(node v) const
Returns the y-coordinate of node v.
void setX(hypernode v, double pX)
Sets the x-coordinate of hypernode v.
HypernodeArray< double > m_width
Width of a hypernode bounding box.
const Graph & constGraph() const
Returns a reference to the representation graph.
virtual ~HypergraphAttributesES()
Destructor.
virtual DRect boundingBox() const
Returns the bounding box of the graph.
Stores additional attributes of a graph (like layout information).
const Hypergraph * m_hypergraph
Only points to an existing hypergraph.
hypernode hypernodeMap(node v)
Returns the hypernode associated with the node (if any).
Class for the representation of hypernodes.
Definition: Hypergraph.h:265
Class for the representation of edges.
Definition: Graph_d.h:291
HypergraphAttributes(const Hypergraph &H)
Initializes new instance of class HypergraphAttributes.
EdgeStandardRep * m_repG
Edge standard representation reference.
double x(node v) const
Returns the x-coordinate of node v.
Class for the representation of nodes.
Definition: Graph_d.h:167
HypergraphAttributes()
Initializes new instance of class HypergraphAttributes.
void setWidth(hypernode v, int pWidth)
Sets the the width of hypernode v.
A declaration of EdgeStandardRep class representing a graph representation of a hypergraph in the edg...
Declaration and implementation of hyperraph array classes based on Node/EdgeArray classes written by ...
const double & height(hypernode v)
Returns the height of the bounding box of hypernode v.
void setX(hypernode v, double pX)
Sets the x-coordinate of hypernode v.
HypernodeArray< double > m_y
Coordinate y of a hypernode.
const double & width(node v)
Returns the width of a representation node v.
void setY(hypernode v, double pY)
Sets the y-coordinate of hypernode v.
const double & x(node v)
Returns the x-coordinate of representation node v.
int shape(hypernode v)
Returns the shape of hypernode v.
void setWidth(node v, double pWidth)
Sets the the width of a representation node v.
const Hypergraph & constHypergraph() const
string & label(hypernode v)
Returns the label of hypernode v.
The namespace for all OGDF objects.
HypernodeArray< string > m_label
Label of a hypernode.
void clearAllBends()
Removes all edge bends.
const DRect boundingBox() const
Returns the bounding box of the hypergraph.
Type
The type of hypernodes.
Definition: Hypergraph.h:274
Stores additional attributes of a hypergraph.
Edge standard representation of hypergraphs.
void removeUnnecessaryBendsHV()
Removes unnecessary bend points in orthogonal segements.
const double & height(node v)
Returns the height of a representation node v.
GraphAttributes * m_repGA
Wrapped graph attributes reference.
void setHeight(hypernode v, int pHeight)
Sets the the height of hypernode v.