Statistics
| Revision:

root / trunk / libraries / libRaster / src / org / gvsig / raster / driver / Band.java @ 10740

History | View | Annotate | Download (3.98 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 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.driver;
20

    
21

    
22
/**
23
 * Clase que representa a una banda de un fichero.
24
 * @author Nacho Brodin (nachobrodin@gmail.com)
25
 */
26
public class Band {
27
        //Nombre del fichero al que pertenece la banda
28
        private String                 fileName = "";
29
        //Posici?n en el fichero de la  banda
30
        private int                 position = -1;
31
        //Tipo de dato de la banda
32
        private int                 dataType = IBuffer.TYPE_BYTE;
33
        //lista de bandas del buffer donde se dibuja esta banda de imagen. Cada elemento
34
        //del vector es un n?mero que corresponde con el n?mero de banda del buffer donde se escribe esta
35
        private int[]                rasterBufBandToDrawList = null;
36
        
37
        public Band(String f, int p, int dt){
38
                setFileName(f);
39
                setPosition(p);
40
                setDataType(dt);
41
        }
42
        
43
        /**
44
         * Resetea la asignaci?n de dibujado de las bandas de la imagen
45
         * sobre el DataImage cuando se hace un update para esta banda.
46
         */
47
        public void clearDrawableBands(){
48
                rasterBufBandToDrawList = null;
49
        }
50

    
51
        //******************************
52
        //Setters and Getters
53
        //******************************
54
        
55
        /**
56
         * Obtiene las banda del RasterBuf sobre la que se pinta
57
         * este objeto banda
58
         * @return bandas del RasterBuf
59
         */
60
        public int[] getDataImageBandToDraw() {
61
                return rasterBufBandToDrawList;
62
        }
63

    
64
        
65
        
66
        /**
67
         * Dice si la banda se est? dibujando en el buffers de salida.
68
         * @return true si la banda se est? dibujando y false si no se est? haciendo
69
         */
70
        public boolean isDrawing(){
71
                if(this.rasterBufBandToDrawList == null)
72
                        return false;
73
                return true;
74
        }
75
                
76
        /**
77
         * Asigna una banda del RasterBuf sobre la que se pinta
78
         * este objeto banda
79
         * @param rasterBufBandToDraw banda del RasterBuf
80
         */
81
        public void setPositionToDrawInBuffer(int rasterBufBandToDraw) {
82
                if(rasterBufBandToDrawList == null){
83
                        rasterBufBandToDrawList = new int[1];
84
                        rasterBufBandToDrawList[0] = rasterBufBandToDraw;
85
                }else{
86
                        int[] auxList = new int[rasterBufBandToDrawList.length + 1];
87
                        for(int i=0;i<rasterBufBandToDrawList.length;i++)
88
                                auxList[i] = rasterBufBandToDrawList[i];
89
                        auxList[rasterBufBandToDrawList.length] = rasterBufBandToDraw;
90
                        rasterBufBandToDrawList = auxList;
91
                }
92
        }
93
        
94
        /**
95
         * Obtiene el nombre del fichero al que pertenece la banda
96
         * @return String con el nombre del fichero al 
97
         * que pertenece la banda
98
         */
99
        public String getFileName() {
100
                return fileName;
101
        }
102

    
103
        /**
104
         * Asigna el nombre del fichero al que pertenece la banda
105
         * @param fileName String con el nombre del fichero al 
106
         * que pertenece la banda
107
         */
108
        public void setFileName(String fileName) {
109
                this.fileName = fileName;
110
        }
111

    
112
        /**
113
         * Obtiene la posici?n de la banda en el fichero
114
         * @return entero con la posici?n de la banda en el fichero
115
         */
116
        public int getPosition() {
117
                return position;
118
        }
119

    
120
        /**
121
         * Asigna la posici?n de la banda en el fichero
122
         * @param position Posici?n de la banda en el fichero
123
         */
124
        public void setPosition(int position) {
125
                this.position = position;
126
        }
127

    
128
        /**
129
         * Obtiene el tipo de dato de la banda
130
         * @return entero con el tipo de dato 
131
         */
132
        public int getDataType() {
133
                return dataType;
134
        }
135

    
136
        /**
137
         * Asigna el tipo de dato de la banda
138
         * @param datatype entero con el tipo de dato de la banda
139
         */
140
        public void setDataType(int dataType) {
141
                this.dataType = dataType;
142
        }
143
}