Statistics
| Revision:

gvsig-raster / org.gvsig.raster.cache / trunk / org.gvsig.raster.cache / org.gvsig.raster.cache.lib.api / src / main / java / org / gvsig / raster / cache / buffer / BufferCacheManager.java @ 995

History | View | Annotate | Download (5.97 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.cache.buffer;
23

    
24
import org.gvsig.raster.cache.buffer.histogram.BufferHistogram;
25

    
26

    
27

    
28

    
29

    
30
/**
31
 * This class is responsible of the management of the library's business logic.
32
 * It is the library's main entry point, and provides all the services to manage
33
 * {@link BufferCacheService}s.
34
 * 
35
 * @author Nacho Brodin (nachobrodin@gmail.com)
36
 * @version $Id$
37
 */
38
public interface BufferCacheManager {
39
        public static int                      DONT_FORCE                 = 0;
40
        public static int                      MEMORY_BUFFER              = 1;
41
        public static int                      BAND_CACHE                 = 2;
42
        public static int                      BAND_VERT_CACHE            = 3;
43
        public static int                      READ_ONLY_CACHE            = 4;
44
        
45
        /**
46
         * Valor noData por defecto para la librer?a. En caso de no tener un valor asociado
47
         * al raster se usar? este.
48
         */
49
        public static double            defaultNoDataValue       = -99999;
50
        public static boolean           noDataValueEnable        = false;
51
        
52
        /**
53
         * Genera instancias del buffer de datos adecuado al tama?o del raster. Si no hay muchos datos
54
         * (menos de cacheMemorySize) crear? un buffer en memoria. Si hay m?s de esta cantidad
55
         * entonces crearemos un buffer cacheado (RasterCache). A partir de la cantidad se?alada
56
         * por multicacheMemorySize haremos un buffer cacheado donde cada p?gina no ocupa todo
57
         * el ancho del raster ya que este ser? muy grande. La gesti?n de una cache donde cada
58
         * pagina ha de partir una l?nea lleva una complejidad a?adida.
59
         *  
60
         * @param params Par?metros de la carga
61
         * @return Objeto RasterBuffer
62
         */
63
        public Buffer createBuffer(BufferParam params);
64
        
65
        /**
66
         * Genera una instancia del buffer de solo lectura. Este buffer consta de una cache y unos apuntadores
67
         * a las p?ginas en disco. Cuando se accede a los datos se carga en memoria la p?gina pedida.
68
         *  
69
         * @param  file 
70
         *         File to read data
71
         */
72
        public Buffer createReadOnlyBuffer(String file);
73
        
74
        /**
75
         * Genera una instancia del buffer de solo lectura. Este buffer consta de una cache y unos apuntadores
76
         * a las p?ginas en disco. Cuando se accede a los datos se carga en memoria la p?gina pedida.
77
         *  
78
         * @param dataType Tipo de dato
79
         * @param width Ancho
80
         * @param height Alto
81
         * @param bandNr Banda
82
         * @param flag En caso de buffers de memoria este flag a true significa que se reserva la memoria
83
         * para el buffer de forma normal y si est? a false no se reserva por lo que la reserva deber? ser
84
         * posterior. 
85
         */
86
        public Buffer createMemoryBuffer(int dataType, int width, int height, int bandNr, boolean malloc);
87
        
88
        /**
89
         * Creates a new instance of an interpolation object.
90
         * @param buf IRasterBuffer
91
         * @return IBufferInterpolation
92
         */
93
        public BufferInterpolation createInterpolation(Buffer buf);
94
        
95
        /**
96
         * Builds a new parameter object
97
         * @param  x
98
         *         Upper left X position 
99
         * @param  y
100
         *         Upper left X position
101
         * @param  w
102
         *         Width
103
         * @param  h
104
         *         Height
105
         */
106
        public BufferParam createBufferParams(int w, int h);
107
        
108
        /**
109
         * Creates a parameter object for building a buffer. The buffer type is read-write.
110
         * This type could be changed after the creation of a {@link BufferParam} object.
111
         * @param  w
112
         *         Width
113
         * @param  h
114
         *         Height
115
         * @param  bandCount
116
         *                    Number of bands
117
         * @param  dataType
118
         *         Type of data        
119
         */
120
        public BufferParam createBufferParams(int w, int h, int bandCount, int dataType);
121
        
122
        /**
123
         * Builds a new NoData object
124
         * @param noData
125
         *        value to assign to all bands
126
         * @param nativeNoData
127
         *        The native is the original value
128
         *        saved in the head of the file or its metadata.
129
         * @param fileName
130
         *        Name of file owner of this nodata value. This string is useful to
131
         *        save the rmf file
132
         * @param bandCount
133
         *        Number of bands of the file
134
         * @return NoData
135
         */
136
        public BufferNoData createNoData(Number noData, Number nativeNoData, String fileName, int bandCount);
137
        
138
        /**
139
         * Builds a new NoData for DEMs
140
         * @param noData
141
         *        value to assign to all bands
142
         * @param nativeNoData
143
         *        The native is the original value
144
         *        saved in the head of the file or its metadata.
145
         * @param fileName
146
         *        Name of file owner of this nodata value. This string is useful to
147
         *        save the rmf file
148
         * @return NoData
149
         */
150
        public BufferNoData createNoData(Number noData, Number nativeNoData, String fileName);
151
        
152
        /**
153
         * Builds a new NoData for DEMs
154
         * @param dataType
155
         *        dataType of this NoData
156
         * @param bandCount
157
         *        Number of bands
158
         * @return NoData
159
         */
160
        public BufferNoData createDefaultNoData(int bandCount, int dataType);
161
        
162
        /**
163
         * Creates a empty histogram
164
         * @param nBands
165
         * @param min
166
         * @param max
167
         * @param dataType
168
         * @param numberOfClasses
169
         * @return
170
         */
171
        public BufferHistogram createHistogram(int nBands, double[] min, double[] max, int dataType, int numberOfClasses);
172
        
173
        /**
174
         * Creates a empty histogram
175
         * @param nBands
176
         * @param min
177
         * @param max
178
         * @param dataType
179
         * @param numberOfClasses
180
         * @return
181
         */
182
        public BufferHistogram createHistogram(int nBands, int nClasses, double[] min, double[] max);
183
}