Revision 11393 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/cutting/CuttingProcess.java
CuttingProcess.java | ||
---|---|---|
34 | 34 |
import org.gvsig.rastertools.cutting.ui.listener.CuttingPanelListener; |
35 | 35 |
|
36 | 36 |
/** |
37 |
* <code>CuttingProcess</code> es un proceso que usa un <code>Thread</code> |
|
38 |
* para calcular el recorte de una capa. |
|
37 | 39 |
* |
38 |
* |
|
39 | 40 |
* @version 24/04/2007 |
40 | 41 |
* @author Borja S?nchez Zamorano (borja.sanchez@iver.es) |
41 | 42 |
*/ |
42 | 43 |
public class CuttingProcess implements Runnable, IncrementableListener { |
43 |
// private GeoRasterWriter writer = null; |
|
44 | 44 |
private String fileName = ""; |
45 | 45 |
private IncrementableTask incrementableTask = null; |
46 | 46 |
private volatile Thread blinker = null; |
... | ... | |
53 | 53 |
private int[] dValues = null; |
54 | 54 |
|
55 | 55 |
/** |
56 |
* Constructor |
|
57 |
* @param vp ViewPortData |
|
58 |
* @param dimension Dimension |
|
59 |
* @param rast Objeto servidor de datos |
|
60 |
* @param fName Nombre del fichero de salida |
|
61 |
* @param params Par?metros del escritor |
|
62 |
*/ |
|
56 |
* Variables de la resoluci?n de salida |
|
57 |
*/ |
|
58 |
private int resolutionWidth = 0, resolutionHeight = 0; |
|
59 |
|
|
60 |
/** |
|
61 |
* Crea un <code>CuttingProcess</code> para generar un recorte |
|
62 |
* @param cuttingPanelListener |
|
63 |
* @param dValues |
|
64 |
* @param fileName |
|
65 |
* @param writerBufferServer |
|
66 |
* @param rasterMultiDataset |
|
67 |
* @param extent |
|
68 |
* @param drawableBands |
|
69 |
* @param oneLayerPerBand |
|
70 |
*/ |
|
63 | 71 |
public CuttingProcess(CuttingPanelListener cuttingPanelListener, int[] dValues, String fileName, WriterBufferServer writerBufferServer, RasterMultiDataset rasterMultiDataset, Extent extent, int[] drawableBands, boolean oneLayerPerBand) { |
64 | 72 |
this.fileName = fileName; |
65 | 73 |
this.writerBufferServer = writerBufferServer; |
... | ... | |
72 | 80 |
} |
73 | 81 |
|
74 | 82 |
/** |
75 |
* Arranca el proceso de salvado a raster
|
|
83 |
* Arranca el proceso de recorte de un layer
|
|
76 | 84 |
*/ |
77 | 85 |
public void start() { |
78 | 86 |
blinker = new Thread(this); |
... | ... | |
80 | 88 |
} |
81 | 89 |
|
82 | 90 |
/** |
83 |
* Detiene el proceso de salvado a raster |
|
91 |
* Establecer la resolucion de salida al crear el recorte |
|
92 |
* @param width |
|
93 |
* @param height |
|
84 | 94 |
*/ |
85 |
public synchronized void stop() {
|
|
86 |
blinker = null;
|
|
87 |
notify();
|
|
95 |
public void setResolution(int width, int height) {
|
|
96 |
resolutionWidth = width;
|
|
97 |
resolutionHeight = height;
|
|
88 | 98 |
} |
89 | 99 |
|
100 |
/** |
|
101 |
* Escribir el recorte en disco usando las bandas especificadas |
|
102 |
* @param file Ruta completa del fichero |
|
103 |
* @param bands Array de bandas que se quieren guardar en dicho fichero |
|
104 |
* @throws NotSupportedExtensionException |
|
105 |
* @throws RasterDriverException |
|
106 |
* @throws IOException |
|
107 |
*/ |
|
90 | 108 |
private void WriteFile(String file, int[] bands) |
91 | 109 |
throws NotSupportedExtensionException, RasterDriverException, IOException { |
92 | 110 |
|
93 | 111 |
BufferFactory bufferFactory = new BufferFactory(rasterMultiDataset); |
94 | 112 |
bufferFactory.addDrawableBands(bands); |
95 |
bufferFactory.setAreaOfInterest(dValues[0], dValues[3], dValues[2] - dValues[0], dValues[1] - dValues[3], (int) cuttingPanelListener.getCuttingPanel().getWidthText(), (int) cuttingPanelListener.getCuttingPanel().getHeightText());
|
|
113 |
bufferFactory.setAreaOfInterest(dValues[0], dValues[3], dValues[2] - dValues[0], dValues[1] - dValues[3], resolutionWidth, resolutionHeight);
|
|
96 | 114 |
|
97 | 115 |
IBuffer buffer = bufferFactory.getRasterBuf(); |
98 | 116 |
|
Also available in: Unified diff