Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / base / lti_geoFileImageWriter.h @ 3539

History | View | Annotate | Download (4.95 KB)

1
/* $Id: lti_geoFileImageWriter.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 LTI_GEOFILEIMAGEWRITER_H
14
#define LTI_GEOFILEIMAGEWRITER_H
15

    
16
// lt_lib_base
17
#include "lt_base.h"
18

    
19
// lt_lib_mrsid_core
20
#include "lti_imageWriter.h"
21
#include "lti_scene.h"
22

    
23
LT_BEGIN_NAMESPACE(LizardTech)
24

    
25
#if defined(LT_COMPILER_MS)
26
   #pragma warning(push,4)
27
#endif
28

    
29
class LTFileSpec;
30
class LTIOStreamInf;
31

    
32
/**
33
 * class for writing geographic images to files or streams
34
 *
35
 * This abstract class extends LTIImageWriter by adding functions for
36
 * controlling the output form (either a file or a stream) and world file
37
 * generation.
38
 */
39
class LTIGeoFileImageWriter : public LTIImageWriter
40
{
41
public:
42
   /**
43
    * constructor
44
    *
45
    * Constructs a writer which will write to files or streams.  The 
46
    * \c supportsStreams parameter is used to indicate whether the
47
    * derived class can write directly to a stream or only to files.
48
    *
49
    * @param  image            the source of image data to be written  
50
    * @param  supportsStreams  set to true if output to streams is allowed 
51
    */
52
   LTIGeoFileImageWriter(LTIImageStage* image,
53
                         bool supportsStreams);
54

    
55
   virtual ~LTIGeoFileImageWriter();
56

    
57
   virtual LT_STATUS writeBegin(const LTIScene& scene);
58
   virtual LT_STATUS writeStrip(LTISceneBuffer& stripBuffer,
59
                                const LTIScene& stripScene) = 0;
60
   virtual LT_STATUS writeEnd();
61

    
62

    
63
   /**
64
    * set output file name
65
    *
66
    * Sets the output target to the given filename.  Must be called prior to
67
    * calling write().
68
    *
69
    * @param fileSpec the name of the file to write to 
70
    * @return status code indicating success or failure
71
    */
72
   virtual LT_STATUS setOutputFileSpec(const LTFileSpec& fileSpec);
73

    
74
   /**
75
    * set output file name
76
    *
77
    * Sets the output target to the given filename.  Must be called prior to
78
    * calling write().
79
    *
80
    * @param fileSpec the name of the file to write to 
81
    * @return success or failure
82
    */
83
   virtual LT_STATUS setOutputFileSpec(const char* fileSpec);
84

    
85
   /**
86
    * set output file stream
87
    *
88
    * Sets the output target to the given stream.  Must be called prior to
89
    * calling write().
90
    *
91
    * This operation will only succeed if the derived class has set the
92
    * \c supportsStream parameter to the LTIGeoFileImageWriter ctor to true.
93
    *
94
    * @param stream the stream to write to (may not be NULL) 
95
    * @return status code indicating success or failure
96
    */
97
   virtual LT_STATUS setOutputStream(LTIOStreamInf* stream);
98

    
99
   /**
100
    * enable writing of world file
101
    *
102
    * Enables or disables automatic generation of a world file.  Only
103
    * applicable when the output target is a filename.
104
    *
105
    * The default is to not generate a world file.
106
    *
107
    * @param enabled set to true for world file generation
108
    */
109
   virtual void setWorldFileSupport(bool enabled);
110

    
111
   /**
112
    * enable writing of large files
113
    *
114
    * Enables or disables use of 64-bit safe file output.  Only
115
    * applicable when the output target is a filename.
116
    *
117
    * The default is to not use 64-bit file modes (as this may incur a
118
    * performance penalty under certain circumstances).
119
    *
120
    * @param enabled set to true for large file support
121
    */
122
   void setFileStream64(bool enabled); // default false
123

    
124
protected:
125
   /**
126
    * get underlying stream
127
    *
128
    * Returns the stream being written to.
129
    *
130
    * If the output target is a filename, the returned stream will  be NULL
131
    * until the write() sequence has begun.
132
    *
133
    * @return the stream (may be NULL)
134
    */
135
   LTIOStreamInf* getStream() const;
136

    
137
   /**
138
    * get target filename
139
    *
140
    * Returns the name of the file being written to.
141
    *
142
    * If the output target is set by the user to be a stream, the returned filename
143
    * will  be NULL.
144
    *
145
    * @return the filename (may be NULL)
146
    */
147
   LTFileSpec* getFileSpec() const;
148

    
149
private:
150
   bool m_supportsStreams;
151
   LTFileSpec* m_fileSpec;
152
   LTIOStreamInf* m_stream;
153
   bool m_ownStream;
154

    
155
   bool m_worldFileEnabled;
156

    
157
   bool m_useFileStream64;
158
   LTIScene m_fullScene;
159

    
160
   // nope
161
   LTIGeoFileImageWriter();
162
   LTIGeoFileImageWriter(LTIGeoFileImageWriter&);
163
   LTIGeoFileImageWriter& operator=(const LTIGeoFileImageWriter&);
164
};
165

    
166

    
167
LT_END_NAMESPACE(LizardTech)
168

    
169
#if defined(LT_COMPILER_MS)
170
        #pragma warning(pop)
171
#endif
172

    
173
#endif // LTI_GEOFILEIMAGEWRITER_H