gvsig-raster / org.gvsig.raster / branches / org.gvsig.raster_proyeccion_al_vuelo / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.impl / src / main / java / org / gvsig / raster / impl / buffer / cache / PageBandBuffer.java @ 5458
History | View | Annotate | Download (2.66 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.raster.impl.buffer.cache; |
23 |
|
24 |
import java.io.IOException; |
25 |
|
26 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
27 |
import org.gvsig.raster.impl.buffer.RasterMemoryBuffer; |
28 |
|
29 |
/**
|
30 |
* Esta clase representa una p?gina de cache. Una p?gina no es m?s que un buffer de datos
|
31 |
* con todas sus funcionalidades con un uso especifico, el de ser una p?gina.
|
32 |
*
|
33 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
34 |
*
|
35 |
*/
|
36 |
public class PageBandBuffer extends RasterMemoryBuffer { |
37 |
|
38 |
/**
|
39 |
* N?mero de banda que corresponde a este PageBandBuffer
|
40 |
*/
|
41 |
private int numBand = 0; |
42 |
private HddPage[] hddPages = null; |
43 |
|
44 |
/**
|
45 |
* Constructor.
|
46 |
* @param dataType Tipo de dato
|
47 |
* @param width Ancho de p?gina
|
48 |
* @param height Alto de p?gina
|
49 |
* @param bandNr N?mero de bandas
|
50 |
* @param malloc true para reservar de memoria en el buffer
|
51 |
*/
|
52 |
public PageBandBuffer(int dataType, int width, int height, int bandNr, boolean malloc, int numBand){ |
53 |
super(dataType, width, height, bandNr, malloc);
|
54 |
this.numBand = numBand;
|
55 |
} |
56 |
|
57 |
/**
|
58 |
* Asigna la lista de paginas de disco
|
59 |
* @param hddList Lista de p?ginas de disco
|
60 |
*/
|
61 |
public void setHddPages(HddPage[] hddList){ |
62 |
this.hddPages = hddList;
|
63 |
} |
64 |
|
65 |
/**
|
66 |
* Carga una p?gina especificada en el par?metro nPag con los datos necesarios.
|
67 |
* Para esto utiliza el dataSource.
|
68 |
*
|
69 |
* @param nPag N?mero de p?gina a cargar
|
70 |
*/
|
71 |
public void loadPage(int nPag) throws ProcessInterruptedException { |
72 |
hddPages[nPag].getDataServer(numBand).loadPage(this);
|
73 |
} |
74 |
|
75 |
/**
|
76 |
* Salva una p?gina especificada en el par?metro nPag a disco.
|
77 |
* Para esto utiliza el dataSource
|
78 |
*
|
79 |
* @param nPag N?mero de p?gina a salvar
|
80 |
* @throws IOException
|
81 |
*/
|
82 |
public void savePage(int nPag) throws IOException{ |
83 |
hddPages[nPag].getDataServer(numBand).savePage(this);
|
84 |
} |
85 |
|
86 |
} |