Revision 1830
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Mon Jun 25 09:20:51 CEST 2012 |
|
3 |
buildNumber=2 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/distribution/distribution.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>distribution</id> |
|
3 |
<formats> |
|
4 |
<format>dir</format> |
|
5 |
</formats> |
|
6 |
<fileSets> |
|
7 |
<!-- Estructure for the extension --> |
|
8 |
<fileSet> |
|
9 |
<directory>src/main/resources</directory> |
|
10 |
<outputDirectory>${extension.install.dir.name} |
|
11 |
</outputDirectory> |
|
12 |
</fileSet> |
|
13 |
</fileSets> |
|
14 |
<files> |
|
15 |
<file> |
|
16 |
<source>package.info</source> |
|
17 |
<outputDirectory>${extension.install.dir.name}</outputDirectory> |
|
18 |
</file> |
|
19 |
</files> |
|
20 |
<dependencySets> |
|
21 |
<dependencySet> |
|
22 |
<outputDirectory>${extension.install.dir.name}/${library-dir} |
|
23 |
</outputDirectory> |
|
24 |
<includes> |
|
25 |
<include>org.gvsig:org.gvsig.raster.wmts.app.wmtsclient:jar</include> |
|
26 |
<include>org.gvsig:org.gvsig.raster.wmts.io:jar</include> |
|
27 |
<include>org.gvsig:org.gvsig.raster.wmts.ogc.api:jar</include> |
|
28 |
<include>org.gvsig:org.gvsig.raster.wmts.ogc.impl:jar</include> |
|
29 |
</includes> |
|
30 |
</dependencySet> |
|
31 |
</dependencySets> |
|
32 |
</assembly> |
|
0 | 33 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Wed May 15 12:24:57 CEST 2013 |
|
3 |
buildNumber=33 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/wmts/io/TestWMTSDriver.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.raster.wmts.io; |
|
23 |
|
|
24 |
import java.net.MalformedURLException; |
|
25 |
import java.net.URL; |
|
26 |
|
|
27 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
28 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException; |
|
29 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceIdentification; |
|
30 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceProvider; |
|
31 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
32 |
|
|
33 |
/** |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public class TestWMTSDriver extends AbstractLibraryAutoInitTestCase { |
|
37 |
|
|
38 |
protected void doSetUp() throws Exception { |
|
39 |
System.err.println("TestWMTSDriver running..."); |
|
40 |
} |
|
41 |
|
|
42 |
public void testStack() { |
|
43 |
|
|
44 |
URL url = null; |
|
45 |
try { |
|
46 |
url = new URL("http://scolab.es:9090/geoserver/gwc/service/wmts"); |
|
47 |
|
|
48 |
//Crea el manejador para la versi?n del servidor y devuelve la versi?n |
|
49 |
//WMTSConnector conn = WMTSDriver.getConnectorFromURL(url); |
|
50 |
//String version = conn.getVersion(); |
|
51 |
|
|
52 |
//Creamos un explorer para obtener los datos del servidor |
|
53 |
WMTSServerExplorerParameters.registerDynClass(); |
|
54 |
WMTSServerExplorerParameters param = new WMTSServerExplorerParameters(); |
|
55 |
param.setHost(url.toString()); |
|
56 |
WMTSServerExplorer explorer = new WMTSServerExplorer(param, null); |
|
57 |
explorer.connect(null); |
|
58 |
|
|
59 |
WMTSServiceIdentification id = explorer.getConnector().getServiceIdentification(); |
|
60 |
String title = id.getTitle(); |
|
61 |
String version = id.getServiceTypeVersion(); |
|
62 |
String type = id.getServiceType(); |
|
63 |
|
|
64 |
WMTSServiceProvider prov = explorer.getConnector().getServiceProvider(); |
|
65 |
String pN = prov.getProviderName(); |
|
66 |
String pS = prov.getProviderSite(); |
|
67 |
String pC = prov.getServiceContact(); |
|
68 |
|
|
69 |
//WMTSThemes themes = explorer.getThemes(); |
|
70 |
System.out.println("Title: " + title); |
|
71 |
System.out.println("Version: " + version); |
|
72 |
System.out.println("Type: " + type); |
|
73 |
System.out.println("Provider Name: " + pN); |
|
74 |
System.out.println("Provider Site: " + pS); |
|
75 |
System.out.println("Service Contact: " + pC); |
|
76 |
|
|
77 |
//En este caso solo hay una lista de temas con una capa por cada uno |
|
78 |
//pero en un caso corriente seria un ?rbol de themas con una capa asociada a cada uno |
|
79 |
/*for (int i = 0; i < themes.size(); i++) { |
|
80 |
WMTSLayer layer = ((WMTSTheme)themes.get(i)).getLayer(); |
|
81 |
if(layer != null) |
|
82 |
layer.print(); |
|
83 |
}*/ |
|
84 |
|
|
85 |
} catch (MalformedURLException e) { |
|
86 |
e.printStackTrace(); |
|
87 |
} catch (InitializeException e) { |
|
88 |
e.printStackTrace(); |
|
89 |
} catch (WMTSException e) { |
|
90 |
e.printStackTrace(); |
|
91 |
} |
|
92 |
|
|
93 |
} |
|
94 |
} |
|
0 | 95 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/dialog/TestPropsDialog.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.raster.app.extension.wmtsclient.gui.dialog; |
|
20 |
|
|
21 |
import javax.swing.JFrame; |
|
22 |
|
|
23 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.dialog.WMTSPropsDialog; |
|
24 |
|
|
25 |
public class TestPropsDialog { |
|
26 |
private int w = 510; |
|
27 |
private int h = 610; |
|
28 |
private JFrame frame = new JFrame(); |
|
29 |
private WMTSPropsDialog desc = null; |
|
30 |
|
|
31 |
public TestPropsDialog() { |
|
32 |
desc = new WMTSPropsDialog(); |
|
33 |
frame.getContentPane().add(desc); |
|
34 |
frame.setSize(w, h); |
|
35 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
36 |
frame.setVisible(true); |
|
37 |
} |
|
38 |
|
|
39 |
public static void main(String[] args) { |
|
40 |
new TestPropsDialog(); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/TestStylesPanel.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.raster.app.extension.wmtsclient.gui.panel; |
|
20 |
|
|
21 |
import javax.swing.JFrame; |
|
22 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.StylesPanel; |
|
23 |
|
|
24 |
public class TestStylesPanel { |
|
25 |
private int w = 510; |
|
26 |
private int h = 610; |
|
27 |
private JFrame frame = new JFrame(); |
|
28 |
private StylesPanel desc = null; |
|
29 |
|
|
30 |
public TestStylesPanel() { |
|
31 |
desc = new StylesPanel(); |
|
32 |
frame.getContentPane().add(desc); |
|
33 |
frame.setSize(w, h); |
|
34 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
35 |
frame.setVisible(true); |
|
36 |
} |
|
37 |
|
|
38 |
public static void main(String[] args) { |
|
39 |
new TestStylesPanel(); |
|
40 |
} |
|
41 |
} |
|
0 | 42 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestConnectPanel.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main; |
|
20 |
|
|
21 |
import javax.swing.JFrame; |
|
22 |
|
|
23 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.ConnectPanel; |
|
24 |
|
|
25 |
public class TestConnectPanel { |
|
26 |
private int w = 510; |
|
27 |
private int h = 90; |
|
28 |
private JFrame frame = new JFrame(); |
|
29 |
private ConnectPanel connect = null; |
|
30 |
|
|
31 |
public TestConnectPanel() { |
|
32 |
connect = new ConnectPanel(); |
|
33 |
frame.getContentPane().add(connect); |
|
34 |
frame.setSize(w, h); |
|
35 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
36 |
frame.setVisible(true); |
|
37 |
} |
|
38 |
|
|
39 |
public static void main(String[] args) { |
|
40 |
new TestConnectPanel(); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestNextPrevPanel.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main; |
|
20 |
|
|
21 |
import javax.swing.JFrame; |
|
22 |
|
|
23 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.NextPrevPanel; |
|
24 |
|
|
25 |
public class TestNextPrevPanel { |
|
26 |
private int w = 510; |
|
27 |
private int h = 100; |
|
28 |
private JFrame frame = new JFrame(); |
|
29 |
private NextPrevPanel desc = null; |
|
30 |
|
|
31 |
public TestNextPrevPanel() { |
|
32 |
desc = new NextPrevPanel(); |
|
33 |
frame.getContentPane().add(desc); |
|
34 |
frame.setSize(w, h); |
|
35 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
36 |
frame.setVisible(true); |
|
37 |
} |
|
38 |
|
|
39 |
public static void main(String[] args) { |
|
40 |
new TestNextPrevPanel(); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestDescriptionPanel.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main; |
|
20 |
|
|
21 |
import javax.swing.JFrame; |
|
22 |
|
|
23 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.DescriptionPanel; |
|
24 |
|
|
25 |
public class TestDescriptionPanel { |
|
26 |
private int w = 510; |
|
27 |
private int h = 510; |
|
28 |
private JFrame frame = new JFrame(); |
|
29 |
private DescriptionPanel desc = null; |
|
30 |
|
|
31 |
public TestDescriptionPanel() { |
|
32 |
desc = new DescriptionPanel(); |
|
33 |
frame.getContentPane().add(desc); |
|
34 |
frame.setSize(w, h); |
|
35 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
36 |
frame.setVisible(true); |
|
37 |
} |
|
38 |
|
|
39 |
public static void main(String[] args) { |
|
40 |
new TestDescriptionPanel(); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestServerPanel.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main; |
|
20 |
|
|
21 |
import javax.swing.JFrame; |
|
22 |
|
|
23 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.IServerPanel; |
|
24 |
|
|
25 |
public class TestServerPanel { |
|
26 |
private int w = 510; |
|
27 |
private int h = 610; |
|
28 |
private JFrame frame = new JFrame(); |
|
29 |
private IServerPanel desc = null; |
|
30 |
|
|
31 |
public TestServerPanel() { |
|
32 |
desc = new IServerPanel(); |
|
33 |
frame.getContentPane().add(desc); |
|
34 |
frame.setSize(w, h); |
|
35 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
36 |
frame.setVisible(true); |
|
37 |
} |
|
38 |
|
|
39 |
public static void main(String[] args) { |
|
40 |
new TestServerPanel(); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/format/TestFormatsPanel.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.format; |
|
20 |
|
|
21 |
import javax.swing.JFrame; |
|
22 |
|
|
23 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.format.IFormatsPanel; |
|
24 |
|
|
25 |
public class TestFormatsPanel { |
|
26 |
private int w = 510; |
|
27 |
private int h = 610; |
|
28 |
private JFrame frame = new JFrame(); |
|
29 |
private IFormatsPanel desc = null; |
|
30 |
|
|
31 |
public TestFormatsPanel() { |
|
32 |
desc = new IFormatsPanel(); |
|
33 |
frame.getContentPane().add(desc); |
|
34 |
frame.setSize(w, h); |
|
35 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
36 |
frame.setVisible(true); |
|
37 |
} |
|
38 |
|
|
39 |
public static void main(String[] args) { |
|
40 |
new TestFormatsPanel(); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/layer/TestLayerListPanel.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.layer; |
|
20 |
|
|
21 |
import javax.swing.JFrame; |
|
22 |
|
|
23 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.LayersSelectedPanel; |
|
24 |
|
|
25 |
public class TestLayerListPanel { |
|
26 |
private int w = 510; |
|
27 |
private int h = 610; |
|
28 |
private JFrame frame = new JFrame(); |
|
29 |
private LayersSelectedPanel desc = null; |
|
30 |
|
|
31 |
public TestLayerListPanel() { |
|
32 |
desc = new LayersSelectedPanel(); |
|
33 |
frame.getContentPane().add(desc); |
|
34 |
frame.setSize(w, h); |
|
35 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
36 |
frame.setVisible(true); |
|
37 |
} |
|
38 |
|
|
39 |
public static void main(String[] args) { |
|
40 |
new TestLayerListPanel(); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/layer/TestAddDelPanel.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.layer; |
|
20 |
|
|
21 |
import javax.swing.JFrame; |
|
22 |
|
|
23 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.AddDelLayerPanel; |
|
24 |
|
|
25 |
public class TestAddDelPanel { |
|
26 |
private int w = 510; |
|
27 |
private int h = 110; |
|
28 |
private JFrame frame = new JFrame(); |
|
29 |
private AddDelLayerPanel desc = null; |
|
30 |
|
|
31 |
public TestAddDelPanel() { |
|
32 |
desc = new AddDelLayerPanel(); |
|
33 |
frame.getContentPane().add(desc); |
|
34 |
frame.setSize(w, h); |
|
35 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
36 |
frame.setVisible(true); |
|
37 |
} |
|
38 |
|
|
39 |
public static void main(String[] args) { |
|
40 |
new TestAddDelPanel(); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/layer/TestILayerPanel.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.layer; |
|
20 |
|
|
21 |
import javax.swing.JFrame; |
|
22 |
|
|
23 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.ILayerPanel; |
|
24 |
|
|
25 |
public class TestILayerPanel { |
|
26 |
private int w = 510; |
|
27 |
private int h = 610; |
|
28 |
private JFrame frame = new JFrame(); |
|
29 |
private ILayerPanel desc = null; |
|
30 |
|
|
31 |
public TestILayerPanel() { |
|
32 |
desc = new ILayerPanel(); |
|
33 |
frame.getContentPane().add(desc); |
|
34 |
frame.setSize(w, h); |
|
35 |
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
|
36 |
frame.setVisible(true); |
|
37 |
} |
|
38 |
|
|
39 |
public static void main(String[] args) { |
|
40 |
new TestILayerPanel(); |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/dialog/WMTSPropsDialog.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.wmts.app.wmtsclient.gui.dialog; |
|
24 |
|
|
25 |
import java.awt.BorderLayout; |
|
26 |
import java.awt.event.ActionEvent; |
|
27 |
import java.awt.event.ActionListener; |
|
28 |
import java.util.HashMap; |
|
29 |
|
|
30 |
import javax.swing.JOptionPane; |
|
31 |
import javax.swing.JPanel; |
|
32 |
|
|
33 |
import org.gvsig.andami.PluginServices; |
|
34 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
35 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
36 |
import org.gvsig.app.gui.wizards.WizardListener; |
|
37 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
38 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
39 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
40 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
41 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
42 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
|
43 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
|
44 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
|
45 |
import org.gvsig.raster.tools.app.basic.RasterToolsUtil; |
|
46 |
import org.gvsig.raster.util.CancelTaskImpl; |
|
47 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.WMTSGUIInterface; |
|
48 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.WMTSParamsPanel; |
|
49 |
import org.gvsig.raster.wmts.app.wmtsclient.layer.FLyrWMTS; |
|
50 |
import org.gvsig.raster.wmts.io.WMTSServerExplorer; |
|
51 |
import org.gvsig.raster.wmts.ogc.exception.WMTSException; |
|
52 |
|
|
53 |
|
|
54 |
/** |
|
55 |
* The TOC WMTS properties panel container. |
|
56 |
* |
|
57 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
58 |
*/ |
|
59 |
public class WMTSPropsDialog extends JPanel implements IWindow, ButtonsPanelListener { |
|
60 |
private static final long serialVersionUID = 1L; |
|
61 |
private FLyrWMTS fLayer = null; |
|
62 |
private WindowInfo m_ViewInfo = null; |
|
63 |
private ButtonsPanel buttonsPanel = null; |
|
64 |
private WMTSGUIInterface wmtsGUIInterface = null; |
|
65 |
private WMTSServerExplorer explorer = null; |
|
66 |
|
|
67 |
public WMTSPropsDialog() { |
|
68 |
initialize(null); |
|
69 |
} |
|
70 |
|
|
71 |
public WMTSPropsDialog(FLayer layer) { |
|
72 |
super(); |
|
73 |
if(layer instanceof FLyrWMTS) { |
|
74 |
fLayer = (FLyrWMTS)layer; |
|
75 |
initialize(fLayer); |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
private void initialize(FLyrWMTS layer) { |
|
80 |
HashMap<String, Object> hash = layer != null ? layer.getProperties() : null; |
|
81 |
wmtsGUIInterface = getParamsPanel(hash); |
|
82 |
wmtsGUIInterface.addWizardListener(new WizardListener(){ |
|
83 |
public void wizardStateChanged(boolean finishable) { |
|
84 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(finishable); |
|
85 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(finishable); |
|
86 |
} |
|
87 |
|
|
88 |
public void error(Exception e) { |
|
89 |
} |
|
90 |
|
|
91 |
}); |
|
92 |
setLayout(new BorderLayout()); |
|
93 |
this.add(wmtsGUIInterface.getComponent(), BorderLayout.CENTER); |
|
94 |
this.add(getButtonsPanel(), BorderLayout.SOUTH); |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* Gets the buttons panel |
|
99 |
* @return |
|
100 |
*/ |
|
101 |
public ButtonsPanel getButtonsPanel() { |
|
102 |
if(buttonsPanel == null) { |
|
103 |
buttonsPanel = new ButtonsPanel(); |
|
104 |
buttonsPanel.addApply(); |
|
105 |
buttonsPanel.addAccept(); |
|
106 |
buttonsPanel.addClose(); |
|
107 |
buttonsPanel.addButtonPressedListener(this); |
|
108 |
} |
|
109 |
return buttonsPanel; |
|
110 |
} |
|
111 |
|
|
112 |
/** |
|
113 |
* With getParamsPanel we have access to the map config TabbedPane. |
|
114 |
* If this panel doesn't exist yet (which can occur when an existing project is |
|
115 |
* recovered) it is been automatically constructed by connecting to the server, |
|
116 |
* reloading the necessary data, filling up the content and setting the selected |
|
117 |
* values that were selected when the projet was saved. |
|
118 |
* |
|
119 |
* |
|
120 |
* Since a connection to the server is needed when rebuiliding the panel, this |
|
121 |
* causes a delay for the panel's showing up or a nullPointer error if there is |
|
122 |
* no path to the server. |
|
123 |
* |
|
124 |
* |
|
125 |
* Con getParamsPanel tenemos acceso a juego de pesta?as de configuraci?n |
|
126 |
* del mapa. Si este panel todav?a no existe (como puede ser cuando |
|
127 |
* recuperamos un proyecto guardado) ?ste se crea autom?ticamente conectando |
|
128 |
* al servidor, recuperando los datos necesarios, rellenando el contenido y |
|
129 |
* dejando seleccionados los valores que estaban seleccionados cuando se |
|
130 |
* guarda el proyecto. |
|
131 |
* |
|
132 |
* |
|
133 |
* Como para reconstruirse requiere una conexi?n con el servidor esto causa |
|
134 |
* un retardo en la aparici?n en el toc o un error de nullPointer si no |
|
135 |
* hay conexi?n hasta el servidor. |
|
136 |
* |
|
137 |
* |
|
138 |
* @return WMSParamsPanel |
|
139 |
*/ |
|
140 |
public WMTSGUIInterface getParamsPanel(HashMap<String, Object> info) { |
|
141 |
if (info == null) { |
|
142 |
WMTSGUIInterface toc = new WMTSParamsPanel(); |
|
143 |
return toc; |
|
144 |
} |
|
145 |
|
|
146 |
try { |
|
147 |
if(explorer == null) { |
|
148 |
explorer = ((FLyrWMTS)fLayer).getExplorer(); |
|
149 |
|
|
150 |
try { |
|
151 |
explorer.connect(new CancelTaskImpl()); |
|
152 |
} catch (WMTSException e) { |
|
153 |
RasterToolsUtil.messageBoxError("The connection cannot be established", this, e); |
|
154 |
return null; |
|
155 |
} |
|
156 |
} |
|
157 |
} catch (Exception e) { |
|
158 |
explorer = null; |
|
159 |
JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE); |
|
160 |
} |
|
161 |
|
|
162 |
try { |
|
163 |
WMTSGUIInterface toc = new WMTSParamsPanel(); |
|
164 |
((WMTSParamsPanel)toc).setWizardData(explorer); |
|
165 |
toc.updateSelectedInfo(info); |
|
166 |
return toc; |
|
167 |
} catch (Exception e) { |
|
168 |
JOptionPane.showMessageDialog(null, "error_comunicacion_servidor", "Error", JOptionPane.ERROR_MESSAGE); |
|
169 |
} |
|
170 |
|
|
171 |
return null; |
|
172 |
} |
|
173 |
|
|
174 |
@SuppressWarnings("unused") |
|
175 |
private class CommandListener implements ActionListener { |
|
176 |
|
|
177 |
/** |
|
178 |
* Creates a new ComandosListener object. |
|
179 |
* |
|
180 |
* @param lg DOCUMENT ME! |
|
181 |
*/ |
|
182 |
public CommandListener(WMTSPropsDialog tp) { |
|
183 |
} |
|
184 |
|
|
185 |
/* (non-Javadoc) |
|
186 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) |
|
187 |
*/ |
|
188 |
public void actionPerformed(ActionEvent e) { |
|
189 |
if (e.getActionCommand() == "CANCEL") { |
|
190 |
close(); |
|
191 |
} else { |
|
192 |
MapControl mapCtrl = null; |
|
193 |
|
|
194 |
IWindow[] w = PluginServices.getMDIManager().getAllWindows(); |
|
195 |
for (int i = 0; i < w.length; i++) { |
|
196 |
if (w[i] instanceof org.gvsig.app.project.documents.view.gui.AbstractViewPanel) { |
|
197 |
MapContext mapContext = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl().getMapContext(); |
|
198 |
if(mapContext == fLayer.getMapContext()) |
|
199 |
mapCtrl = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl(); |
|
200 |
} |
|
201 |
} |
|
202 |
|
|
203 |
try { |
|
204 |
FLayer[] layerList = wmtsGUIInterface.getLayers(); |
|
205 |
removeDuplicate(layerList, mapCtrl); |
|
206 |
for (int i = 0; i < layerList.length; i++) { |
|
207 |
mapCtrl.getMapContext().getLayers().addLayer(layerList[i]); |
|
208 |
} |
|
209 |
mapCtrl.getMapContext().invalidate(); |
|
210 |
} catch (LoadLayerException exc) { |
|
211 |
exc.printStackTrace(); |
|
212 |
} |
|
213 |
} |
|
214 |
} |
|
215 |
} |
|
216 |
|
|
217 |
private void removeDuplicate(FLayer[] layerList, MapControl mapCtrl) { |
|
218 |
FLayers lyrs = mapCtrl.getMapContext().getLayers(); |
|
219 |
for (int i = 0; i < lyrs.getLayersCount(); i++) { |
|
220 |
FLayer lyr = lyrs.getLayer(i); |
|
221 |
for (int j = 0; j < layerList.length; j++) { |
|
222 |
if(lyr.getName().compareTo(layerList[j].getName()) == 0) { |
|
223 |
lyrs.removeLayer(lyr); |
|
224 |
} |
|
225 |
} |
|
226 |
} |
|
227 |
} |
|
228 |
|
|
229 |
|
|
230 |
public WindowInfo getWindowInfo() { |
|
231 |
if (m_ViewInfo == null) { |
|
232 |
m_ViewInfo = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE); |
|
233 |
m_ViewInfo.setTitle(PluginServices.getText(this,"fit_WMTS_layer")); |
|
234 |
m_ViewInfo.setWidth(500); |
|
235 |
m_ViewInfo.setHeight(500); |
|
236 |
} |
|
237 |
return m_ViewInfo; |
|
238 |
} |
|
239 |
|
|
240 |
public void close() { |
|
241 |
PluginServices.getMDIManager().closeWindow(this); |
|
242 |
} |
|
243 |
|
|
244 |
public Object getWindowProfile() { |
|
245 |
return WindowInfo.DIALOG_PROFILE; |
|
246 |
} |
|
247 |
|
|
248 |
public void actionButtonPressed(ButtonsPanelEvent e) { |
|
249 |
if( e.getButton() == ButtonsPanel.BUTTON_APPLY || |
|
250 |
e.getButton() == ButtonsPanel.BUTTON_ACCEPT) { |
|
251 |
MapControl mapCtrl = null; |
|
252 |
|
|
253 |
IWindow[] w = PluginServices.getMDIManager().getAllWindows(); |
|
254 |
for (int i = 0; i < w.length; i++) { |
|
255 |
if (w[i] instanceof org.gvsig.app.project.documents.view.gui.AbstractViewPanel) { |
|
256 |
MapContext mapContext = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl().getMapContext(); |
|
257 |
if(mapContext == fLayer.getMapContext()) |
|
258 |
mapCtrl = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl(); |
|
259 |
} |
|
260 |
} |
|
261 |
|
|
262 |
try { |
|
263 |
FLayer[] layerList = wmtsGUIInterface.getLayers(); |
|
264 |
if(layerList.length > 0 && layerList[0] != null) { |
|
265 |
if(layerList[0] instanceof FLyrWMTS) { |
|
266 |
mapCtrl.getMapContext().getLayers().removeLayer(fLayer); |
|
267 |
mapCtrl.getMapContext().getLayers().addLayer(layerList[0]); |
|
268 |
fLayer = (FLyrWMTS)layerList[0]; |
|
269 |
} |
|
270 |
} |
|
271 |
//removeDuplicate(layerList, mapCtrl); |
|
272 |
mapCtrl.getMapContext().invalidate(); |
|
273 |
} catch (LoadLayerException exc) { |
|
274 |
exc.printStackTrace(); |
|
275 |
} |
|
276 |
} |
|
277 |
|
|
278 |
if( e.getButton() == ButtonsPanel.BUTTON_CLOSE || |
|
279 |
e.getButton() == ButtonsPanel.BUTTON_ACCEPT) { |
|
280 |
close(); |
|
281 |
} |
|
282 |
} |
|
283 |
|
|
284 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
0 | 285 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/panel/StyleTree.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.wmts.app.wmtsclient.gui.panel; |
|
24 |
|
|
25 |
import java.awt.Color; |
|
26 |
import java.awt.Component; |
|
27 |
import java.util.ArrayList; |
|
28 |
import java.util.List; |
|
29 |
import java.util.Vector; |
|
30 |
|
|
31 |
import javax.swing.JLabel; |
|
32 |
import javax.swing.JPanel; |
|
33 |
import javax.swing.JRadioButton; |
|
34 |
import javax.swing.JTree; |
|
35 |
import javax.swing.event.TreeModelListener; |
|
36 |
import javax.swing.tree.DefaultTreeCellRenderer; |
|
37 |
import javax.swing.tree.TreeModel; |
|
38 |
import javax.swing.tree.TreePath; |
|
39 |
|
|
40 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.WMTSParamsPanel.LayerUI; |
|
41 |
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle; |
|
42 |
import org.gvsig.raster.wmts.ogc.struct.WMTSTheme; |
|
43 |
|
|
44 |
|
|
45 |
/** |
|
46 |
* This class holds a visual tree that handles the selection of the styles in the |
|
47 |
* selected layers. It encapsulates any gui interface handling the mouse selection. |
|
48 |
* <p> |
|
49 |
* It has a method getStylesSelection that returns the current selection in a |
|
50 |
* bi-dimensional string array containing the layer name and the selected style name. |
|
51 |
* </p> |
|
52 |
* <p> |
|
53 |
* Keep in mind that although it's similar to LayersTree it is not the same. |
|
54 |
* It does not use the same instances of the WMTSLayerNode that LayerTreeModel |
|
55 |
* because it allows to repeat layers. So, each layer is a completely new |
|
56 |
* WMTSLayerNode containing same properties but not the same parent (which is always |
|
57 |
* the tree root) and each style is a completely new FMapStyle containing same |
|
58 |
* properties but its parent is one of the layers of the StylesTree and not one |
|
59 |
* of those of the Layers tree. |
|
60 |
* </p> |
|
61 |
* |
|
62 |
* @author jaume dominguez faus |
|
63 |
* |
|
64 |
*/ |
|
65 |
@SuppressWarnings("serial") |
|
66 |
public class StyleTree extends JTree { |
|
67 |
private static final long serialVersionUID = 1L; |
|
68 |
public boolean showLayerNames = false; |
|
69 |
|
|
70 |
public StyleTree() { |
|
71 |
super(); |
|
72 |
initialize(); |
|
73 |
} |
|
74 |
|
|
75 |
|
|
76 |
private void initialize() { |
|
77 |
setToggleClickCount(1); |
|
78 |
setRowHeight(22); |
|
79 |
|
|
80 |
setCellRenderer(new DefaultTreeCellRenderer() { |
|
81 |
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { |
|
82 |
if (leaf) { |
|
83 |
JPanel leafComponent = new JPanel(); |
|
84 |
leafComponent.setBackground(Color.WHITE); |
|
85 |
JRadioButton leafRadioButton = new JRadioButton("", ((StyleTreeModel) getModel()).isSelected((WMTSStyle) value));//selected); |
|
86 |
leafRadioButton.setBackground(Color.WHITE); |
|
87 |
leafComponent.add(leafRadioButton); |
|
88 |
leafComponent.add(new JLabel(((WMTSStyle) value).getIdentifier())); |
|
89 |
return leafComponent; |
|
90 |
} else { |
|
91 |
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); |
|
92 |
if (value instanceof WMTSTheme) { |
|
93 |
WMTSTheme layer = (WMTSTheme) value; |
|
94 |
if (!showLayerNames) { |
|
95 |
if (layer.getIdentifier() != null || layer.getIdentifier() == "") { |
|
96 |
String text = layer.toString(); |
|
97 |
text = text.substring(text.indexOf(']') + 2, text.length()); |
|
98 |
setText(text); |
|
99 |
} |
|
100 |
} |
|
101 |
} |
|
102 |
return this; |
|
103 |
} |
|
104 |
}}); |
|
105 |
addMouseListener(new java.awt.event.MouseAdapter() { |
|
106 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
|
107 |
((StyleTreeModel)getModel()).setSelectedLeaf(getSelectionPath()); |
|
108 |
clearSelection(); |
|
109 |
repaint(); |
|
110 |
} |
|
111 |
}); |
|
112 |
} |
|
113 |
|
|
114 |
/** |
|
115 |
* Expands this tree. |
|
116 |
* |
|
117 |
*/ |
|
118 |
public void expandAll() { |
|
119 |
int row = 0; |
|
120 |
while (row < getRowCount()) { |
|
121 |
expandRow(row); |
|
122 |
row++; |
|
123 |
} |
|
124 |
} |
|
125 |
|
|
126 |
/** |
|
127 |
* Returns a Vector of Strings containing the style titles. |
|
128 |
*/ |
|
129 |
@SuppressWarnings("unchecked") |
|
130 |
public Vector getStyleSelectionTitles() { |
|
131 |
if (getModel() instanceof StyleTreeModel) |
|
132 |
return ((StyleTreeModel)getModel()).getStyleSelectionTitles(); |
|
133 |
else |
|
134 |
return null; |
|
135 |
} |
|
136 |
|
|
137 |
/** |
|
138 |
* Sets the selected styles in the StylesTree. The argument styleNames is |
|
139 |
* a Vector with exactly the same amount of strings than the amount of |
|
140 |
* themes (layers) contained by the tree. A blank or null string will |
|
141 |
* leave the default style for that layer, but this element <b>must exist</b> |
|
142 |
* in the array in any case. |
|
143 |
* |
|
144 |
* @param styleNames, Vector containing the style names. |
|
145 |
* The styles order <b>must match</b> with the layer order. |
|
146 |
*/ |
|
147 |
@SuppressWarnings("unchecked") |
|
148 |
public void initSelections(Vector styleNames){ |
|
149 |
if (styleNames!=null) { |
|
150 |
StyleTreeModel model = (StyleTreeModel) getModel(); |
|
151 |
model.setStylesSelection(styleNames); |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
/** |
|
156 |
* Gets the style selected |
|
157 |
* @param layerName |
|
158 |
* @return |
|
159 |
*/ |
|
160 |
public WMTSStyle getSelectedStyle(String layerName) { |
|
161 |
StyleTreeModel model = (StyleTreeModel) getModel(); |
|
162 |
LayerUI layerUI = model.getLayer(layerName); |
|
163 |
if(layerUI != null) |
|
164 |
return layerUI.styleSelected; |
|
165 |
return null; |
|
166 |
} |
|
167 |
|
|
168 |
} |
|
169 |
|
|
170 |
class StyleTreeModel implements TreeModel { |
|
171 |
private String root = null; |
|
172 |
private ArrayList<LayerUI> layers = new ArrayList<LayerUI>(); |
|
173 |
|
|
174 |
public StyleTreeModel(String root) { |
|
175 |
this.root = root; |
|
176 |
} |
|
177 |
|
|
178 |
public LayerUI getLayer(String layerName) { |
|
179 |
for (int i = 0; i < layers.size(); i++) { |
|
180 |
if(layers.get(i).theme.getLayer().getTitle().compareTo(layerName) == 0) { |
|
181 |
return layers.get(i); |
|
182 |
} |
|
183 |
} |
|
184 |
return null; |
|
185 |
} |
|
186 |
|
|
187 |
/** |
|
188 |
* Will return true if this style is selected. |
|
189 |
* @param style |
|
190 |
* @return |
|
191 |
*/ |
|
192 |
public boolean isSelected(WMTSStyle style) { |
|
193 |
for (int i = 0; i < layers.size(); i++) { |
|
194 |
LayerUI layerUI = layers.get(i); |
|
195 |
if(layerUI.styleSelected == style) |
|
196 |
return true; |
|
197 |
} |
|
198 |
return false; |
|
199 |
} |
|
200 |
|
|
201 |
/** |
|
202 |
* Gets the names of the selected styles into a Vector using the same order |
|
203 |
* as they was represented in the StylesTree. |
|
204 |
* @return |
|
205 |
*/ |
|
206 |
public Vector<String> getStyleSelectionTitles() { |
|
207 |
Vector<String> v = new Vector<String>(); |
|
208 |
for (int i = 0; i < layers.size(); i++) { |
|
209 |
LayerUI layer = (LayerUI) layers.get(i); |
|
210 |
WMTSStyle sty = layer.styleSelected; |
|
211 |
if (sty == null) |
|
212 |
v.add(""); |
|
213 |
else |
|
214 |
v.add(sty.getIdentifier()); |
|
215 |
} |
|
216 |
return v; |
|
217 |
} |
|
218 |
|
|
219 |
/** |
|
220 |
* Sets the selected styles in the StylesTree. The argument styleNames is |
|
221 |
* a Vector with exactly the same amount of strings than the amount of |
|
222 |
* themes (layers) contained by the tree. A blank or null string will |
|
223 |
* leave the default style for that layer, but this element <b>must exist</b> |
|
224 |
* in the array in any case. |
|
225 |
* |
|
226 |
* @param styleNames, Vector containing the style names. |
|
227 |
* The styles order <b>must match</b> with the layer order. |
|
228 |
*/ |
|
229 |
@SuppressWarnings("unchecked") |
|
230 |
public void setStylesSelection(Vector styleNames) { |
|
231 |
for (int i = 0; i < layers.size(); i++) { |
|
232 |
LayerUI layer = (LayerUI) layers.get(i); |
|
233 |
for (int j = 0; j < layer.theme.getLayer().getStyle().size(); j++) { |
|
234 |
WMTSStyle sty = (WMTSStyle) layer.theme.getLayer().getStyle().get(j); |
|
235 |
if ( sty.getIdentifier().compareTo((String) styleNames.get(i)) == 0) { |
|
236 |
layer.styleSelected = sty; |
|
237 |
} |
|
238 |
} |
|
239 |
} |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 |
* Adds a new branch to this tree. It must be a layer node. |
|
244 |
* @param node |
|
245 |
* @return <b>True</b>, if the added branch actually defines any style. |
|
246 |
* <b>False</b>, if the layer has no styles. |
|
247 |
*/ |
|
248 |
public boolean addLayerBranch(LayerUI node) { |
|
249 |
layers.add(node); |
|
250 |
|
|
251 |
//Si no hay ninguno seleccionado seleccionamos el primero |
|
252 |
for (int i = 0; i < layers.size(); i++) { |
|
253 |
if(layers.get(i).styleSelected == null) { |
|
254 |
List<WMTSStyle> sty = layers.get(i).theme.getLayer().getStyle(); |
|
255 |
if(sty != null && sty.size() > 0 && sty.get(0) != null) |
|
256 |
layers.get(i).styleSelected = sty.get(0); |
|
257 |
} |
|
258 |
} |
|
259 |
|
|
260 |
if (node.theme.getLayer().getStyle() == null || node.theme.getLayer().getStyle().size() == 0) { |
|
261 |
return false; |
|
262 |
} |
|
263 |
return true; |
|
264 |
} |
|
265 |
|
|
266 |
/** |
|
267 |
* Sets a leaf (an style) selected. |
|
268 |
* @param selectionPath to this leaf. |
|
269 |
*/ |
|
270 |
protected void setSelectedLeaf(TreePath selectionPath) { |
|
271 |
if (selectionPath != null) { |
|
272 |
Object[] objects = selectionPath.getPath(); |
|
273 |
Object item = objects[objects.length - 1]; |
|
274 |
if (isLeaf(item)) { |
|
275 |
LayerUI layer = (LayerUI)objects[objects.length - 2]; |
|
276 |
WMTSStyle style = (WMTSStyle) item; |
|
277 |
for (int j = 0; j < layer.theme.getLayer().getStyle().size(); j++) { |
|
278 |
WMTSStyle sty = (WMTSStyle)layer.theme.getLayer().getStyle().get(j); |
|
279 |
if(sty.getIdentifier().equals(style.getIdentifier())) { |
|
280 |
layer.styleSelected = sty; |
|
281 |
} |
|
282 |
} |
|
283 |
} |
|
284 |
} |
|
285 |
} |
|
286 |
|
|
287 |
/* |
|
288 |
* (non-Javadoc) |
|
289 |
* @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object) |
|
290 |
*/ |
|
291 |
public int getChildCount(Object parent) { |
|
292 |
if (parent instanceof LayerUI) |
|
293 |
return ((LayerUI) parent).theme.getLayer().getStyle().size(); |
|
294 |
if (parent instanceof WMTSStyle) |
|
295 |
return 0; |
|
296 |
return layers.size(); |
|
297 |
} |
|
298 |
|
|
299 |
/* |
|
300 |
* (non-Javadoc) |
|
301 |
* @see javax.swing.tree.TreeModel#isLeaf(java.lang.Object) |
|
302 |
*/ |
|
303 |
public boolean isLeaf(Object node) { |
|
304 |
return (node instanceof WMTSStyle); |
|
305 |
} |
|
306 |
|
|
307 |
/* |
|
308 |
* (non-Javadoc) |
|
309 |
* @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener) |
|
310 |
*/ |
|
311 |
public void addTreeModelListener(TreeModelListener l) { |
|
312 |
} |
|
313 |
|
|
314 |
/* |
|
315 |
* (non-Javadoc) |
|
316 |
* @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener) |
|
317 |
*/ |
|
318 |
public void removeTreeModelListener(TreeModelListener l) { |
|
319 |
} |
|
320 |
|
|
321 |
/* |
|
322 |
* (non-Javadoc) |
|
323 |
* @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int) |
|
324 |
*/ |
|
325 |
public Object getChild(Object parent, int index) { |
|
326 |
if (parent instanceof WMTSStyle) |
|
327 |
return null; |
|
328 |
|
|
329 |
if (parent instanceof LayerUI) |
|
330 |
return ((LayerUI) parent).theme.getLayer().getStyle().get(index); |
|
331 |
|
|
332 |
return layers.get(index); |
|
333 |
} |
|
334 |
|
|
335 |
public int getIndexOfChild(Object parent, Object child) { |
|
336 |
if (parent instanceof LayerUI && child instanceof WMTSStyle) { |
|
337 |
List<WMTSStyle> listStyle = ((LayerUI)parent).theme.getLayer().getStyle(); |
|
338 |
for (int i = 0; i < listStyle.size(); i++) { |
|
339 |
WMTSStyle sty = listStyle.get(i); |
|
340 |
if(sty.equals(child)) |
|
341 |
return i; |
|
342 |
} |
|
343 |
} |
|
344 |
|
|
345 |
if(child instanceof LayerUI) { |
|
346 |
for (int i = 0; i < layers.size(); i++) { |
|
347 |
LayerUI layerUI = layers.get(i); |
|
348 |
if(layerUI.equals(child)) |
|
349 |
return i; |
|
350 |
} |
|
351 |
} |
|
352 |
|
|
353 |
return -1; |
|
354 |
} |
|
355 |
|
|
356 |
/* |
|
357 |
* (non-Javadoc) |
|
358 |
* @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath, java.lang.Object) |
|
359 |
*/ |
|
360 |
public void valueForPathChanged(TreePath path, Object newValue) { |
|
361 |
} |
|
362 |
|
|
363 |
public Object getRoot() { |
|
364 |
return root; |
|
365 |
} |
|
366 |
} |
|
0 | 367 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/panel/WMTSGUIInterface.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
package org.gvsig.raster.wmts.app.wmtsclient.gui.panel; |
|
23 |
|
|
24 |
import java.util.HashMap; |
|
25 |
|
|
26 |
import javax.swing.JComponent; |
|
27 |
|
|
28 |
import org.gvsig.app.gui.wizards.WizardListener; |
|
29 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
30 |
import org.gvsig.raster.wmts.app.wmtsclient.layer.FLyrWMTS; |
|
31 |
|
|
32 |
/** |
|
33 |
* |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public interface WMTSGUIInterface { |
|
37 |
/** |
|
38 |
* Gets the component associated. |
|
39 |
* @return |
|
40 |
*/ |
|
41 |
public JComponent getComponent(); |
|
42 |
|
|
43 |
/** |
|
44 |
* Adds a listener to the wizard |
|
45 |
* @param listener |
|
46 |
*/ |
|
47 |
public void addWizardListener(WizardListener listener); |
|
48 |
|
|
49 |
/** |
|
50 |
* Gets the layer list |
|
51 |
* @return |
|
52 |
* @throws LoadLayerException |
|
53 |
*/ |
|
54 |
//TODO: A eliminar cuando el interface salga a un proyecto swing. Esta funcionalidad debe ir en la extension |
|
55 |
public FLyrWMTS[] getLayers() throws LoadLayerException; |
|
56 |
|
|
57 |
/** |
|
58 |
* Updates the selected elements by the user in the properties panel |
|
59 |
* @param info |
|
60 |
*/ |
|
61 |
public void updateSelectedInfo(HashMap<String, Object> info); |
|
62 |
|
|
63 |
|
|
64 |
} |
|
0 | 65 |
org.gvsig.raster.wmts/tags/buildNumber_33/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/panel/StylesPanel.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.wmts.app.wmtsclient.gui.panel; |
|
24 |
|
|
25 |
import java.awt.BorderLayout; |
|
26 |
|
|
27 |
import javax.swing.JScrollPane; |
|
28 |
|
|
29 |
import org.gvsig.gui.beans.DefaultBean; |
|
30 |
|
|
31 |
/** |
|
32 |
* This is the Styles tab of the WMTS wizard. |
|
33 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
34 |
*/ |
|
35 |
public class StylesPanel extends DefaultBean{ |
|
36 |
private static final long serialVersionUID = 1L; |
|
37 |
private JScrollPane jScrollPane = null; |
|
38 |
private StyleTree treeStyles = null; |
|
39 |
|
|
40 |
public StylesPanel() { |
|
41 |
super(); |
|
42 |
setLayout(new BorderLayout()); |
|
43 |
add(getJScrollPane(), BorderLayout.CENTER); |
|
44 |
} |
|
45 |
|
Also available in: Unified diff