root / org.gvsig.geotools.proj / trunk / org.gvsig.geotools.proj / org.gvsig.geotools.proj.main / src / main / java / org / gvsig / geotools / proj / main / TestCrsPanel.java @ 867
History | View | Annotate | Download (2.52 KB)
1 | 865 | cmartinez | package org.gvsig.geotools.proj.main; |
---|---|---|---|
2 | |||
3 | |||
4 | 867 | cmartinez | import java.util.List; |
5 | |||
6 | 865 | cmartinez | import javax.swing.JFrame; |
7 | import javax.swing.SwingUtilities; |
||
8 | |||
9 | import org.apache.log4j.ConsoleAppender; |
||
10 | import org.apache.log4j.Level; |
||
11 | import org.apache.log4j.PatternLayout; |
||
12 | 867 | cmartinez | import org.gvsig.proj.catalog.TransformationDefinition; |
13 | import org.gvsig.proj.catalog.exception.CoordinateReferenceSystemException; |
||
14 | import org.gvsig.proj.catalog.exception.UnsupportedCoordinateReferenceSystemException; |
||
15 | 865 | cmartinez | import org.gvsig.proj.swing.CoordinateReferenceSystemSelectorComponent; |
16 | import org.gvsig.proj.swing.CoordinateReferenceSystemSwingLocator; |
||
17 | 867 | cmartinez | import org.gvsig.proj.swing.CoordinateTransformationSelectorComponent; |
18 | 865 | cmartinez | import org.gvsig.proj.swing.impl.DefaultCoordinateReferenceSystemSwingManager; |
19 | import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
||
20 | |||
21 | public class TestCrsPanel { |
||
22 | |||
23 | public TestCrsPanel() {
|
||
24 | // TODO Auto-generated constructor stub
|
||
25 | } |
||
26 | 867 | cmartinez | |
27 | 865 | cmartinez | public static void main(String[] args) { |
28 | ConsoleAppender console = new ConsoleAppender(); //create appender |
||
29 | //configure the appender
|
||
30 | String PATTERN = "%d [%p|%c|%C{1}] %m%n"; |
||
31 | console.setLayout(new PatternLayout(PATTERN));
|
||
32 | console.setThreshold(Level.ALL);
|
||
33 | console.activateOptions(); |
||
34 | //add appender to any Logger (here is root)
|
||
35 | org.apache.log4j.Logger.getRootLogger().addAppender(console); |
||
36 | |||
37 | DefaultLibrariesInitializer initializer = new DefaultLibrariesInitializer();
|
||
38 | initializer.fullInitialize(); |
||
39 | final JFrame frame = new JFrame(); |
||
40 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||
41 | 867 | cmartinez | |
42 | try {
|
||
43 | 865 | cmartinez | DefaultCoordinateReferenceSystemSwingManager manager = (DefaultCoordinateReferenceSystemSwingManager) CoordinateReferenceSystemSwingLocator.getSwingManager(); |
44 | 867 | cmartinez | manager.getCoordinateReferenceSystemHistory().add(manager.getCatalogManager().getCRSDefinition("EPSG:3857"));
|
45 | manager.getCoordinateReferenceSystemHistory().add(manager.getCatalogManager().getCRSDefinition("EPSG:23030"));
|
||
46 | |||
47 | CoordinateReferenceSystemSelectorComponent selector = manager.createCoordinateReferenceSystemSelectionComponent(); |
||
48 | selector.setCustomGroupLabel("Layer");
|
||
49 | |||
50 | selector.addCustomCRS(manager.getCatalogManager().getCRSDefinition("EPSG:25830"));
|
||
51 | selector.addCustomCRS(manager.getCatalogManager().getCRSDefinition("EPSG:25831"));
|
||
52 | 865 | cmartinez | |
53 | frame.add(selector.asJComponent()); |
||
54 | frame.setSize(400, 600); |
||
55 | //frame.pack();
|
||
56 | SwingUtilities.invokeLater(new Runnable() { |
||
57 | public void run() { |
||
58 | frame.setVisible(true);
|
||
59 | } |
||
60 | }); |
||
61 | 867 | cmartinez | } catch (UnsupportedCoordinateReferenceSystemException e) {
|
62 | // TODO Auto-generated catch block
|
||
63 | e.printStackTrace(); |
||
64 | } |
||
65 | 865 | cmartinez | } |
66 | } |