root / trunk / extensions / extGeoprocessingExtensions / src / com / iver / cit / gvsig / geoprocess / impl / reproject / gui / GeoprocessingReprojectPanel.java @ 6884
History | View | Annotate | Download (5.12 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 6884 2006-08-29 08:46:36Z cesar $
|
47 |
* $Log$
|
48 |
* Revision 1.5 2006-08-29 08:46:36 cesar
|
49 |
* Rename the remaining method calls (extGeoprocessingExtensions was not in my workspace)
|
50 |
*
|
51 |
* Revision 1.4 2006/08/11 17:20:32 azabala
|
52 |
* *** empty log message ***
|
53 |
*
|
54 |
* Revision 1.2 2006/07/04 16:43:18 azabala
|
55 |
* *** empty log message ***
|
56 |
*
|
57 |
* Revision 1.1 2006/07/03 20:28:56 azabala
|
58 |
* *** empty log message ***
|
59 |
*
|
60 |
*
|
61 |
*/
|
62 |
package com.iver.cit.gvsig.geoprocess.impl.reproject.gui; |
63 |
|
64 |
import java.awt.BorderLayout; |
65 |
import java.awt.GridBagConstraints; |
66 |
import java.awt.Insets; |
67 |
import java.awt.event.ActionEvent; |
68 |
import java.awt.event.ActionListener; |
69 |
import java.awt.event.ItemEvent; |
70 |
|
71 |
import javax.swing.JLabel; |
72 |
import javax.swing.JPanel; |
73 |
|
74 |
import org.cresques.cts.IProjection; |
75 |
import org.cresques.cts.ProjectionPool; |
76 |
import org.gvsig.gui.beans.swing.JButton; |
77 |
|
78 |
import com.iver.andami.PluginServices; |
79 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
80 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
81 |
import com.iver.cit.gvsig.geoprocess.core.gui.AbstractGeoprocessGridbagPanel; |
82 |
import com.iver.cit.gvsig.gui.dialogs.CSSelectionDialog; |
83 |
|
84 |
public class GeoprocessingReprojectPanel extends AbstractGeoprocessGridbagPanel { |
85 |
/**
|
86 |
* projection of the input layer
|
87 |
*/
|
88 |
private IProjection inputLayerProjection;
|
89 |
/**
|
90 |
* projection of the target layer
|
91 |
*/
|
92 |
private IProjection targetLayerProjection;
|
93 |
|
94 |
/**
|
95 |
* label to show input projection name
|
96 |
*/
|
97 |
private JLabel inputProjectionLabel; |
98 |
|
99 |
/**
|
100 |
* label to show target projection name
|
101 |
*/
|
102 |
private JLabel targetProjectionLabel; |
103 |
|
104 |
/**
|
105 |
* Constructor.
|
106 |
*
|
107 |
*/
|
108 |
public GeoprocessingReprojectPanel(FLayers layers) {
|
109 |
super(layers,
|
110 |
PluginServices.getText(null,
|
111 |
"Reproyeccion._Introduccion_de_datos"));
|
112 |
} |
113 |
|
114 |
protected void addSpecificDesign() { |
115 |
Insets insets = new Insets(5, 5, 5, 5); |
116 |
inputLayerProjection = getInputLayer().getProjection(); |
117 |
targetLayerProjection = ProjectionPool.get("EPSG:23030");
|
118 |
String inputProjectionText = PluginServices.
|
119 |
getText(this, "Proyeccion_Actual")+ |
120 |
": "+
|
121 |
inputLayerProjection.getAbrev(); |
122 |
inputProjectionLabel = new JLabel(inputProjectionText); |
123 |
addComponent(inputProjectionLabel, insets); |
124 |
|
125 |
|
126 |
String targetProjectionText = PluginServices.
|
127 |
getText(this, "Proyeccion_Destino")+ |
128 |
": " +
|
129 |
targetLayerProjection.getAbrev(); |
130 |
targetProjectionLabel = new JLabel(targetProjectionText); |
131 |
addComponent(targetProjectionLabel, |
132 |
getOpenProjectionDialogButton(), |
133 |
GridBagConstraints.REMAINDER,
|
134 |
insets); |
135 |
initSelectedItemsJCheckBox(); |
136 |
updateNumSelectedFeaturesLabel(); |
137 |
} |
138 |
|
139 |
|
140 |
private JButton getOpenProjectionDialogButton(){ |
141 |
JButton solution = new JButton("..."); |
142 |
solution.addActionListener(new ActionListener(){ |
143 |
public void actionPerformed(ActionEvent arg0) { |
144 |
CSSelectionDialog csSelect = new CSSelectionDialog();
|
145 |
csSelect.setProjection(targetLayerProjection); |
146 |
PluginServices.getMDIManager().addWindow(csSelect); |
147 |
if (csSelect.isOkPressed()) {
|
148 |
targetLayerProjection = |
149 |
csSelect.getProjection(); |
150 |
String targetProjectionText = PluginServices.
|
151 |
getText(this, "Proyeccion_Destino")+ |
152 |
": " +
|
153 |
targetLayerProjection.getAbrev(); |
154 |
targetProjectionLabel. |
155 |
setText(targetProjectionText); |
156 |
} |
157 |
}}); |
158 |
return solution;
|
159 |
} |
160 |
|
161 |
/**
|
162 |
* This method processes selection events in layer combo box
|
163 |
* (in this case, modify the projection to show the projection
|
164 |
* of the selected layer)
|
165 |
*/
|
166 |
protected void processLayerComboBoxStateChange(ItemEvent e) { |
167 |
FLyrVect inputLyr = getInputLayer(); |
168 |
inputLayerProjection = inputLyr.getProjection(); |
169 |
String inputProjectionText = PluginServices.
|
170 |
getText(this, "Proyeccion_Actual")+ |
171 |
": "+
|
172 |
inputLayerProjection.getAbrev(); |
173 |
|
174 |
inputProjectionLabel.setText(inputProjectionText); |
175 |
} |
176 |
|
177 |
public IProjection getTargetProjection(){
|
178 |
return targetLayerProjection;
|
179 |
} |
180 |
|
181 |
|
182 |
} // @jve:decl-index=0:visual-constraint="10,10"
|
183 |
|