root / tags / v1_0_2_Build_908 / libraries / libjni-ecw / include / NCSBlockFile.h @ 11054
History | View | Annotate | Download (4.69 KB)
1 |
/**********************************************************
|
---|---|
2 |
** Copyright 1998 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: NCSBlockFile.h
|
15 |
** CREATED: 30 Jun 2004
|
16 |
** AUTHOR: Simon Cope
|
17 |
** PURPOSE:
|
18 |
** EDITS:
|
19 |
*******************************************************/
|
20 |
|
21 |
#ifndef NCSBLOCKFILE_H
|
22 |
#define NCSBLOCKFILE_H
|
23 |
|
24 |
#undef NCS_ODBC
|
25 |
|
26 |
#include "NCSEcw.h" |
27 |
#include "NCSECWClient.h" |
28 |
#include "NCSJP2File.h" |
29 |
|
30 |
#ifdef NCS_ODBC
|
31 |
#include "sql.h" |
32 |
#include "SQLEXT.H" |
33 |
#endif // NCS_ODBC |
34 |
|
35 |
/**
|
36 |
* CNCSBlockFile class - JP2/ECW File abstraction for packet stream server implementations.
|
37 |
*
|
38 |
* @author Simon Cope
|
39 |
* @version $Revision: 3538 $ $Author: nacho $ $Date: 2006-01-09 12:56:54 +0100 (Mon, 09 Jan 2006) $
|
40 |
*/
|
41 |
class NCS_EXPORT CNCSBlockFile { |
42 |
public:
|
43 |
/** Resolution level structure. */
|
44 |
typedef struct { |
45 |
/** Level number. */
|
46 |
UINT8 m_nLevel; |
47 |
/** Level Width. */
|
48 |
UINT32 m_nWidth; |
49 |
/** Level Height. */
|
50 |
UINT32 m_nHeight; |
51 |
/** Codeblock Width. */
|
52 |
UINT16 m_nBlockWidth; |
53 |
/** Codeblock Height. */
|
54 |
UINT16 m_nBlockHeight; |
55 |
/** # Codeblocks Across. */
|
56 |
UINT32 m_nBlocksWide; |
57 |
/** # Codeblocks Down. */
|
58 |
UINT32 m_nBlocksHigh; |
59 |
|
60 |
/** First packet/block number in level. */
|
61 |
UINT32 m_nFirstPacketNr; |
62 |
/** # packets/blocks in level. */
|
63 |
UINT32 m_nNrPackets; |
64 |
} ResolutionLevel; |
65 |
|
66 |
/** Default constructor. */
|
67 |
CNCSBlockFile(); |
68 |
/** virtual default destructor. */
|
69 |
virtual ~CNCSBlockFile(); |
70 |
|
71 |
/**
|
72 |
* Open a file, optionally reading the header only.
|
73 |
* @param pFilename JP2/ECW file to open
|
74 |
* @param bHeaderOnly Only read in the header.
|
75 |
* @return CNCSError NCS_SUCCESS, or Error code on failure.
|
76 |
*/
|
77 |
CNCSError Open(char *pFilename, bool bHeaderOnly); |
78 |
|
79 |
/**
|
80 |
* Close file.
|
81 |
* @return CNCSError NCS_SUCCESS, or Error code on failure.
|
82 |
*/
|
83 |
CNCSError Close(); |
84 |
|
85 |
/**
|
86 |
* Do we have the "block" table.
|
87 |
* @return bool true if we have the block table.
|
88 |
*/
|
89 |
bool HaveBlockTable();
|
90 |
/**
|
91 |
* Get the memory image of the file.
|
92 |
* @param nLength Returned length of image
|
93 |
* @return void * NCSMalloc()'d pointer to image.
|
94 |
*/
|
95 |
void *GetMemImage(UINT32 &nLength);
|
96 |
/**
|
97 |
* Get length of a packet in the file.
|
98 |
* @param nPacket Absolute Packet number to determine length for
|
99 |
* @return UINT32 Packet length or 0 on failure.
|
100 |
*/
|
101 |
UINT32 GetPacketLength(NCSBlockId nPacket); |
102 |
/**
|
103 |
* Read a packet from the file.
|
104 |
* @param nPacket Absolute Packet number to determine length for
|
105 |
* @param nLength Returned length of packet (header+data)
|
106 |
* @return void * NCSMalloc()'d pointer to read packet (header+data).
|
107 |
*/
|
108 |
void *GetPacket(NCSBlockId nPacket, UINT32 &nLength);
|
109 |
/**
|
110 |
* Get Zero (empty) packet from the file.
|
111 |
* @param nLength Returned length of packet (header+data)
|
112 |
* @return void * NCSMalloc()'d pointer to read packet (header+data).
|
113 |
*/
|
114 |
void *GetZeroPacket(UINT32 &nLength);
|
115 |
|
116 |
/**
|
117 |
* Get total # of packets/blocks in the file.
|
118 |
* @return UINT32 Number of packets/blocks in the file.
|
119 |
*/
|
120 |
UINT32 GetNrPackets(); |
121 |
|
122 |
/**
|
123 |
* Get the file info structure.
|
124 |
* @return NCSFileViewFileInfoEx * Pointer to file info structure.
|
125 |
*/
|
126 |
|
127 |
NCSFileViewFileInfoEx *GetFileInfo(); |
128 |
|
129 |
/**
|
130 |
* Get resolution levels for the file.
|
131 |
* @return std:vector<ResolutionLevel> STL vector of levels.
|
132 |
*/
|
133 |
std::vector<ResolutionLevel> GetLevels(); |
134 |
|
135 |
/**
|
136 |
* Can we support Image Web Server security on thie file.
|
137 |
* @param bIsJP2 Set to true on return if file is a JP2 compatible file
|
138 |
* @param po Set to Progression Order on return.
|
139 |
* @return bool True if we can do advanced security on this file.
|
140 |
*/
|
141 |
bool AdvancedSecurityCompatible( bool &bIsJP2, CNCSJPCProgressionOrderType::Type &po ); |
142 |
/**
|
143 |
* Can we support Image Web Server security on thie file.
|
144 |
* @return bool True if we can do advanced security on this file.
|
145 |
*/
|
146 |
bool AdvancedSecurityCompatible() {
|
147 |
bool bIsJP2;
|
148 |
CNCSJPCProgressionOrderType::Type po; |
149 |
return AdvancedSecurityCompatible( bIsJP2, po );
|
150 |
} |
151 |
|
152 |
/**
|
153 |
* Get the type of the open file.
|
154 |
* @return NCSFileType The files type.
|
155 |
*/
|
156 |
NCSFileType GetFileType(); |
157 |
|
158 |
private:
|
159 |
/** JP2 file pointer */
|
160 |
CNCSJP2File *m_pJP2File; |
161 |
/** ECW File pointer */
|
162 |
NCSFile *m_pNCSFile; |
163 |
#ifdef NCS_ODBC
|
164 |
SQLHENV m_hODBCEnv; |
165 |
SQLHDBC m_hODBCCon; |
166 |
SQLHSTMT m_hODBCCmd; |
167 |
#endif // NCS_ODBC |
168 |
}; |
169 |
|
170 |
#endif /* NCSBLOCKFILE_H */ |