1 #ifndef SEEN_SP_CONN_END_PAIR
2 #define SEEN_SP_CONN_END_PAIR
4 /*
5 * A class for handling connector endpoint movement and libavoid interaction.
6 *
7 * Authors:
8 * Peter Moulder <pmoulder@mail.csse.monash.edu.au>
9 *
10 * * Copyright (C) 2004 Monash University
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
14 #include <glib/gtypes.h>
16 #include "forward.h"
17 #include "libnr/nr-point.h"
18 #include <sigc++/connection.h>
19 #include <sigc++/functors/slot.h>
20 #include <sigc++/signal.h>
21 #include "libavoid/connector.h"
24 class SPConnEnd;
25 struct SPCurve;
27 namespace Inkscape {
28 namespace XML {
29 class Node;
30 }
31 }
33 extern void recreateCurve(SPCurve *curve, Avoid::ConnRef *connRef, gdouble curvature);
35 class SPConnEndPair {
36 public:
37 SPConnEndPair(SPPath *);
38 ~SPConnEndPair();
39 void release();
40 void setAttr(unsigned const key, gchar const *const value);
41 void writeRepr(Inkscape::XML::Node *const repr) const;
42 void getAttachedItems(SPItem *[2]) const;
43 void getEndpoints(Geom::Point endPts[]) const;
44 gdouble getCurvature(void) const;
45 SPConnEnd** getConnEnds(void);
46 bool isOrthogonal(void) const;
47 friend void recreateCurve(SPCurve *curve, Avoid::ConnRef *connRef, gdouble curvature);
48 void tellLibavoidNewEndpoints(const bool processTransaction = false);
49 bool reroutePathFromLibavoid(void);
50 void makePathInvalid(void);
51 void update(void);
52 bool isAutoRoutingConn(void);
53 void rerouteFromManipulation(void);
55 private:
56 SPConnEnd *_connEnd[2];
58 SPPath *_path;
60 // libavoid's internal representation of the item.
61 Avoid::ConnRef *_connRef;
63 int _connType;
64 gdouble _connCurvature;
66 // A sigc connection for transformed signal.
67 sigc::connection _transformed_connection;
69 void storeIds(void);
70 };
73 void sp_conn_end_pair_build(SPObject *object);
76 // _connType options:
77 enum {
78 SP_CONNECTOR_NOAVOID, // Basic connector - a straight line.
79 SP_CONNECTOR_POLYLINE, // Object avoiding polyline.
80 SP_CONNECTOR_ORTHOGONAL // Object avoiding orthogonal polyline (only horizontal and verical segments).
81 };
84 #endif /* !SEEN_SP_CONN_END_PAIR */
86 /*
87 Local Variables:
88 mode:c++
89 c-file-style:"stroustrup"
90 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
91 indent-tabs-mode:nil
92 fill-column:99
93 End:
94 */
95 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :