root / trunk / extensions / extGeoprocessingExtensions / src / com / iver / cit / gvsig / geoprocess / impl / reproject / gui / GeoprocessingReprojectPanel.java @ 6179
History | View | Annotate | Download (4.31 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 6179 2006-07-04 16:43:18Z azabala $
|
47 |
* $Log$
|
48 |
* Revision 1.2 2006-07-04 16:43:18 azabala
|
49 |
* *** empty log message ***
|
50 |
*
|
51 |
* Revision 1.1 2006/07/03 20:28:56 azabala
|
52 |
* *** empty log message ***
|
53 |
*
|
54 |
*
|
55 |
*/
|
56 |
package com.iver.cit.gvsig.geoprocess.impl.reproject.gui; |
57 |
|
58 |
import java.awt.GridBagConstraints; |
59 |
import java.awt.event.ActionEvent; |
60 |
import java.awt.event.ActionListener; |
61 |
import java.awt.event.ItemEvent; |
62 |
|
63 |
import javax.swing.JLabel; |
64 |
|
65 |
import org.cresques.cts.IProjection; |
66 |
import org.cresques.cts.ProjectionPool; |
67 |
import org.gvsig.gui.beans.swing.JButton; |
68 |
|
69 |
import com.iver.andami.PluginServices; |
70 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
71 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
72 |
import com.iver.cit.gvsig.geoprocess.impl.AbstractGeoprocessGridbagPanel; |
73 |
import com.iver.cit.gvsig.gui.Dialogs.CSSelectionDialog; |
74 |
|
75 |
public class GeoprocessingReprojectPanel extends AbstractGeoprocessGridbagPanel { |
76 |
/**
|
77 |
* projection of the input layer
|
78 |
*/
|
79 |
private IProjection inputLayerProjection;
|
80 |
/**
|
81 |
* projection of the target layer
|
82 |
*/
|
83 |
private IProjection targetLayerProjection;
|
84 |
|
85 |
/**
|
86 |
* label to show input projection name
|
87 |
*/
|
88 |
private JLabel inputProjectionLabel; |
89 |
|
90 |
/**
|
91 |
* label to show target projection name
|
92 |
*/
|
93 |
private JLabel targetProjectionLabel; |
94 |
|
95 |
/**
|
96 |
* Constructor.
|
97 |
*
|
98 |
*/
|
99 |
public GeoprocessingReprojectPanel(FLayers layers) {
|
100 |
super(layers,
|
101 |
PluginServices.getText(null,
|
102 |
"Reproyeccion._Introduccion_de_datos"));
|
103 |
} |
104 |
|
105 |
protected void addSpecificDesign() { |
106 |
inputLayerProjection = getInputLayer().getProjection(); |
107 |
targetLayerProjection = ProjectionPool.get("EPSG:23030");
|
108 |
inputProjectionLabel = new JLabel(inputLayerProjection.getAbrev()); |
109 |
targetProjectionLabel = new JLabel(targetLayerProjection.getAbrev()); |
110 |
addComponent(PluginServices.getText(this, "Proyeccion_Actual"), |
111 |
inputProjectionLabel, GridBagConstraints.NONE);
|
112 |
|
113 |
addComponent(new JLabel(PluginServices.getText(this, "Proyeccion_Destino")), |
114 |
targetProjectionLabel, |
115 |
getOpenProjectionDialogButton(), |
116 |
GridBagConstraints.NONE);
|
117 |
} |
118 |
|
119 |
|
120 |
private JButton getOpenProjectionDialogButton(){ |
121 |
JButton solution = new JButton("..."); |
122 |
solution.addActionListener(new ActionListener(){ |
123 |
public void actionPerformed(ActionEvent arg0) { |
124 |
CSSelectionDialog csSelect = new CSSelectionDialog();
|
125 |
csSelect.setProjection(targetLayerProjection); |
126 |
PluginServices.getMDIManager().addView(csSelect); |
127 |
if (csSelect.isOkPressed()) {
|
128 |
targetLayerProjection = |
129 |
csSelect.getProjection(); |
130 |
targetProjectionLabel. |
131 |
setText(targetLayerProjection.getAbrev()); |
132 |
} |
133 |
}}); |
134 |
return solution;
|
135 |
} |
136 |
|
137 |
/**
|
138 |
* This method processes selection events in layer combo box
|
139 |
* (in this case, modify the projection to show the projection
|
140 |
* of the selected layer)
|
141 |
*/
|
142 |
protected void processLayerComboBoxStateChange(ItemEvent e) { |
143 |
FLyrVect inputLyr = getInputLayer(); |
144 |
inputLayerProjection = inputLyr.getProjection(); |
145 |
inputProjectionLabel.setText(inputLayerProjection.getAbrev()); |
146 |
} |
147 |
|
148 |
public IProjection getTargetProjection(){
|
149 |
return targetLayerProjection;
|
150 |
} |
151 |
|
152 |
|
153 |
} // @jve:decl-index=0:visual-constraint="10,10"
|
154 |
|