Adaptagrams
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-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 
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 #include "libavoid/dllexport.h"
38 
39 namespace Avoid {
40 
41 class Router;
42 class VertInf;
43 class ConnEnd;
44 class ConnRef;
45 class ShapeConnectionPin;
46 class JunctionRef;
47 typedef std::list<JunctionRef *> JunctionRefList;
48 
49 
57 class AVOID_EXPORT JunctionRef : public Obstacle
58 {
59  public:
112  JunctionRef(Router *router, Point position, const unsigned int id = 0);
113 
114 // To prevent C++ objects from being destroyed in garbage collected languages
115 // when the libraries are called from SWIG, we hide the declarations of the
116 // destructors and prevent generation of default destructors.
117 #ifndef SWIG
118  virtual ~JunctionRef();
123 #endif
124 
141  ConnRef *removeJunctionAndMergeConnectors(void);
142 
145  Point position(void) const;
146 
158  void setPositionFixed(bool fixed);
159 
163  bool positionFixed(void) const;
164 
170  Point recommendedPosition(void) const;
171 
172  Rectangle makeRectangle(Router *router, const Point& position);
173  void preferOrthogonalDimension(const size_t dim);
174 
175  private:
176  friend class Router;
177  friend class ShapeConnectionPin;
178  friend class ConnEnd;
179  friend class HyperedgeImprover;
180 
181  void outputCode(FILE *fp) const;
182  void setPosition(const Point& position);
183  void setRecommendedPosition(const Point& position);
184  void moveAttachedConns(const Point& newPosition);
185 
186  Point m_position;
187  Point m_recommended_position;
188  bool m_position_fixed;
189 };
190 
191 
192 }
193 
194 
195 #endif
196 
197 
The ConnEnd class represents different possible endpoints for connectors.
Definition: connend.h:110
The ConnRef class represents a connector object.
Definition: connector.h:131
A Rectangle, a simpler way to define the polygon for square or rectangular shapes.
Definition: geomtypes.h:356
The ShapeConnectionPin class represents a fixed point or "pin" on a shape that can be connected to...
Definition: connectionpin.h:96
Contains the interface for various geometry types and classes.
The Point class defines a point in the plane.
Definition: geomtypes.h:52
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
Contains the interface for the Obstacle class, the superclass for ShapeRef and JunctionRef.