Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extGeoprocessingExtensions / src / com / iver / cit / gvsig / geoprocess / impl / reproject / gui / GeoprocessingReprojectPanel.java @ 6166

History | View | Annotate | Download (4.21 KB)

1
/*
2
 * Created on 30-jun-2006
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: GeoprocessingReprojectPanel.java 6166 2006-07-03 20:29:16Z azabala $
47
* $Log$
48
* Revision 1.1  2006-07-03 20:28:56  azabala
49
* *** empty log message ***
50
*
51
*
52
*/
53
package com.iver.cit.gvsig.geoprocess.impl.reproject.gui;
54

    
55
import java.awt.GridBagConstraints;
56
import java.awt.event.ActionEvent;
57
import java.awt.event.ActionListener;
58
import java.awt.event.ItemEvent;
59

    
60
import javax.swing.JLabel;
61

    
62
import org.cresques.cts.IProjection;
63
import org.cresques.cts.ProjectionPool;
64
import org.gvsig.gui.beans.swing.JButton;
65

    
66
import com.iver.andami.PluginServices;
67
import com.iver.cit.gvsig.fmap.layers.FLayers;
68
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
69
import com.iver.cit.gvsig.geoprocess.impl.AbstractGeoprocessGridbagPanel;
70
import com.iver.cit.gvsig.gui.Dialogs.CSSelectionDialog;
71

    
72
public class GeoprocessingReprojectPanel extends AbstractGeoprocessGridbagPanel {
73
        /**
74
         * projection of the input layer
75
         */
76
        private IProjection inputLayerProjection;
77
        /**
78
         * projection of the target layer
79
         */
80
        private IProjection targetLayerProjection;
81
        
82
        /**
83
         * label to show input projection name
84
         */
85
        private JLabel inputProjectionLabel;
86
        
87
        /**
88
         * label to show target projection name
89
         */
90
        private JLabel targetProjectionLabel;
91
        
92
        /**
93
         * Constructor.
94
         * 
95
         */
96
        public GeoprocessingReprojectPanel(FLayers layers) {
97
                super(layers, 
98
                        PluginServices.getText(null, 
99
                                        "Reproyeccion._Introduccion_de_datos"));
100
        }
101

    
102
        protected void addSpecificDesign() {
103
                inputLayerProjection = getInputLayer().getProjection();
104
                targetLayerProjection = ProjectionPool.get("EPSG:23030");
105
                inputProjectionLabel = new JLabel(inputLayerProjection.getAbrev());
106
                targetProjectionLabel = new JLabel(targetLayerProjection.getAbrev());
107
                addComponent(PluginServices.getText(this, "Proyeccion_Actual"),
108
                                inputProjectionLabel);
109
                
110
                addComponent(new JLabel(PluginServices.getText(this, "Proyeccion_Destino")),
111
                                targetProjectionLabel,
112
                                getOpenProjectionDialogButton(),
113
                                GridBagConstraints.BOTH);
114
        }
115
        
116
        
117
        private JButton getOpenProjectionDialogButton(){
118
                JButton solution = new JButton("...");
119
                solution.addActionListener(new ActionListener(){
120
                        public void actionPerformed(ActionEvent arg0) {
121
                                CSSelectionDialog csSelect = new CSSelectionDialog();
122
                                csSelect.setProjection(targetLayerProjection);
123
                        PluginServices.getMDIManager().addView(csSelect);
124
                        if (csSelect.isOkPressed()) {
125
                                targetLayerProjection = 
126
                                        csSelect.getProjection();
127
                                targetProjectionLabel.
128
                                        setText(targetLayerProjection.getAbrev());
129
                        }
130
                        }});
131
                return solution;
132
        }
133

    
134
        /**
135
         * This method processes selection events in layer combo box
136
         * (in this case, modify the projection to show the projection
137
         * of the selected layer)
138
         */
139
        protected void processLayerComboBoxStateChange(ItemEvent e) {
140
                FLyrVect inputLyr = getInputLayer();
141
                inputLayerProjection = inputLyr.getProjection();
142
                inputProjectionLabel.setText(inputLayerProjection.getAbrev());
143
        }
144
        
145
        public IProjection getTargetProjection(){
146
                return targetLayerProjection;
147
        }
148

    
149

    
150
}  //  @jve:decl-index=0:visual-constraint="10,10"
151