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-2011  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 
25 #ifndef AVOID_ACTIONINFO_H
26 #define AVOID_ACTIONINFO_H
27 
28 #include <list>
29 
30 #include "libavoid/actioninfo.h"
31 #include "libavoid/connend.h"
32 #include "libavoid/geomtypes.h"
33 
34 namespace Avoid {
35 
36 // This class is not intended for public use.
37 // It is used internally by Router to track actions performed on objects
38 // during transactions.
39 
40 
41 
42 class ShapeRef;
43 class JunctionRef;
44 
45 
46 enum ActionType {
47     ShapeMove,
48     ShapeAdd,
49     ShapeRemove,
50     JunctionMove,
51     JunctionAdd,
52     JunctionRemove,
53     ConnChange,
54     ConnectionPinChange
55 };
56 
57 typedef std::list<std::pair<unsigned int, ConnEnd> > ConnUpdateList;
58 
59 class ActionInfo {
60     public:
61         ActionInfo(ActionType t, ShapeRef *s, const Polygon& p, bool fM);
62         ActionInfo(ActionType t, ShapeRef *s);
63         ActionInfo(ActionType t, JunctionRef *j, const Point& p);
64         ActionInfo(ActionType t, JunctionRef *j);
65         ActionInfo(ActionType t, ConnRef *c);
66         ActionInfo(ActionType t, ShapeConnectionPin *p);
67         ~ActionInfo();
68         Obstacle *obstacle(void) const;
69         ShapeRef *shape(void) const;
70         ConnRef *conn(void) const;
71         JunctionRef *junction(void) const;
72         void addConnEndUpdate(const unsigned int type, const ConnEnd& connEnd,
73                 bool isConnPinMoveUpdate);
74         bool operator==(const ActionInfo& rhs) const;
75         bool operator<(const ActionInfo& rhs) const;
76 
77         ActionType type;
78         void *objPtr;
79         Polygon newPoly;
80         Point newPosition;
81         bool firstMove;
82         ConnUpdateList conns;
83 };
84 typedef std::list<ActionInfo> ActionInfoList;
85 
86 
87 }
88 #endif
89