Scribus
Open source desktop publishing at your fingertips
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
point-l.h
1
#ifndef SEEN_Geom_POINT_L_H
2
#define SEEN_Geom_POINT_L_H
3
4
#include <stdexcept>
5
#include "
point.h
"
6
7
namespace
Geom
{
8
9
typedef
long
ICoord;
10
11
class
IPoint
{
12
ICoord _pt[2];
13
14
public
:
15
IPoint
() { }
16
17
IPoint
(ICoord x, ICoord y) {
18
_pt[X] = x;
19
_pt[Y] = y;
20
}
21
22
IPoint
(NRPointL
const
&p) {
23
_pt[X] = p.x;
24
_pt[Y] = p.y;
25
}
26
27
IPoint
(
IPoint
const
&p) {
28
for
(
unsigned
i = 0; i < 2; ++i) {
29
_pt[i] = p._pt[i];
30
}
31
}
32
33
IPoint
&operator=(
IPoint
const
&p) {
34
for
(
unsigned
i = 0; i < 2; ++i) {
35
_pt[i] = p._pt[i];
36
}
37
return
*
this
;
38
}
39
40
operator
Point
() {
41
return
Point
(_pt[X], _pt[Y]);
42
}
43
44
ICoord operator[](
unsigned
i)
const
throw
(std::out_of_range) {
45
if
( i > Y )
throw
std::out_of_range(
"index out of range"
);
46
return
_pt[i];
47
}
48
49
ICoord &operator[](
unsigned
i)
throw
(std::out_of_range) {
50
if
( i > Y )
throw
std::out_of_range(
"index out of range"
);
51
return
_pt[i];
52
}
53
54
ICoord operator[](Dim2 d)
const
throw
() {
return
_pt[d]; }
55
ICoord &operator[](Dim2 d)
throw
() {
return
_pt[d]; }
56
57
IPoint
&operator+=(
IPoint
const
&o) {
58
for
(
unsigned
i = 0 ; i < 2 ; ++i ) {
59
_pt[i] += o._pt[i];
60
}
61
return
*
this
;
62
}
63
64
IPoint
&operator-=(
IPoint
const
&o) {
65
for
(
unsigned
i = 0 ; i < 2 ; ++i ) {
66
_pt[i] -= o._pt[i];
67
}
68
return
*
this
;
69
}
70
};
71
72
73
}
// namespace Geom
74
75
#endif
/* !SEEN_Geom_POINT_L_H */
76
77
/*
78
Local Variables:
79
mode:c++
80
c-file-style:"stroustrup"
81
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
82
indent-tabs-mode:nil
83
fill-column:99
84
End:
85
*/
86
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
Geom
Definition:
angle.h:38
point.h
Geom::IPoint
Definition:
point-l.h:11
Geom::Point
Cartesian point.
Definition:
point.h:20
scribus
third_party
lib2geom
point-l.h
Generated on Tue Sep 29 2015 09:15:14 for Scribus by
1.8.9.1