root / trunk / libraries / libRaster / src / org / gvsig / raster / dataset / Band.java @ 11571
History | View | Annotate | Download (4.36 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.dataset; |
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 |
* (non-Javadoc)
|
45 |
* @see java.lang.Object#clone()
|
46 |
*/
|
47 |
public Object clone() { |
48 |
Band result = new Band(fileName, position, dataType);
|
49 |
if(rasterBufBandToDrawList != null) { |
50 |
int[] drawBands = new int[rasterBufBandToDrawList.length]; |
51 |
for (int i = 0; i < rasterBufBandToDrawList.length; i++) |
52 |
drawBands[i] = rasterBufBandToDrawList[i]; |
53 |
} |
54 |
return result;
|
55 |
} |
56 |
|
57 |
/**
|
58 |
* Resetea la asignaci?n de dibujado de las bandas de la imagen
|
59 |
* sobre el DataImage cuando se hace un update para esta banda.
|
60 |
*/
|
61 |
public void clearDrawableBands(){ |
62 |
rasterBufBandToDrawList = null;
|
63 |
} |
64 |
|
65 |
//******************************
|
66 |
//Setters and Getters
|
67 |
//******************************
|
68 |
|
69 |
/**
|
70 |
* Obtiene las banda del RasterBuf sobre la que se pinta
|
71 |
* este objeto banda
|
72 |
* @return bandas del RasterBuf
|
73 |
*/
|
74 |
public int[] getDataImageBandToDraw() { |
75 |
return rasterBufBandToDrawList;
|
76 |
} |
77 |
|
78 |
|
79 |
|
80 |
/**
|
81 |
* Dice si la banda se est? dibujando en el buffers de salida.
|
82 |
* @return true si la banda se est? dibujando y false si no se est? haciendo
|
83 |
*/
|
84 |
public boolean isDrawing(){ |
85 |
if(this.rasterBufBandToDrawList == null) |
86 |
return false; |
87 |
return true; |
88 |
} |
89 |
|
90 |
/**
|
91 |
* Asigna una banda del RasterBuf sobre la que se pinta
|
92 |
* este objeto banda
|
93 |
* @param rasterBufBandToDraw banda del RasterBuf
|
94 |
*/
|
95 |
public void setPositionToDrawInBuffer(int rasterBufBandToDraw) { |
96 |
if(rasterBufBandToDrawList == null){ |
97 |
rasterBufBandToDrawList = new int[1]; |
98 |
rasterBufBandToDrawList[0] = rasterBufBandToDraw;
|
99 |
}else{
|
100 |
int[] auxList = new int[rasterBufBandToDrawList.length + 1]; |
101 |
for(int i=0;i<rasterBufBandToDrawList.length;i++) |
102 |
auxList[i] = rasterBufBandToDrawList[i]; |
103 |
auxList[rasterBufBandToDrawList.length] = rasterBufBandToDraw; |
104 |
rasterBufBandToDrawList = auxList; |
105 |
} |
106 |
} |
107 |
|
108 |
/**
|
109 |
* Obtiene el nombre del fichero al que pertenece la banda
|
110 |
* @return String con el nombre del fichero al
|
111 |
* que pertenece la banda
|
112 |
*/
|
113 |
public String getFileName() { |
114 |
return fileName;
|
115 |
} |
116 |
|
117 |
/**
|
118 |
* Asigna el nombre del fichero al que pertenece la banda
|
119 |
* @param fileName String con el nombre del fichero al
|
120 |
* que pertenece la banda
|
121 |
*/
|
122 |
public void setFileName(String fileName) { |
123 |
this.fileName = fileName;
|
124 |
} |
125 |
|
126 |
/**
|
127 |
* Obtiene la posici?n de la banda en el fichero
|
128 |
* @return entero con la posici?n de la banda en el fichero
|
129 |
*/
|
130 |
public int getPosition() { |
131 |
return position;
|
132 |
} |
133 |
|
134 |
/**
|
135 |
* Asigna la posici?n de la banda en el fichero
|
136 |
* @param position Posici?n de la banda en el fichero
|
137 |
*/
|
138 |
public void setPosition(int position) { |
139 |
this.position = position;
|
140 |
} |
141 |
|
142 |
/**
|
143 |
* Obtiene el tipo de dato de la banda
|
144 |
* @return entero con el tipo de dato
|
145 |
*/
|
146 |
public int getDataType() { |
147 |
return dataType;
|
148 |
} |
149 |
|
150 |
/**
|
151 |
* Asigna el tipo de dato de la banda
|
152 |
* @param datatype entero con el tipo de dato de la banda
|
153 |
*/
|
154 |
public void setDataType(int dataType) { |
155 |
this.dataType = dataType;
|
156 |
} |
157 |
} |