Adaptagrams
connend.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) 2004-2014 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_CONNEND_H
30 #define AVOID_CONNEND_H
31 
32 
33 #include <cstdio>
34 #include <list>
35 #include <vector>
36 #include <utility>
37 
38 #include "libavoid/dllexport.h"
39 #include "libavoid/geometry.h"
40 
41 
42 namespace Avoid {
43 
44 class Obstacle;
45 class ShapeRef;
46 class JunctionRef;
47 class Router;
48 class ConnRef;
49 class ShapeConnectionPin;
50 typedef std::list<ConnRef *> ConnRefList;
51 class VertInf;
52 
53 
63  ConnDirNone = 0,
66  ConnDirUp = 1,
80 };
83 typedef unsigned int ConnDirFlags;
84 
85 
100 };
101 
102 
110 class AVOID_EXPORT ConnEnd
111 {
112  public:
117  ConnEnd(const Point& point);
118 
130  ConnEnd(const Point& point, const ConnDirFlags visDirs);
131 
162  ConnEnd(ShapeRef *shapeRef, const unsigned int connectionPinClassID);
163 
174  ConnEnd(JunctionRef *junctionRef);
175 
176 
181  ConnEndType type(void) const;
182 
187  const Point position(void) const;
188 
194  ConnDirFlags directions(void) const;
195 
202  ShapeRef *shape(void) const;
203 
211  JunctionRef *junction(void) const;
212 
220  unsigned int pinClassId(void) const;
221 
222  ConnEnd();
223  ~ConnEnd();
224  private:
225  friend class Obstacle;
226  friend class JunctionRef;
227  friend class ShapeRef;
228  friend class ConnRef;
229  friend class Router;
230  friend class HyperedgeRerouter;
231  friend class ShapeConnectionPin;
232  friend class HyperedgeImprover;
233  friend class CrossingConnectorsInfo;
234 
235  void connect(ConnRef *conn);
236  void disconnect(const bool shapeDeleted = false);
237  void usePin(ShapeConnectionPin *pin);
238  void usePinVertex(VertInf *pinVert);
239  void freeActivePin(void);
240  unsigned int endpointType(void) const;
241  bool isPinConnection(void) const;
242  std::vector<Point> possiblePinPoints(void) const;
243  void assignPinVisibilityTo(VertInf *dummyConnectionVert,
244  VertInf *targetVert);
245  void outputCode(FILE *fp, const char *srcDst) const;
246  std::pair<bool, VertInf *> getHyperedgeVertex(Router *router) const;
247 
248  ConnEndType m_type;
249  Point m_point;
250  ConnDirFlags m_directions;
251  unsigned int m_connection_pin_class_id;
252 
253  // For referencing ConnEnds
254  Obstacle *m_anchor_obj; // The shape/junction this is attached to.
255  ConnRef *m_conn_ref; // The parent connector.
256 
257  // The pin to which the ConnEnd is attached.
258  ShapeConnectionPin *m_active_pin;
259 };
260 
261 
262 }
263 
264 
265 #endif
266 
267 
The ConnEnd class represents different possible endpoints for connectors.
Definition: connend.h:110
unsigned int ConnDirFlags
One or more Avoid::ConnDirFlag options.
Definition: connend.h:83
The ConnRef class represents a connector object.
Definition: connector.h:131
ConnEndType
Types that describe the kind a connection that a ConnEnd represents.
Definition: connend.h:89
This option specifies the point should be given visibility to the bottom of the shape that it is loca...
Definition: connend.h:69
This option specifies the point should be given visibility to the right side of the shape that it is ...
Definition: connend.h:75
This option specifies the point should be given visibility to the left side of the shape that it is l...
Definition: connend.h:72
This option, provided for convenience, specifies the point should be given visibility to all four sid...
Definition: connend.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
The ConnEnd represents a free-floating point that may or may not have visibility in specific directio...
Definition: connend.h:92
The ConnEnd is empty and doesn&#39;t have any information set.
Definition: connend.h:99
The ShapeConnectionPin class represents a fixed point or "pin" on a shape that can be connected to...
Definition: connectionpin.h:96
The Point class defines a point in the plane.
Definition: geomtypes.h:52
The ConnEnd attaches to a junction.
Definition: connend.h:97
libavoid: Object-avoiding orthogonal and polyline connector routing library.
Definition: actioninfo.cpp:33
The Router class represents a libavoid router instance.
Definition: router.h:386
This option specifies the point should be given visibility to the top of the shape that it is located...
Definition: connend.h:66
The ShapeRef class represents a shape object.
Definition: shape.h:81
The JunctionRef class represents a fixed or free-floating point that connectors can be attached to...
Definition: junction.h:57
The ConnEnd attaches to a specific ShapeConnectionPin on a shape.
Definition: connend.h:95
ConnDirFlag
Flags that can be passed to the ConnEnd constructor to specify which sides of a shape this point shou...
Definition: connend.h:62