Statistics
| Revision:

root / trunk / extensions / extRasterTools / src / org / gvsig / rasterTools / saveRaster / ui / properties / ProgressSaveRasterDialog.java @ 6877

History | View | Annotate | Download (5.16 KB)

1
/*
2
 * Created on 17-feb-2004
3
 *
4
 * To change the template for this generated file go to
5
 * Window>Preferences>Java>Code Generation>Code and Comments
6
 */
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47
package org.gvsig.rasterTools.saveRaster.ui.properties;
48

    
49
import java.awt.Dimension;
50
import java.awt.geom.Rectangle2D;
51

    
52
import org.cresques.cts.IProjection;
53
import org.cresques.io.GeoRasterWriter;
54
import org.gvsig.rasterTools.saveRaster.operations.SaveRasterThread;
55
import org.gvsig.rasterTools.saveRaster.ui.listener.ProgressBarListener;
56
import org.gvsig.rasterTools.saveRaster.ui.main.SaveRasterDefaultPanel;
57
import org.gvsig.rasterTools.saveRaster.util.DriverProperties;
58

    
59
import com.iver.andami.PluginServices;
60
import com.iver.andami.ui.mdiManager.IWindow;
61
import com.iver.andami.ui.mdiManager.ViewInfo;
62
import com.iver.cit.gvsig.fmap.MapControl;
63
import com.iver.cit.gvsig.fmap.ViewPort;
64
import com.iver.cit.gvsig.fmap.layers.FLayers;
65

    
66
/**
67
 * @author Nacho Brodin <brodin_ign@gva.es>
68
 */
69
public class ProgressSaveRasterDialog extends ProgressSaveRasterPanel implements IWindow{
70
        private ViewPort                                         vp = null;
71
        private SaveRasterThread                        threadSave = null;
72
        private        ProgressBarListener                        progressBarListener = null;
73
        private SaveRasterDefaultPanel                 parent = null;
74
        
75
        /**
76
         * Contructor 
77
         * @param mapCtrl                        MapControl
78
         * @param layers                        Capas a rasterizar
79
         * @param currentProjection        Proyecci?n 
80
         * @param dimension                        Dimensi?n del marco en pixeles
81
         * @param ext                                Extend de las capas a rasterizar
82
         */
83
        public ProgressSaveRasterDialog(        MapControl mapCtrl, 
84
                                                                                FLayers layers, 
85
                                                                                IProjection currentProjection,
86
                                                                                Dimension dimension, 
87
                                                                                Rectangle2D ext,
88
                                                                                SaveRasterDefaultPanel parent){
89
                super();
90
        
91
                vp = new ViewPort(currentProjection);
92
                vp.setBackColor(mapCtrl.getViewPort().getBackColor());
93
                vp.setImageSize(dimension);
94
                vp.setExtent(ext);
95
                this.parent = parent;
96
                 
97
                threadSave = new SaveRasterThread(mapCtrl, layers, dimension, vp, this);
98
                progressBarListener = new ProgressBarListener(threadSave, this);
99
                this.setTranslation();
100
        }
101
        
102
        /**
103
         * Asigna los textos a los paneles en el idioma seleccionado
104
         */        
105
        private void setTranslation(){
106
                this.getLabelWait().setText(PluginServices.getText(this,"espere")+",...");
107
        }
108
        
109
        /**
110
         * Asigna el objeto que contiene las propiedades
111
         * @param driverProps
112
         */
113
        public void setProps(DriverProperties driverProps){
114
                if(threadSave != null)
115
                        threadSave.setProps(driverProps);
116
        }
117
        
118
        /**
119
         * Asigna el nombre del fichero
120
         * @param fName        Nombre del fichero
121
         */
122
        public void setFName(String fName){
123
                if(threadSave != null)
124
                        threadSave.setFName(fName);
125
        }
126
        
127
        /**
128
         * Asigna el GeoRasterWriter que se usar? para salvar
129
         * @param writer
130
         */
131
        public void setWriter(GeoRasterWriter writer){
132
                if(threadSave != null)
133
                        threadSave.setWriter(writer);
134
        }
135
        
136
        /**
137
         * Asigna el tama?o de bloque que se lee de una sola vez desde el origen
138
         * Esto influye en la velocidad de escritura y depende de la memoria que 
139
         * tengamos disponible. Si disponemos de poca corremos el riesgo de que al
140
         * asignar un bloque muy grande nos de un error
141
         * @param sizeBlock Tama?o de bloque
142
         */
143
        public void setBlockSize(int sizeBlock){
144
                if(threadSave != null)
145
                        threadSave.setBlockSize(sizeBlock);
146
        }
147
        
148
        /**
149
         * Asigna la compresi?n si el formato dispone de este par?metro
150
         * @param compresion Nivel de compresi?n
151
         */
152
        public void setCompresion(int compresion){
153
                if(threadSave != null)
154
                        threadSave.setCompresion(compresion);
155
        }
156
        
157
        /**
158
         * Muestra la barra de incremento
159
         */
160
        public void showWindow(){
161
                threadSave.start();
162
                PluginServices.getMDIManager().addView(this);
163
        }
164
                
165
        /**
166
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#getViewInfo()
167
         */
168
        public ViewInfo getViewInfo() {
169
                ViewInfo m_viewinfo=new ViewInfo(ViewInfo.MODALDIALOG);
170
                    m_viewinfo.setTitle(PluginServices.getText(this, "tarea_en_progreso"));
171
                return m_viewinfo;
172
        }
173

    
174
        /**
175
         * Obtiene la ventana padre de esta.
176
         * @return SaveRasterDefaultPanel
177
         */
178
        public SaveRasterDefaultPanel getParentWindow() {
179
                return parent;
180
        }
181
}
182

    
183