Adaptagrams
hyperedge.h
Go to the documentation of this file.
1 /*
2  * vim: ts=4 sw=4 et tw=0 wm=0
3  *
4  * libavoid - Fast, Incremental, Object-avoiding Line Router
5  *
6  * Copyright (C) 2011-2015 Monash University
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  * See the file LICENSE.LGPL distributed with the library.
13  *
14  * Licensees holding a valid commercial license may use this file in
15  * accordance with the commercial license agreement provided with the
16  * library.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21  *
22  * Author(s): Michael Wybrow
23 */
24 
27 
28 #ifndef AVOID_HYPEREDGE_H
29 #define AVOID_HYPEREDGE_H
30 
31 #include <cstdio>
32 #include <list>
33 #include <vector>
34 #include <set>
35 
36 #include "libavoid/dllexport.h"
37 
38 namespace Avoid {
39 
40 class ConnRef;
41 class JunctionRef;
42 class Router;
43 class ConnEnd;
44 class VertInf;
45 
47 typedef std::list<ConnEnd> ConnEndList;
48 
50 typedef std::list<ConnRef *> ConnRefList;
51 
53 typedef std::list<JunctionRef *> JunctionRefList;
54 
55 typedef std::list<VertInf *> VertexList;
56 typedef std::set<ConnRef *> ConnRefSet;
57 typedef std::set<VertInf *> VertexSet;
58 
59 typedef std::vector<JunctionRef *> JunctionRefVector;
60 typedef std::vector<ConnEndList> ConnEndListVector;
61 typedef std::vector<ConnRefList> ConnRefListVector;
62 typedef std::vector<JunctionRefList> JunctionRefListVector;
63 typedef std::vector<VertexSet> VertexSetVector;
64 
80 {
83 
86 
89 
92 
95 };
96 
97 
129 class AVOID_EXPORT HyperedgeRerouter
130 {
131  public:
139 
148  size_t registerHyperedgeForRerouting(ConnEndList terminals);
149 
164  size_t registerHyperedgeForRerouting(JunctionRef *junction);
165 
182  HyperedgeNewAndDeletedObjectLists newAndDeletedObjectLists(
183  size_t index) const;
184 
185  // @brief The number of hyperedges that are being or have been
186  // rerouted.
187  // @return The number of rerouted hyperedges.
188  //
189  size_t count(void) const;
190 
191  private:
192  friend class Router;
193 
194  // @brief Sets the router instance that this object operates on.
195  //
196  // @param[in] router The router instance to operate on.
197  //
198  void setRouter(Router *router);
199 
200  ConnRefSet calcHyperedgeConnectors(void);
201  // Called by Router during processTransaction().
202  void performRerouting(void);
203  void outputInstanceToSVG(FILE *fp);
204  bool findAttachedObjects(size_t index, ConnRef *connector,
205  JunctionRef *ignore, ConnRefSet& hyperedgeConns);
206  bool findAttachedObjects(size_t index, JunctionRef *junction,
207  ConnRef *ignore, ConnRefSet& hyperedgeConns);
208 
209  Router *m_router;
210  ConnEndListVector m_terminals_vector;
211  JunctionRefVector m_root_junction_vector;
212  JunctionRefListVector m_new_junctions_vector;
213  JunctionRefListVector m_deleted_junctions_vector;
214  ConnRefListVector m_new_connectors_vector;
215  ConnRefListVector m_deleted_connectors_vector;
216  VertexSetVector m_terminal_vertices_vector;
217  VertexList m_added_vertices;
218 };
219 
220 
221 }
222 
223 #endif
ConnRefList deletedConnectorList
A list of deleted connectors.
Definition: hyperedge.h:91
The ConnRef class represents a connector object.
Definition: connector.h:131
The HyperedgeNewAndDeletedObjectLists class stores lists of objects created and deleted during hypere...
Definition: hyperedge.h:79
std::list< ConnRef * > ConnRefList
A list of ConnRef objects.
Definition: connector.h:47
The HyperedgeRerouter class is a convenience object that can be used to register hyperedges to be rer...
Definition: hyperedge.h:129
std::list< ConnEnd > ConnEndList
A list of ConnEnd objects.
Definition: hyperedge.h:44
JunctionRefList newJunctionList
A list of newly created junctions.
Definition: hyperedge.h:82
JunctionRefList deletedJunctionList
A list of deleted junctions.
Definition: hyperedge.h:88
libavoid: Object-avoiding orthogonal and polyline connector routing library.
Definition: actioninfo.cpp:33
std::list< JunctionRef * > JunctionRefList
A list of JunctionRef objects.
Definition: hyperedge.h:53
The Router class represents a libavoid router instance.
Definition: router.h:386
The JunctionRef class represents a fixed or free-floating point that connectors can be attached to...
Definition: junction.h:57
ConnRefList newConnectorList
A list of newly created connectors.
Definition: hyperedge.h:85
ConnRefList changedConnectorList
A list of changed connectors.
Definition: hyperedge.h:94