root / trunk / libraries / libCq_CMS_praster / src / org / cresques / io / data / Band.java @ 8026
History | View | Annotate | Download (4.02 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.cresques.io.data; |
20 |
|
21 |
import org.cresques.filter.IRaster; |
22 |
|
23 |
/**
|
24 |
* Clase que representa a una banda de un fichero.
|
25 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
26 |
*/
|
27 |
public class Band { |
28 |
//Nombre del fichero al que pertenece la banda
|
29 |
private String fileName = ""; |
30 |
//Posici?n en el fichero de la banda
|
31 |
private int position = -1; |
32 |
//Tipo de dato de la banda
|
33 |
private int dataType = IRaster.TYPE_BYTE; |
34 |
//lista de bandas del buffer donde se dibuja esta banda de imagen. Cada elemento
|
35 |
//del vector es un n?mero que corresponde con el n?mero de banda del buffer donde se escribe esta
|
36 |
private int[] rasterBufBandToDrawList = null; |
37 |
|
38 |
public Band(String f, int p, int dt){ |
39 |
setFileName(f); |
40 |
setPosition(p); |
41 |
setDataType(dt); |
42 |
} |
43 |
|
44 |
/**
|
45 |
* Resetea la asignaci?n de dibujado de las bandas de la imagen
|
46 |
* sobre el DataImage cuando se hace un update para esta banda.
|
47 |
*/
|
48 |
public void clearDrawableBands(){ |
49 |
rasterBufBandToDrawList = null;
|
50 |
} |
51 |
|
52 |
//******************************
|
53 |
//Setters and Getters
|
54 |
//******************************
|
55 |
|
56 |
/**
|
57 |
* Obtiene las banda del RasterBuf sobre la que se pinta
|
58 |
* este objeto banda
|
59 |
* @return bandas del RasterBuf
|
60 |
*/
|
61 |
public int[] getDataImageBandToDraw() { |
62 |
return rasterBufBandToDrawList;
|
63 |
} |
64 |
|
65 |
|
66 |
|
67 |
/**
|
68 |
* Dice si la banda se est? dibujando en el buffers de salida.
|
69 |
* @return true si la banda se est? dibujando y false si no se est? haciendo
|
70 |
*/
|
71 |
public boolean isDrawing(){ |
72 |
if(this.rasterBufBandToDrawList == null) |
73 |
return false; |
74 |
return true; |
75 |
} |
76 |
|
77 |
/**
|
78 |
* Asigna una banda del RasterBuf sobre la que se pinta
|
79 |
* este objeto banda
|
80 |
* @param rasterBufBandToDraw banda del RasterBuf
|
81 |
*/
|
82 |
public void setPositionToDrawInBuffer(int rasterBufBandToDraw) { |
83 |
if(rasterBufBandToDrawList == null){ |
84 |
rasterBufBandToDrawList = new int[1]; |
85 |
rasterBufBandToDrawList[0] = rasterBufBandToDraw;
|
86 |
}else{
|
87 |
int[] auxList = new int[rasterBufBandToDrawList.length + 1]; |
88 |
for(int i=0;i<rasterBufBandToDrawList.length;i++) |
89 |
auxList[i] = rasterBufBandToDrawList[i]; |
90 |
auxList[rasterBufBandToDrawList.length] = rasterBufBandToDraw; |
91 |
rasterBufBandToDrawList = auxList; |
92 |
} |
93 |
} |
94 |
|
95 |
/**
|
96 |
* Obtiene el nombre del fichero al que pertenece la banda
|
97 |
* @return String con el nombre del fichero al
|
98 |
* que pertenece la banda
|
99 |
*/
|
100 |
public String getFileName() { |
101 |
return fileName;
|
102 |
} |
103 |
|
104 |
/**
|
105 |
* Asigna el nombre del fichero al que pertenece la banda
|
106 |
* @param fileName String con el nombre del fichero al
|
107 |
* que pertenece la banda
|
108 |
*/
|
109 |
public void setFileName(String fileName) { |
110 |
this.fileName = fileName;
|
111 |
} |
112 |
|
113 |
/**
|
114 |
* Obtiene la posici?n de la banda en el fichero
|
115 |
* @return entero con la posici?n de la banda en el fichero
|
116 |
*/
|
117 |
public int getPosition() { |
118 |
return position;
|
119 |
} |
120 |
|
121 |
/**
|
122 |
* Asigna la posici?n de la banda en el fichero
|
123 |
* @param position Posici?n de la banda en el fichero
|
124 |
*/
|
125 |
public void setPosition(int position) { |
126 |
this.position = position;
|
127 |
} |
128 |
|
129 |
/**
|
130 |
* Obtiene el tipo de dato de la banda
|
131 |
* @return entero con el tipo de dato
|
132 |
*/
|
133 |
public int getDataType() { |
134 |
return dataType;
|
135 |
} |
136 |
|
137 |
/**
|
138 |
* Asigna el tipo de dato de la banda
|
139 |
* @param datatype entero con el tipo de dato de la banda
|
140 |
*/
|
141 |
public void setDataType(int dataType) { |
142 |
this.dataType = dataType;
|
143 |
} |
144 |
} |