Revision 42917
tags/org.gvsig.desktop-2.0.146/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.146/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.146/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.146/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; |
|
31 |
|
|
32 |
import org.cresques.cts.IProjection; |
|
33 |
import org.gvsig.app.gui.panels.crs.ICrsUIFactory; |
|
34 |
import org.gvsig.app.gui.panels.crs.ISelectCRSButton; |
|
35 |
|
|
36 |
|
|
37 |
public abstract class CRSSelectPanel extends JPanel implements ISelectCRSButton { |
|
38 |
private boolean transPanelActive = false; |
|
39 |
|
|
40 |
protected ActionListener actionListener = null; |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
* @param panelClass |
|
45 |
* @deprecated use CRSSelectPanelFactory.registerPanelClass |
|
46 |
*/ |
|
47 |
public static void registerPanelClass(Class panelClass) { |
|
48 |
CRSSelectPanelFactory.registerPanelClass(panelClass); |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* |
|
53 |
* @param uiFactory |
|
54 |
* @deprecated use CRSSelectPanelFactory.registerUIFactory |
|
55 |
*/ |
|
56 |
public static void registerUIFactory(Class uiFactory) { |
|
57 |
CRSSelectPanelFactory.registerUIFactory(uiFactory); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* |
|
62 |
* @param proj |
|
63 |
* @return CRSSelectPanel |
|
64 |
* @deprecated use CRSSelectPanelFactory.getPanel |
|
65 |
*/ |
|
66 |
public static CRSSelectPanel getPanel(IProjection proj) { |
|
67 |
return CRSSelectPanelFactory.getPanel(proj); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* |
|
72 |
* @return ICrsUIFactory |
|
73 |
* @deprecated use CRSSelectPanelFactory.getUIFactory |
|
74 |
*/ |
|
75 |
public static ICrsUIFactory getUIFactory() { |
|
76 |
return CRSSelectPanelFactory.getUIFactory(); |
|
77 |
} |
|
78 |
|
|
79 |
|
|
80 |
public CRSSelectPanel(IProjection proj) { |
|
81 |
super(); |
|
82 |
} |
|
83 |
|
|
84 |
abstract public JButton getJBtnChangeProj(); |
|
85 |
|
|
86 |
abstract public JLabel getJLabel(); |
|
87 |
|
|
88 |
abstract public IProjection getCurProj(); |
|
89 |
|
|
90 |
abstract public boolean isOkPressed(); |
|
91 |
/** |
|
92 |
* @param actionListener The actionListener to set. |
|
93 |
*/ |
|
94 |
public void addActionListener(ActionListener actionListener) { |
|
95 |
this.actionListener = actionListener; |
|
96 |
} |
|
97 |
|
|
98 |
public boolean isTransPanelActive() { |
|
99 |
return transPanelActive; |
|
100 |
} |
|
101 |
|
|
102 |
public void setTransPanelActive(boolean transPanelActive) { |
|
103 |
this.transPanelActive = transPanelActive; |
|
104 |
} |
|
105 |
|
|
106 |
} |
|
0 | 107 |
tags/org.gvsig.desktop-2.0.146/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/crs/ISelectCRSButton.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.crs; |
|
25 |
|
|
26 |
import javax.swing.JButton; |
|
27 |
|
|
28 |
import org.cresques.cts.IProjection; |
|
29 |
|
|
30 |
public interface ISelectCRSButton { |
|
31 |
public boolean isTransPanelActive(); |
|
32 |
public void setTransPanelActive(boolean transPanelActive); |
|
33 |
public IProjection getCurProj(); |
|
34 |
public boolean isOkPressed(); |
|
35 |
public void setCurProj(IProjection curProj); |
|
36 |
} |
|
0 | 37 |
tags/org.gvsig.desktop-2.0.146/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/crs/CrsUIFactory.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.crs; |
|
25 |
|
|
26 |
import org.cresques.cts.IProjection; |
|
27 |
import org.gvsig.app.project.documents.view.info.gui.CSSelectionDialog; |
|
28 |
|
|
29 |
|
|
30 |
public class CrsUIFactory implements ICrsUIFactory { |
|
31 |
|
|
32 |
|
|
33 |
public ISelectCrsPanel getSelectCrsPanel(IProjection projection, |
|
34 |
boolean isTransPanelActive) { |
|
35 |
CSSelectionDialog panel = new CSSelectionDialog(); |
|
36 |
panel.setProjection(projection); |
|
37 |
return panel; |
|
38 |
} |
|
39 |
|
|
40 |
} |
|
0 | 41 |
tags/org.gvsig.desktop-2.0.146/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/crs/ISelectCrsPanel.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.crs; |
|
25 |
|
|
26 |
import org.cresques.cts.IProjection; |
|
27 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
28 |
|
|
29 |
|
|
30 |
public interface ISelectCrsPanel extends IWindow { |
|
31 |
public IProjection getProjection(); |
|
32 |
public void setProjection(IProjection proj); |
|
33 |
public boolean isOkPressed(); |
|
34 |
} |
|
0 | 35 |
tags/org.gvsig.desktop-2.0.146/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/crs/ICrsUIFactory.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.crs; |
|
25 |
|
|
26 |
import org.cresques.cts.IProjection; |
|
27 |
|
|
28 |
public interface ICrsUIFactory { |
|
29 |
public ISelectCrsPanel getSelectCrsPanel(IProjection projection, boolean isTransPanelActive); |
|
30 |
} |
|
0 | 31 |
tags/org.gvsig.desktop-2.0.146/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/ProjChooserPanel.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 30-ene-2005 |
|
26 |
*/ |
|
27 |
package org.gvsig.app.gui.panels; |
|
28 |
|
|
29 |
import java.awt.GridBagConstraints; |
|
30 |
import java.awt.GridBagLayout; |
|
31 |
import java.awt.GridLayout; |
|
32 |
|
|
33 |
import javax.swing.JButton; |
|
34 |
import javax.swing.JComponent; |
|
35 |
import javax.swing.JLabel; |
|
36 |
import javax.swing.JPanel; |
|
37 |
|
|
38 |
import org.cresques.Messages; |
|
39 |
import org.cresques.cts.IProjection; |
|
40 |
import org.gvsig.app.gui.panels.crs.ISelectCrsPanel; |
|
41 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
42 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE; |
|
43 |
|
|
44 |
/** |
|
45 |
* @author Luis W. Sevilla (sevilla_lui@gva.es) |
|
46 |
*/ |
|
47 |
public class ProjChooserPanel extends CRSSelectPanel { |
|
48 |
|
|
49 |
private IProjection curProj = null; |
|
50 |
private JLabel jLblProj = null; |
|
51 |
private JLabel jLblProjName = null; |
|
52 |
private JButton jBtnChangeProj = null; |
|
53 |
private final JPanel jPanelProj = null; |
|
54 |
private boolean okPressed = false; |
|
55 |
|
|
56 |
/** |
|
57 |
* |
|
58 |
* @param proj |
|
59 |
*/ |
|
60 |
public ProjChooserPanel(IProjection proj) { |
|
61 |
super(proj); |
|
62 |
setCurProj(proj); |
|
63 |
initialize(); |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* This method initializes this |
|
68 |
* |
|
69 |
* @return void |
|
70 |
*/ |
|
71 |
private void initialize() { |
|
72 |
GridLayout gl = new GridLayout(1,2); |
|
73 |
|
|
74 |
this.setLayout(gl); // new FlowLayout(FlowLayout.LEFT, 15, 0)); |
|
75 |
this.add(getJLblProjName()); |
|
76 |
|
|
77 |
JPanel secondHalf = new JPanel(new GridBagLayout()); |
|
78 |
GridBagConstraints c = new GridBagConstraints(); |
|
79 |
|
|
80 |
c.fill = GridBagConstraints.HORIZONTAL; |
|
81 |
c.weightx = 1.0; //request any extra vertical space |
|
82 |
c.gridx = 0; |
|
83 |
c.gridwidth = 1; |
|
84 |
c.gridy = 0; |
|
85 |
secondHalf.add(getJLblProj(), c); |
|
86 |
|
|
87 |
c.fill = GridBagConstraints.NONE; |
|
88 |
c.weightx = 0.0; |
|
89 |
c.gridx = 1; |
|
90 |
secondHalf.add(getJBtnChangeProj(), c); |
|
91 |
|
|
92 |
this.add(secondHalf); |
|
93 |
initBtnChangeProj(); |
|
94 |
} |
|
95 |
|
|
96 |
private void initBtnChangeProj() { |
|
97 |
getJBtnChangeProj().addActionListener( |
|
98 |
new java.awt.event.ActionListener() { |
|
99 |
|
|
100 |
@Override |
|
101 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
102 |
okPressed = false; |
|
103 |
|
|
104 |
ISelectCrsPanel csSelect = |
|
105 |
getUIFactory().getSelectCrsPanel(curProj, true); |
|
106 |
|
|
107 |
ToolsSwingLocator.getWindowManager().showWindow((JComponent) csSelect, Messages.getText("selecciona_sistema_de_referencia"), MODE.DIALOG); |
|
108 |
|
|
109 |
if (csSelect.isOkPressed()) { |
|
110 |
curProj = csSelect.getProjection(); |
|
111 |
jLblProj.setText(curProj.getAbrev()); |
|
112 |
okPressed = true; |
|
113 |
if (actionListener != null) { |
|
114 |
actionListener.actionPerformed(e); |
|
115 |
} |
|
116 |
} |
|
117 |
} |
|
118 |
}); |
|
119 |
} |
|
120 |
|
|
121 |
public JLabel getJLblProjName() { |
|
122 |
if (jLblProjName == null) { |
|
123 |
jLblProjName = new JLabel("Proyeccion actual"); |
|
124 |
jLblProjName.setText(Messages.getText("__proyeccion_actual")); //$NON-NLS-1$ |
|
125 |
} |
|
126 |
return jLblProjName; |
|
127 |
} |
|
128 |
|
|
129 |
@Override |
|
130 |
public JLabel getJLabel() { |
|
131 |
return getJLblProjName(); |
|
132 |
} |
|
133 |
|
|
134 |
public JLabel getJLblProj() { |
|
135 |
if (jLblProj == null) { |
|
136 |
jLblProj = new JLabel(); |
|
137 |
jLblProj.setAlignmentX(JLabel.CENTER_ALIGNMENT); |
|
138 |
if (curProj != null) |
|
139 |
jLblProj.setText(curProj.getAbrev()); |
|
140 |
} |
|
141 |
return jLblProj; |
|
142 |
} |
|
143 |
|
|
144 |
public void addBtnChangeProjActionListener(java.awt.event.ActionListener al) { |
|
145 |
jBtnChangeProj.addActionListener(al); |
|
146 |
} |
|
147 |
|
|
148 |
/** |
|
149 |
* This method initializes jButton |
|
150 |
* |
|
151 |
* @return javax.swing.JButton |
|
152 |
*/ |
|
153 |
@Override |
|
154 |
public JButton getJBtnChangeProj() { |
|
155 |
if (jBtnChangeProj == null) { |
|
156 |
jBtnChangeProj = new JButton(); |
|
157 |
jBtnChangeProj.setText("..."); //$NON-NLS-1$ |
|
158 |
// jBtnChangeProj.setPreferredSize(new java.awt.Dimension(26, 26)); |
|
159 |
} |
|
160 |
return jBtnChangeProj; |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* @return Returns the curProj. |
|
165 |
*/ |
|
166 |
@Override |
|
167 |
public IProjection getCurProj() { |
|
168 |
return curProj; |
|
169 |
} |
|
170 |
|
|
171 |
/** |
|
172 |
* @param curProj |
|
173 |
* The curProj to set. |
|
174 |
*/ |
|
175 |
@Override |
|
176 |
public void setCurProj(IProjection curProj) { |
|
177 |
this.curProj = curProj; |
|
178 |
} |
|
179 |
|
|
180 |
/** |
|
181 |
* @return Returns the okPressed. |
|
182 |
*/ |
|
183 |
@Override |
|
184 |
public boolean isOkPressed() { |
|
185 |
return okPressed; |
|
186 |
} |
|
187 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
0 | 188 |
tags/org.gvsig.desktop-2.0.146/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/CRSSelectPanelFactory.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.lang.reflect.InvocationTargetException; |
|
27 |
|
|
28 |
import org.cresques.cts.IProjection; |
|
29 |
import org.gvsig.app.gui.panels.crs.ICrsUIFactory; |
|
30 |
import org.slf4j.Logger; |
|
31 |
import org.slf4j.LoggerFactory; |
|
32 |
|
|
33 |
public abstract class CRSSelectPanelFactory { |
|
34 |
private static Logger logger = LoggerFactory.getLogger(CRSSelectPanelFactory.class); |
|
35 |
|
|
36 |
private static Class panelClass = null; |
|
37 |
private static Class uiFactory = null; |
|
38 |
|
|
39 |
public static void registerPanelClass(Class panelClass) { |
|
40 |
CRSSelectPanelFactory.panelClass = panelClass; |
|
41 |
} |
|
42 |
|
|
43 |
public static void registerUIFactory(Class uiFactory) { |
|
44 |
CRSSelectPanelFactory.uiFactory = uiFactory; |
|
45 |
} |
|
46 |
|
|
47 |
public static CRSSelectPanel getPanel(IProjection proj) { |
|
48 |
CRSSelectPanel panel = null; |
|
49 |
Class [] args = {IProjection.class}; |
|
50 |
Object [] params = {proj}; |
|
51 |
try { |
|
52 |
panel = (CRSSelectPanel) panelClass.getConstructor(args).newInstance(params); |
|
53 |
} catch (IllegalArgumentException e) { |
|
54 |
logger.error("Error creating CRS selection button", e); |
|
55 |
} catch (SecurityException e) { |
|
56 |
logger.error("Error creating CRS selection button", e); |
|
57 |
} catch (InstantiationException e) { |
|
58 |
logger.error("Error creating CRS selection button", e); |
|
59 |
} catch (IllegalAccessException e) { |
|
60 |
logger.error("Error creating CRS selection button", e); |
|
61 |
} catch (InvocationTargetException e) { |
|
62 |
logger.error("Error creating CRS selection button", e); |
|
63 |
} catch (NoSuchMethodException e) { |
|
64 |
logger.error("Error creating CRS selection button", e); |
|
65 |
} |
|
66 |
return panel; |
|
67 |
} |
|
68 |
|
|
69 |
public static ICrsUIFactory getUIFactory() { |
|
70 |
ICrsUIFactory factory = null; |
|
71 |
try { |
|
72 |
factory = (ICrsUIFactory) uiFactory.newInstance(); |
|
73 |
} catch (InstantiationException e) { |
|
74 |
logger.error("Error creating CRS UI factory. Switching to default factory", e); |
|
75 |
} catch (IllegalAccessException e) { |
|
76 |
logger.error("Error creating CRS UI factory. Switching to default factory", e); |
|
77 |
} |
|
78 |
return factory; |
|
79 |
} |
|
80 |
|
|
81 |
} |
|
0 | 82 |
tags/org.gvsig.desktop-2.0.146/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.146/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.146/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.146/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.146/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.146/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}, |
Also available in: Unified diff