svn-gvsig-desktop / tags / v2_0_Build_1213 / libraries / libjni-ecwcompress / include / NCSJPCRect.h @ 44700
History | View | Annotate | Download (3.74 KB)
1 | 1429 | igbrotru | /********************************************************
|
---|---|---|---|
2 | ** Copyright 2003 Earth Resource Mapping Pty Ltd.
|
||
3 | ** This document contains unpublished source code of
|
||
4 | ** Earth Resource Mapping Pty Ltd. This notice does
|
||
5 | ** not indicate any intention to publish the source
|
||
6 | ** code contained herein.
|
||
7 | **
|
||
8 | ** FILE: $Archive: /NCS/Source/include/NCSJPCRect.h $
|
||
9 | ** CREATED: 14/03/2003 3:27:34 PM
|
||
10 | ** AUTHOR: Simon Cope
|
||
11 | ** PURPOSE: CNCSJPCNode class header
|
||
12 | ** EDITS: [xx] ddMmmyy NAME COMMENTS
|
||
13 | *******************************************************/
|
||
14 | |||
15 | #ifndef NCSJPCRECT_H
|
||
16 | #define NCSJPCRECT_H
|
||
17 | |||
18 | #ifndef NCSJPCTYPES_H
|
||
19 | #include "NCSJPCTypes.h" |
||
20 | #endif // NCSJPCTYPES_H |
||
21 | |||
22 | /**
|
||
23 | * CNCSJPCRect class - the base JPC rectangle class.
|
||
24 | *
|
||
25 | * @author Simon Cope
|
||
26 | * @version $Revision$ $Author$ $Date$
|
||
27 | */
|
||
28 | class NCSJPC_EXPORT_ALL CNCSJPCRect { |
||
29 | public:
|
||
30 | /** Default constructor, initialises members */
|
||
31 | CNCSJPCRect() { |
||
32 | m_X0.m_Value = (-1 * (signed)0x7fffffff - 1); |
||
33 | m_Y0.m_Value = (-1 * (signed)0x7fffffff - 1); |
||
34 | m_X1.m_Value = (-1 * (signed)0x7fffffff - 1); |
||
35 | m_Y1.m_Value = (-1 * (signed)0x7fffffff - 1); |
||
36 | }; |
||
37 | /** constructor, specify rect values */
|
||
38 | CNCSJPCRect(INT32 nX0, INT32 nY0, INT32 nX1, INT32 nY1) { m_X0 = nX0; m_Y0 = nY0; m_X1 = nX1; m_Y1 = nY1; }; |
||
39 | /** constructor, specify rect values */
|
||
40 | CNCSJPCRect(INT32 nX0, INT32 nY0, UINT32 nWidth, UINT32 nHeight) { m_X0 = nX0; m_Y0 = nY0; m_X1 = nX0 + nWidth; m_Y1 = nY0 + nHeight; }; |
||
41 | /** Virtual destructor */
|
||
42 | virtual ~CNCSJPCRect() {}; |
||
43 | |||
44 | /**
|
||
45 | * Get X0 of this rect.
|
||
46 | * @return INT32 Coordinate value.
|
||
47 | */
|
||
48 | // virtual INT32 GetX0() { return(m_X0.Cached() ? m_X0 : 99999999); };
|
||
49 | virtual __inline INT32 GetX0() { return(m_X0); };
|
||
50 | /**
|
||
51 | * Get Y0 of this rect.
|
||
52 | * @return INT32 Coordinate value.
|
||
53 | */
|
||
54 | // virtual INT32 GetY0() { return(m_Y0.Cached() ? m_Y0 : 99999999); };
|
||
55 | virtual __inline INT32 GetY0() { return(m_Y0); };
|
||
56 | /**
|
||
57 | * Get X1 of this rect.
|
||
58 | * @return INT32 Coordinate value.
|
||
59 | */
|
||
60 | // virtual INT32 GetX1() { return(m_X1.Cached() ? m_X1 : 99999999); };
|
||
61 | virtual __inline INT32 GetX1() { return(m_X1); };
|
||
62 | /**
|
||
63 | * Get Y1 of this rect.
|
||
64 | * @return INT32 Coordinate value.
|
||
65 | */
|
||
66 | // virtual INT32 GetY1() { return(m_Y1.Cached() ? m_Y1 : 99999999); };
|
||
67 | virtual __inline INT32 GetY1() { return(m_Y1); };
|
||
68 | /**
|
||
69 | * Get Width of this rect.
|
||
70 | * @return INT32 Width value.
|
||
71 | */
|
||
72 | virtual __inline UINT32 GetWidth() { return(GetX1() - GetX0()); };
|
||
73 | /**
|
||
74 | * Get Height of this rect.
|
||
75 | * @return INT32 Height value.
|
||
76 | */
|
||
77 | virtual __inline UINT32 GetHeight() { return(GetY1() - GetY0()); };
|
||
78 | |||
79 | /**
|
||
80 | * EQ operator.
|
||
81 | * @return bool TF Rect is equal.
|
||
82 | */
|
||
83 | bool operator==(const CNCSJPCRect& rect) { |
||
84 | return(m_X0 == rect.m_X0 && m_Y0 == rect.m_Y0 && m_X1 == rect.m_X1 && m_Y1 == rect.m_Y1);
|
||
85 | } |
||
86 | /**
|
||
87 | * NEQ operator.
|
||
88 | * @return bool TF Rect is not equal.
|
||
89 | */
|
||
90 | bool operator!=(const CNCSJPCRect& rect) { |
||
91 | return(m_X0 != rect.m_X0 || m_Y0 != rect.m_Y0 || m_X1 != rect.m_X1 || m_Y1 != rect.m_Y1);
|
||
92 | } |
||
93 | /**
|
||
94 | * LT operator.
|
||
95 | * @return bool TF Rect is LT.
|
||
96 | */
|
||
97 | bool operator<(const CNCSJPCRect& rect) { |
||
98 | return(m_X0 < rect.m_X0 || m_Y0 < rect.m_Y0);
|
||
99 | } |
||
100 | |||
101 | /**
|
||
102 | * IsValid()
|
||
103 | * @return bool TF Rect is valid (all points calculated)
|
||
104 | */
|
||
105 | bool IsValid(void) { |
||
106 | return(m_X0.Cached() && m_Y0.Cached() && m_X1.Cached() && m_Y1.Cached());
|
||
107 | } |
||
108 | protected:
|
||
109 | /** X0 of rectangle */
|
||
110 | TNCSCachedValue<INT32> m_X0; |
||
111 | /** Y0 of rectangle */
|
||
112 | TNCSCachedValue<INT32> m_Y0; |
||
113 | /** non-inclusive X1 of rectangle */
|
||
114 | TNCSCachedValue<INT32> m_X1; |
||
115 | /** non-inclusive Y1 of rectangle */
|
||
116 | TNCSCachedValue<INT32> m_Y1; |
||
117 | /** Width of rectangle */
|
||
118 | // TNCSCachedValue<UINT32> m_Height;
|
||
119 | /** Height of rectangle */
|
||
120 | // TNCSCachedValue<UINT32> m_Width;
|
||
121 | |||
122 | }; |
||
123 | |||
124 | #endif // !NCSJPCRECT_H |