Revision 40612
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.projection.app/org.gvsig.projection.app.proj4j/src/main/java/org/gvsig/proj/app/mainplugin/CoordinateReferenceSystemExtension.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 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 2 |
|
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.proj.app.mainplugin; |
|
25 |
|
|
26 |
import org.gvsig.andami.plugins.Extension; |
|
27 |
import org.gvsig.app.gui.panels.CRSSelectPanelFactory; |
|
28 |
|
|
29 |
/** |
|
30 |
* Extension to register the org.gvsid.proj facade implementation |
|
31 |
* of the org.gvsig.projection library. |
|
32 |
* |
|
33 |
* @author gvSIG Team |
|
34 |
* @version $Id$ |
|
35 |
*/ |
|
36 |
public class CoordinateReferenceSystemExtension extends Extension { |
|
37 |
|
|
38 |
// private static final String DEFAULT_PROJECTION_KEY_NAME = |
|
39 |
// "DefaultProjection"; |
|
40 |
// private static final String FACTORY_DEFAULT_PROJECTION = "EPSG:23030"; |
|
41 |
// |
|
42 |
public void initialize() { |
|
43 |
CRSSelectPanelFactory.registerUIFactory(CoordinateReferenceSystemSelectUIFactory.class); |
|
44 |
|
|
45 |
// Default Projection |
|
46 |
// PluginServices ps = PluginServices.getPluginServices("org.gvsig.app"); |
|
47 |
// XMLEntity xml = ps.getPersistentXML(); |
|
48 |
// String projCode = null; |
|
49 |
// if (xml.contains(DEFAULT_PROJECTION_KEY_NAME)) { |
|
50 |
// projCode = xml.getStringProperty(DEFAULT_PROJECTION_KEY_NAME); |
|
51 |
// } else { |
|
52 |
// projCode = FACTORY_DEFAULT_PROJECTION; |
|
53 |
// } |
|
54 |
// |
|
55 |
// ((ProjectPreferences) ApplicationLocator.getManager().getPreferences( |
|
56 |
// "project")).setDefaultProjection(CRSFactory.getCRS(projCode)); |
|
57 |
} |
|
58 |
|
|
59 |
public void execute(String actionCommand) { |
|
60 |
// Nothing to do |
|
61 |
} |
|
62 |
|
|
63 |
public boolean isEnabled() { |
|
64 |
return true; |
|
65 |
} |
|
66 |
|
|
67 |
public boolean isVisible() { |
|
68 |
return false; |
|
69 |
} |
|
70 |
|
|
71 |
} |
|
0 | 72 |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.projection.app/org.gvsig.projection.app.proj4j/src/main/java/org/gvsig/proj/app/mainplugin/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 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 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., 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 html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
28 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
29 |
<head> |
|
30 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
31 |
<title>org.gvsig.proj package documentation</title> |
|
32 |
</head> |
|
33 |
<body> |
|
34 |
|
|
35 |
<p>Proj gvSIG extension</p> |
|
36 |
|
|
37 |
<p> |
|
38 |
Shows Proj into gvSIG. |
|
39 |
</p> |
|
40 |
|
|
41 |
</body> |
|
42 |
</html> |
|
0 | 43 |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.projection.app/org.gvsig.projection.app.proj4j/src/main/java/org/gvsig/proj/app/mainplugin/CoordinateReferenceSystemSelectUIFactory.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.app.mainplugin; |
|
24 |
|
|
25 |
import org.cresques.cts.IProjection; |
|
26 |
|
|
27 |
import org.gvsig.app.gui.panels.crs.ICrsUIFactory; |
|
28 |
import org.gvsig.app.gui.panels.crs.ISelectCrsPanel; |
|
29 |
|
|
30 |
|
|
31 |
/** |
|
32 |
* {@link ICrsUIFactory} implementation which returns |
|
33 |
* {@link CoordinateReferenceSystemSelectionDialog} instances. |
|
34 |
* |
|
35 |
* @author gvSIG Team |
|
36 |
*/ |
|
37 |
public class CoordinateReferenceSystemSelectUIFactory implements ICrsUIFactory { |
|
38 |
|
|
39 |
public ISelectCrsPanel getSelectCrsPanel(IProjection projection, |
|
40 |
boolean isTransPanelActive) { |
|
41 |
CoordinateReferenceSystemSelectionDialog dialog = |
|
42 |
new CoordinateReferenceSystemSelectionDialog(); |
|
43 |
dialog.setProjection(projection); |
|
44 |
return dialog; |
|
45 |
} |
|
46 |
|
|
47 |
} |
|
0 | 48 |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.projection.app/org.gvsig.projection.app.proj4j/src/main/java/org/gvsig/proj/app/mainplugin/CoordinateReferenceSystemSelectionDialog.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2012 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.proj.app.mainplugin; |
|
24 |
|
|
25 |
import java.awt.BorderLayout; |
|
26 |
import java.awt.Dimension; |
|
27 |
import java.awt.FlowLayout; |
|
28 |
|
|
29 |
import javax.swing.JButton; |
|
30 |
import javax.swing.JPanel; |
|
31 |
|
|
32 |
import org.cresques.Messages; |
|
33 |
import org.cresques.cts.IProjection; |
|
34 |
|
|
35 |
import org.gvsig.andami.PluginServices; |
|
36 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
37 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
38 |
import org.gvsig.app.gui.panels.crs.ISelectCrsPanel; |
|
39 |
import org.gvsig.proj.CoordinateReferenceSystem; |
|
40 |
import org.gvsig.proj.cts.DefaultIProjection; |
|
41 |
import org.gvsig.proj.swing.CoordinateReferenceSystemSelectorComponent; |
|
42 |
import org.gvsig.proj.swing.CoordinateReferenceSystemSwingLocator; |
|
43 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
44 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
|
45 |
|
|
46 |
/** |
|
47 |
* ISelectCrsPanel implementation based on the org.gvsig.proj library. |
|
48 |
* |
|
49 |
* @author gvSIG Team |
|
50 |
*/ |
|
51 |
public class CoordinateReferenceSystemSelectionDialog extends JPanel implements |
|
52 |
IWindow, ISelectCrsPanel { |
|
53 |
|
|
54 |
private static final long serialVersionUID = 810773451033764544L; |
|
55 |
private boolean okPressed = false; |
|
56 |
private IProjection lastProjection = null; |
|
57 |
private CoordinateReferenceSystemSelectorComponent component; |
|
58 |
private JPanel panel; |
|
59 |
|
|
60 |
/** |
|
61 |
* Constructor. |
|
62 |
*/ |
|
63 |
public CoordinateReferenceSystemSelectionDialog() { |
|
64 |
super(new BorderLayout(4, 0)); |
|
65 |
|
|
66 |
add(getContentPanel(), BorderLayout.CENTER); |
|
67 |
|
|
68 |
JPanel buttonsPanel = |
|
69 |
new JPanel(new FlowLayout(FlowLayout.RIGHT, 4, 4)); |
|
70 |
add(buttonsPanel, BorderLayout.SOUTH); |
|
71 |
|
|
72 |
UsabilitySwingManager usabilitySwingManager = |
|
73 |
ToolsSwingLocator.getUsabilitySwingManager(); |
|
74 |
JButton acceptButton = |
|
75 |
usabilitySwingManager.createJButton(Messages.getText("Aceptar")); |
|
76 |
buttonsPanel.add(acceptButton); |
|
77 |
JButton cancelButton = |
|
78 |
usabilitySwingManager.createJButton(Messages.getText("Cancelar")); |
|
79 |
buttonsPanel.add(cancelButton); |
|
80 |
|
|
81 |
acceptButton.addActionListener(new java.awt.event.ActionListener() { |
|
82 |
|
|
83 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
84 |
PluginServices.getMDIManager().closeWindow( |
|
85 |
CoordinateReferenceSystemSelectionDialog.this); |
|
86 |
okPressed = true; |
|
87 |
} |
|
88 |
}); |
|
89 |
cancelButton.addActionListener(new java.awt.event.ActionListener() { |
|
90 |
|
|
91 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
92 |
setProjection(lastProjection); |
|
93 |
PluginServices.getMDIManager().closeWindow( |
|
94 |
CoordinateReferenceSystemSelectionDialog.this); |
|
95 |
okPressed = false; |
|
96 |
} |
|
97 |
}); |
|
98 |
} |
|
99 |
|
|
100 |
public WindowInfo getWindowInfo() { |
|
101 |
WindowInfo m_viewinfo = |
|
102 |
new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE); |
|
103 |
m_viewinfo.setTitle(PluginServices.getText(this, |
|
104 |
"selecciona_sistema_de_referencia")); |
|
105 |
Dimension dim = getPreferredSize(); |
|
106 |
m_viewinfo.setWidth(dim.width); |
|
107 |
m_viewinfo.setHeight(dim.height); |
|
108 |
return m_viewinfo; |
|
109 |
} |
|
110 |
|
|
111 |
public boolean isOkPressed() { |
|
112 |
return okPressed; |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* @return |
|
117 |
*/ |
|
118 |
public IProjection getProjection() { |
|
119 |
CoordinateReferenceSystem crs = |
|
120 |
component.getSelectedCoordinateReferenceSystem(); |
|
121 |
if (crs == null) { |
|
122 |
return lastProjection; |
|
123 |
} |
|
124 |
return new DefaultIProjection(crs); |
|
125 |
} |
|
126 |
|
|
127 |
protected JPanel getContentPanel() { |
|
128 |
if (panel == null) { |
|
129 |
panel = new JPanel(); |
|
130 |
component = |
|
131 |
CoordinateReferenceSystemSwingLocator.getSwingManager() |
|
132 |
.createCoordinateReferenceSystemSelectionComponent(); |
|
133 |
panel.add(component.asJComponent()); |
|
134 |
} |
|
135 |
|
|
136 |
return panel; |
|
137 |
} |
|
138 |
|
|
139 |
/** |
|
140 |
* @param proj |
|
141 |
*/ |
|
142 |
public void setProjection(IProjection proj) { |
|
143 |
lastProjection = proj; |
|
144 |
CoordinateReferenceSystem crs = |
|
145 |
((DefaultIProjection) proj).getCoordinateReferenceSystem(); |
|
146 |
component.setCoordinateReferenceSystem(crs); |
|
147 |
} |
|
148 |
|
|
149 |
public Object getWindowProfile() { |
|
150 |
return WindowInfo.DIALOG_PROFILE; |
|
151 |
} |
|
152 |
} |
|
0 | 153 |
Also available in: Unified diff