Statistics
| Revision:

root / trunk / libraries / libRaster / src / org / gvsig / raster / dataset / io / ErmapperWriter.java @ 22422

History | View | Annotate | Download (19.2 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.dataset.io;
20

    
21
import java.awt.geom.AffineTransform;
22
import java.awt.geom.Point2D;
23
import java.io.File;
24
import java.io.IOException;
25

    
26
import org.cresques.cts.IProjection;
27
import org.gvsig.raster.RasterLibrary;
28
import org.gvsig.raster.dataset.GeoRasterWriter;
29
import org.gvsig.raster.dataset.IBuffer;
30
import org.gvsig.raster.dataset.IDataWriter;
31
import org.gvsig.raster.dataset.Params;
32
import org.gvsig.raster.dataset.Params.Param;
33
import org.gvsig.raster.dataset.io.features.WriteFileFormatFeatures;
34
import org.gvsig.raster.util.RasterUtilities;
35
import org.gvsig.raster.util.extensionPoints.ExtensionPoint;
36

    
37
import es.gva.cit.jecwcompress.EcwException;
38
import es.gva.cit.jecwcompress.JniObject;
39
import es.gva.cit.jecwcompress.NCSEcwCompressClient;
40
import es.gva.cit.jecwcompress.ReadCallBack;
41
/**
42
 * Driver para la compresi?n en formato Ecw.
43
 *
44
 * Puede exportar un fichero desde un GeoRasterFile en cualquier formato soportado
45
 * por los drivers de lectura a uno en formato Ecw.
46
 *
47
 * Puede salvar a disco en formato Ecw obteniendo los datos que van siendo servidos
48
 * desde el cliente. Este cliente debe implementar un IDataWriter o tener un objeto
49
 * que lo implemente. Inicialmente le pasar? los par?metros de la imagen de salida
50
 * y cuando el driver comience a escribir le ir? solicitando m?s a trav?s del m?todo
51
 * readData de IDataWriter. El cliente ser? el que lleve el control de lo que va
52
 * sirviendo y lo que le queda por servir.
53
 * @author Nacho Brodin (brodin_ign@gva.es)
54
 */
55
public class ErmapperWriter extends GeoRasterWriter {
56

    
57
        public static void register() {
58
                ExtensionPoint point = ExtensionPoint.getExtensionPoint("RasterWriter");
59
                WriteFileFormatFeatures features = null;
60

    
61
                String os = System.getProperties().getProperty("os.version");
62
                if (os.startsWith("2.4")){
63
                        point.register("ecw", ErmapperWriter.class);
64
                        features = new WriteFileFormatFeatures("Ecw", "ecw", new int[]{3}, null, ErmapperWriter.class);
65
                        fileFeature.put("ecw", features);
66
                }
67
                point.register("jp2", ErmapperWriter.class);
68
                features = new WriteFileFormatFeatures("Jpeg2000", "jp2", new int[]{3}, null, ErmapperWriter.class);
69
                fileFeature.put("jp2", features);
70
        }
71

    
72
        public final int                                 windowSizeX = 386;
73
        public final int                                 windowSizeY = 220;
74
        public final int                                 panelSizeX = 358;
75
        public final int                                 panelSizeY = 125;
76
        public final String                         panelLayout = "BorderLayout";
77
        private NCSEcwCompressClient         compressclient = null;
78
        private Reader                                         readerObj;
79
        private double                                         pixelSizeX;
80
        private double                                         pixelSizeY;
81
        private double                                         geoCoordOrigenX;
82
        private double                                         geoCoordOrigenY;
83
        private boolean                                 consulta = false;
84

    
85
        /**
86
         * Carga los par?metros de este driver.
87
         */
88
        public void loadParams() {
89
                WriteFileFormatFeatures wfff = new WriteFileFormatFeatures();
90
                wfff.loadParams();
91
                driverParams = wfff.getParams();
92

    
93
                driverParams.setParam(        "compression",
94
                                new Integer(10),
95
                                Params.SLIDER,
96
                                new String[]{ "1", "20", "10", "1", "5" }); //min, max, valor defecto, intervalo peque?o, intervalo grande;
97

    
98
                driverParams.setParam(        "format",
99
                                new Integer(4),
100
                                Params.CHOICE,
101
                                new String[]{ "NONE", "UINT8", "YUV", "MULTI", "RGB"});
102
        }
103

    
104
        /**
105
         * Constructor para la obtenci?n de par?metros del driver.
106
         */
107
        public ErmapperWriter(String fileName) {
108
                ident = RasterUtilities.getExtensionFromFileName(fileName);
109
                driver = ((WriteFileFormatFeatures)fileFeature.get(ident)).getDriverName();
110

    
111
                loadParams();
112

    
113
                consulta = true;
114
        }
115

    
116
        /**
117
         * Constructor para la lectura de datos desde el objeto cliente a partir
118
         * de un viewport dado.
119
         * @param dataWriter        Objeto que sirve datos para el escritor
120
         * @param vp        viewport de origen
121
         * @param outFileName        Fichero de salida
122
         * @param blockSize        Tama?o de bloque
123
         * @param nBands        N?mero de bandas
124
         * @param compresion        Compresi?n
125
         * @throws EcwException
126
         * @throws IOException
127
         */
128
        public ErmapperWriter(        IDataWriter dataWriter,
129
                        String outFileName,
130
                        Integer nBands,
131
                        AffineTransform at,
132
                        Integer outSizeX,
133
                        Integer outSizeY,
134
                        Integer dataType,
135
                        Params params,
136
                        IProjection proj, 
137
                        Boolean geo) throws EcwException, IOException {
138
                
139
                //La libreria de ECW no se traga caracteres raros al escribir. Los cambiamos por X de momento y ya se apa?a el usuario
140
                
141
                String ext = RasterUtilities.getExtensionFromFileName(outFileName);
142
                String fname = outFileName.substring(outFileName.lastIndexOf(File.separator) + 1, outFileName.lastIndexOf(".")).replaceAll("[^a-zA-Z0-9_]", "X");
143
                outFileName = outFileName.substring(0, outFileName.lastIndexOf(File.separator) + 1) + fname + "." + ext;
144
                
145
                this.proj = proj;
146
                ident = RasterUtilities.getExtensionFromFileName(outFileName);
147
                driver = ((WriteFileFormatFeatures)fileFeature.get(ident)).getDriverName();
148
                this.dataType = dataType.intValue();
149

    
150
                if (nBands.intValue() <= 0)
151
                        throw new EcwException("N?mero de bandas erroneo.");
152

    
153
                this.outFileName = outFileName;
154
                this.dataWriter = dataWriter;
155

    
156
                this.nBands = nBands.intValue();
157

    
158
                this.sizeWindowX = outSizeX.intValue();
159
                this.sizeWindowY = outSizeY.intValue();
160

    
161
                //Calculamos la georeferenciaci?n a partir del extend pasado por el cliente.
162
                geoCoordOrigenX = at.getTranslateX();
163
                geoCoordOrigenY = at.getTranslateY();
164

    
165
                pixelSizeX = (at.getScaleX() > 0) ? at.getScaleX() : -at.getScaleX();
166
                pixelSizeY = (at.getScaleY() < 0) ? at.getScaleY() : -at.getScaleY();
167
                
168
                String outRmf = outFileName.substring(0, outFileName.lastIndexOf("."));
169
                if(geo.booleanValue())
170
                        RasterUtilities.saveGeoInfo(outRmf, at, new Point2D.Double(sizeWindowX, sizeWindowY));
171

    
172
                if (pixelSizeX == 0)
173
                        pixelSizeX = 1.0;
174

    
175
                if (pixelSizeY == 0)
176
                        pixelSizeY = 1.0;
177

    
178
                if(params == null)
179
                        loadParams();
180
                else
181
                        driverParams = params;
182

    
183
                init();
184
        }
185

    
186
        /**
187
         * Inicializaci?n de los par?metros del compresor que ser?n obtenidos
188
         * de PxRaster.
189
         * @throws EcwException
190
         */
191
        private void init() throws EcwException {
192
                percent = 0;
193
                int comp = ((Integer)((Param)driverParams.getParamById("compression")).defaultValue).intValue();
194
                Param param = driverParams.getParamById("format");
195
                String format = param.list[((Integer)param.defaultValue).intValue()];
196
                if ( comp == 0 )
197
                        driverParams.changeParamValue("compression", "1");
198

    
199
                if (compressclient == null)
200
                        compressclient = new NCSEcwCompressClient();
201

    
202
                compressclient.setOutputFilename(outFileName);
203
                compressclient.setInputFilename(inFileName);
204
                compressclient.setTargetCompress(comp);
205
                compressclient.setInOutSizeX(sizeWindowX);
206
                compressclient.setInOutSizeY(sizeWindowY);
207
                compressclient.setInputBands(nBands);
208
                compressclient.setCompressFormat(convertFormatToInt(format));
209

    
210
                /* boolean georef = new Boolean(((Param)driverParams.getParamById("georef")).defaultValue).booleanValue();
211
                                if (georef) {*/
212
                compressclient.setCellIncrementX(pixelSizeX);
213
                compressclient.setCellIncrementY(pixelSizeY);
214
                compressclient.setOriginX(geoCoordOrigenX);
215
                compressclient.setOriginY(geoCoordOrigenY);
216
                //}
217

    
218
                compressclient.setCellSizeUnits(1);
219
                int blocksize = RasterLibrary.blockHeight;
220
                
221
                if (dataWriter != null) {
222
                        readerObj = new Reader(dataWriter, compressclient, sizeWindowX,
223
                                        sizeWindowY, blocksize, nBands, this, dataType);
224
                }
225
        }
226

    
227
        /**
228
         * Convierte la cadena que representa el formato en un valor n?merico
229
         * que entiende el driver.
230
         * @param format Cadena que representa el formato
231
         * @return Entero que representa a la cadena
232
         */
233
        private int convertFormatToInt(String format) {
234
                if(format.compareTo("NONE") == 0)
235
                        return 0;
236
                if(format.compareTo("UINT8") == 0)
237
                        return 1;
238
                if(format.compareTo("YUV") == 0)
239
                        return 2;
240
                if(format.compareTo("MULTI") == 0)
241
                        return 3;
242
                if(format.compareTo("RGB") == 0)
243
                        return 4;
244
                return -1;
245
        }
246
        /**
247
         * A partir de un elemento que contiene una propiedad y un valor
248
         * lo parsea y asigna el valor a su variable.
249
         * @param propValue        elemento con la forma propiedad=valor
250
         */
251
        private void readProperty(String propValue) {
252
                String prop = propValue.substring(0, propValue.indexOf("="));
253

    
254
                if (propValue.startsWith(prop)) {
255
                        String value = propValue.substring(propValue.indexOf("=") + 1, propValue.length());
256

    
257
                        if ((value != null) && !value.equals("")) {
258
                                if (prop.equals("BLOCKSIZE"))
259
                                        driverParams.changeParamValue("blocksize", value);
260
                                if (prop.equals("FORMAT"))
261
                                        driverParams.changeParamValue("format", value);
262
                                if (prop.equals("COMPRESSION"))
263
                                        driverParams.changeParamValue("compression", value);
264
                        }
265
                }
266
        }
267

    
268
        /**
269
         * Asigna propiedades al driver a partir de un vector de
270
         * strings donde cada elemento tiene la estructura de
271
         * propiedad=valor.
272
         * @param props        Propiedades
273
         */
274
        public void setProps(String[] props) {
275
                for (int iProps = 0; iProps < props.length; iProps++)
276
                        readProperty(props[iProps]);
277

    
278
                loadParams();
279

    
280
                try {
281
                        if (!consulta) {
282
                                init();
283
                        }
284
                } catch (EcwException e) {
285
                        e.printStackTrace();
286
                }
287
        }
288

    
289
        /**
290
         * Realiza la funci?n de compresi?n a partir de un GeoRasterFile.
291
         * @throws IOException
292
         */
293
        public void fileWrite() throws IOException {
294
                /* try {
295
                                                compressclient.NCSEcwCompressOpen(false);
296
                                                compressclient.NCSEcwCompress(readerObj);
297
                                } catch (EcwException e) {
298
                                                e.printStackTrace();
299
                                }*/
300
                //TODO: FUNCIONALIDAD: Compresi?n a partir de un dataset. De momento no es necesario y es posible que nunca lo sea.
301
        }
302

    
303
        /**
304
         * Realiza la funci?n de compresi?n a partir de los datos pasados por el cliente.
305
         * @throws IOException
306
         */
307
        public void dataWrite() throws IOException, InterruptedException {
308
                if (dataWriter == null) {
309
                        throw new IOException("No se ha obtenido un objeto para la lectura valido.");
310
                }
311

    
312
                try {
313
                        compressclient.NCSEcwCompressOpen(false);
314
                        compressclient.NCSEcwCompress(readerObj);
315
                } catch (EcwException e) {
316
                        throw new IOException("Error en la compresi?n.");
317
                }
318
        }
319

    
320
        /**
321
         * Cierra el compresor ecw.
322
         */
323
        public void writeClose() {
324
                try {
325
                        compressclient.NCSEcwCompressClose();
326
                } catch (EcwException e) {
327
                        e.printStackTrace();
328
                }
329
        }
330

    
331
        /**
332
         * Cancela el compresor ecw.
333
         */
334
        public void writeCancel() {
335
                try {
336
                        if(readerObj != null)
337
                                readerObj.setWrite(false);
338
                        compressclient.NCSEcwCompressCancel();
339
                } catch (EcwException e) {
340
                        e.printStackTrace();
341
                }
342
        }
343

    
344
        /*
345
         * (non-Javadoc)
346
         * @see org.gvsig.raster.dataset.GeoRasterWriter#setWkt(java.lang.String)
347
         */
348
        public void setWkt(String wkt) {
349
                //TODO: FUNCIONALIDAD: La asignaci?n de proyecci?n en Ecw falla haciendo petar la aplicaci?n.
350
                /*if(compressclient != null && wkt != null && wkt.compareTo("unknown") != 0) {
351
                        WktUtils wktutil = new WktUtils(wkt);
352
                        compressclient.setProjection("EPSG:" + wktutil.getEPSG());
353
                }*/
354
        }
355

    
356
}
357

    
358

    
359
/**
360
 * Clase que se encarga de la lectura de datos que ser?n escritos. Hereda de JniObject
361
 * para asegurar  para asegurar que el interfaz de la libreria tiene acceso a variables
362
 * necesarias para la petici?n de datos cuando vacia el buffer. Implementa ReadCallBack
363
 * para obligar escribir el m?todo loadBuffer encargado de servir los datos cuando el
364
 * buffer se vacia.
365
 *
366
 */
367
class Reader extends JniObject implements ReadCallBack {
368
        private NCSEcwCompressClient        compressclient = null;
369
        private int                                         width;
370
        //private int                                         height;
371
        //private int                                         ulX;
372
        //private int                                         ulY;
373
        private IDataWriter                         dataWriter = null;
374
        //private GdalRasterBand                         rband = null;
375
        private GeoRasterWriter                        writer = null;
376
        private int                                         blockSizeRead = 1; //Alto del bloque leido de la imagen origen
377
        private int                                         countLine = 1; //Contador de l?neas procesadas en cada lectura de bloque
378
        byte[][]                                                 buf = null;
379
        byte[]                                                         bufband1 = null;
380
        byte[]                                                         bufband2 = null;
381
        byte[]                                                         bufband3 = null;
382
        byte[]                                                         bufband4 = null;
383
        byte[]                                                         bufband5 = null;
384
        byte[]                                                         bufband6 = null;
385
        int[]                                                         dataBuffer = null;
386
        byte[][]                                                 byteBuffer = null;
387
        private int                                         lineasBloqueFinal = 0; //N?mero de l?neas leidas del bloque final
388
        private int                                         nBlocks = 0; //N?mero de bloques completos
389
        private int                                         countBlock = 1; //Contador de bloques completos procesados
390
        private int                                         nBands = 0;
391
        private        boolean                                        write = true; //Cuando est? a true se puede escribir en la imagen de salida. Si est? a false el proceso es interrumpido
392
        private int                                                dataType = IBuffer.TYPE_BYTE;
393

    
394
        /**
395
         * Constructor para que los datos sean servidos desde el cliente a trav?s de un
396
         * IDataWriter.
397
         * @param dataWriter        Objeto servidor de datos del driver
398
         * @param compressclient        Objeto que representa al compresor ecw
399
         * @param width        Ancho de la imagen
400
         * @param height        Alto de la imagen
401
         * @param blockSizeRead        Altura del bloque en la lectura
402
         * @param nBands        N?mero de bandas
403
         */
404
        public Reader(IDataWriter dataWriter, NCSEcwCompressClient compressclient,
405
                        int width, int height, int blockSizeRead, int nBands,
406
                        GeoRasterWriter writer, int dataType) {
407
                this.compressclient = compressclient;
408
                this.width = width;
409
                //this.height = height;
410
                this.dataWriter = dataWriter;
411
                this.nBands = nBands;
412
                this.writer = writer;
413
                this.dataType = dataType;
414

    
415
                if (blockSizeRead != 0) {
416
                        this.blockSizeRead = blockSizeRead;
417
                }
418

    
419
                nBlocks = (int) (height / this.blockSizeRead);
420
                lineasBloqueFinal = height - (nBlocks * this.blockSizeRead);
421
        }
422

    
423
        /**
424
         * Lectura de bandas llamando al objeto cliente para que nos cargue el buffer
425
         * @param width        Ancho de la imagen
426
         * @param height        Alto de la imagen
427
         */
428
        /*private void readBands(int width, int height) {
429
                if(dataType == IBuffer.TYPE_IMAGE)
430
                        dataBuffer = dataWriter.readARGBData(width, height, 0);
431
                if(dataType == IBuffer.TYPE_BYTE) {
432
                        byte[][] b = dataWriter.readByteData(width, height);
433

434
                }
435
        }*/
436

    
437
        /**
438
         * M?todo obligado por el interfaz y que es llamado desde C cuando el
439
         * compresor necesita que le sirvan m?s datos.
440
         */
441
        public void loadBuffer() {
442
                int lineasLeidas = 0;
443

    
444
                //si se leen bloques completos lineasLeidas es == al tama?o de bloque sino
445
                //es que es el ?ltimo con lo que ser? del tama?o del bloque final
446
                if (countBlock <= nBlocks)
447
                        lineasLeidas = blockSizeRead;
448
                else
449
                        lineasLeidas = lineasBloqueFinal;
450

    
451
                //Leemos un bloque nuevo cuando se han procesado todas las l?neas del anterior
452
                if ((nNextLine % blockSizeRead) == 0) {
453
                        if (dataWriter != null) {
454
                                if(dataType == IBuffer.TYPE_IMAGE)
455
                                        dataBuffer = dataWriter.readARGBData(width, lineasLeidas, 0);
456
                                if(dataType == IBuffer.TYPE_BYTE)
457
                                        byteBuffer = dataWriter.readByteData(width, lineasLeidas);
458
                        }
459

    
460
                        countLine = 0;
461
                        countBlock++;
462
                }
463

    
464
                if(dataType == IBuffer.TYPE_IMAGE)
465
                        loadBufferFromImageDataType(dataBuffer);
466
                if(dataType == IBuffer.TYPE_BYTE)
467
                        loadBufferFromByteDataType(byteBuffer);
468

    
469
                /* for (int iBand = 0; iBand < this.nBands; iBand++) {
470
                                                for (int pos = 0; pos < width; pos++) {
471
                                                                if (grf != null && write) {
472
                                                                                if (iBand == 0)
473
                                                                                                compressclient.buffer[pos + (width * iBand)] =
474
                                                                                                        bufband1[pos + (width * countLine)];
475

476
                                                                                if (iBand == 1)
477
                                                                                                compressclient.buffer[pos + (width * iBand)] =
478
                                                                                                        bufband2[pos + (width * countLine)];
479

480
                                                                                if (iBand == 2)
481
                                                                                                compressclient.buffer[pos + (width * iBand)] =
482
                                                                                                        bufband3[pos + (width * countLine)];
483

484
                                                                                if (iBand == 3)
485
                                                                                                compressclient.buffer[pos + (width * iBand)] =
486
                                                                                                        bufband4[pos + (width * countLine)];
487

488
                                                                                if (iBand == 4)
489
                                                                                                compressclient.buffer[pos + (width * iBand)] =
490
                                                                                                        bufband5[pos + (width * countLine)];
491

492
                                                                                if (iBand == 5)
493
                                                                                                compressclient.buffer[pos + (width * iBand)] =
494
                                                                                                        bufband6[pos + (width * countLine)];
495

496
                                                                } else {
497
                                                                                if (iBand == 0)
498
                                                                                                compressclient.buffer[pos + (width * iBand)] =
499
                                                                                                        (byte) ((dataBuffer[pos + (width * countLine)] & 0xff0000) >> 16);
500

501

502
                                                                                if (iBand == 1)
503
                                                                                                compressclient.buffer[pos + (width * iBand)] =
504
                                                                                                        (byte) ((dataBuffer[pos + (width * countLine)] & 0xff00) >> 8);
505

506

507
                                                                                if (iBand == 2)
508
                                                                                                compressclient.buffer[pos + (width * iBand)] =
509
                                                                                                        (byte) (dataBuffer[pos + (width * countLine)] & 0xff);
510

511
                                                                }
512

513
                                                                if ((pos == (width - 1)) && (iBand == (this.nBands - 1))) {
514
                                                                                countLine++;
515
                                                                }
516
                                                }
517
                                }*/
518
        }
519

    
520
        /**
521
         * Carga el buffer de datos desde elementos de tipo entero con contenido ARGB
522
         * @param data Array de datos enteros
523
         */
524
        private void loadBufferFromImageDataType(int[] data) {
525
                for (int iBand = 0; iBand < this.nBands; iBand++) {
526
                        for (int pos = 0; pos < width; pos++) {
527
                                switch(iBand) {
528
                                case 0:
529
                                        compressclient.buffer[pos + (width * iBand)] =
530
                                                (byte) ((data[pos + (width * countLine)] & 0xff0000) >> 16);
531
                                        break;
532
                                case 1:
533
                                        compressclient.buffer[pos + (width * iBand)] =
534
                                                (byte) ((data[pos + (width * countLine)] & 0xff00) >> 8);
535
                                        break;
536
                                case 2:
537
                                        compressclient.buffer[pos + (width * iBand)] =
538
                                                (byte) (data[pos + (width * countLine)] & 0xff);
539
                                        break;
540
                                }
541
                                if ((pos == (width - 1)) && (iBand == (this.nBands - 1)))
542
                                        countLine++;
543
                        }
544
                }
545
        }
546

    
547
        /**
548
         * Carga el buffer de datos a comprimir desde un buffer byte[][] donde la primera dimensi?n
549
         * es el n?mero de bandas y la segunda los elementos en lista (Ancho X Alto)
550
         * @param b Buffer de datos de tipo byte[][]
551
         */
552
        private void loadBufferFromByteDataType(byte[][] b) {
553
                for (int iBand = 0; iBand < this.nBands; iBand++) {
554
                        for (int pos = 0; pos < width; pos++) {
555
                                compressclient.buffer[pos + (width * iBand)] = b[iBand][pos + (width * countLine)];
556
                                if ((pos == (width - 1)) && (iBand == (this.nBands - 1)))
557
                                        countLine++;
558
                        }
559
                }
560
        }
561

    
562
        /**
563
         * M?todo obligado por el interfaz y que es llamado desde C cuando el
564
         * compresor actualiza el porcentaje de compresi?n
565
         */
566
        public void updatePercent() {
567
                writer.setPercent(compressclient.getPercent());
568
                //System.out.println(compressclient.getPercent() + "%");
569
        }
570

    
571
        /**
572
         * Obtiene el valor a la variable write que estar? a true cuando se est? escribiendo
573
         *  o puede escribirse la imagen de salida. El cancelar la operaci?n de escritura
574
         * pondr? esta variable a false deteniendose la escritura y cerrandose el dataset
575
         * de salida.
576
         * @return True si puede escribirse y false si no puede
577
         */
578
        public boolean isWrite() {
579
                return write;
580
        }
581

    
582
        /**
583
         * Asigna el valor a la variable write que estar? a true cuando se est? escribiendo
584
         *  o puede escribirse la imagen de salida. El cancelar la operaci?n de escritura
585
         * pondr? esta variable a false deteniendose la escritura y cerrandose el dataset
586
         * de salida.
587
         * @param write Variable booleana. True si puede escribirse y false si no puede
588
         */
589
        public void setWrite(boolean write) {
590
                this.write = write;
591
        }
592

    
593
}