Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_1_Build_1016 / libraries / libjni-ecw / include / NCSFile.h @ 33925

History | View | Annotate | Download (8.29 KB)

1 3538 nacho
/**********************************************************
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:           NCSFile.c
15
** CREATED:        12 Jan 2000
16
** AUTHOR:         Mark Sheridan
17
** PURPOSE:        C++ class wrappers for the ECW library
18
** EDITS:
19
** [01] sjc 10Dec02 Temporary fix for bug #1219
20
*******************************************************/
21
/** @file NCSFile.h */
22
23
#ifndef NCSFILE_H
24
#define NCSFILE_H
25
26
#include "NCSJP2FileView.h"
27
#include "NCSECWClient.h"
28
#include "NCSErrors.h"
29
#include "NCSDefs.h"
30
31
typedef NCSEcwReadStatus (*NCSRefreshCallback)( class CNCSFile *pFile);
32
33
/** @class CNCSFile
34
 *        @brief This class is the main access point for SDK functionality using the C++ API.
35
 *
36
 *        CNCSFile inherits from CNCSJP2FileView and is the parent class of CNCSRenderer.
37
 *        Client applications will generally include classes that inherit from CNCSFile
38
 *        and override its RefreshUpdateEx(NCSFileViewSetInfo *pViewSetInfo) method.
39
 */
40
class NCS_EXPORT CNCSFile: public CNCSJP2FileView
41
{
42
public:
43
        /**
44
         *        Constructor.
45
         */
46
        CNCSFile();
47
        /**
48
         *        Destructor.
49
         */
50
        virtual ~CNCSFile();
51
        /**
52
         *        Open a file for input or output.
53
         *
54
         *        @param[in]        pURLPath                        The location of the file - if for input, can be a remote file.  Can be a UNC location.
55
         *        @param[in]        bProgressiveDisplay        Whether the file will be opened in progressive mode if for input.
56
         *        @param[in]        bWrite                                Whether the file is being opened for output.
57
         *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
58
         */
59
        NCSError Open ( char * pURLPath,
60
                                        BOOLEAN bProgressiveDisplay,
61
                                        BOOLEAN bWrite = FALSE);
62
        /**
63
         *        Close the file.
64
         *
65
         *        @param[in]        bFreeCache                        Whether to free the memory cache that is associated with the file after closing it.
66
         *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
67
         */
68
        NCSError Close ( BOOLEAN bFreeCache = TRUE );
69
        /**
70
         *        Set the view on the open file.  This version takes world coordinates as input.
71
         *
72
         *        @param[in]        nBands                                The number of bands to include in the view being set.
73
         *        @param[in]        pBandList                        An array of band indices specifying which bands to include and in which order.
74
         *        @param[in]        nWidth                                The width of the view to construct in dataset cells.
75
         *        @param[in]        nHeight                                The height of the view to construct in dataset cells.
76
         *        @param[in]        dWorldTLX                        The left of the view to construct in world coordinates.
77
         *        @param[in]        dWorldTLY                        The top of the view to construct in world coordinates.
78
         *        @param[in]        dWorldBRX                        The right of the view to construct in world coordinates.
79
         *        @param[in]        dWorldBRY                        The bottom of the view to construct in world coordinates.
80
         *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
81
         */
82
        NCSError SetView ( INT32 nBands, INT32 *pBandList,
83
                                           INT32 nWidth, INT32 nHeight,
84
                                           IEEE8 dWorldTLX, IEEE8 dWorldTLY,
85
                                           IEEE8 dWorldBRX, IEEE8 dWorldBRY );
86
        /**
87
         *        Set the view on the open file.  This version takes dataset coordinates as input.
88
         *
89
         *        @param[in]        nBands                                The number of bands to include in the view being set.
90
         *        @param[in]        pBandList                        An array of band indices specifying which bands to include and in which order.
91
         *        @param[in]        nWidth                                The width of the view to construct in dataset cells.
92
         *        @param[in]        nHeight                                The height of the view to construct in dataset cells.
93
         *        @param[in]        dDatasetTLX                        The left of the view to construct in dataset coordinates.
94
         *        @param[in]        dDatasetTLY                        The top of the view to construct in dataset coordinates.
95
         *        @param[in]        dDatasetBRX                        The right of the view to construct in dataset coordinates.
96
         *        @param[in]        dDatasetBRY                        The bottom of the view to construct in dataset coordinates.
97
         *        @return                                                        NCSError value, NCS_SUCCESS or any applicable error code
98
         */
99
        NCSError SetView ( INT32 nBands, INT32 *pBandList,
100
                                           INT32 nWidth, INT32 nHeight,
101
                                           INT32 dDatasetTLX, INT32 dDatasetTLY,
102
                                           INT32 dDatasetBRX, INT32 dDatasetBRY );
103
        /**
104
         *        Rectilinear conversion from world coordinates to dataset coordinates.
105
         *
106
         *        @param[in]        dWorldX                                The world X coordinate.
107
         *        @param[in]        dWorldY                                The world Y coordinate.
108
         *        @param[out]        pnDatasetX                        A buffer for the output dataset X coordinate.
109
         *        @param[out]        pnDatasetY                        A buffer for the output dataset Y coordinate.
110
         */
111
        NCSError ConvertWorldToDataset(IEEE8 dWorldX, IEEE8 dWorldY, INT32 *pnDatasetX, INT32 *pnDatasetY);
112
        /**
113
         *        Rectilinear conversion from dataset coordinates to world coordinates.
114
         *
115
         *        @param[in]        nDatasetX                        The dataset X coordinate.
116
         *        @param[in]        nDatasetY                        The dataset Y coordinate.
117
         *        @param[out]        pdWorldX                        A buffer for the output world X coordinate.
118
         *        @param[out]        pdWorldY                        A buffer for the output world Y coordinate.
119
         */
120
        NCSError ConvertDatasetToWorld(INT32 nDatasetX, INT32 nDatasetY, IEEE8 *pdWorldX, IEEE8 *pdWorldY);
121
        /**
122
         *        Set a (void *) to a data structure containing any client data that must be accessed in the read callback.
123
         *
124
         *        @param[in]        pClientData                        (void *) pointer to client data.
125
         */
126
        void SetClientData(void *pClientData);
127
        /**
128
         *        Obtain any client data that has been established.
129
         *
130
         *        @return                                                        (void *) pointer to client data.
131
         */
132
        void *GetClientData();
133
134
        /**
135
         *        Utility function.  Breaks down a URL string into protocol, hostname, and filename components.
136
         *
137
         *        @param[in]        pURLPath                The URL to be broken down and analyzed.
138
         *        @param[out]        ppProtocol                A pointer to the protocol string resulting from the URL decomposition.
139
         *        @param[out]        ppHost                        A pointer to the hostname resulting from the URL decomposition.
140
         *        @param[out]        ppFilename                A pointer to the filename resulting from the URL decomposition.
141
         *        @return                                                BOOLEAN value, whether the input URL is a remote file.
142
         */
143
        static BOOLEAN BreakdownURL(  char *pURLPath,
144
                                                        char **ppProtocol,
145
                                                        char **ppHost,
146
                                                        char **ppFilename);
147
        /**
148
         *        Obtain meaningful error text from a returned error code.
149
         *
150
         *        @param[in]        nErrorNum                Error code
151
         *        @return                                                (char *) value, an explanatory ASCII string for the error code
152
         */
153
        static const char *FormatErrorText ( NCSError nErrorNum );
154
        /**
155
         *        More data has become available and a refresh update should be done.  Deprecated.
156
         *
157
         *        @param[in]        pViewSetInfo        Pointer to a SetViewInfo containing details on view the update is from.
158
         */
159
        virtual void RefreshUpdate(NCSFileViewSetInfo *pViewSetInfo);
160
        /**
161
         * More data is available and a refresh update should be done.
162
         *
163
         * @param[in]        pSetViewInfo                Pointer to SetViewInfo containing details on view the update is for
164
         * @return      NCSEcwReadStatus        Return the Read status code from the ReadLine*() call.
165
         */
166
        virtual NCSEcwReadStatus RefreshUpdateEx(NCSFileViewSetInfo *pViewSetInfo);
167
168
private:
169
        void *m_pClientData;
170
};
171
        /**
172
         * Set the custom GDT data path (for EPSG<-->ER Mapper projection/datum mapping)
173
         * @param szPath the new GDT data path
174
         */
175
extern "C" void        NCSSetGDTPath(char *szPath);
176
        /**
177
         * Get the custom GDT data path (for EPSG<-->ER Mapper projection/datum mapping)
178
         * @return the custom path being used, or NULL
179
         */
180
extern "C" char *NCSGetGDTPath();
181
        /**
182
         * Get an EPSG Code for a specified GDT Datum/Projection pairing
183
         * @param                szDatum                        GDT Datum name
184
         * @param                szProjection        GDT Projection name
185
         * @param                pnEPSG                        Returned EPSG code
186
         * @return                NCSError                NCS_SUCCESS, or error on failure
187
         */
188
extern "C" NCSError NCSGetEPSGCode(char *szDatum, char *szProjection, INT32 *pnEPSG);
189
        /**
190
         * Get an ER Mapper projection/datum pair from an EPSG code, if any are applicable
191
         * @param                nEPSGCode                EPSG code
192
         * @param                pszProjection        Returned ER Mapper projection string
193
         * @param                pszDatum                Returned ER Mapper datum string
194
         * @return                NCSError                NCS_SUCCESS, or error on failure
195
         */
196
extern "C" NCSError NCSGetProjectionAndDatum(INT32 nEPSGCode, char **pszProjection, char **pszDatum);
197
        /**
198
         * Refresh the custom GDT data path, doing a search and validity check on
199
         * the current path value and several common GDT data locations
200
         */
201
extern "C" void NCSDetectGDTPath();
202
#endif /* NCSFILE_H */