Revision 28832
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/info/gui/CSSelectionDialog.java | ||
---|---|---|
9 | 9 |
import com.iver.andami.PluginServices; |
10 | 10 |
import com.iver.andami.ui.mdiManager.IWindow; |
11 | 11 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
12 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel; |
|
12 | 13 |
|
13 | 14 |
/** |
14 | 15 |
* @author Luis W. Sevilla (sevilla_lui@gva.es) |
15 | 16 |
*/ |
16 | 17 |
public class CSSelectionDialog |
17 |
extends CSSelectionDialogPanel implements IWindow { |
|
18 |
extends CSSelectionDialogPanel implements IWindow, ISelectCrsPanel {
|
|
18 | 19 |
private boolean okPressed = false; |
19 | 20 |
private IProjection lastProj = null; |
20 | 21 |
|
... | ... | |
31 | 32 |
* @return void |
32 | 33 |
*/ |
33 | 34 |
private void init() { |
34 |
this.setBounds(0, 0, 338, 260);
|
|
35 |
this.setBounds(0, 0, 350, 260);
|
|
35 | 36 |
getAcceptButton().addActionListener(new java.awt.event.ActionListener() { |
36 | 37 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
37 | 38 |
PluginServices.getMDIManager().closeWindow(CSSelectionDialog.this); |
... | ... | |
50 | 51 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo() |
51 | 52 |
*/ |
52 | 53 |
public WindowInfo getWindowInfo() { |
53 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG); |
|
54 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
|
|
54 | 55 |
m_viewinfo.setTitle(PluginServices.getText(this, "selecciona_sistema_de_referencia")); |
55 | 56 |
return m_viewinfo; |
56 | 57 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/preferencespage/ViewPage.java | ||
---|---|---|
171 | 171 |
package com.iver.cit.gvsig.gui.preferencespage; |
172 | 172 |
|
173 | 173 |
import java.awt.Color; |
174 |
import java.awt.Dimension; |
|
174 | 175 |
import java.awt.FlowLayout; |
175 | 176 |
import java.awt.event.ActionEvent; |
176 | 177 |
import java.awt.event.ActionListener; |
... | ... | |
191 | 192 |
import com.iver.andami.PluginServices; |
192 | 193 |
import com.iver.andami.preferences.AbstractPreferencePage; |
193 | 194 |
import com.iver.andami.preferences.StoreException; |
195 |
import com.iver.cit.gvsig.addlayer.AddLayerDialog; |
|
194 | 196 |
import com.iver.cit.gvsig.fmap.MapContext; |
195 | 197 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
198 |
import com.iver.cit.gvsig.gui.panels.CRSSelectPanel; |
|
196 | 199 |
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel; |
200 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel; |
|
197 | 201 |
import com.iver.cit.gvsig.project.Project; |
198 | 202 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
199 | 203 |
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog; |
... | ... | |
255 | 259 |
private JComboBox jCmbMapUnits; |
256 | 260 |
private JComboBox jCmbDistanceUnits; |
257 | 261 |
private JComboBox jCmbDistanceArea; |
262 |
|
|
263 |
CRSSelectPanel jPanelProj = null; |
|
264 |
|
|
265 |
|
|
258 | 266 |
/* |
259 | 267 |
* Locator's background color, for when we let it be possible |
260 | 268 |
* private ColorChooserPanel jccDefaultMapOverViewBackColor; |
... | ... | |
300 | 308 |
btnChangeProjection = new JButton(PluginServices.getText(this, "change")); |
301 | 309 |
btnChangeProjection.addActionListener(new ActionListener() { |
302 | 310 |
public void actionPerformed(ActionEvent e) { |
303 |
CSSelectionDialog csSelect = new CSSelectionDialog(); |
|
304 |
csSelect.setProjection( CRSFactory.getCRS( |
|
305 |
lblDefaultProjection.getText())); |
|
306 |
PluginServices.getMDIManager().addWindow(csSelect); |
|
307 |
|
|
308 |
if (csSelect.isOkPressed()) { |
|
309 |
IProjection proj = csSelect.getProjection(); |
|
311 |
ISelectCrsPanel panel = CRSSelectPanel.getUIFactory().getSelectCrsPanel( |
|
312 |
CRSFactory.getCRS(lblDefaultProjection.getText()), false); |
|
313 |
PluginServices.getMDIManager().addWindow(panel); |
|
314 |
if (panel.isOkPressed()) { |
|
315 |
IProjection proj = panel.getProjection(); |
|
310 | 316 |
lblDefaultProjection.setText(proj.getAbrev()); |
311 | 317 |
} |
312 | 318 |
} |
313 | 319 |
}); |
314 | 320 |
|
315 | 321 |
addComponent(PluginServices.getText(this, "default_projection") + ":", lblDefaultProjection ); |
322 |
|
|
323 |
IProjection proj = CRSFactory.getCRS("EPSG:23030"); |
|
324 |
if (PluginServices.getMainFrame() != null) { |
|
325 |
proj = AddLayerDialog.getLastProjection(); |
|
326 |
} |
|
327 |
|
|
328 |
jPanelProj = CRSSelectPanel.getPanel(proj); |
|
329 |
jPanelProj.setTransPanelActive(true); |
|
330 |
jPanelProj.setBounds(11, 400, 448, 35); |
|
331 |
jPanelProj.setPreferredSize(new Dimension(448, 35)); |
|
332 |
jPanelProj.addActionListener(new ActionListener() { |
|
333 |
public void actionPerformed(ActionEvent e) { |
|
334 |
if (jPanelProj.isOkPressed()) { |
|
335 |
lblDefaultProjection.setText(jPanelProj.getCurProj().getAbrev()); |
|
336 |
} |
|
337 |
} |
|
338 |
}); |
|
339 |
|
|
340 |
|
|
316 | 341 |
JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
317 | 342 |
aux.add(btnChangeProjection); |
318 | 343 |
addComponent("", aux); |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/panels/CRSSelectPanel.java | ||
---|---|---|
49 | 49 |
import org.cresques.cts.IProjection; |
50 | 50 |
import org.gvsig.gui.beans.swing.JButton; |
51 | 51 |
|
52 |
import com.iver.andami.PluginServices; |
|
53 |
import com.iver.cit.gvsig.gui.panels.crs.CrsUIFactory; |
|
54 |
import com.iver.cit.gvsig.gui.panels.crs.ICrsUIFactory; |
|
55 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCRSButton; |
|
56 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel; |
|
57 |
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog; |
|
58 |
|
|
52 | 59 |
/** |
53 | 60 |
* |
54 | 61 |
* @author Luis W. Sevilla <sevilla_lui@gva.es> |
55 | 62 |
*/ |
56 |
public abstract class CRSSelectPanel extends JPanel { |
|
57 |
private static Class panelClass = ProjChooserPanel.class; |
|
63 |
public abstract class CRSSelectPanel extends JPanel |
|
64 |
implements ISelectCRSButton { |
|
65 |
private static Class panelClass = ProjChooserPanel.class; |
|
66 |
private static Class uiFactory = CrsUIFactory.class; |
|
58 | 67 |
private boolean transPanelActive = false; |
59 | 68 |
|
60 | 69 |
protected ActionListener actionListener = null; |
... | ... | |
62 | 71 |
public static void registerPanelClass(Class panelClass) { |
63 | 72 |
CRSSelectPanel.panelClass = panelClass; |
64 | 73 |
} |
74 |
|
|
75 |
public static void registerUIFactory(Class uiFactory) { |
|
76 |
CRSSelectPanel.uiFactory = uiFactory; |
|
77 |
} |
|
65 | 78 |
|
66 | 79 |
public static CRSSelectPanel getPanel(IProjection proj) { |
67 | 80 |
CRSSelectPanel panel = null; |
... | ... | |
70 | 83 |
try { |
71 | 84 |
panel = (CRSSelectPanel) panelClass.getConstructor(args).newInstance(params); |
72 | 85 |
} catch (IllegalArgumentException e) { |
73 |
// TODO Auto-generated catch block |
|
74 |
e.printStackTrace(); |
|
86 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
75 | 87 |
} catch (SecurityException e) { |
76 |
// TODO Auto-generated catch block |
|
77 |
e.printStackTrace(); |
|
88 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
78 | 89 |
} catch (InstantiationException e) { |
79 |
// TODO Auto-generated catch block |
|
80 |
e.printStackTrace(); |
|
90 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
81 | 91 |
} catch (IllegalAccessException e) { |
82 |
// TODO Auto-generated catch block |
|
83 |
e.printStackTrace(); |
|
92 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
84 | 93 |
} catch (InvocationTargetException e) { |
85 |
// TODO Auto-generated catch block |
|
86 |
e.printStackTrace(); |
|
94 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
87 | 95 |
} catch (NoSuchMethodException e) { |
88 |
// TODO Auto-generated catch block |
|
89 |
e.printStackTrace(); |
|
96 |
PluginServices.getLogger().error("Error creating CRS selection button", e); |
|
90 | 97 |
} |
91 | 98 |
return panel; |
92 | 99 |
} |
... | ... | |
117 | 124 |
this.transPanelActive = transPanelActive; |
118 | 125 |
} |
119 | 126 |
|
127 |
public static ICrsUIFactory getUIFactory() { |
|
128 |
ICrsUIFactory factory; |
|
129 |
try { |
|
130 |
factory = (ICrsUIFactory) uiFactory.newInstance(); |
|
131 |
} catch (InstantiationException e) { |
|
132 |
PluginServices.getLogger().error("Error creating CRS UI factory. Switching to default factory", e); |
|
133 |
factory = new CrsUIFactory(); |
|
134 |
} catch (IllegalAccessException e) { |
|
135 |
PluginServices.getLogger().error("Error creating CRS UI factory. Switching to default factory", e); |
|
136 |
factory = new CrsUIFactory(); |
|
137 |
} |
|
138 |
return factory; |
|
139 |
} |
|
140 |
|
|
120 | 141 |
} |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/panels/crs/ISelectCrsPanel.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.gui.panels.crs; |
|
2 |
|
|
3 |
import org.cresques.cts.IProjection; |
|
4 |
|
|
5 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
6 |
|
|
7 |
public interface ISelectCrsPanel extends IWindow { |
|
8 |
public IProjection getProjection(); |
|
9 |
public void setProjection(IProjection proj); |
|
10 |
public boolean isOkPressed(); |
|
11 |
} |
|
0 | 12 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/panels/crs/ICrsUIFactory.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.gui.panels.crs; |
|
2 |
|
|
3 |
import org.cresques.cts.IProjection; |
|
4 |
|
|
5 |
public interface ICrsUIFactory { |
|
6 |
public ISelectCrsPanel getSelectCrsPanel(IProjection projection, boolean isTransPanelActive); |
|
7 |
} |
|
0 | 8 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/panels/crs/ISelectCRSButton.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.gui.panels.crs; |
|
2 |
|
|
3 |
import javax.swing.JButton; |
|
4 |
|
|
5 |
import org.cresques.cts.IProjection; |
|
6 |
|
|
7 |
public interface ISelectCRSButton { |
|
8 |
public boolean isTransPanelActive(); |
|
9 |
public void setTransPanelActive(boolean transPanelActive); |
|
10 |
public IProjection getCurProj(); |
|
11 |
public boolean isOkPressed(); |
|
12 |
public void setCurProj(IProjection curProj); |
|
13 |
} |
|
0 | 14 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/panels/crs/CrsUIFactory.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.gui.panels.crs; |
|
2 |
|
|
3 |
import org.cresques.cts.IProjection; |
|
4 |
|
|
5 |
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog; |
|
6 |
|
|
7 |
public class CrsUIFactory implements ICrsUIFactory { |
|
8 |
|
|
9 |
|
|
10 |
public ISelectCrsPanel getSelectCrsPanel(IProjection projection, |
|
11 |
boolean isTransPanelActive) { |
|
12 |
CSSelectionDialog panel = new CSSelectionDialog(); |
|
13 |
panel.setProjection(projection); |
|
14 |
return panel; |
|
15 |
} |
|
16 |
|
|
17 |
} |
|
0 | 18 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/panels/ProjChooserPanel.java | ||
---|---|---|
12 | 12 |
import org.gvsig.gui.beans.swing.JButton; |
13 | 13 |
|
14 | 14 |
import com.iver.andami.PluginServices; |
15 |
import com.iver.cit.gvsig.gui.panels.crs.ICrsUIFactory; |
|
16 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel; |
|
15 | 17 |
import com.iver.cit.gvsig.project.documents.view.info.gui.CSSelectionDialog; |
16 | 18 |
|
17 | 19 |
/** |
... | ... | |
53 | 55 |
getJBtnChangeProj().addActionListener(new java.awt.event.ActionListener() { |
54 | 56 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
55 | 57 |
okPressed = false; |
56 |
CSSelectionDialog csSelect = new CSSelectionDialog(); |
|
57 |
csSelect.setProjection(curProj);
|
|
58 |
|
|
59 |
ISelectCrsPanel csSelect = getUIFactory().getSelectCrsPanel(curProj, true);
|
|
58 | 60 |
|
59 | 61 |
PluginServices.getMDIManager().addWindow(csSelect); |
60 | 62 |
|
trunk/extensions/extJCRS/src/org/gvsig/crs/gui/CRSSelectionDialog.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
import javax.swing.JPanel; |
44 | 44 |
import javax.swing.ListSelectionModel; |
45 |
|
|
45 | 46 |
import org.cresques.cts.IProjection; |
46 | 47 |
import org.gvsig.crs.ICrs; |
47 | 48 |
import org.gvsig.crs.gui.listeners.CRSSelectionDialogListener; |
... | ... | |
51 | 52 |
import com.iver.andami.PluginServices; |
52 | 53 |
import com.iver.andami.ui.mdiManager.IWindow; |
53 | 54 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
55 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel; |
|
54 | 56 |
|
55 | 57 |
/** |
56 | 58 |
* Dilogo contenedor del panel para la seleccin de CRS. |
... | ... | |
59 | 61 |
* @author Jos Luis Gmez Martnez (jolugomar@gmail.com) |
60 | 62 |
* @author Diego Guerrero Sevilla (diego.guerrero@uclm.es) |
61 | 63 |
*/ |
62 |
public class CRSSelectionDialog extends JPanel implements IWindow { |
|
64 |
public class CRSSelectionDialog extends JPanel |
|
65 |
implements IWindow, ISelectCrsPanel{ |
|
63 | 66 |
|
64 | 67 |
private static final long serialVersionUID = 1L; |
65 | 68 |
|
trunk/extensions/extJCRS/src/org/gvsig/crs/gui/dialog/TRSelectionDialog.java | ||
---|---|---|
13 | 13 |
import com.iver.andami.PluginServices; |
14 | 14 |
import com.iver.andami.ui.mdiManager.IWindow; |
15 | 15 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
16 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel; |
|
16 | 17 |
|
17 | 18 |
/** |
18 | 19 |
* @author Luis W. Sevilla (sevilla_lui@gva.es) |
19 | 20 |
*/ |
20 | 21 |
public class TRSelectionDialog |
21 |
extends CRSSelectionTrDialog implements IWindow {
|
|
22 |
extends CRSSelectionTrDialog implements IWindow, ISelectCrsPanel{
|
|
22 | 23 |
/** |
23 | 24 |
* |
24 | 25 |
*/ |
25 | 26 |
private static final long serialVersionUID = 1L; |
26 |
private boolean okPressed = false; |
|
27 |
private IProjection lastProj = null; |
|
28 | 27 |
boolean targetNad = false; |
29 | 28 |
|
30 | 29 |
/** |
... | ... | |
47 | 46 |
|
48 | 47 |
} |
49 | 48 |
|
50 |
public boolean isOkPressed() { return okPressed; } |
|
51 |
|
|
52 | 49 |
public void setTargetNad(boolean tarNad){ |
53 | 50 |
targetNad = tarNad; |
54 | 51 |
} |
... | ... | |
57 | 54 |
return targetNad; |
58 | 55 |
} |
59 | 56 |
|
60 |
/** |
|
61 |
* @return |
|
62 |
*/ |
|
63 |
public IProjection getProjection() { |
|
64 |
return (IProjection) getProjPanel().getProjection(); |
|
65 |
} |
|
66 |
/** |
|
67 |
* @param proj |
|
68 |
*/ |
|
69 |
public void setProjection(IProjection proj) { |
|
70 |
lastProj = proj; |
|
71 |
getProjPanel().setProjection(proj); |
|
72 |
} |
|
73 |
|
|
74 | 57 |
public String getProjectionName(){ |
75 | 58 |
return (String) getProjPanel().getProjection().getCrsWkt().getName(); |
76 | 59 |
} |
trunk/extensions/extJCRS/src/org/gvsig/crs/gui/panels/CrsUIFactory.java | ||
---|---|---|
1 |
package org.gvsig.crs.gui.panels; |
|
2 |
|
|
3 |
import java.awt.GridLayout; |
|
4 |
|
|
5 |
import org.cresques.cts.IProjection; |
|
6 |
import org.gvsig.crs.ICrs; |
|
7 |
import org.gvsig.crs.gui.dialog.CSSelectionDialog; |
|
8 |
import org.gvsig.crs.gui.dialog.TRSelectionDialog; |
|
9 |
|
|
10 |
import com.iver.cit.gvsig.gui.panels.crs.ICrsUIFactory; |
|
11 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel; |
|
12 |
|
|
13 |
public class CrsUIFactory implements ICrsUIFactory { |
|
14 |
|
|
15 |
public ISelectCrsPanel getSelectCrsPanel(IProjection projection, |
|
16 |
boolean isTransPanelActive) { |
|
17 |
if (isTransPanelActive){ |
|
18 |
TRSelectionDialog trSelect = new TRSelectionDialog((ICrs)projection); |
|
19 |
trSelect.setProjection(projection); |
|
20 |
trSelect.setLayout(new GridLayout(0,1)); |
|
21 |
return trSelect; |
|
22 |
} |
|
23 |
else { |
|
24 |
CSSelectionDialog csSelect = new CSSelectionDialog((ICrs) projection); |
|
25 |
csSelect.setProjection(projection); |
|
26 |
csSelect.initRecents((ICrs)projection); |
|
27 |
return csSelect; |
|
28 |
} |
|
29 |
|
|
30 |
} |
|
31 |
} |
|
0 | 32 |
trunk/extensions/extJCRS/src/org/gvsig/crs/gui/CRSSelectionTrDialog.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
import javax.swing.JPanel; |
44 | 44 |
|
45 |
import org.cresques.cts.IProjection; |
|
45 | 46 |
import org.gvsig.crs.CrsWkt; |
46 | 47 |
import org.gvsig.crs.ICrs; |
47 | 48 |
import org.gvsig.crs.persistence.CrsData; |
... | ... | |
65 | 66 |
|
66 | 67 |
JPanel contentPane = null; |
67 | 68 |
ICrs curProj = null; |
68 |
|
|
69 |
private IProjection lastProj = null; |
|
70 |
private boolean okPressed = false; |
|
71 |
|
|
69 | 72 |
public CRSSelectionTrDialog(ICrs proj) { |
70 | 73 |
super(false); |
71 | 74 |
curProj = proj; |
... | ... | |
84 | 87 |
return (CRSMainTrPanel) getContentPanel(); |
85 | 88 |
} |
86 | 89 |
|
90 |
/** |
|
91 |
* @return |
|
92 |
*/ |
|
93 |
public IProjection getProjection() { |
|
94 |
return (IProjection) getProjPanel().getProjection(); |
|
95 |
} |
|
96 |
/** |
|
97 |
* @param proj |
|
98 |
*/ |
|
99 |
public void setProjection(IProjection proj) { |
|
100 |
lastProj = proj; |
|
101 |
getProjPanel().setProjection(proj); |
|
102 |
} |
|
103 |
|
|
87 | 104 |
public JPanel getContentPanel() { |
88 | 105 |
if (contentPane == null) { |
89 | 106 |
IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow(); |
... | ... | |
98 | 115 |
return contentPane; |
99 | 116 |
} |
100 | 117 |
|
118 |
public boolean isOkPressed() { return okPressed; } |
|
101 | 119 |
} |
trunk/extensions/extJCRS/src/org/gvsig/crs/JCrsExtension.java | ||
---|---|---|
46 | 46 |
|
47 | 47 |
import org.geotools.factory.FactoryRegistry; |
48 | 48 |
import org.geotools.referencing.operation.MathTransformProvider; |
49 |
import org.gvsig.crs.gui.panels.CrsUIFactory; |
|
49 | 50 |
import org.gvsig.crs.gui.panels.ProjChooserPanel; |
50 | 51 |
import org.gvsig.crs.persistence.RecentCRSsPersistence; |
51 | 52 |
import org.gvsig.crs.persistence.RecentTrsPersistence; |
... | ... | |
102 | 103 |
|
103 | 104 |
CRSFactory.cp = new CrsFactory(); |
104 | 105 |
CRSSelectPanel.registerPanelClass(ProjChooserPanel.class); |
106 |
CRSSelectPanel.registerUIFactory(CrsUIFactory.class); |
|
105 | 107 |
|
106 | 108 |
// Default Projection |
107 | 109 |
PluginServices ps = PluginServices.getPluginServices("com.iver.cit.gvsig"); |
Also available in: Unified diff