1 #ifndef INKSCAPE_CONNECTION_POINT_H
2 #define INKSCAPE_CONNECTION_POINT_H
4 #include <2geom/point.h>
5 //#include <libavoid/vertices.h>
6 #include <libavoid/connector.h>
8 #include "svg/stringstream.h"
11 enum ConnPointType {
12 ConnPointDefault = 0,
13 ConnPointUserDefined = 1
14 };
15 enum ConnPointDefaultPos{
16 ConnPointPosTL, // Top Left
17 ConnPointPosTC, // Top Centre
18 ConnPointPosTR, // Top Right
19 ConnPointPosCL, // Centre Left
20 ConnPointPosCC, // Centre Centre
21 ConnPointPosCR, // Centre Right
22 ConnPointPosBL, // Bottom Left
23 ConnPointPosBC, // Bottom Centre
24 ConnPointPosBR, // Bottom Right
25 };
28 struct ConnectionPoint
29 {
30 ConnectionPoint():
31 type(ConnPointDefault), // default to a default connection point
32 id(ConnPointPosCC), // default to the centre point
33 pos(),
34 dir(Avoid::ConnDirAll) // allow any direction
35 {
36 }
37 // type of the connection point
38 // default or user-defined
39 int type;
41 /* id of the connection point
42 in the case of default
43 connection points it specifies
44 which of the 9 types the
45 connection point is.
46 */
47 int id;
49 /* position related to parent item
50 in the case of default connection
51 points, these positions should be
52 computed by the item's avoidRef
53 */
54 Geom::Point pos;
56 // directions from which connections can occur
57 Avoid::ConnDirFlags dir;
59 bool operator!=(ConnectionPoint&);
60 bool operator==(ConnectionPoint&);
61 };
63 namespace Inkscape{
65 SVGIStringStream& operator>>(SVGIStringStream& istr, ConnectionPoint& cp);
66 SVGOStringStream& operator<<(SVGOStringStream& ostr, const ConnectionPoint& cp);
68 }
70 #endif