svn-gvsig-desktop / tags / extI18n-0.1.0-1045_8 / libraries / libjni-ecw / include / NCSJPCRect.h @ 40799
History | View | Annotate | Download (3.99 KB)
1 | 3538 | nacho | /********************************************************
|
---|---|---|---|
2 | ** Copyright 2003 Earth Resource Mapping Ltd.
|
||
3 | ** This document contains proprietary source code of
|
||
4 | ** Earth Resource Mapping Ltd, and can only be used under
|
||
5 | ** one of the three licenses as described in the
|
||
6 | ** license.txt file supplied with this distribution.
|
||
7 | ** See separate license.txt file for license details
|
||
8 | ** and conditions.
|
||
9 | **
|
||
10 | ** This software is covered by US patent #6,442,298,
|
||
11 | ** #6,102,897 and #6,633,688. Rights to use these patents
|
||
12 | ** is included in the license agreements.
|
||
13 | **
|
||
14 | ** FILE: $Archive: /NCS/Source/include/NCSJPCRect.h $
|
||
15 | ** CREATED: 14/03/2003 3:27:34 PM
|
||
16 | ** AUTHOR: Simon Cope
|
||
17 | ** PURPOSE: CNCSJPCNode class header
|
||
18 | ** EDITS: [xx] ddMmmyy NAME COMMENTS
|
||
19 | *******************************************************/
|
||
20 | |||
21 | #ifndef NCSJPCRECT_H
|
||
22 | #define NCSJPCRECT_H
|
||
23 | |||
24 | #ifndef NCSJPCTYPES_H
|
||
25 | #include "NCSJPCTypes.h" |
||
26 | #endif // NCSJPCTYPES_H |
||
27 | |||
28 | /**
|
||
29 | * CNCSJPCRect class - the base JPC rectangle class.
|
||
30 | *
|
||
31 | * @author Simon Cope
|
||
32 | * @version $Revision$ $Author$ $Date$
|
||
33 | */
|
||
34 | class NCSJPC_EXPORT_ALL CNCSJPCRect { |
||
35 | public:
|
||
36 | /** Default constructor, initialises members */
|
||
37 | CNCSJPCRect() { |
||
38 | m_X0.m_Value = (-1 * (signed)0x7fffffff - 1); |
||
39 | m_Y0.m_Value = (-1 * (signed)0x7fffffff - 1); |
||
40 | m_X1.m_Value = (-1 * (signed)0x7fffffff - 1); |
||
41 | m_Y1.m_Value = (-1 * (signed)0x7fffffff - 1); |
||
42 | }; |
||
43 | /** constructor, specify rect values */
|
||
44 | CNCSJPCRect(INT32 nX0, INT32 nY0, INT32 nX1, INT32 nY1) { m_X0 = nX0; m_Y0 = nY0; m_X1 = nX1; m_Y1 = nY1; }; |
||
45 | /** constructor, specify rect values */
|
||
46 | CNCSJPCRect(INT32 nX0, INT32 nY0, UINT32 nWidth, UINT32 nHeight) { m_X0 = nX0; m_Y0 = nY0; m_X1 = nX0 + nWidth; m_Y1 = nY0 + nHeight; }; |
||
47 | /** Virtual destructor */
|
||
48 | virtual ~CNCSJPCRect() {}; |
||
49 | |||
50 | /**
|
||
51 | * Get X0 of this rect.
|
||
52 | * @return INT32 Coordinate value.
|
||
53 | */
|
||
54 | // virtual INT32 GetX0() { return(m_X0.Cached() ? m_X0 : 99999999); };
|
||
55 | virtual __inline INT32 GetX0() { return(m_X0); };
|
||
56 | /**
|
||
57 | * Get Y0 of this rect.
|
||
58 | * @return INT32 Coordinate value.
|
||
59 | */
|
||
60 | // virtual INT32 GetY0() { return(m_Y0.Cached() ? m_Y0 : 99999999); };
|
||
61 | virtual __inline INT32 GetY0() { return(m_Y0); };
|
||
62 | /**
|
||
63 | * Get X1 of this rect.
|
||
64 | * @return INT32 Coordinate value.
|
||
65 | */
|
||
66 | // virtual INT32 GetX1() { return(m_X1.Cached() ? m_X1 : 99999999); };
|
||
67 | virtual __inline INT32 GetX1() { return(m_X1); };
|
||
68 | /**
|
||
69 | * Get Y1 of this rect.
|
||
70 | * @return INT32 Coordinate value.
|
||
71 | */
|
||
72 | // virtual INT32 GetY1() { return(m_Y1.Cached() ? m_Y1 : 99999999); };
|
||
73 | virtual __inline INT32 GetY1() { return(m_Y1); };
|
||
74 | /**
|
||
75 | * Get Width of this rect.
|
||
76 | * @return INT32 Width value.
|
||
77 | */
|
||
78 | virtual __inline UINT32 GetWidth() { return(GetX1() - GetX0()); };
|
||
79 | /**
|
||
80 | * Get Height of this rect.
|
||
81 | * @return INT32 Height value.
|
||
82 | */
|
||
83 | virtual __inline UINT32 GetHeight() { return(GetY1() - GetY0()); };
|
||
84 | |||
85 | /**
|
||
86 | * EQ operator.
|
||
87 | * @return bool TF Rect is equal.
|
||
88 | */
|
||
89 | bool operator==(const CNCSJPCRect& rect) { |
||
90 | return(m_X0 == rect.m_X0 && m_Y0 == rect.m_Y0 && m_X1 == rect.m_X1 && m_Y1 == rect.m_Y1);
|
||
91 | } |
||
92 | /**
|
||
93 | * NEQ operator.
|
||
94 | * @return bool TF Rect is not equal.
|
||
95 | */
|
||
96 | bool operator!=(const CNCSJPCRect& rect) { |
||
97 | return(m_X0 != rect.m_X0 || m_Y0 != rect.m_Y0 || m_X1 != rect.m_X1 || m_Y1 != rect.m_Y1);
|
||
98 | } |
||
99 | /**
|
||
100 | * LT operator.
|
||
101 | * @return bool TF Rect is LT.
|
||
102 | */
|
||
103 | bool operator<(const CNCSJPCRect& rect) { |
||
104 | return(m_X0 < rect.m_X0 || m_Y0 < rect.m_Y0);
|
||
105 | } |
||
106 | |||
107 | /**
|
||
108 | * IsValid()
|
||
109 | * @return bool TF Rect is valid (all points calculated)
|
||
110 | */
|
||
111 | bool IsValid(void) { |
||
112 | return(m_X0.Cached() && m_Y0.Cached() && m_X1.Cached() && m_Y1.Cached());
|
||
113 | } |
||
114 | protected:
|
||
115 | /** X0 of rectangle */
|
||
116 | TNCSCachedValue<INT32> m_X0; |
||
117 | /** Y0 of rectangle */
|
||
118 | TNCSCachedValue<INT32> m_Y0; |
||
119 | /** non-inclusive X1 of rectangle */
|
||
120 | TNCSCachedValue<INT32> m_X1; |
||
121 | /** non-inclusive Y1 of rectangle */
|
||
122 | TNCSCachedValue<INT32> m_Y1; |
||
123 | /** Width of rectangle */
|
||
124 | // TNCSCachedValue<UINT32> m_Height;
|
||
125 | /** Height of rectangle */
|
||
126 | // TNCSCachedValue<UINT32> m_Width;
|
||
127 | |||
128 | }; |
||
129 | |||
130 | #endif // !NCSJPCRECT_H |