~centralelyon2010/inkscape/imagelinks2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef INKSCAPE_CONNECTION_POINT_H
#define INKSCAPE_CONNECTION_POINT_H

#include <2geom/point.h>
//#include <libavoid/vertices.h>
#include <libavoid/connector.h>

#include "svg/stringstream.h"


enum ConnPointType {
    ConnPointDefault = 0,
    ConnPointUserDefined = 1
};
enum ConnPointDefaultPos{
    ConnPointPosTL, // Top Left
    ConnPointPosTC, // Top Centre
    ConnPointPosTR, // Top Right
    ConnPointPosCL, // Centre Left
    ConnPointPosCC, // Centre Centre
    ConnPointPosCR, // Centre Right
    ConnPointPosBL, // Bottom Left
    ConnPointPosBC, // Bottom Centre
    ConnPointPosBR, // Bottom Right
};


struct ConnectionPoint
{
    ConnectionPoint():
        type(ConnPointDefault), // default to a default connection point
        id(ConnPointPosCC), // default to the centre point
        pos(),
        dir(Avoid::ConnDirAll) // allow any direction
    {
    }
    // type of the connection point
    // default or user-defined
    int type;

    /* id of the connection point
       in the case of default
       connection points it specifies
       which of the 9 types the
       connection point is.
    */
    int id;

    /* position related to parent item
       in the case of default connection
       points, these positions should be
       computed by the item's avoidRef
    */
    Geom::Point pos;

    // directions from which connections can occur
    Avoid::ConnDirFlags dir;

    bool operator!=(ConnectionPoint&);
    bool operator==(ConnectionPoint&);
};

namespace Inkscape{

SVGIStringStream& operator>>(SVGIStringStream& istr, ConnectionPoint& cp);
SVGOStringStream& operator<<(SVGOStringStream& ostr, const ConnectionPoint& cp);

}

#endif