Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / mrsid_readers / MrSIDImageReader.h @ 3539

History | View | Annotate | Download (5.56 KB)

1
/* $Id: MrSIDImageReader.h 3539 2006-01-09 12:23:20Z nacho $ */
2
/* //////////////////////////////////////////////////////////////////////////
3
//                                                                         //
4
// This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue,   //
5
// Suite 200, Seattle, WA 98104.  Unauthorized use or distribution         //
6
// prohibited.  Access to and use of this code is permitted only under     //
7
// license from LizardTech, Inc.  Portions of the code are protected by    //
8
// US and foreign patents and other filings. All Rights Reserved.          //
9
//                                                                         //
10
////////////////////////////////////////////////////////////////////////// */
11
/* PUBLIC */
12

    
13
#ifndef MRSIDIMAGEREADER_H
14
#define MRSIDIMAGEREADER_H
15

    
16
// lt_lib_mrsid_mrsidReader
17
#include "MrSIDImageReaderBase.h"
18

    
19

    
20
LT_BEGIN_NAMESPACE(LizardTech)
21

    
22
#if defined(LT_COMPILER_MS)
23
   #pragma warning(push,4)
24
#endif
25

    
26
class LTFileSpec;
27
class LTIOStreamInf;
28
class MG2ImageReader;
29
class MG3SingleImageReader;
30
class MG3CompositeImageReader;
31
class MG3Container;
32

    
33

    
34
/**
35
 * reader for MrSID images (MG2 and MG3)
36
 *
37
 * This class supports reading MrSID/MG2 and MrSID/MG3 images, including
38
 * composite MG3 images.
39
 */
40
class MrSIDImageReader : public MrSIDImageReaderBase
41
{
42
public:
43
   /**
44
    * constructor
45
    *
46
    * Construct a MrSID reader from the given file.
47
    *
48
    * @param  fileSpec      file containing MrSID image
49
    * @param  useWorldFile  incorporate world file data when reading image
50
    * @param  memoryUsage   control memory resource usage
51
    * @param  streamUsage   control stream resource usage
52
    */
53
   MrSIDImageReader(const LTFileSpec& fileSpec,
54
                    bool useWorldFile = false,
55
                    MrSIDMemoryUsage memoryUsage=MRSID_MEMORY_USAGE_DEFAULT,
56
                    MrSIDStreamUsage streamUsage=MRSID_STREAM_USAGE_DEFAULT);
57

    
58
   /**
59
    * constructor
60
    *
61
    * Construct a MrSID reader from the given stream.
62
    *
63
    * @param  stream        stream containing MrSID image (may not be NULL)
64
    * @param  worldFileStream  stream containing world file data (may be NULL)
65
    * @param  memoryUsage   control memory resource usage
66
    * @param  streamUsage   control stream resource usage
67
    */
68
   MrSIDImageReader(LTIOStreamInf* stream,
69
                    LTIOStreamInf* worldFileStream = 0,
70
                    MrSIDMemoryUsage memoryUsage=MRSID_MEMORY_USAGE_DEFAULT,
71
                    MrSIDStreamUsage streamUsage=MRSID_STREAM_USAGE_DEFAULT);
72

    
73
   virtual ~MrSIDImageReader();
74

    
75
   virtual LT_STATUS initialize();
76

    
77
   /**
78
    * number of levels
79
    * 
80
    * Return the number of resolution levels in the image.  (This is similar to querying
81
    * getMinMagnificaton(), but expressed as an integer.)
82
    *
83
    * @return the number of levels in the image
84
    */
85
   virtual lt_uint8 getNumLevels() const;
86

    
87
   /**
88
    * query for image encryption
89
    * 
90
    * Return true if the image is password-protected.
91
    *
92
    * @return true, if and only if the image is encrypted
93
    */
94
   virtual bool isLocked() const;
95

    
96
   /**
97
    * query for file format version
98
    * 
99
    * This functions returns detailed version information for the
100
    * MG2 or MG3 file.
101
    *
102
    * @param major the major version number
103
    * @param minor the minor version number
104
    * @param tweak the reversion number
105
    * @param letter the format letter (MG3 only)
106
    */
107
   virtual void getVersion(lt_uint8& major, lt_uint8& minor, lt_uint8& tweak, char& letter) const;
108

    
109
   virtual lt_int64 getPhysicalFileSize() const;
110

    
111
   virtual LT_STATUS setStripHeight(lt_uint32 stripHeight);
112
   virtual lt_uint32 getStripHeight() const;
113

    
114
   // not for the faint of heart
115
   MG2ImageReader* getMG2Reader() const;
116
   MG3SingleImageReader* getMG3SingleReader() const;
117
   MG3CompositeImageReader* getMG3CompositeReader() const;
118

    
119
   virtual LT_STATUS projectPointAtMag(double upperLeft,
120
                                       double mag,
121
                                       double& newUpperLeft) const;
122
   virtual LT_STATUS projectDimAtMag(double dim,
123
                                     double mag,
124
                                     double& newDim) const;
125

    
126
   virtual LT_STATUS getDimsAtMag(double mag,
127
                                  lt_uint32& width,
128
                                  lt_uint32& height) const;
129

    
130
   void setProgressDelegate(LTIProgressDelegate* delegate);
131
   void setInterruptDelegate(LTIInterruptDelegate* delegate);
132

    
133
protected:
134
   virtual LT_STATUS decodeBegin(const LTIScene& scene);
135
   virtual LT_STATUS decodeStrip(LTISceneBuffer& stripBuffer,
136
                                 const LTIScene& stripScene);
137
   virtual LT_STATUS decodeEnd();
138

    
139
   virtual LT_STATUS createMG2Reader(void);
140
   virtual LT_STATUS createMG3Reader(void);
141

    
142
#ifndef DOXYGEN_EXCLUDE
143
   struct Data
144
   {
145
      ~Data(void);
146
      Data(const LTFileSpec *fileSpec,
147
           LTIOStreamInf *stream,
148
           MG3Container* container,
149
           LTIOStreamInf* worldFileStream);
150
   
151
      LTIOStreamInf* m_stream;
152
      LTFileSpec* m_fileSpec;
153
      bool m_ownStream;
154
      LTIOStreamInf* m_worldFileStream;
155
      bool m_worldFileStreamOwned;
156
      MG3Container* m_container;
157
      MrSIDImageReaderBase *m_mrsidReader;
158
      MG3CompositeImageReader* m_mg3CompositeReader;
159
      MG3SingleImageReader* m_mg3SingleReader;
160
      MG2ImageReader* m_mg2Reader;
161
   };
162
#endif
163
   Data *m_dat;
164

    
165
private:
166
   typedef MrSIDImageReaderBase Super;
167

    
168
   // nope
169
   MrSIDImageReader(const MrSIDImageReader&);
170
   MrSIDImageReader& operator=(const MrSIDImageReader&);
171
};
172

    
173

    
174
LT_END_NAMESPACE(LizardTech)
175

    
176
#if defined(LT_COMPILER_MS)
177
        #pragma warning(pop)
178
#endif
179

    
180
#endif // MRSIDIMAGEREADER_H