forked from ixmilia/dxf-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewMode.go
74 lines (63 loc) · 1.76 KB
/
viewMode.go
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
71
72
73
74
package dxf
// ViewMode represents the various states a given `ViewPort` can have.
type ViewMode int
// PerspectiveViewActive specifies whether the perspective view is active.
func (v *ViewMode) PerspectiveViewActive() bool {
return int(*v)&1 != 0
}
// SetPerspectiveViewActive sets the active state of the perspective view.
func (v *ViewMode) SetPerspectiveViewActive(val bool) {
if val {
*v = ViewMode(int(*v) | 1)
} else {
*v = ViewMode(int(*v) & ^1)
}
}
// FrontClippingOn specifies whether front clipping is on.
func (v *ViewMode) FrontClippingOn() bool {
return int(*v)&2 != 0
}
// SetFrontClippingOn sets the front clipping state of the view.
func (v *ViewMode) SetFrontClippingOn(val bool) {
if val {
*v = ViewMode(int(*v) | 2)
} else {
*v = ViewMode(int(*v) & ^2)
}
}
// BackClippingOn specifies whether back clipping is on.
func (v *ViewMode) BackClippingOn() bool {
return int(*v)&4 != 0
}
// SetBackClippingOn sets the front clipping state of the view.
func (v *ViewMode) SetBackClippingOn(val bool) {
if val {
*v = ViewMode(int(*v) | 4)
} else {
*v = ViewMode(int(*v) & ^4)
}
}
// UcsFollowModeOn specifies whether UCS follow mode is on.
func (v *ViewMode) UcsFollowModeOn() bool {
return int(*v)&8 != 0
}
// SetUcsFollowModeOn sets the UCS follow mode of the view.
func (v *ViewMode) SetUcsFollowModeOn(val bool) {
if val {
*v = ViewMode(int(*v) | 8)
} else {
*v = ViewMode(int(*v) & ^8)
}
}
// FrontClippingAtEye specifies whether front eye clipping is on.
func (v *ViewMode) FrontClippingAtEye() bool {
return int(*v)&16 != 0
}
// SetFrontClippingAtEye sets the front eye clipping mode of the view.
func (v *ViewMode) SetFrontClippingAtEye(val bool) {
if val {
*v = ViewMode(int(*v) | 16)
} else {
*v = ViewMode(int(*v) & ^16)
}
}