7
7
This file is part of the extensible drawing editor Ipe.
8
Copyright (C) 1993-2007 Otfried Cheong
8
Copyright (C) 1993-2009 Otfried Cheong
10
10
Ipe is free software; you can redistribute it and/or modify it
11
11
under the terms of the GNU General Public License as published by
12
the Free Software Foundation; either version 2 of the License, or
12
the Free Software Foundation; either version 3 of the License, or
13
13
(at your option) any later version.
15
15
As a special exception, you have permission to link Ipe with the
37
37
// --------------------------------------------------------------------
41
class IPE_EXPORT IpeSnapData {
43
//! The different snap modes as bitmasks.
44
enum TSnapModes { ESnapNone = 0,
45
ESnapVtx = 1, ESnapBd = 2, ESnapInt = 4,
46
ESnapGrid = 8, ESnapAngle = 0x10,
49
int iSnap; //!< Activated snapping modes (TSnapModes)
50
bool iGridVisible; //!< Is the grid visible?
51
int iGridSize; //!< Snap grid spacing.
52
double iAngleSize; //!< Angle for angular snapping.
53
int iSnapDistance; //!< Snap distance (in pixels).
54
int iSelectDistance; //!< Select distance (in pixels).
55
bool iWithAxes; //!< Show coordinate system?
56
IpeVector iOrigin; //!< Origin of coordinate system
57
IpeAngle iDir; //!< Direction of x-axis
59
bool IntersectionSnap(IpeVector &pos, const IpePage *page,
60
double snapDist) const;
61
bool SnapAngularIntersection(IpeVector &pos, const IpeLine &l,
63
double snapDist) const;
64
bool SimpleSnap(IpeVector &pos, const IpePage *page, double snapDist) const;
65
bool Snap(IpeVector &pos, const IpePage *page, double snapDist,
66
IpeVector *autoOrg = 0) const;
67
IpeLine GetLine(const IpeVector &mouse, const IpeVector &base) const;
68
bool SetEdge(const IpeVector &pos, const IpePage *page);
45
//! The different snap modes as bitmasks.
46
enum TSnapModes { ESnapNone = 0,
47
ESnapVtx = 1, ESnapBd = 2, ESnapInt = 4,
48
ESnapGrid = 8, ESnapAngle = 0x10,
51
int iSnap; //!< Activated snapping modes (TSnapModes)
52
bool iGridVisible; //!< Is the grid visible?
53
int iGridSize; //!< Snap grid spacing.
54
double iAngleSize; //!< Angle for angular snapping.
55
int iSnapDistance; //!< Snap distance (in pixels).
56
bool iWithAxes; //!< Show coordinate system?
57
Vector iOrigin; //!< Origin of coordinate system
58
Angle iDir; //!< Direction of x-axis
60
bool intersectionSnap(Vector &pos, const Page *page,
61
double snapDist) const;
62
bool snapAngularIntersection(Vector &pos, const Line &l,
64
double snapDist) const;
65
bool simpleSnap(Vector &pos, const Page *page,
66
double snapDist) const;
67
bool snap(Vector &pos, const Page *page, double snapDist,
68
Vector *autoOrg = 0) const;
69
Line getLine(const Vector &mouse, const Vector &base) const;
70
bool setEdge(const Vector &pos, const Page *page);
71
75
// --------------------------------------------------------------------