svn-gvsig-desktop / tags / v1_0_2_Build_911 / libraries / libjni-ecwcompress / include / NCSJP2FileView.h @ 39111
History | View | Annotate | Download (25.2 KB)
1 |
/********************************************************
|
---|---|
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/NCSJP2FileView.h $
|
9 |
** CREATED: 14/03/2003 3:27:34 PM
|
10 |
** AUTHOR: Simon Cope
|
11 |
** PURPOSE: CNCSJP2FileView class header
|
12 |
** EDITS: [xx] ddMmmyy NAME COMMENTS
|
13 |
** [01] 07Sep04 tfl Added support for configuring georeferencing use
|
14 |
*******************************************************/
|
15 |
|
16 |
#ifndef NCSJP2FILEVIEW_H
|
17 |
#define NCSJP2FILEVIEW_H
|
18 |
|
19 |
#ifndef NCSJPCDEFS_H
|
20 |
#include "NCSJPCDefs.h" |
21 |
#endif // NCSJPCDEFS_H |
22 |
|
23 |
#ifdef NCSJPC_ECW_SUPPORT
|
24 |
#ifndef NCSECWCLIENT_H
|
25 |
#include "NCSECWClient.h" |
26 |
#endif // NCSECWCLIENT_H |
27 |
#endif // NCSJPC_ECW_SUPPORT |
28 |
|
29 |
#ifndef NCSMUTEX_H
|
30 |
#include "NCSMutex.h" |
31 |
#endif // NCSMUTEX_H |
32 |
#ifndef NCSJPCBUFFER_H
|
33 |
#include "NCSJPCBuffer.h" |
34 |
#endif // NCSJPCBUFFER_H |
35 |
#ifndef NCSJPCEVENT_H
|
36 |
#include "NCSJPCEVENT.H" |
37 |
#endif // NCSJPCEVENT_H |
38 |
#ifndef NCSJP2BOX_H
|
39 |
#include "NCSJP2Box.h" |
40 |
#endif // NCSJP2BOX_H |
41 |
|
42 |
/**
|
43 |
* CNCSJP2FileView class - the JP2 file view class.
|
44 |
*
|
45 |
* @author Simon Cope
|
46 |
* @version $Revision: 3538 $ $Author: nacho $ $Date: 2006-01-09 12:56:54 +0100 (Mon, 09 Jan 2006) $
|
47 |
*/
|
48 |
class NCSJPC_EXPORT_ALL CNCSJP2FileView: private CNCSThread { |
49 |
public:
|
50 |
typedef enum { |
51 |
ST_CODEBLOCK_DECODER_US = 0, /** Global T1 Decoder US total */ |
52 |
ST_CODEBLOCK_DECODER_SAMPLES = 1, /** Global T1 Decoder samples total */ |
53 |
ST_CODEBLOCK_READ_US = 2, /** Global Codeblock read US total */ |
54 |
ST_CODEBLOCK_READ_SAMPLES = 3, /** Global Codeblock read samples total */ |
55 |
ST_DCSHIFT_US = 10,
|
56 |
ST_MCT_US = 20,
|
57 |
ST_DWT_ROW_US = 30,
|
58 |
ST_DWT_COL_US = 31,
|
59 |
ST_DWT_SAMPLES = 32,
|
60 |
ST_VIEW_SETVIEW_US = 40,
|
61 |
ST_VIEW_READLINE_US = 41,
|
62 |
ST_VIEW_RESAMPLE_US = 42,
|
63 |
ST_IO_READ_US = 50,
|
64 |
ST_IO_WRITE_US = 51,
|
65 |
ST_IO_SEEK_US = 52,
|
66 |
ST_BUF_ALLOC_US = 60, /** Global Buffer Alloc US total */ |
67 |
ST_BUF_FREE_US = 61, /** Global Buffer Free US total */ |
68 |
ST_BUF_ALLOC_BYTES = 62, /** Global Buffer bytes allocated total */ |
69 |
ST_BUF_COPY_US = 63, /** Global Buffer Copy US total */ |
70 |
ST_BUF_COPY_BYTES = 64, /** Global Buffer bytes copied total */ |
71 |
ST_BUF_CLEAR_US = 65, /** Global Buffer Clear US total */ |
72 |
ST_BUF_CLEAR_BYTES = 66, /** Global Buffer bytes cleared total */ |
73 |
ST_COMPRESS_TOTAL_MS = 80, /** File Compression Total MS */ |
74 |
ST_COMPRESS_OUTPUT_SIZE = 81 /** File Compression output size bytes total */ |
75 |
} Statistic; |
76 |
|
77 |
typedef enum { |
78 |
JP2_COMPRESS_PROFILE_BASELINE_0 = 0, /** Default, Baseline Profile 0 */ |
79 |
JP2_COMPRESS_PROFILE_BASELINE_1 = 1, /** Baseline Profile 1 */ |
80 |
JP2_COMPRESS_PROFILE_BASELINE_2 = 2, /** Profile 2 (unrestricted) */ |
81 |
JP2_COMPRESS_PROFILE_NITF_BIIF_NPJE = 3, /** NITF NSIF BIIF NPJE Profile */ |
82 |
JP2_COMPRESS_PROFILE_NITF_BIIF_EPJE = 4, /** NITF NSIF BIIF EPJE Profile */ |
83 |
|
84 |
JP2_COMPRESS_LEVELS = 20, /** UINT32 - Calculated so r=0 <= 64x64 */ |
85 |
JP2_COMPRESS_LAYERS = 21, /** UINT32 - Default 1 */ |
86 |
JP2_COMPRESS_PRECINCT_WIDTH = 22, /** UINT32 - Default 64 or larger depending on file size */ |
87 |
JP2_COMPRESS_PRECINCT_HEIGHT = 23, /** UINT32 - Default 64 or larger depending on file size */ |
88 |
JP2_COMPRESS_TILE_WIDTH = 24, /** UINT32 - Default to image width given in SetFileInfo() */ |
89 |
JP2_COMPRESS_TILE_HEIGHT = 25, /** UINT32 - Default to image height given in SetFileInfo() */ |
90 |
JP2_COMPRESS_INCLUDE_SOP = 26, /** bool - Default false */ |
91 |
JP2_COMPRESS_INCLUDE_EPH = 27, /** bool - Default true */ |
92 |
|
93 |
JP2_COMPRESS_PROGRESSION_LRCP = 30, /** Default, LRCP progression */ |
94 |
JP2_COMPRESS_PROGRESSION_RLCP = 31, /** RLCP progression */ |
95 |
|
96 |
JP2_GEODATA_USAGE = 40, /** Control the precedence of georeferencing metadata from |
97 |
world files and embedded GML XML boxes and PCS UUID boxes */
|
98 |
JP2_DECOMPRESS_LAYERS = 100, /** UINT32 - Defaults to all */ |
99 |
JPC_DECOMPRESS_RECONSTRUCTION_PARAMETER = 101, /** IEEE4 - defaults to 0.0, ranve 0.0 <= r < 1.0 */ |
100 |
} Parameter; |
101 |
|
102 |
class NCSJPC_EXPORT_ALL CNCSJP2FileViewVector: public std::vector<CNCSJP2FileView *>, public CNCSThread { |
103 |
public:
|
104 |
virtual ~CNCSJP2FileViewVector(); |
105 |
CNCSJPCEvent m_Event; |
106 |
virtual void Work(void *pData); |
107 |
}; |
108 |
|
109 |
INT32 m_nWidth; /*!< The number of cells across the dataset */
|
110 |
INT32 m_nHeight; /*!< The number of lines down the dataset */
|
111 |
INT32 m_nNumberOfBands; /*!< The number of bands in the dataset */
|
112 |
IEEE8 m_dCompressionRate; /*!< The actual compression ratio */
|
113 |
IEEE8 m_dTargetCompressionRate;/*!< The target compression ratio */
|
114 |
IEEE8 m_dCellIncrementX; /*!< The X cell size in m_CellSizeUnits */
|
115 |
IEEE8 m_dCellIncrementY; /*!< The Y cell size in m_CellSizeUnits */
|
116 |
IEEE8 m_dOriginX; /*!< The top left X origin of the dataset (world) */
|
117 |
IEEE8 m_dOriginY; /*!< The top left Y origin of the dataset (world) */
|
118 |
|
119 |
char *m_pDatum; /*!< The GDT datum of the dataset */ |
120 |
char *m_pProjection; /*!< The GDT projection of the dataset */ |
121 |
char *m_pFilename; /*!< A pointer to the currently open filename */ |
122 |
CellSizeUnits m_CellSizeUnits;/*!< Cell units, meters, degrees or feet */
|
123 |
NCSEcwCellType m_eCellType; /*!< Cell type image should be read as */
|
124 |
NCSFileColorSpace m_eColorSpace; /*!< ColorSpace of image */
|
125 |
std::vector<NCSFileBandInfo> m_Bands; /*!< BandInfo for each band */
|
126 |
|
127 |
INT32 m_nSetViewNrBands; /*!< The number of bands in the current view */
|
128 |
INT32 *m_pnSetViewBandList; /*!< A pointer to the band list for the current view */
|
129 |
INT32 m_nSetViewWidth; /*!< The current view width */
|
130 |
INT32 m_nSetViewHeight; /*!< The current view height */
|
131 |
IEEE8 m_dSetViewWorldTLX; /*!< The current view world top left X */
|
132 |
IEEE8 m_dSetViewWorldTLY; /*!< The current view world top left Y */
|
133 |
IEEE8 m_dSetViewWorldBRX; /*!< The current view world bottom right X */
|
134 |
IEEE8 m_dSetViewWorldBRY; /*!< The current view world bottom right Y */
|
135 |
INT32 m_nSetViewDatasetTLX; /*!< The current view dataset top left X */
|
136 |
INT32 m_nSetViewDatasetTLY; /*!< The current view dataset top left Y */
|
137 |
INT32 m_nSetViewDatasetBRX; /*!< The current view dataset bottom right X */
|
138 |
INT32 m_nSetViewDatasetBRY; /*!< The current view dataset bottom right Y */
|
139 |
|
140 |
/** Default constructor, initialises members */
|
141 |
CNCSJP2FileView(); |
142 |
/** Virtual Destructor */
|
143 |
virtual ~CNCSJP2FileView(); |
144 |
#ifdef _WCHAR_T_DEFINED
|
145 |
/**
|
146 |
* Open the JP2 file for Parsing/UnParsing.
|
147 |
* @param pURLPath Full path name of JP2 file to open
|
148 |
* @param bProgressiveDisplay Open for preogressive reading.
|
149 |
* @return CNCSError NCS_SUCCESS or error code on failure.
|
150 |
*/
|
151 |
virtual CNCSError Open(wchar_t *pURLPath, bool bProgressiveDisplay = false, bool bWrite = false); |
152 |
#endif
|
153 |
/**
|
154 |
* Open the JP2 file for Parsing/UnParsing.
|
155 |
* @param pURLPath Full path name of JP2 file to open
|
156 |
* @param bProgressiveDisplay Open for preogressive reading.
|
157 |
* @return CNCSError NCS_SUCCESS or error code on failure.
|
158 |
*/
|
159 |
virtual CNCSError Open(char *pURLPath, bool bProgressiveDisplay = false, bool bWrite = false); |
160 |
/**
|
161 |
* Close the JP2 file
|
162 |
* @param bFreeCache Free the cached JP2 file data.
|
163 |
* @return CNCSError NCS_SUCCESS or error code on failure.
|
164 |
*/
|
165 |
virtual CNCSError Close ( bool bFreeCache = false ); |
166 |
|
167 |
/**
|
168 |
* Set a view into the JP2 file for reading.
|
169 |
* @param nBands Number of bands in pBandList to read
|
170 |
* @param pBandList Array of band indices to read.
|
171 |
* @param nWidth Width of the view in pixels
|
172 |
* @param nHeight Height of the view in pixels
|
173 |
* @param nDatasetTLX Top left X dataset coordinate of view
|
174 |
* @param nDatasetTLY Top left Y dataset coordinate of view
|
175 |
* @param nDatasetBRX Bottom right X dataset coordinate of view
|
176 |
* @param nDatasetBRY Bottom right Y dataset voordinate of view
|
177 |
* @param dWorldTLX Top left X world coordinate of view (informative only)
|
178 |
* @param dWorldTLY Top left Y world coordinate of view (informative only)
|
179 |
* @param dWorldBRX Bottom right X world coordinate of view (informative only)
|
180 |
* @param dWorldBRY Bottom right Y world coordinate of view (informative only)
|
181 |
* @return CNCSError NCS_SUCCESS or error code on failure.
|
182 |
*/
|
183 |
virtual CNCSError SetView(UINT32 nBands, UINT32 *pBandList, |
184 |
UINT32 nDatasetTLX, UINT32 nDatasetTLY, |
185 |
UINT32 nDatasetBRX, UINT32 nDatasetBRY, |
186 |
UINT32 nWidth, UINT32 nHeight, |
187 |
IEEE8 dWorldTLX = 0.0, IEEE8 dWorldTLY = 0.0, |
188 |
IEEE8 dWorldBRX = 0.0, IEEE8 dWorldBRY = 0.0); |
189 |
|
190 |
/**
|
191 |
* Read the next line in BIL format from the current view into the file.
|
192 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
193 |
* @return NCSEcwReadStatus Read status code
|
194 |
*/
|
195 |
virtual NCSEcwReadStatus ReadLineBIL(UINT8 **ppOutputLine); |
196 |
/**
|
197 |
* Read the next line in BIL format from the current view into the file.
|
198 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
199 |
* @return NCSEcwReadStatus Read status code
|
200 |
*/
|
201 |
virtual NCSEcwReadStatus ReadLineBIL(UINT16 **ppOutputLine); |
202 |
/**
|
203 |
* Read the next line in BIL format from the current view into the file.
|
204 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
205 |
* @return NCSEcwReadStatus Read status code
|
206 |
*/
|
207 |
virtual NCSEcwReadStatus ReadLineBIL(UINT32 **ppOutputLine); |
208 |
/**
|
209 |
* Read the next line in BIL format from the current view into the file.
|
210 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
211 |
* @return NCSEcwReadStatus Read status code
|
212 |
*/
|
213 |
virtual NCSEcwReadStatus ReadLineBIL(UINT64 **ppOutputLine); |
214 |
/**
|
215 |
* Read the next line in BIL format from the current view into the file.
|
216 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
217 |
* @return NCSEcwReadStatus Read status code
|
218 |
*/
|
219 |
virtual NCSEcwReadStatus ReadLineBIL(INT8 **ppOutputLine); |
220 |
/**
|
221 |
* Read the next line in BIL format from the current view into the file.
|
222 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
223 |
* @return NCSEcwReadStatus Read status code
|
224 |
*/
|
225 |
virtual NCSEcwReadStatus ReadLineBIL(INT16 **ppOutputLine); |
226 |
/**
|
227 |
* Read the next line in BIL format from the current view into the file.
|
228 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
229 |
* @return NCSEcwReadStatus Read status code
|
230 |
*/
|
231 |
virtual NCSEcwReadStatus ReadLineBIL(INT32 **ppOutputLine); |
232 |
/**
|
233 |
* Read the next line in BIL format from the current view into the file.
|
234 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
235 |
* @return NCSEcwReadStatus Read status code
|
236 |
*/
|
237 |
virtual NCSEcwReadStatus ReadLineBIL(INT64 **ppOutputLine); |
238 |
/**
|
239 |
* Read the next line in BIL format from the current view into the file.
|
240 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
241 |
* @return NCSEcwReadStatus Read status code
|
242 |
*/
|
243 |
virtual NCSEcwReadStatus ReadLineBIL(IEEE4 **ppOutputLine); |
244 |
/**
|
245 |
* Read the next line in BIL format from the current view into the file.
|
246 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
247 |
* @return NCSEcwReadStatus Read status code
|
248 |
*/
|
249 |
virtual NCSEcwReadStatus ReadLineBIL(IEEE8 **ppOutputLine); |
250 |
/**
|
251 |
* Read the next line in RGB UINT8 triplet format from the current view into the file.
|
252 |
* @param pRGBTripler Pointer to UINT8 buffer to receive RGB data
|
253 |
* @return NCSEcwReadStatus Read status code
|
254 |
*/
|
255 |
virtual NCSEcwReadStatus ReadLineRGB(UINT8 *pRGBTriplet); |
256 |
/**
|
257 |
* Read the next line in BGR UINT8 triplet format from the current view into the file.
|
258 |
* @param pBGRTripler Pointer to UINT8 buffer to receive BGR data
|
259 |
* @return NCSEcwReadStatus Read status code
|
260 |
*/
|
261 |
virtual NCSEcwReadStatus ReadLineBGR(UINT8 *pBGRTriplet); |
262 |
/**
|
263 |
* Read the next line in RGBA UINT32 format from the current view into the file.
|
264 |
* @param pRGBA Pointer to UINT32 buffer to receive RGBA data
|
265 |
* @return NCSEcwReadStatus Read status code
|
266 |
*/
|
267 |
virtual NCSEcwReadStatus ReadLineRGBA(UINT32 *pRGBA); |
268 |
/**
|
269 |
* Read the next line in BGRA UINT32 format from the current view into the file.
|
270 |
* @param pBGRA Pointer to UINT32 buffer to receive BGRA data
|
271 |
* @return NCSEcwReadStatus Read status code
|
272 |
*/
|
273 |
virtual NCSEcwReadStatus ReadLineBGRA(UINT32 *pBGRA); |
274 |
/**
|
275 |
* Read the next line in ARGB UINT32 format from the current view into the file.
|
276 |
* @param pARGB Pointer to UINT32 buffer to receive ARGB data
|
277 |
* @return NCSEcwReadStatus Read status code
|
278 |
*/
|
279 |
virtual NCSEcwReadStatus ReadLineARGB(UINT32 *pARGB); |
280 |
/**
|
281 |
* Read the next line in ABGR UINT32 format from the current view into the file.
|
282 |
* @param pABGR Pointer to UINT32 buffer to receive ABGR data
|
283 |
* @return NCSEcwReadStatus Read status code
|
284 |
*/
|
285 |
virtual NCSEcwReadStatus ReadLineABGR(UINT32 *pABGR); |
286 |
/**
|
287 |
* Read the next line in BIL format from the current view into the file.
|
288 |
* @param eType Output buffer type
|
289 |
* @param nBands Number of output bands
|
290 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
291 |
* @param pLineSteps Line steps, in CELLS.
|
292 |
* @return NCSEcwReadStatus Read status code
|
293 |
*/
|
294 |
virtual NCSEcwReadStatus ReadLineBIL(NCSEcwCellType eType, UINT16 nBands, void **ppOutputLine, UINT32 *pLineSteps = NULL); |
295 |
|
296 |
/**
|
297 |
* Write the next line in BIL format into the JP2 file.
|
298 |
* @param eType Output buffer type
|
299 |
* @param nBands Number of output bands
|
300 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
301 |
* @param pLineSteps Line steps, in CELLS.
|
302 |
* @return CNCSError Write status code
|
303 |
*/
|
304 |
virtual CNCSError WriteLineBIL(NCSEcwCellType eType, UINT16 nBands, void **ppOutputLine, UINT32 *pLineSteps = NULL); |
305 |
|
306 |
/**
|
307 |
* More data is available and a refresh update should be done.
|
308 |
* @param pSetViewInfo Pointer to SetViewInfo containing details on view the update is for
|
309 |
* @return NCSEcwReadStatus Return the Read status code from the ReadLine*() call.
|
310 |
*/
|
311 |
virtual NCSEcwReadStatus RefreshUpdateEx(NCSFileViewSetInfo *pViewSetInfo); |
312 |
|
313 |
/**
|
314 |
* Start the compression.
|
315 |
* In progressive (pull) mode scanlines will be sequentially
|
316 |
* read by the overloaded WriteReadLine() method
|
317 |
* @param eType Output buffer type
|
318 |
* @param nBands Number of output bands
|
319 |
* @param ppOutputLine Array of buffer pointers, one buffer for each band
|
320 |
* @param pLineSteps Line steps, in CELLS.
|
321 |
* @return CNCSError Write status code
|
322 |
*/
|
323 |
virtual CNCSError Write(); |
324 |
/**
|
325 |
* Read input line for compression.
|
326 |
* In progressive (pull) mode scanlines will be sequentially
|
327 |
* read by the overloaded WriteReadLine() method
|
328 |
* @param nNextLine Next input line to read
|
329 |
* @param ppInputArray Array of buffer pointers, one buffer for each band
|
330 |
* @return CNCSError Write status code
|
331 |
*/
|
332 |
virtual CNCSError WriteReadLine(UINT32 nNextLine, void **ppInputArray);
|
333 |
/**
|
334 |
* Compression status callback.
|
335 |
* you overload this if you want a status callback to show progress during compression
|
336 |
* @param nCurrentLine Current input line processed
|
337 |
*/
|
338 |
virtual void WriteStatus(UINT32 nCurrentLine);
|
339 |
/**
|
340 |
* Compression cancel callback.
|
341 |
* you overload this if you want to be able to cancel during compression
|
342 |
* @return bool Return true to cancel, else false to continue
|
343 |
*/
|
344 |
virtual bool WriteCancel(void); |
345 |
|
346 |
/**
|
347 |
* Get current ViewSetinfo structure.
|
348 |
* @return NCSFileViewSetInfo* Return pointer to the current SetViewInfo.
|
349 |
*/
|
350 |
virtual /*const*/ NCSFileViewSetInfo *GetFileViewSetInfo();
|
351 |
/**
|
352 |
* Get FileInfo structure.
|
353 |
* @return NCSFileViewFileInfo* Return pointer to the FileInfo.
|
354 |
*/
|
355 |
virtual /*const*/ NCSFileViewFileInfoEx *GetFileInfo();
|
356 |
/**
|
357 |
* Set FileInfo structure.
|
358 |
* @param Info New fileinfo - used to specify file info for compression
|
359 |
* @return CNCSError Return pointer to the FileInfo.
|
360 |
*/
|
361 |
virtual CNCSError SetFileInfo(NCSFileViewFileInfoEx &Info); |
362 |
|
363 |
/**
|
364 |
* Get the next UUID box with the specified UUID from the file.
|
365 |
* @param uuid UUID of UUID box to find.
|
366 |
* @param pLast Last UUID box found, else NULL for first
|
367 |
* @return CNCSJP2Box* Pointer to box if found, else NULL;
|
368 |
*/
|
369 |
virtual CNCSJP2Box *GetUUIDBox(NCSUUID uuid, CNCSJP2Box *pLast = NULL);
|
370 |
/**
|
371 |
* Get the next XML box from the file.
|
372 |
* @param pLast Last XML box found, else NULL for first
|
373 |
* @return CNCSJP2Box* Pointer to box if found, else NULL;
|
374 |
*/
|
375 |
virtual CNCSJP2Box *GetXMLBox(CNCSJP2Box *pLast = NULL);
|
376 |
/**
|
377 |
* Get the next box of the specified type from the file.
|
378 |
* @param nTBox Box type to find
|
379 |
* @param pLast Last box found, else NULL for first
|
380 |
* @return CNCSJP2Box* Pointer to box if found, else NULL;
|
381 |
*/
|
382 |
virtual CNCSJP2Box *GetBox(UINT32 nTBox, CNCSJP2Box *pLast = NULL);
|
383 |
/**
|
384 |
* Add a box to be written to the file on compression.
|
385 |
* The specified box's UnParse() method will be called to write the box into the file
|
386 |
* @param pBox Box to be written to file
|
387 |
* @return CNCSError returned error or NCS_SUCCESS;
|
388 |
*/
|
389 |
virtual CNCSError AddBox(CNCSJP2Box *pBox); |
390 |
|
391 |
/**
|
392 |
* Get a GDT (ER Mapper) Projection/Datum pair for the given EPSG code, if available
|
393 |
* @param nEPSGCode EPSG Code to find projection/datum for
|
394 |
* @param ppProjection Returned GDT Projection name - free with NCSFree()
|
395 |
* @param ppDatum Returned GDT Datum name - free with NCSFree()
|
396 |
* @return CNCSError Error code;
|
397 |
*/
|
398 |
static CNCSError GetGDTProjDat(UINT32 nEPSGCode, char **ppProjection, char **ppDatum); |
399 |
/**
|
400 |
* Get an EPSG code from the given GDT (ER Mapper) Projection/Datum pair if available
|
401 |
* @param pProjection GDT Projection name
|
402 |
* @param pDatum GDT Datum name
|
403 |
* @param nEPSGCode Returned EPSG Code or 0 on error
|
404 |
* @return CNCSError Error code;
|
405 |
*/
|
406 |
static CNCSError GetEPSGCode(char *pProjection, char *pDatum, UINT32 &nEPSGCode); |
407 |
|
408 |
/**
|
409 |
* Set refresh callback funnction
|
410 |
* @param pCallback Refresh callback function to use
|
411 |
* @return CNCSError Error code;
|
412 |
*/
|
413 |
CNCSError SetRefreshCallback(NCSEcwReadStatus (*pCallback)(NCSFileView*)); |
414 |
|
415 |
/**
|
416 |
* Set Compress Client - Internal func for "C" API support only
|
417 |
* @param pCompressClient ECW Compress Client struct
|
418 |
* @return CNCSError Error code;
|
419 |
*/
|
420 |
CNCSError SetCompressClient(struct NCSEcwCompressClient *pCompressClient);
|
421 |
|
422 |
/**
|
423 |
* Get underlying CNCSJP2File pointer.
|
424 |
* @return CNCSJP2File* Return pointer to the CNCSJP2File instance.
|
425 |
*/
|
426 |
class CNCSJP2File *GetFile(); |
427 |
#ifdef NCSJPC_ECW_SUPPORT
|
428 |
/**
|
429 |
* Get underlying NCSFileView pointer, where it exists.
|
430 |
* @return NCSFileView* Return pointer to the NCSFileView instance.
|
431 |
*/
|
432 |
NCSFileView *GetNCSFileView(); |
433 |
#endif
|
434 |
|
435 |
/**
|
436 |
* Get a pointer to the underlying CNCSJPCIOStream.
|
437 |
* This can be used to read specific JP2 UUID/XML boxes etc.
|
438 |
* @return CNCSJPCIOStream* Return pointer to the CNCSJPCIOStream, else NULL.
|
439 |
*/
|
440 |
CNCSJPCIOStream *GetStream(); |
441 |
|
442 |
/**
|
443 |
* Find the CNCSJP2FileVIew instance pointer for a given NCSFileView structure
|
444 |
* @param pNCSFileView NCSFileView to find
|
445 |
* @return CNCSJP2FileView* CNCSJP2FileView instance if found, else NULL
|
446 |
*/
|
447 |
static CNCSJP2FileView *FindJP2FileView(NCSFileView *pNCSFileView);
|
448 |
|
449 |
/**
|
450 |
* Get a statistic of NCSTimeStampMs type
|
451 |
* @param eType Statistic to find
|
452 |
* @param Val Statistic value
|
453 |
*/
|
454 |
void GetStatistic(Statistic eType, NCSTimeStampMs &Val);
|
455 |
/**
|
456 |
* Get a statistic of UINT64 type
|
457 |
* @param eType Statistic to find
|
458 |
* @param Val Statistic value
|
459 |
*/
|
460 |
void GetStatistic(Statistic eType, UINT64 &Val);
|
461 |
/**
|
462 |
* Reset the specified statistic to the default value
|
463 |
* @param eType Statistic to reset
|
464 |
*/
|
465 |
void ResetStatistic(Statistic eType);
|
466 |
/**
|
467 |
* Reset all statistics to their default values
|
468 |
*/
|
469 |
void ResetStatistics();
|
470 |
|
471 |
/**
|
472 |
* Set a parameter on the view. These over-ride default settings, such as compression output profile,
|
473 |
* progression order, tiling etc
|
474 |
* @param eType Parameter type to set.
|
475 |
*/
|
476 |
void SetParameter(Parameter eType);
|
477 |
/**
|
478 |
* Set a parameter on the view. These over-ride default settings, such as compression output profile,
|
479 |
* progression order, tiling etc
|
480 |
* @param eType Parameter type to set.
|
481 |
* @param bBool Boolean parameter true/false
|
482 |
*/
|
483 |
void SetParameter(Parameter eType, bool bBool); |
484 |
/**
|
485 |
* Set a parameter on the view. These over-ride default settings, such as compression output profile,
|
486 |
* progression order, tiling etc
|
487 |
* @param eType Parameter type to set.
|
488 |
* @param nValue UINT32 parameter value to set
|
489 |
*/
|
490 |
void SetParameter(Parameter eType, UINT32 nValue);
|
491 |
/**
|
492 |
* Set a parameter on the view. These over-ride default settings, such as compression output profile,
|
493 |
* progression order, tiling etc
|
494 |
* @param eType Parameter type to set.
|
495 |
* @param fValue IEEE4 parameter value to set
|
496 |
*/
|
497 |
void SetParameter(Parameter eType, IEEE4 fValue);
|
498 |
|
499 |
/**
|
500 |
* Get the percent complete (from time of setview == 0%)
|
501 |
* @return INT32 Returned Percent complete
|
502 |
*/
|
503 |
INT32 GetPercentComplete(); |
504 |
|
505 |
/**
|
506 |
* Get the percent complete as a percentage of total blocks in the current view.
|
507 |
* @return INT32 Returned Percent complete
|
508 |
*/
|
509 |
INT32 GetPercentCompleteTotalBlocksInView(); |
510 |
|
511 |
/**
|
512 |
* Internal shutdown function.
|
513 |
*/
|
514 |
static void Shutdown(); |
515 |
|
516 |
/**
|
517 |
* Call this function to enable unlimited compression.
|
518 |
* NOTE: Verify you are in compliance with the appropriate license agreements.
|
519 |
* Calling this function signifies you accept the terms of the appropriate license.
|
520 |
*/
|
521 |
static void SetKeySize(void); |
522 |
|
523 |
protected:
|
524 |
/** Timestamp representing lat time a blocking read was called */
|
525 |
NCSTimeStampMs m_tsLastBlockTime; |
526 |
/** Next line in view to read */
|
527 |
UINT32 m_nNextLine; |
528 |
|
529 |
friend class CNCSJPCResample; |
530 |
/** Add a dynamically allocated node to the dynamic node list so it is released */
|
531 |
void AddDynamicNode(class CNCSJPCNode *pNode) { m_DynamicNodes.push_back(pNode); };
|
532 |
|
533 |
protected:
|
534 |
friend CNCSJP2FileViewVector; |
535 |
/** Display update is progressive for this view */
|
536 |
bool m_bIsProgressive;
|
537 |
/** SetView is valid */
|
538 |
bool m_bHaveValidSetView;
|
539 |
/** Set view mode is world? */
|
540 |
bool m_bSetViewModeIsWorld;
|
541 |
/** File is open */
|
542 |
bool m_bIsOpen;
|
543 |
/** File is open */
|
544 |
bool m_bIsWrite;
|
545 |
|
546 |
/** CNCSJP2File */
|
547 |
CNCSJP2File *m_pFile; |
548 |
/** ECW SetViewInfo Structure */
|
549 |
NCSFileViewSetInfo m_CurrentView; |
550 |
/** Do we have a pending setview */
|
551 |
bool m_bPendingView;
|
552 |
/** Progressive pending View */
|
553 |
NCSFileViewSetInfo m_PendingView; |
554 |
/** JP2 Compression Output node */
|
555 |
class CNCSJPCNode *m_pOutputNode; |
556 |
|
557 |
private:
|
558 |
class NCSJPC_EXPORT_ALL ParameterValuePair { |
559 |
public:
|
560 |
Parameter m_eParam; |
561 |
void *m_pValue;
|
562 |
|
563 |
ParameterValuePair(); |
564 |
ParameterValuePair(const ParameterValuePair &Src);
|
565 |
ParameterValuePair(Parameter eParam); |
566 |
ParameterValuePair(Parameter eParam, bool bValue);
|
567 |
ParameterValuePair(Parameter eParam, UINT32 nValue); |
568 |
ParameterValuePair(Parameter eParam, IEEE4 fValue); |
569 |
virtual ~ParameterValuePair(); |
570 |
}; |
571 |
|
572 |
UINT32 m_nBlocksAtLastRefreshUpdate; |
573 |
bool m_bInRefreshUpdate;
|
574 |
bool m_bCancelRead;
|
575 |
bool m_bLowMemCompress;
|
576 |
|
577 |
std::vector<ParameterValuePair> m_Parameters; |
578 |
void SetFileParameters();
|
579 |
/** List of other JP2 box(es) to be included in the output file */
|
580 |
CNCSJP2Box::CNCSJP2BoxList m_OtherBoxes; |
581 |
|
582 |
/** Used when SetView is >4000 in either dimension - too large to cache */
|
583 |
bool m_bTiledView;
|
584 |
std::vector<CNCSJP2FileView *> m_TiledViews; |
585 |
CNCSError SetTiledView(NCSFileViewSetInfo &View, UINT32 nReadLine); |
586 |
|
587 |
/** Static list of file views */
|
588 |
static CNCSJP2FileViewVector sm_Views;
|
589 |
/** Dynamic Nodes to free */
|
590 |
CNCSJPCNodeVector m_DynamicNodes; |
591 |
|
592 |
// The following private members are here to support the "C" API only.
|
593 |
// Progressive read callback for ECW decompression
|
594 |
NCSEcwReadStatus (*m_pRefreshCallback)(NCSFileView *pNCSFileView); |
595 |
// ECW Compress Client for "C" compression API
|
596 |
struct NCSEcwCompressClient *m_pCompressClient;
|
597 |
|
598 |
NCSTimeStampMs m_tsCompressStart; |
599 |
NCSTimeStampMs m_tsCompressEnd; |
600 |
|
601 |
// JP2 compression progressive buffer queue
|
602 |
std::vector<CNCSJPCBufferVector*> m_CompressReadQueue; |
603 |
CNCSJPCEvent m_CompressReadEvent; |
604 |
std::vector<CNCSJPCBufferVector*> m_CompressFreeQueue; |
605 |
CNCSJPCEvent m_CompressFreeEvent; |
606 |
CNCSMutex m_CompressQueueMutex; |
607 |
CNCSError m_CompressError; |
608 |
bool m_bCompressMTRead;
|
609 |
#ifdef NCSJPC_ECW_SUPPORT
|
610 |
// ECW File reading
|
611 |
NCSFileView *m_pECWFileView; |
612 |
static NCSEcwReadStatus sRefreshCallback(NCSFileView *pNCSFileView);
|
613 |
|
614 |
// ECW File writing
|
615 |
struct EcwCompressionTask *m_pECWCompressionTask;
|
616 |
|
617 |
static void sECWCompressThreadReadFunc(void *pData); |
618 |
static NCSError sECWCompressRead(void *pClient, UINT32 nNextLine, IEEE4 **ppInputArray); |
619 |
static void sECWCompressStatus(void *pClient, UINT32 nCurrentLine); |
620 |
static BOOLEAN sECWCompressCancel(void *pClient); |
621 |
#endif // NCSJPC_ECW_SUPPORT |
622 |
|
623 |
/** JP2 resampler */
|
624 |
CNCSJPCResample *m_pResampler; |
625 |
|
626 |
/** Scanline input buffer */
|
627 |
CNCSJPCBuffer m_InputBuf; |
628 |
|
629 |
/** Update the public file & view members */
|
630 |
bool UpdateFileViewInfo(void); |
631 |
|
632 |
/** Delete all dynamic nodes */
|
633 |
void DeleteDynamicNodes(void); |
634 |
|
635 |
void UpdateViewStats();
|
636 |
|
637 |
/** Thread Work func for JP2 progressive compression */
|
638 |
void Work(void *pDate); |
639 |
}; |
640 |
|
641 |
#endif // !NCSJP2FILEVIEW_H |