Revision 40883
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
28 |
|
|
29 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
30 |
|
|
31 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
32 |
<layout class="org.apache.log4j.PatternLayout"> |
|
33 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
34 |
</layout> |
|
35 |
</appender> |
|
36 |
|
|
37 |
<category name="org.gvsig.tools"> |
|
38 |
<priority value="DEBUG" /> |
|
39 |
</category> |
|
40 |
<category name="org.cresques"> |
|
41 |
<priority value="DEBUG" /> |
|
42 |
</category> |
|
43 |
<category name="org.gvsig.fmap.crs"> |
|
44 |
<priority value="DEBUG" /> |
|
45 |
</category> |
|
46 |
|
|
47 |
<root> |
|
48 |
<priority value="INFO" /> |
|
49 |
<appender-ref ref="CONSOLE" /> |
|
50 |
</root> |
|
51 |
</log4j:configuration> |
|
0 | 52 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/test/java/org/cresques/cts/AllTests.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.cts; |
|
25 |
|
|
26 |
import junit.framework.Test; |
|
27 |
import junit.framework.TestSuite; |
|
28 |
|
|
29 |
public class AllTests { |
|
30 |
|
|
31 |
public static Test suite() { |
|
32 |
TestSuite suite = new TestSuite("Test for org.cresques.cts"); |
|
33 |
//$JUnit-BEGIN$ |
|
34 |
|
|
35 |
//$JUnit-END$ |
|
36 |
return suite; |
|
37 |
} |
|
38 |
|
|
39 |
} |
|
0 | 40 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.cresques.ui.CresquesCtsUILibrary |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/cresques/ui/CresquesCtsUILibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.ui; |
|
25 |
|
|
26 |
import org.cresques.impl.cts.ProjectionPool; |
|
27 |
import org.gvsig.app.gui.panels.CRSSelectPanelFactory; |
|
28 |
import org.gvsig.app.gui.panels.ProjChooserPanel; |
|
29 |
import org.gvsig.app.gui.panels.crs.CrsUIFactory; |
|
30 |
import org.gvsig.fmap.crs.CRSFactory; |
|
31 |
import org.gvsig.tools.library.AbstractLibrary; |
|
32 |
import org.gvsig.tools.library.LibraryException; |
|
33 |
|
|
34 |
public class CresquesCtsUILibrary extends AbstractLibrary { |
|
35 |
|
|
36 |
public void doRegistration() { |
|
37 |
this.registerAsAPI(CresquesCtsUILibrary.class); |
|
38 |
} |
|
39 |
|
|
40 |
protected void doInitialize() throws LibraryException { |
|
41 |
CRSSelectPanelFactory.registerPanelClass(ProjChooserPanel.class); |
|
42 |
CRSSelectPanelFactory.registerUIFactory(CrsUIFactory.class); |
|
43 |
//CRSFactory.registerCRSFactory(new ProjectionPool()); |
|
44 |
} |
|
45 |
|
|
46 |
protected void doPostInitialize() throws LibraryException { |
|
47 |
// Nothing to do |
|
48 |
} |
|
49 |
} |
|
0 | 50 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/cresques/ui/cts/package.html | ||
---|---|---|
1 |
<!-- |
|
2 |
|
|
3 |
gvSIG. Desktop Geographic Information System. |
|
4 |
|
|
5 |
Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
|
8 |
modify it under the terms of the GNU General Public License |
|
9 |
as published by the Free Software Foundation; either version 3 |
|
10 |
of the License, or (at your option) any later version. |
|
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
GNU General Public License for more details. |
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
|
18 |
along with this program; if not, write to the Free Software |
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
MA 02110-1301, USA. |
|
21 |
|
|
22 |
For any additional information, do not hesitate to contact us |
|
23 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
|
|
25 |
--> |
|
26 |
<html> |
|
27 |
<body>Interfaces gr?ficas relacionadas con el manejo de proyecciones. |
|
28 |
</body> |
|
29 |
</html> |
|
0 | 30 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/cresques/ui/cts/CSSelectionDialogPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.ui.cts; |
|
25 |
|
|
26 |
import javax.swing.JPanel; |
|
27 |
|
|
28 |
import org.cresques.Messages; |
|
29 |
import org.cresques.impl.cts.ProjectionPool; |
|
30 |
import org.cresques.ui.DefaultDialogPanel; |
|
31 |
|
|
32 |
/** |
|
33 |
* Dialogo para abrir fichero. |
|
34 |
* |
|
35 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
36 |
*/ |
|
37 |
public class CSSelectionDialogPanel extends DefaultDialogPanel { |
|
38 |
|
|
39 |
final private static long serialVersionUID = -3370601314380922368L; |
|
40 |
|
|
41 |
public CSSelectionPanel getProjPanel() { |
|
42 |
return (CSSelectionPanel) getContentPanel(); |
|
43 |
} |
|
44 |
|
|
45 |
protected JPanel getContentPanel() { |
|
46 |
if (contentPane == null) { |
|
47 |
contentPane = |
|
48 |
new CSSelectionPanel(Messages.getText("reference_system")); |
|
49 |
|
|
50 |
((CSSelectionPanel) contentPane).setProjection(new ProjectionPool() |
|
51 |
.get("EPSG:32619")); |
|
52 |
} |
|
53 |
|
|
54 |
return contentPane; |
|
55 |
} |
|
56 |
} |
|
0 | 57 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/cresques/ui/cts/CSSelectionPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.ui.cts; |
|
25 |
|
|
26 |
import java.awt.GridBagConstraints; |
|
27 |
import java.awt.GridBagLayout; |
|
28 |
import java.awt.Insets; |
|
29 |
|
|
30 |
import javax.swing.BorderFactory; |
|
31 |
import javax.swing.JComponent; |
|
32 |
import javax.swing.JLabel; |
|
33 |
import javax.swing.JPanel; |
|
34 |
import javax.swing.border.TitledBorder; |
|
35 |
|
|
36 |
import org.cresques.Messages; |
|
37 |
import org.cresques.cts.IProjection; |
|
38 |
import org.cresques.ui.LoadableComboBox; |
|
39 |
|
|
40 |
//import es.gva.cit.geoexplorer.ui.LoadableComboBox; |
|
41 |
|
|
42 |
/** |
|
43 |
* Panel de edici?n de Sistemas de referencia |
|
44 |
* |
|
45 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
46 |
*/ |
|
47 |
public class CSSelectionPanel extends JPanel { |
|
48 |
|
|
49 |
final private static long serialVersionUID = -3370601314380922368L; |
|
50 |
private LoadableComboBox datumComboBox = null; |
|
51 |
private LoadableComboBox projComboBox = null; |
|
52 |
private LoadableComboBox huseComboBox = null; |
|
53 |
private JLabel jLabel = null; |
|
54 |
private JLabel jLabel1 = null; |
|
55 |
private JLabel jLabel2 = null; |
|
56 |
private String tit; |
|
57 |
private CSSelectionModel model; |
|
58 |
|
|
59 |
/** |
|
60 |
* Constructor de la clase. |
|
61 |
*/ |
|
62 |
public CSSelectionPanel(String tit) { |
|
63 |
super(); |
|
64 |
|
|
65 |
if (tit == null) { |
|
66 |
tit = Messages.getText("reference_system"); |
|
67 |
if (tit == null) |
|
68 |
tit = "Reference System"; |
|
69 |
} |
|
70 |
|
|
71 |
this.tit = tit; |
|
72 |
setModel(new CSSelectionModel()); |
|
73 |
initialize(); |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* Inicializa el panel. |
|
78 |
* |
|
79 |
* @return javax.swing.JPanel |
|
80 |
*/ |
|
81 |
private void initialize() { |
|
82 |
setLayout(new GridBagLayout()); |
|
83 |
GridBagConstraints c = new GridBagConstraints(); |
|
84 |
c.insets = new Insets(2, 5, 2, 5); |
|
85 |
c.gridy = -1; |
|
86 |
|
|
87 |
setBorder(BorderFactory.createCompoundBorder(null, BorderFactory |
|
88 |
.createTitledBorder(null, Messages.getText("reference_system"), |
|
89 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
90 |
TitledBorder.DEFAULT_POSITION, null, null))); |
|
91 |
|
|
92 |
jLabel = new JLabel(Messages.getText("datum") + ":"); |
|
93 |
addRow(c, jLabel, getDatumComboBox()); |
|
94 |
|
|
95 |
jLabel1 = new JLabel(Messages.getText("projection") + ":"); |
|
96 |
addRow(c, jLabel1, getProjComboBox()); |
|
97 |
|
|
98 |
jLabel2 = new JLabel(Messages.getText("zone") + ":"); |
|
99 |
addRow(c, jLabel2, getHuseComboBox()); |
|
100 |
|
|
101 |
setHuseComboBoxEnabled(false); |
|
102 |
} |
|
103 |
|
|
104 |
public void setModel(CSSelectionModel model) { |
|
105 |
this.model = model; |
|
106 |
|
|
107 |
getHuseComboBox().loadData(model.getZoneList()); |
|
108 |
getDatumComboBox().loadData(model.getDatumList()); |
|
109 |
getProjComboBox().loadData(model.getProjectionList()); |
|
110 |
} |
|
111 |
|
|
112 |
private void setHuseComboBoxEnabled(boolean enabled) { |
|
113 |
if (jLabel2 != null) { |
|
114 |
jLabel2.setEnabled(enabled); |
|
115 |
} |
|
116 |
|
|
117 |
getHuseComboBox().setEnabled(enabled); |
|
118 |
} |
|
119 |
|
|
120 |
private void setDatumComboBoxEnabled(boolean enabled) { |
|
121 |
if (jLabel != null) { |
|
122 |
jLabel.setEnabled(enabled); |
|
123 |
} |
|
124 |
|
|
125 |
getDatumComboBox().setEnabled(enabled); |
|
126 |
} |
|
127 |
|
|
128 |
public void setProjection(IProjection proj) { |
|
129 |
model.setProjection(proj); |
|
130 |
|
|
131 |
setDatumComboBoxEnabled(true); |
|
132 |
getDatumComboBox().setSelectedIndex(model.getSelectedDatum()); |
|
133 |
|
|
134 |
getProjComboBox().removeAllItems(); |
|
135 |
getProjComboBox().loadData(model.getProjectionList()); |
|
136 |
|
|
137 |
model.setProjection(proj); |
|
138 |
getProjComboBox().setSelectedIndex(model.getSelectedProj()); |
|
139 |
model.setProjection(proj); |
|
140 |
|
|
141 |
if (model.getSelectedZone() >= 0) { |
|
142 |
setHuseComboBoxEnabled(true); |
|
143 |
getHuseComboBox().removeAllItems(); |
|
144 |
getHuseComboBox().loadData(model.getZoneList()); |
|
145 |
|
|
146 |
model.setProjection(proj); |
|
147 |
getHuseComboBox().setSelectedIndex(model.getSelectedZone()); |
|
148 |
} else { |
|
149 |
setHuseComboBoxEnabled(false); |
|
150 |
getHuseComboBox().setSelectedIndex(0); |
|
151 |
} |
|
152 |
} |
|
153 |
|
|
154 |
/** |
|
155 |
* Inicializa datumComboBox |
|
156 |
* |
|
157 |
* @return javax.swing.JComboBox |
|
158 |
*/ |
|
159 |
private LoadableComboBox getDatumComboBox() { |
|
160 |
if (datumComboBox == null) { |
|
161 |
datumComboBox = new LoadableComboBox(); |
|
162 |
|
|
163 |
datumComboBox.addItemListener(new java.awt.event.ItemListener() { |
|
164 |
|
|
165 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
166 |
model.setSelectedDatum(e.getItem()); |
|
167 |
getProjComboBox().removeAllItems(); |
|
168 |
getProjComboBox().loadData(model.getProjectionList()); |
|
169 |
} |
|
170 |
}); |
|
171 |
} |
|
172 |
|
|
173 |
return datumComboBox; |
|
174 |
} |
|
175 |
|
|
176 |
/** |
|
177 |
* Inicializa projComboBox |
|
178 |
* |
|
179 |
* @return javax.swing.JComboBox |
|
180 |
*/ |
|
181 |
private LoadableComboBox getProjComboBox() { |
|
182 |
if (projComboBox == null) { |
|
183 |
projComboBox = new LoadableComboBox(); |
|
184 |
// projComboBox.setBounds(14, 80, 250, 23); |
|
185 |
projComboBox.addItemListener(new java.awt.event.ItemListener() { |
|
186 |
|
|
187 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
188 |
model.setSelectedProj(e.getItem()); |
|
189 |
|
|
190 |
if (model.getSelectedProjType() == CSSelectionModel.TRANSVERSAL) { |
|
191 |
setHuseComboBoxEnabled(true); |
|
192 |
getHuseComboBox().removeAllItems(); |
|
193 |
getHuseComboBox().loadData(model.getZoneList()); |
|
194 |
|
|
195 |
} else { |
|
196 |
setHuseComboBoxEnabled(false); |
|
197 |
} |
|
198 |
|
|
199 |
} |
|
200 |
}); |
|
201 |
} |
|
202 |
|
|
203 |
return projComboBox; |
|
204 |
} |
|
205 |
|
|
206 |
/** |
|
207 |
* Inicializa usoComboBox |
|
208 |
* |
|
209 |
* @return javax.swing.JComboBox |
|
210 |
*/ |
|
211 |
private LoadableComboBox getHuseComboBox() { |
|
212 |
if (huseComboBox == null) { |
|
213 |
huseComboBox = new LoadableComboBox(); |
|
214 |
huseComboBox.addItemListener(new java.awt.event.ItemListener() { |
|
215 |
|
|
216 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
217 |
model.setSelectedZone(e.getItem()); |
|
218 |
} |
|
219 |
}); |
|
220 |
} |
|
221 |
|
|
222 |
return huseComboBox; |
|
223 |
} |
|
224 |
|
|
225 |
/** |
|
226 |
* @return |
|
227 |
*/ |
|
228 |
public IProjection getProjection() { |
|
229 |
return model.getProjection(); |
|
230 |
} |
|
231 |
|
|
232 |
private void addRow(GridBagConstraints c, JComponent label, JComponent text) { |
|
233 |
c.anchor = GridBagConstraints.WEST; |
|
234 |
c.weightx = 0.0d; |
|
235 |
c.gridx = 0; |
|
236 |
c.gridy++; |
|
237 |
add(label, c); |
|
238 |
|
|
239 |
c.fill = GridBagConstraints.HORIZONTAL; |
|
240 |
c.weightx = 1.0d; |
|
241 |
c.gridx = 1; |
|
242 |
add(text, c); |
|
243 |
} |
|
244 |
} |
|
0 | 245 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/cresques/ui/cts/CSSelectionModel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.ui.cts; |
|
25 |
|
|
26 |
import org.cresques.cts.IProjection; |
|
27 |
import org.cresques.impl.cts.ProjectionPool; |
|
28 |
|
|
29 |
|
|
30 |
/** |
|
31 |
* @author Luis W. Sevilla (sevilla_lui@gva.es) |
|
32 |
*/ |
|
33 |
public class CSSelectionModel { |
|
34 |
public static int NONE = 0x01; |
|
35 |
public static int GEODETIC = 0x02; |
|
36 |
public static int TRANSVERSAL = 0x03; |
|
37 |
public String[] datumList = { |
|
38 |
"WGS 84", "European 1950", "Datum 73", |
|
39 |
"North American Datum 1927", |
|
40 |
"North American Datum 1983", |
|
41 |
"La Canoa", |
|
42 |
"NTF (Paris)", |
|
43 |
"ETRS 89", |
|
44 |
"Moon (IAU 2000)", |
|
45 |
"Mars (IAU 2000)", |
|
46 |
"Campo_Inchauspe", |
|
47 |
"RGF93" |
|
48 |
}; |
|
49 |
/*private String[] projList = { |
|
50 |
"Geodesica", |
|
51 |
"(UTM) Universal Transversal Mercator", |
|
52 |
"Datum 73 / Modified Portuguese Grid", |
|
53 |
"WGS 84 / LCC Canada", |
|
54 |
"NAD83 / NRCan LCC Canada", |
|
55 |
"Lambert Etendu", |
|
56 |
"RGF93 / Lambert-93", |
|
57 |
"WGS 84 / Mercator", |
|
58 |
"Campo Inchauspe / Zonas 1-7" |
|
59 |
};*/ |
|
60 |
private String[][] projList = { |
|
61 |
{"Geodesica", "(UTM) Universal Transversal Mercator", |
|
62 |
"LCC Canada", "Mercator"}, // WGS84 |
|
63 |
{"Geodesica", "(UTM) Universal Transversal Mercator"}, // ED50 |
|
64 |
{"Geodesica", "Modified Portuguese Grid"}, //Datum 73 |
|
65 |
{"Geodesica", "(UTM) Universal Transversal Mercator"}, // NAD27 |
|
66 |
{"Geodesica", "(UTM) Universal Transversal Mercator", "NRCan LCC Canada"}, // NAD83 |
|
67 |
{"Geodesica", "(UTM) Universal Transversal Mercator"}, // La Canoa |
|
68 |
{"Geodesica", "Lambert Etendu"}, // NTF (Paris) |
|
69 |
{"Geodesica", "(UTM) Universal Transversal Mercator"}, // ETRS89 |
|
70 |
{"Geodesica"}, // Moon |
|
71 |
{"Geodesica"}, // Mars |
|
72 |
{"Geodesica", "Zonas 1-7"}, // CampoInchauspe |
|
73 |
{"Geodesica", "Lambert-93"} // RFG93 |
|
74 |
}; |
|
75 |
|
|
76 |
private int[][] projType = { |
|
77 |
{GEODETIC, TRANSVERSAL, NONE, NONE}, |
|
78 |
{GEODETIC, TRANSVERSAL}, |
|
79 |
{GEODETIC, NONE}, |
|
80 |
{GEODETIC, TRANSVERSAL}, |
|
81 |
{GEODETIC, TRANSVERSAL, NONE}, |
|
82 |
{GEODETIC, TRANSVERSAL}, |
|
83 |
{GEODETIC, NONE}, |
|
84 |
{GEODETIC, TRANSVERSAL}, |
|
85 |
{GEODETIC}, |
|
86 |
{GEODETIC}, |
|
87 |
{GEODETIC, TRANSVERSAL}, |
|
88 |
{GEODETIC, NONE} |
|
89 |
}; |
|
90 |
|
|
91 |
private int [][] zoneRange = { |
|
92 |
{1,60}, |
|
93 |
{1,60}, |
|
94 |
{0,0}, |
|
95 |
{3,23}, |
|
96 |
{3,23}, |
|
97 |
{18,21}, |
|
98 |
{0,0}, |
|
99 |
{28,38}, |
|
100 |
{0,0}, |
|
101 |
{0,0}, |
|
102 |
{1,7}, |
|
103 |
{0,0} |
|
104 |
}; |
|
105 |
private String[] zoneList = { }; |
|
106 |
private int selectedDatum = 0; |
|
107 |
private int selectedProj = 0; |
|
108 |
private int selectedZone = 0; |
|
109 |
|
|
110 |
/** |
|
111 |
* |
|
112 |
*/ |
|
113 |
public CSSelectionModel() { |
|
114 |
super(); |
|
115 |
zoneList = new String[60]; |
|
116 |
|
|
117 |
for (int i = 1; i <= 60; i++) |
|
118 |
zoneList[i - 1] = "Huso " + Integer.toString(i); |
|
119 |
} |
|
120 |
|
|
121 |
|
|
122 |
public String[] getDatumList() { |
|
123 |
return datumList; |
|
124 |
} |
|
125 |
|
|
126 |
public String[] getProjectionList() { |
|
127 |
return projList[getSelectedDatum()]; |
|
128 |
} |
|
129 |
|
|
130 |
public String[] getZoneList() { |
|
131 |
int [] r = zoneRange[getSelectedDatum()]; |
|
132 |
return getZoneList(r[0],r[1]); |
|
133 |
} |
|
134 |
|
|
135 |
public String[] getZoneList(int from, int to) { |
|
136 |
zoneList = new String[to-from+1]; |
|
137 |
|
|
138 |
for (int i = from; i <= to; i++) |
|
139 |
zoneList[i - from] = "Huso " + Integer.toString(i); |
|
140 |
return zoneList; |
|
141 |
} |
|
142 |
public void setSelectedDatum(int opNr) { |
|
143 |
selectedDatum = opNr; |
|
144 |
} |
|
145 |
|
|
146 |
public void setSelectedDatum(Object item) { |
|
147 |
String[] list = datumList; |
|
148 |
|
|
149 |
for (int i = 0; i < list.length; i++) |
|
150 |
if (list[i].compareTo((String) item) == 0) { |
|
151 |
selectedDatum = i; |
|
152 |
break; |
|
153 |
} |
|
154 |
} |
|
155 |
|
|
156 |
public int getSelectedDatum() { |
|
157 |
return selectedDatum; |
|
158 |
} |
|
159 |
|
|
160 |
public void setSelectedProj(int opNr) { |
|
161 |
selectedProj = opNr; |
|
162 |
} |
|
163 |
|
|
164 |
public void setSelectedProj(Object item) { |
|
165 |
String[] list = projList[getSelectedDatum()]; |
|
166 |
|
|
167 |
for (int i = 0; i < list.length; i++) |
|
168 |
if (list[i].compareTo((String) item) == 0) { |
|
169 |
selectedProj = i; |
|
170 |
break; |
|
171 |
} |
|
172 |
} |
|
173 |
|
|
174 |
public int getSelectedProj() { |
|
175 |
return selectedProj; |
|
176 |
} |
|
177 |
|
|
178 |
public int getSelectedProjType() { |
|
179 |
return projType[getSelectedDatum()][selectedProj]; |
|
180 |
} |
|
181 |
|
|
182 |
public void setSelectedZone(int opNr) { |
|
183 |
selectedZone = opNr; |
|
184 |
} |
|
185 |
|
|
186 |
public void setSelectedZone(Object item) { |
|
187 |
String[] list = zoneList; |
|
188 |
|
|
189 |
for (int i = 0; i < list.length; i++) |
|
190 |
if (list[i].compareTo((String) item) == 0) { |
|
191 |
selectedZone = i; |
|
192 |
break; |
|
193 |
} |
|
194 |
} |
|
195 |
|
|
196 |
public int getSelectedZone() { |
|
197 |
return selectedZone; |
|
198 |
} |
|
199 |
|
|
200 |
public void setProjection(IProjection proj) { |
|
201 |
if (proj!=null){ |
|
202 |
String key = proj.getAbrev(); |
|
203 |
// Para usos posteriores. |
|
204 |
// String db = key.split(":")[0]; |
|
205 |
key = key.split(":")[1]; |
|
206 |
|
|
207 |
setSelectedProj(0); |
|
208 |
setSelectedZone(-1); |
|
209 |
|
|
210 |
if (key.endsWith("4326")) { |
|
211 |
setSelectedDatum(0); |
|
212 |
} else if (key.endsWith("4230")) { |
|
213 |
setSelectedDatum(1); |
|
214 |
} else if (key.endsWith("4274")) { |
|
215 |
setSelectedDatum(2); |
|
216 |
} else if (key.endsWith("4267")) { |
|
217 |
setSelectedDatum(3); |
|
218 |
} else if (key.endsWith("4269")) { |
|
219 |
setSelectedDatum(4); |
|
220 |
} else if (key.endsWith("4247")) { |
|
221 |
setSelectedDatum(5); |
|
222 |
} else if (key.endsWith("4807")) { |
|
223 |
setSelectedDatum(6); |
|
224 |
} else if (key.endsWith("4258")) { |
|
225 |
setSelectedDatum(7); |
|
226 |
} else if (key.endsWith("30100")) { |
|
227 |
setSelectedDatum(8); |
|
228 |
} else if (key.endsWith("49900")) { |
|
229 |
setSelectedDatum(9); |
|
230 |
} else if (key.endsWith("4221")) { |
|
231 |
setSelectedDatum(10); |
|
232 |
} else if (key.endsWith("4171")) { |
|
233 |
setSelectedDatum(11); |
|
234 |
} else if (key.startsWith("326")) { |
|
235 |
setSelectedDatum(0); |
|
236 |
setSelectedProj(1); |
|
237 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3))); |
|
238 |
} else if (key.startsWith("230")) { |
|
239 |
setSelectedDatum(1); |
|
240 |
setSelectedProj(1); |
|
241 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3))); |
|
242 |
} else if (key.startsWith("267")) { |
|
243 |
setSelectedDatum(3); |
|
244 |
setSelectedProj(1); |
|
245 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3))); |
|
246 |
} else if (key.startsWith("269")) { |
|
247 |
setSelectedDatum(4); |
|
248 |
setSelectedProj(1); |
|
249 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3))); |
|
250 |
} else if (key.startsWith("247")) { |
|
251 |
setSelectedDatum(5); |
|
252 |
setSelectedProj(1); |
|
253 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3))); |
|
254 |
} else if (key.startsWith("258")) { |
|
255 |
setSelectedDatum(7); |
|
256 |
setSelectedProj(1); |
|
257 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3))); |
|
258 |
} else if (key.startsWith("221")) { |
|
259 |
setSelectedDatum(10); |
|
260 |
setSelectedProj(1); |
|
261 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(4))); |
|
262 |
} else if (key.endsWith("27492")) { // Datum 73 / Modified Portuguese Grid |
|
263 |
setSelectedDatum(2); |
|
264 |
setSelectedProj(1); |
|
265 |
setSelectedZone(-1); |
|
266 |
} else if (key.endsWith("42101")) { // WGS 84 / LCC Canada |
|
267 |
setSelectedDatum(0); |
|
268 |
setSelectedProj(2); |
|
269 |
setSelectedZone(-1); |
|
270 |
} else if (key.endsWith("9804")) { // WGS 84 / Mercator |
|
271 |
setSelectedDatum(0); |
|
272 |
setSelectedProj(3); |
|
273 |
setSelectedZone(-1); |
|
274 |
} else if (key.endsWith("30100")) { // Moon |
|
275 |
setSelectedDatum(8); |
|
276 |
setSelectedProj(0); |
|
277 |
setSelectedZone(-1); |
|
278 |
} else if (key.endsWith("49900")) { // Mars |
|
279 |
setSelectedDatum(9); |
|
280 |
setSelectedProj(0); |
|
281 |
setSelectedZone(-1); |
|
282 |
} else if (key.endsWith("42304")) { // NAD83 / / LCC Canada |
|
283 |
setSelectedDatum(4); |
|
284 |
setSelectedProj(2); |
|
285 |
setSelectedZone(-1); |
|
286 |
} else if (key.endsWith("27582")) { // NTFParis / / Lambert Etendu |
|
287 |
setSelectedDatum(6); |
|
288 |
setSelectedProj(1); |
|
289 |
setSelectedZone(-1); |
|
290 |
} else if (key.equals("2154")) { // RGF93 / / Lambert 93 |
|
291 |
setSelectedDatum(11); |
|
292 |
setSelectedProj(1); |
|
293 |
setSelectedZone(-1); |
|
294 |
} else { |
|
295 |
System.err.println("CAGADA EN EL PARSING DE LA PROYECCION: " + key); |
|
296 |
} |
|
297 |
} else { |
|
298 |
selectedDatum = 0; |
|
299 |
selectedProj = 0; |
|
300 |
selectedZone = 0; |
|
301 |
} |
|
302 |
} |
|
303 |
|
|
304 |
public IProjection getProjection() { |
|
305 |
IProjection proj = null; |
|
306 |
String datum = "326"; |
|
307 |
|
|
308 |
if (selectedDatum == 0) { |
|
309 |
datum = "326"; |
|
310 |
if (selectedProj == 0) |
|
311 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
312 |
else if (selectedProj == 1) { |
|
313 |
String zone = Integer.toString(selectedZone + 1); |
|
314 |
if (selectedZone < 9) zone = "0" + zone; |
|
315 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
316 |
} else if (selectedProj == 2) |
|
317 |
return new ProjectionPool().get("EPSG:42101"); |
|
318 |
else if (selectedProj == 3) |
|
319 |
return new ProjectionPool().get("EPSG:9804"); |
|
320 |
|
|
321 |
} else if (selectedDatum == 1) { |
|
322 |
datum = "230"; |
|
323 |
if (selectedProj == 0) |
|
324 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
325 |
else if (selectedProj == 1) { |
|
326 |
String zone = Integer.toString(selectedZone + 1); |
|
327 |
if (selectedZone < 9) zone = "0" + zone; |
|
328 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
329 |
} |
|
330 |
|
|
331 |
} else if (selectedDatum == 2) { // Lisboa 73 |
|
332 |
datum = "274"; |
|
333 |
if (selectedProj == 0) |
|
334 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
335 |
else if (selectedProj == 1) |
|
336 |
return new ProjectionPool().get("EPSG:"+datum+"92"); |
|
337 |
|
|
338 |
} else if (selectedDatum == 3) { |
|
339 |
datum = "267"; |
|
340 |
if (selectedProj == 0) |
|
341 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
342 |
else if (selectedProj == 1) { |
|
343 |
String zone = Integer.toString(selectedZone + 3); |
|
344 |
if (selectedZone+3 <= 9) zone = "0" + zone; |
|
345 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
346 |
} |
|
347 |
|
|
348 |
} else if (selectedDatum == 4) { |
|
349 |
datum = "269"; |
|
350 |
if (selectedProj == 0) |
|
351 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
352 |
else if (selectedProj == 1) { |
|
353 |
String zone = Integer.toString(selectedZone + 3); |
|
354 |
if (selectedZone+3 <= 9) zone = "0" + zone; |
|
355 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
356 |
} else if (selectedProj == 2) |
|
357 |
return new ProjectionPool().get("EPSG:42304"); |
|
358 |
|
|
359 |
} else if (selectedDatum == 5) { |
|
360 |
datum = "247"; |
|
361 |
if (selectedProj == 0) |
|
362 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
363 |
else if (selectedProj == 1) { |
|
364 |
String zone = Integer.toString(selectedZone + 18); |
|
365 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
366 |
} |
|
367 |
|
|
368 |
} else if (selectedDatum == 6) { |
|
369 |
datum = "807"; |
|
370 |
if (selectedProj == 0) |
|
371 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
372 |
else if (selectedProj == 1) |
|
373 |
return new ProjectionPool().get("EPSG:27582"); |
|
374 |
|
|
375 |
} else if (selectedDatum == 7) { |
|
376 |
datum = "258"; |
|
377 |
if (selectedProj == 0) |
|
378 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
379 |
else if (selectedProj == 1) { |
|
380 |
String zone = Integer.toString(selectedZone + 28); |
|
381 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
382 |
} |
|
383 |
|
|
384 |
} else if (selectedDatum == 8) { |
|
385 |
datum = "30100"; |
|
386 |
return new ProjectionPool().get("IAU2000:" + datum); |
|
387 |
|
|
388 |
} else if (selectedDatum == 9) { |
|
389 |
datum = "49900"; |
|
390 |
return new ProjectionPool().get("IAU2000:" + datum); |
|
391 |
|
|
392 |
} else if (selectedDatum == 10) { |
|
393 |
datum = "221"; |
|
394 |
if (selectedProj == 0) |
|
395 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
396 |
else if (selectedProj == 1) { |
|
397 |
String zone = Integer.toString(selectedZone + 1); |
|
398 |
return new ProjectionPool().get("EPSG:" + datum + "9"+ zone); |
|
399 |
} |
|
400 |
|
|
401 |
} else if (selectedDatum == 11) { |
|
402 |
if (selectedProj == 0) |
|
403 |
return new ProjectionPool().get("EPSG:4171"); |
|
404 |
else if (selectedProj == 1) |
|
405 |
return new ProjectionPool().get("EPSG:2154"); |
|
406 |
} |
|
407 |
|
|
408 |
if (selectedProj == 2) { |
|
409 |
return new ProjectionPool().get("EPSG:27492"); |
|
410 |
} else if (selectedProj == 3) { |
|
411 |
return new ProjectionPool().get("EPSG:42101"); |
|
412 |
} else if (selectedProj == 4) { |
|
413 |
return new ProjectionPool().get("EPSG:42304"); |
|
414 |
} else if (selectedProj == 5) { |
|
415 |
return new ProjectionPool().get("EPSG:27582"); |
|
416 |
} else if (selectedProj == 6) { |
|
417 |
return new ProjectionPool().get("EPSG:2154"); |
|
418 |
} else if (selectedProj == 7) { |
|
419 |
return new ProjectionPool().get("EPSG:9804"); |
|
420 |
} else if (selectedProj == 8) { |
|
421 |
datum = "221"; |
|
422 |
String zone = "9"; |
|
423 |
//if (selectedDatum == 10) { |
|
424 |
if (selectedZone < 1) { |
|
425 |
zone += "1"; |
|
426 |
} else if (selectedZone > 7) { |
|
427 |
zone += "7"; |
|
428 |
} else |
|
429 |
zone += (selectedZone+1)+""; |
|
430 |
// } |
|
431 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
432 |
} |
|
433 |
|
|
434 |
|
|
435 |
if (selectedProj == 0) { |
|
436 |
return new ProjectionPool().get("EPSG:4" + datum); |
|
437 |
} else if (selectedProj == 1) { |
|
438 |
String Zone = Integer.toString(selectedZone + 1); |
|
439 |
|
|
440 |
if (selectedZone < 9) { |
|
441 |
Zone = "0" + Zone; |
|
442 |
} |
|
443 |
|
|
444 |
if ((selectedDatum == 2) || (selectedDatum == 3)) { |
|
445 |
if (selectedZone < 3) { |
|
446 |
Zone = "03"; |
|
447 |
} |
|
448 |
|
|
449 |
if (selectedZone > 23) { |
|
450 |
Zone = "23"; |
|
451 |
} |
|
452 |
} |
|
453 |
|
|
454 |
if (selectedDatum == 5) { |
|
455 |
if (selectedZone < 18) { |
|
456 |
Zone = "18"; |
|
457 |
} |
|
458 |
|
|
459 |
if (selectedZone > 22) { |
|
460 |
Zone = "22"; |
|
461 |
} |
|
462 |
} |
|
463 |
|
|
464 |
if (selectedDatum == 7) { |
|
465 |
if (selectedZone < 28) { |
|
466 |
Zone = "28"; |
|
467 |
} |
|
468 |
|
|
469 |
if (selectedZone > 38) { |
|
470 |
Zone = "38"; |
|
471 |
} |
|
472 |
} |
|
473 |
return new ProjectionPool().get("EPSG:" + datum + Zone); |
|
474 |
} |
|
475 |
|
|
476 |
return proj; |
|
477 |
} |
|
478 |
} |
|
0 | 479 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/cresques/ui/LoadableComboBox.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.ui; |
|
25 |
|
|
26 |
import javax.swing.JComboBox; |
|
27 |
|
|
28 |
/** |
|
29 |
* @author "Luis W. Sevilla" (sevilla_lui@gva.es) |
|
30 |
*/ |
|
31 |
public class LoadableComboBox extends JComboBox { |
|
32 |
|
|
33 |
final private static long serialVersionUID = -3370601314380922368L; |
|
34 |
|
|
35 |
/** |
|
36 |
* Carga el vector de strings data con los valores pasados por par?metro |
|
37 |
* |
|
38 |
* @param data |
|
39 |
* vector de strings con los valores |
|
40 |
*/ |
|
41 |
public void loadData(String[] data) { |
|
42 |
if (data == null) { |
|
43 |
return; |
|
44 |
} |
|
45 |
|
|
46 |
for (int i = 0; i < data.length; i++) { |
|
47 |
addItem(data[i]); |
|
48 |
} |
|
49 |
} |
|
50 |
} |
|
0 | 51 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/cresques/ui/.cvsignore | ||
---|---|---|
1 |
*.dfPackage |
|
2 |
*.wmf |
|
0 | 3 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/cresques/ui/package.html | ||
---|---|---|
1 |
<!-- |
|
2 |
|
|
3 |
gvSIG. Desktop Geographic Information System. |
|
4 |
|
|
5 |
Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
|
8 |
modify it under the terms of the GNU General Public License |
|
9 |
as published by the Free Software Foundation; either version 3 |
|
10 |
of the License, or (at your option) any later version. |
|
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
GNU General Public License for more details. |
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
|
18 |
along with this program; if not, write to the Free Software |
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
MA 02110-1301, USA. |
|
21 |
|
|
22 |
For any additional information, do not hesitate to contact us |
|
23 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
|
|
25 |
--> |
|
26 |
<html> |
|
27 |
<body>User Interface: Clases para interface de usuario. |
|
28 |
</body> |
|
29 |
</html> |
|
0 | 30 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/cresques/ui/DefaultDialogPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.cresques.ui; |
|
25 |
|
|
26 |
import java.awt.FlowLayout; |
|
27 |
import java.awt.GridBagConstraints; |
|
28 |
import java.awt.GridBagLayout; |
|
29 |
|
|
30 |
import javax.swing.JButton; |
|
31 |
import javax.swing.JPanel; |
|
32 |
|
|
33 |
import org.cresques.Messages; |
|
34 |
|
|
35 |
|
|
36 |
/** |
|
37 |
* @author Luis W. Sevilla (sevilla_lui@gva.es) |
|
38 |
*/ |
|
39 |
public class DefaultDialogPanel extends JPanel { // implements |
|
40 |
// ComponentListener{ |
|
41 |
final private static long serialVersionUID = -3370601314380922368L; |
|
42 |
protected JPanel contentPane = null; |
|
43 |
private JPanel tabPane = null; |
|
44 |
protected JPanel buttonPane = null; |
|
45 |
private JButton acceptButton = null; |
|
46 |
private JButton cancelButton = null; |
|
47 |
protected int cWidth = 0, difWidth = 0; |
|
48 |
protected int cHeight = 0, difHeight = 0; |
|
49 |
protected JPanel pButton = null; |
|
50 |
|
|
51 |
/** |
|
52 |
* Constructor |
|
53 |
* @param init |
|
54 |
*/ |
|
55 |
public DefaultDialogPanel(boolean init){ |
|
56 |
if(init) |
|
57 |
initialize(); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Constructor |
|
62 |
*/ |
|
63 |
public DefaultDialogPanel() { |
|
64 |
super(); |
|
65 |
this.initialize(); |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* This method initializes this |
|
70 |
* |
|
71 |
* @return void |
|
72 |
*/ |
|
73 |
public void initialize() { |
|
74 |
GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
|
75 |
gridBagConstraints11.gridx = 0; |
|
76 |
gridBagConstraints11.insets = new java.awt.Insets(4,0,0,0); |
|
77 |
gridBagConstraints11.gridy = 1; |
|
78 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
|
79 |
gridBagConstraints.insets = new java.awt.Insets(5,0,2,0); |
|
80 |
gridBagConstraints.gridy = 0; |
|
81 |
gridBagConstraints.gridx = 0; |
|
82 |
setLayout(new GridBagLayout()); |
|
83 |
setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
84 |
|
|
85 |
this.add(getTabPanel(), gridBagConstraints); |
|
86 |
this.add(getPButton(), gridBagConstraints11); |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* Obtiene el panel general |
|
91 |
* @return |
|
92 |
*/ |
|
93 |
protected JPanel getContentPanel() { |
|
94 |
if (contentPane == null) { |
|
95 |
contentPane = new JPanel(); |
|
96 |
contentPane.setLayout(new GridBagLayout()); |
|
97 |
} |
|
98 |
|
|
99 |
return contentPane; |
|
100 |
} |
|
101 |
|
|
102 |
public JPanel getTabPanel() { |
|
103 |
if (tabPane == null) { |
|
104 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
|
105 |
gridBagConstraints2.insets = new java.awt.Insets(5,0,0,0); |
|
106 |
gridBagConstraints2.gridy = 0; |
|
107 |
gridBagConstraints2.gridx = 0; |
|
108 |
tabPane = new JPanel(); |
|
109 |
tabPane.setLayout(new GridBagLayout()); |
|
110 |
|
|
111 |
tabPane.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.SoftBevelBorder.RAISED)); |
|
112 |
tabPane.add(getContentPanel(), gridBagConstraints2); |
|
113 |
} |
|
114 |
|
|
115 |
return tabPane; |
|
116 |
} |
|
117 |
|
|
118 |
/** |
|
119 |
* This method initializes jPanel |
|
120 |
* |
|
121 |
* @return javax.swing.JPanel |
|
122 |
*/ |
|
123 |
private JPanel getPButton() { |
|
124 |
if (pButton == null) { |
|
125 |
FlowLayout flowLayout1 = new FlowLayout(); |
|
126 |
flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT); |
|
127 |
flowLayout1.setHgap(0); |
|
128 |
flowLayout1.setVgap(0); |
|
129 |
pButton = new JPanel(); |
|
130 |
pButton.setLayout(flowLayout1); |
|
131 |
pButton.add(getButtonPanel(), null); |
|
132 |
} |
|
133 |
return pButton; |
|
134 |
} |
|
135 |
|
|
136 |
|
|
137 |
/** |
|
138 |
* Obtiene el panel que contiene los botones de Aceptar, Cancelar y Aplicar |
|
139 |
* @return |
|
140 |
*/ |
|
141 |
protected JPanel getButtonPanel() { |
|
142 |
if (buttonPane == null) { |
|
143 |
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
|
144 |
gridBagConstraints3.gridx = 1; |
|
145 |
gridBagConstraints3.insets = new java.awt.Insets(0,3,0,3); |
|
146 |
gridBagConstraints3.gridy = 0; |
|
147 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
148 |
gridBagConstraints1.insets = new java.awt.Insets(0,0,0,3); |
|
149 |
gridBagConstraints1.gridy = 0; |
|
150 |
gridBagConstraints1.gridx = 0; |
|
151 |
buttonPane = new JPanel(); |
|
152 |
buttonPane.setLayout(new GridBagLayout()); |
|
153 |
buttonPane.add(getAcceptButton(), gridBagConstraints1); |
|
154 |
buttonPane.add(getCancelButton(), gridBagConstraints3); |
|
155 |
} |
|
156 |
|
|
157 |
return buttonPane; |
|
158 |
} |
|
159 |
|
|
160 |
/** |
|
161 |
* This method initializes Accept button |
|
162 |
* |
|
163 |
* @return javax.swing.JButton |
|
164 |
*/ |
|
165 |
public JButton getAcceptButton() { |
|
166 |
if (acceptButton == null) { |
|
167 |
acceptButton = new JButton("Aceptar"); |
|
168 |
acceptButton.setText(Messages.getText("Aceptar")); |
|
169 |
} |
|
170 |
|
|
171 |
return acceptButton; |
|
172 |
} |
|
173 |
|
|
174 |
/** |
|
175 |
* This method initializes Cancel Button |
|
176 |
* |
|
177 |
* @return javax.swing.JButton |
|
178 |
*/ |
|
179 |
public JButton getCancelButton() { |
|
180 |
if (cancelButton == null) { |
|
181 |
cancelButton = new JButton("Cancelar"); |
|
182 |
cancelButton.setText(Messages.getText("Cancelar")); |
|
183 |
} |
|
184 |
|
|
185 |
return cancelButton; |
|
186 |
} |
|
187 |
} |
|
0 | 188 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/gvsig/app/project/documents/view/info/gui/CSSelectionDialog.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
/* |
|
25 |
* Created on 26-ene-2005 |
|
26 |
*/ |
|
27 |
package org.gvsig.app.project.documents.view.info.gui; |
|
28 |
|
|
29 |
import java.awt.Dimension; |
|
30 |
|
|
31 |
import org.cresques.Messages; |
|
32 |
import org.cresques.cts.IProjection; |
|
33 |
import org.cresques.ui.cts.CSSelectionDialogPanel; |
|
34 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
35 |
import org.gvsig.app.gui.panels.crs.ISelectCrsPanel; |
|
36 |
|
|
37 |
public class CSSelectionDialog extends CSSelectionDialogPanel implements ISelectCrsPanel { |
|
38 |
|
|
39 |
private boolean okPressed = false; |
|
40 |
private IProjection lastProj = null; |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
*/ |
|
45 |
public CSSelectionDialog() { |
|
46 |
super(); |
|
47 |
this.init(); |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* This method initializes this |
|
52 |
* |
|
53 |
* @return void |
|
54 |
*/ |
|
55 |
private void init() { |
|
56 |
getAcceptButton().addActionListener( |
|
57 |
new java.awt.event.ActionListener() { |
|
58 |
|
|
59 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
60 |
closeWindow(); |
|
61 |
okPressed = true; |
|
62 |
} |
|
63 |
}); |
|
64 |
getCancelButton().addActionListener( |
|
65 |
new java.awt.event.ActionListener() { |
|
66 |
|
|
67 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
68 |
setProjection(lastProj); |
|
69 |
closeWindow(); |
|
70 |
okPressed = false; |
|
71 |
} |
|
72 |
}); |
|
73 |
} |
|
74 |
|
|
75 |
public void closeWindow() { |
|
76 |
this.setVisible(false); |
|
77 |
} |
|
78 |
|
|
79 |
public boolean isOkPressed() { |
|
80 |
return okPressed; |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* @return |
|
85 |
*/ |
|
86 |
public IProjection getProjection() { |
|
87 |
return getProjPanel().getProjection(); |
|
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 |
* @param proj |
|
92 |
*/ |
|
93 |
public void setProjection(IProjection proj) { |
|
94 |
lastProj = proj; |
|
95 |
getProjPanel().setProjection(proj); |
|
96 |
} |
|
97 |
|
|
98 |
public WindowInfo getWindowInfo() { |
|
99 |
WindowInfo m_viewinfo = |
|
100 |
new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE); |
|
101 |
m_viewinfo.setTitle(Messages.getText("selecciona_sistema_de_referencia")); |
|
102 |
Dimension dim = getPreferredSize(); |
|
103 |
m_viewinfo.setWidth(dim.width); |
|
104 |
m_viewinfo.setHeight(dim.height); |
|
105 |
return m_viewinfo; |
|
106 |
} |
|
107 |
|
|
108 |
public Object getWindowProfile() { |
|
109 |
return WindowInfo.DIALOG_PROFILE; |
|
110 |
} |
|
111 |
|
|
112 |
} |
|
0 | 113 |
tags/org.gvsig.desktop-2.0.19/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.ui/src/main/java/org/gvsig/app/gui/panels/CRSSelectPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.app.gui.panels; |
|
25 |
|
|
26 |
import java.awt.event.ActionListener; |
|
27 |
|
|
28 |
import javax.swing.JButton; |
|
29 |
import javax.swing.JLabel; |
|
30 |
import javax.swing.JPanel; |
Also available in: Unified diff