junction.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) 2010 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 <mjwybrow@users.sourceforge.net>
23 */
24 
27 
28 
29 #ifndef AVOID_JUNCTION_H
30 #define AVOID_JUNCTION_H
31 
32 #include <list>
33 #include <set>
34 
35 #include "libavoid/geomtypes.h"
36 #include "libavoid/obstacle.h"
37 
38 namespace Avoid {
39 
40 class Router;
41 class VertInf;
42 class ConnEnd;
43 class ConnRef;
44 class ShapeConnectionPin;
45 class JunctionRef;
46 typedef std::list<JunctionRef *> JunctionRefList;
47 
48 
56 class JunctionRef : public Obstacle
57 {
58  public:
76  JunctionRef(Router *router, Point position, const unsigned int id = 0);
77 
82  virtual ~JunctionRef();
83 
101 
104  Point position(void) const;
105 
106  Rectangle makeRectangle(Router *router, const Point& position);
107  void preferOrthogonalDimension(const size_t dim);
108 
109  private:
110  friend class Router;
111  friend class ShapeConnectionPin;
112  friend class ConnEnd;
113 
114  void outputCode(FILE *fp) const;
115  void setPosition(const Point& position);
116  void moveAttachedConns(const Point& newPosition);
117  void assignPinVisibilityTo(const unsigned int pinClassId,
118  VertInf *dummyConnectionVert);
119 
120  Point m_position;
121 };
122 
123 
124 }
125 
126 
127 #endif
128 
129