root / org.gvsig.proj / trunk / org.gvsig.proj.app / org.gvsig.proj.app.mainplugin / src / main / java / org / gvsig / proj / app / mainplugin / CoordinateReferenceSystemExtension.java @ 26
History | View | Annotate | Download (2.62 KB)
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.PluginServices; |
27 |
import org.gvsig.andami.plugins.Extension; |
28 |
import org.gvsig.app.ApplicationLocator; |
29 |
import org.gvsig.app.gui.panels.CRSSelectPanel; |
30 |
import org.gvsig.app.project.ProjectPreferences; |
31 |
import org.gvsig.fmap.crs.CRSFactory; |
32 |
import org.gvsig.utils.XMLEntity; |
33 |
|
34 |
/**
|
35 |
* Extension to register the org.gvsid.proj facade implementation
|
36 |
* of the org.gvsig.projection library.
|
37 |
*
|
38 |
* @author gvSIG Team
|
39 |
* @version $Id$
|
40 |
*/
|
41 |
public class CoordinateReferenceSystemExtension extends Extension { |
42 |
|
43 |
private static final String DEFAULT_PROJECTION_KEY_NAME = |
44 |
"DefaultProjection";
|
45 |
private static final String FACTORY_DEFAULT_PROJECTION = "EPSG:23030"; |
46 |
|
47 |
public void initialize() { |
48 |
// CRSSelectPanel
|
49 |
// .registerPanelClass(CoordinateReferenceSystemSelectButton.class);
|
50 |
CRSSelectPanel |
51 |
.registerUIFactory(CoordinateReferenceSystemSelectUIFactory.class); |
52 |
// Default Projection
|
53 |
PluginServices ps = PluginServices.getPluginServices("org.gvsig.app");
|
54 |
XMLEntity xml = ps.getPersistentXML(); |
55 |
String projCode = null; |
56 |
if (xml.contains(DEFAULT_PROJECTION_KEY_NAME)) {
|
57 |
projCode = xml.getStringProperty(DEFAULT_PROJECTION_KEY_NAME); |
58 |
} else {
|
59 |
projCode = FACTORY_DEFAULT_PROJECTION; |
60 |
} |
61 |
((ProjectPreferences) ApplicationLocator.getManager().getPreferences( |
62 |
"project")).setDefaultProjection(CRSFactory.getCRS(projCode));
|
63 |
} |
64 |
|
65 |
public void execute(String actionCommand) { |
66 |
// Nothing to do
|
67 |
} |
68 |
|
69 |
public boolean isEnabled() { |
70 |
return true; |
71 |
} |
72 |
|
73 |
public boolean isVisible() { |
74 |
return false; |
75 |
} |
76 |
|
77 |
} |