Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-ecwcompress / include / NCSFile.h @ 12522

History | View | Annotate | Download (6.79 KB)

1
/********************************************************** 
2
** Copyright 1998 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:           NCSFile.c
9
** CREATED:        12 Jan 2000
10
** AUTHOR:         Mark Sheridan
11
** PURPOSE:        C++ class wrappers for the ECW library
12
** EDITS:
13
** [01] sjc 10Dec02 Temporary fix for bug #1219
14
*******************************************************/
15
/** @file NCSFile.h */
16

    
17
#ifndef NCSFILE_H
18
#define NCSFILE_H
19

    
20
#include "NCSJP2FileView.h"
21
#include "NCSECWClient.h"
22
#include "NCSErrors.h"
23
#include "NCSDefs.h"
24

    
25
typedef NCSEcwReadStatus (*NCSRefreshCallback)( class CNCSFile *pFile);
26

    
27
/** @class CNCSFile
28
 *        @brief This class is the main access point for SDK functionality using the C++ API.
29
 *
30
 *        CNCSFile inherits from CNCSJP2FileView and is the parent class of CNCSRenderer.
31
 *        Client applications will generally include classes that inherit from CNCSFile 
32
 *        and override its RefreshUpdateEx(NCSFileViewSetInfo *pViewSetInfo) method.
33
 */
34
class NCS_EXPORT CNCSFile: public CNCSJP2FileView 
35
{
36
public:
37
        /**
38
         *        Constructor.
39
         */
40
        CNCSFile();
41
        /**
42
         *        Destructor.
43
         */
44
        virtual ~CNCSFile();
45
        /**
46
         *        Open a file for input or output.
47
         *
48
         *        @param[in]        pURLPath                        The location of the file - if for input, can be a remote file.  Can be a UNC location.
49
         *        @param[in]        bProgressiveDisplay        Whether the file will be opened in progressive mode if for input.
50
         *        @param[in]        bWrite                                Whether the file is being opened for output.
51
         *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
52
         */
53
        NCSError Open ( char * pURLPath, 
54
                                        BOOLEAN bProgressiveDisplay, 
55
                                        BOOLEAN bWrite = FALSE);
56
        /**
57
         *        Close the file.
58
         *
59
         *        @param[in]        bFreeCache                        Whether to free the memory cache that is associated with the file after closing it.
60
         *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
61
         */
62
        NCSError Close ( BOOLEAN bFreeCache = TRUE );
63
        /**        
64
         *        Set the view on the open file.  This version takes world coordinates as input.
65
         *
66
         *        @param[in]        nBands                                The number of bands to include in the view being set.
67
         *        @param[in]        pBandList                        An array of band indices specifying which bands to include and in which order.
68
         *        @param[in]        nWidth                                The width of the view to construct in dataset cells.
69
         *        @param[in]        nHeight                                The height of the view to construct in dataset cells.
70
         *        @param[in]        dWorldTLX                        The left of the view to construct in world coordinates.
71
         *        @param[in]        dWorldTLY                        The top of the view to construct in world coordinates.
72
         *        @param[in]        dWorldBRX                        The right of the view to construct in world coordinates.
73
         *        @param[in]        dWorldBRY                        The bottom of the view to construct in world coordinates.
74
         *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
75
         */
76
        NCSError SetView ( INT32 nBands, INT32 *pBandList, 
77
                                           INT32 nWidth, INT32 nHeight,
78
                                           IEEE8 dWorldTLX, IEEE8 dWorldTLY,
79
                                           IEEE8 dWorldBRX, IEEE8 dWorldBRY );
80
        /**        
81
         *        Set the view on the open file.  This version takes dataset coordinates as input.
82
         *
83
         *        @param[in]        nBands                                The number of bands to include in the view being set.
84
         *        @param[in]        pBandList                        An array of band indices specifying which bands to include and in which order.
85
         *        @param[in]        nWidth                                The width of the view to construct in dataset cells.
86
         *        @param[in]        nHeight                                The height of the view to construct in dataset cells.
87
         *        @param[in]        dDatasetTLX                        The left of the view to construct in dataset coordinates.
88
         *        @param[in]        dDatasetTLY                        The top of the view to construct in dataset coordinates.
89
         *        @param[in]        dDatasetBRX                        The right of the view to construct in dataset coordinates.
90
         *        @param[in]        dDatasetBRY                        The bottom of the view to construct in dataset coordinates.
91
         *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
92
         */
93
        NCSError SetView ( INT32 nBands, INT32 *pBandList, 
94
                                           INT32 nWidth, INT32 nHeight,
95
                                           INT32 dDatasetTLX, INT32 dDatasetTLY,
96
                                           INT32 dDatasetBRX, INT32 dDatasetBRY );
97
        /**
98
         *        Rectilinear conversion from world coordinates to dataset coordinates.
99
         *
100
         *        @param[in]        dWorldX                                The world X coordinate.
101
         *        @param[in]        dWorldY                                The world Y coordinate.
102
         *        @param[out]        pnDatasetX                        A buffer for the output dataset X coordinate.
103
         *        @param[out]        pnDatasetY                        A buffer for the output dataset Y coordinate.
104
         */
105
        NCSError ConvertWorldToDataset(IEEE8 dWorldX, IEEE8 dWorldY, INT32 *pnDatasetX, INT32 *pnDatasetY);
106
        /**
107
         *        Rectilinear conversion from dataset coordinates to world coordinates.
108
         *
109
         *        @param[in]        nDatasetX                        The dataset X coordinate.
110
         *        @param[in]        nDatasetY                        The dataset Y coordinate.
111
         *        @param[out]        pdWorldX                        A buffer for the output world X coordinate.
112
         *        @param[out]        pdWorldY                        A buffer for the output world Y coordinate.
113
         */
114
        NCSError ConvertDatasetToWorld(INT32 nDatasetX, INT32 nDatasetY, IEEE8 *pdWorldX, IEEE8 *pdWorldY);
115
        /**
116
         *        Set a (void *) to a data structure containing any client data that must be accessed in the read callback.
117
         *
118
         *        @param[in]        pClientData                        (void *) pointer to client data.
119
         */
120
        void SetClientData(void *pClientData);
121
        /**        
122
         *        Obtain any client data that has been established.
123
         *
124
         *        @return                                                        (void *) pointer to client data.
125
         */
126
        void *GetClientData();
127

    
128
        /** 
129
         *        Utility function.  Breaks down a URL string into protocol, hostname, and filename components.
130
         *
131
         *        @param[in]        pURLPath                The URL to be broken down and analyzed.
132
         *        @param[out]        ppProtocol                A pointer to the protocol string resulting from the URL decomposition.
133
         *        @param[out]        ppHost                        A pointer to the hostname resulting from the URL decomposition.
134
         *        @param[out]        ppFilename                A pointer to the filename resulting from the URL decomposition.
135
         *        @return                                                BOOLEAN value, whether the input URL is a remote file.
136
         */
137
        static BOOLEAN BreakdownURL(  char *pURLPath, 
138
                                                        char **ppProtocol,
139
                                                        char **ppHost, 
140
                                                        char **ppFilename);
141
        /**        
142
         *        Obtain meaningful error text from a returned error code.
143
         *
144
         *        @param[in]        nErrorNum                Error code
145
         *        @return                                                (char *) value, an explanatory ASCII string for the error code
146
         */
147
        static const char *FormatErrorText ( NCSError nErrorNum );
148
        /**
149
         *        More data has become available and a refresh update should be done.  Deprecated.
150
         *
151
         *        @param[in]        pViewSetInfo        Pointer to a SetViewInfo containing details on view the update is from.
152
         */
153
        virtual void RefreshUpdate(NCSFileViewSetInfo *pViewSetInfo);
154
        /** 
155
         * More data is available and a refresh update should be done.
156
         *
157
         * @param[in]        pSetViewInfo                Pointer to SetViewInfo containing details on view the update is for
158
         * @return      NCSEcwReadStatus        Return the Read status code from the ReadLine*() call.
159
         */
160
        virtual NCSEcwReadStatus RefreshUpdateEx(NCSFileViewSetInfo *pViewSetInfo);
161

    
162
private:
163
        void *m_pClientData;
164
};
165

    
166
#endif /* NCSFILE_H */