9 class RS_EntityContainer;
13 * This class is used for snapping functions in a graphic view.
14 * Actions are usually derrived from this base class if they need
15 * to catch entities or snap to coordinates. Use the methods to
16 * retrieve a graphic coordinate from a mouse coordinate.
18 * Possible snapping functions are described in RS_SnapMode.
20 * @author Andrew Mustun
25 RS_Snapper(RS_EntityContainer & container, GraphicView & graphicView);
26 virtual ~RS_Snapper();
31 RS_Entity * getKeyEntity();
32 void setSnapMode(RS2::SnapMode snapMode);
33 void setSnapRestriction(RS2::SnapRestriction snapRes);
34 void setSnapRange(int r);
36 Vector snapPoint(QMouseEvent * e);
37 Vector snapFree(Vector coord);
38 Vector snapEndpoint(Vector coord);
39 Vector snapGrid(Vector coord);
40 Vector snapOnEntity(Vector coord);
41 Vector snapCenter(Vector coord);
42 Vector snapMiddle(Vector coord);
43 Vector snapDist(Vector coord);
44 Vector snapIntersection(Vector coord);
45 //Vector snapDirect(Vector coord, bool abs);
47 Vector restrictOrthogonal(Vector coord);
48 Vector restrictHorizontal(Vector coord);
49 Vector restrictVertical(Vector coord);
51 //RS_Entity* catchLeafEntity(const Vector& pos);
52 //RS_Entity* catchLeafEntity(QMouseEvent* e);
53 RS_Entity * catchEntity(const Vector & pos, RS2::ResolveLevel level = RS2::ResolveNone);
54 RS_Entity * catchEntity(QMouseEvent * e, RS2::ResolveLevel level = RS2::ResolveNone);
56 virtual void suspend();
57 virtual void resume();
58 virtual void hideOptions();
59 virtual void showOptions();
68 RS_EntityContainer * container;
69 GraphicView * graphicView;
70 RS_Entity * keyEntity;
73 RS2::SnapMode snapMode;
74 RS2::SnapRestriction snapRes;
76 * Snap distance for snaping to points with a
77 * given distance from endpoints.
81 * Keeps track of the drawings in XOR mode.
85 * Snap range for catching entities.
89 * Show large cross hairs.