Revision 21547
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/buildNumber.properties | ||
---|---|---|
1 |
#Sat Oct 14 19:46:23 CEST 2023 |
|
2 |
buildNumber=283 |
|
0 | 3 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/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.coverage.exception.ConnectException; |
|
28 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
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://v2.suite.opengeo.org/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.getOGCClient().getServiceIdentification(); |
|
60 |
String title = id.getTitle(); |
|
61 |
String version = id.getServiceTypeVersion(); |
|
62 |
String type = id.getServiceType(); |
|
63 |
|
|
64 |
WMTSServiceProvider prov = explorer.getOGCClient().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 (ConnectException e) { |
|
90 |
e.printStackTrace(); |
|
91 |
} |
|
92 |
|
|
93 |
} |
|
94 |
} |
|
0 | 95 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/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.wizard.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/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<depends plugin-name="org.gvsig.raster.tilecache.app" /> |
|
4 |
<libraries library-dir="lib"/> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<extensions> |
|
7 |
<extension class-name="org.gvsig.raster.wmts.app.wmtsclient.WMTSClientExtension" |
|
8 |
description="Support to access WMTS" |
|
9 |
active="true" |
|
10 |
priority="1"> |
|
11 |
<!-- Estas tools se pusieron para pruebas. |
|
12 |
Habilitan dos botones para llevar al siguiente/anterior nivel de resoluci?n |
|
13 |
<tool-bar name="ZoomMas" position="5"> |
|
14 |
<action-tool icon="level-plus" action-command="NEXT_LEVEL" tooltip="Zoom_next_level" position="1"/> |
|
15 |
</tool-bar> |
|
16 |
<tool-bar name="ZoomMenos" position="5"> |
|
17 |
<action-tool icon="level-less" action-command="PREV_LEVEL" tooltip="Zoom_prev_level" position="2"/> |
|
18 |
</tool-bar> |
|
19 |
--> |
|
20 |
</extension> |
|
21 |
</extensions> |
|
22 |
</plugin-config> |
|
0 | 23 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/resources-plugin/servers.properties | ||
---|---|---|
1 |
server[0]=http://v2.suite.opengeo.org/geoserver/gwc/service/wmts/ |
|
2 |
server[1]=http://maps.opengeo.org/geowebcache/service/wmts |
|
0 | 3 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/resources-plugin/about/wmts-about.html | ||
---|---|---|
1 |
<html> |
|
2 |
<head> |
|
3 |
<style type="text/css"> |
|
4 |
BODY { background-image: url(logo.png); background-repeat: no-repeat; background-position: 100% 0% } |
|
5 |
</style> |
|
6 |
</head> |
|
7 |
<body> |
|
8 |
<h2>Soporte WMTS para gvSIG</h2> |
|
9 |
<p><b>Prodevelop S.L.</b> ha incorporado el soporte al formato WMTS para el proyecto de Espa?a Virtual</p> |
|
10 |
|
|
11 |
<p><b>Desarrollo:</b></p> |
|
12 |
|
|
13 |
<p>Director del proyecto:</p> |
|
14 |
<ul> |
|
15 |
<li>Miguel Montesinos Lajara</li> |
|
16 |
</ul> |
|
17 |
<p>Equipo de desarrollo:</p> |
|
18 |
<ul> |
|
19 |
<li>Nacho Brodin</li> |
|
20 |
</ul> |
|
21 |
|
|
22 |
<p>Build Number de la extensión: 1</p> |
|
23 |
<center> |
|
24 |
<p><b><a href="http://www.prodevelop.es" title="Prodevelop">http://www.prodevelop.es</a></b></p> |
|
25 |
</center> |
|
26 |
|
|
27 |
</body> |
|
28 |
</html> |
|
0 | 29 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/resources-plugin/plugin-persistence.def | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
Definitions of plugin persistence org.gvsig.raster.wmts.app.wmstclient. |
|
4 |
--> |
|
5 |
<definitions> |
|
6 |
<version>1.0.0</version> |
|
7 |
<classes> |
|
8 |
<class name="org.gvsig.raster.wmts.app.wmtsclient"> |
|
9 |
<description>Persistence definition for the WMTS client plugin</description> |
|
10 |
<fields> |
|
11 |
<field name="servers" type="object" classOfValue="org.gvsig.andami.persistence.serverData.ServerDataPersistence" mandatory="false"> |
|
12 |
<description>List of WMTS servers</description> |
|
13 |
</field> |
|
14 |
</fields> |
|
15 |
</class> |
|
16 |
</classes> |
|
17 |
</definitions> |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/resources-plugin/text.properties | ||
---|---|---|
1 |
WMTSLayer=Capa WMTS |
|
2 |
select_info_formats=Seleccionar formatos de texto (Info) |
|
3 |
wmts_properties=Propiedades WMTS |
|
4 |
wmts_cant_connect=No ha sido posible realizar la conexi\u00f3n con el servidor WMTS |
|
5 |
wmts_not_queryable=Este servidor no acepta peticiones de este tipo |
|
6 |
wmts_server_error=Error del servidor WMTS |
|
7 |
wmts_transparency=Transparencia |
|
8 |
WMTSLayer=Capa WMTS |
|
9 |
fit_WMTS_layer=Ajustar capa WMTS |
|
10 |
invert_axis_order=Invertir orden de los ejes |
|
11 |
cache_refresh=Este check debe estar activado antes de pulsar el bot?n de conectar.\n Si la capa fue cargada previamente con este check box\n en distinta posici?n es posible que el contenido de la cach? sea erroneo \n. Limpiela antes de continuar. |
|
12 |
view_type=Tipo de vista |
|
13 |
layerlist_view_selection=Ver como lista de capas |
|
14 |
themes_view_selection=Ver como temas |
|
15 |
view_not_disposable=No hay themas definidos en este servidor |
|
16 |
theme_without_reference=Tema sin capa referenciada. \n Selecciona desde la lista de capas. |
|
17 |
host_unreachable=No se puede conectar con el servidor. Tal vez la red est? desconectada o el servidor apagado. |
|
18 |
ip_unknown=Direcci?n IP desconocida |
|
19 |
network_error=Error en la conexi?n a red |
|
0 | 20 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/resources-plugin/text_en.properties | ||
---|---|---|
1 |
WMTSLayer=WMTS Layer |
|
2 |
select_info_formats=Select text formats for Info by point |
|
3 |
wmts_properties=WMTS Properties |
|
4 |
wmts_cant_connect=The connection cannot be established |
|
5 |
wmts_not_queryable=This server does not accept this kind of requests |
|
6 |
wmts_server_error=Error in WMTS Server |
|
7 |
wmts_transparency=Transparency |
|
8 |
WMTSLayer=WMTS Layer |
|
9 |
fit_WMTS_layer=Fits to WTMS layer |
|
10 |
invert_axis_order=Invert the order of the axes |
|
11 |
cache_refresh=This check has to be enabled before press the connect button.\n If the layer was loaded with this check in other status it is possible that the cache not to be correct. \n. Clean the cache before continue. |
|
12 |
view_type=View type |
|
13 |
layerlist_view_selection=View as layers list |
|
14 |
themes_view_selection=View as themes |
|
15 |
view_not_disposable=There are not themes defined in this server |
|
16 |
theme_without_reference=Theme without layer referenced.\n Select from the list of layers. |
|
17 |
host_unreachable=The host is unreachable. Maybe the network is not connected or the host off. |
|
18 |
ip_unknown=IP address unknown |
|
19 |
network_error=Error with the network connection |
|
0 | 20 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
|
|
26 |
<dependencySets> |
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
<includes> |
|
32 |
<include>org.gvsig:org.gvsig.raster.wmts.app.wmtsclient:jar</include> |
|
33 |
<include>org.gvsig:org.gvsig.raster.wmts.io:jar</include> |
|
34 |
<include>org.gvsig:org.gvsig.raster.wmts.ogc.api:jar</include> |
|
35 |
<include>org.gvsig:org.gvsig.raster.wmts.ogc.impl:jar</include> |
|
36 |
<include>org.gvsig:org.gvsig.raster.wmts.swing.api:jar</include> |
|
37 |
<include>org.gvsig:org.gvsig.raster.wmts.swing.impl:jar</include> |
|
38 |
</includes> |
|
39 |
</dependencySet> |
|
40 |
</dependencySets> |
|
41 |
</assembly> |
|
0 | 42 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/WMTSPropsTocMenuEntry.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; |
|
24 |
|
|
25 |
import org.gvsig.andami.PluginServices; |
|
26 |
import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction; |
|
27 |
import org.gvsig.app.project.documents.view.toc.ITocItem; |
|
28 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
29 |
import org.gvsig.raster.wmts.app.wmtsclient.gui.wizard.WMTSPropsDialog; |
|
30 |
import org.gvsig.raster.wmts.app.wmtsclient.layer.FLyrWMTS; |
|
31 |
|
|
32 |
|
|
33 |
/** |
|
34 |
* The TOC WMTS properties. |
|
35 |
* |
|
36 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
37 |
*/ |
|
38 |
public class WMTSPropsTocMenuEntry extends AbstractTocContextMenuAction { |
|
39 |
|
|
40 |
public void execute(ITocItem item, FLayer[] selectedItems) { |
|
41 |
WMTSPropsDialog dialog = new WMTSPropsDialog(selectedItems[0]); |
|
42 |
PluginServices.getMDIManager().addWindow(dialog); |
|
43 |
} |
|
44 |
|
|
45 |
public String getText() { |
|
46 |
return PluginServices.getText(this, "wmts_properties"); |
|
47 |
} |
|
48 |
|
|
49 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
|
50 |
return selectedItems.length == 1 && selectedItems[0].isAvailable(); |
|
51 |
} |
|
52 |
|
|
53 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
|
54 |
if (selectedItems.length != 1) { |
|
55 |
return false; |
|
56 |
} |
|
57 |
return selectedItems[0] instanceof FLyrWMTS; |
|
58 |
|
|
59 |
} |
|
60 |
|
|
61 |
} |
|
0 | 62 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/layer/DynObjectIteratorWMTSInfo.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.layer; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.feature.Feature; |
|
27 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
28 |
import org.gvsig.tools.dynobject.DynObject; |
|
29 |
import org.gvsig.tools.dynobject.DynObjectSet; |
|
30 |
|
|
31 |
/** |
|
32 |
* {@link DynObject} implementation to facade a iterator of a WMTSInfo |
|
33 |
* and allow to be used as a {@link DynObjectSet} iterator. |
|
34 |
* |
|
35 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
36 |
* @version $Id$ |
|
37 |
* |
|
38 |
*/ |
|
39 |
public class DynObjectIteratorWMTSInfo implements DisposableIterator { |
|
40 |
|
|
41 |
private ArrayList<Object> infoList = new ArrayList<Object>(); |
|
42 |
private int index = -1; |
|
43 |
|
|
44 |
/** |
|
45 |
* Creates a new DynObjects iterator facade over a feature iterator. |
|
46 |
* Each WMTSInfo will be returned through a new or reused |
|
47 |
* {@link DynObjectWMTSInfo} which allows the {@link Feature} to be |
|
48 |
* used like a DynObject. |
|
49 |
* |
|
50 |
* @param featureIterator |
|
51 |
* to facade |
|
52 |
* @param featureFacade |
|
53 |
* if not null this object will be reused as the facade for the |
|
54 |
* Feature objects of the feature iterator |
|
55 |
*/ |
|
56 |
public DynObjectIteratorWMTSInfo(Object info) { |
|
57 |
this.infoList.add(info); |
|
58 |
index = 0; |
|
59 |
} |
|
60 |
|
|
61 |
public void addObject(Object info) { |
|
62 |
this.infoList.add(info); |
|
63 |
if(index == -1) |
|
64 |
index = 0; |
|
65 |
} |
|
66 |
|
|
67 |
public synchronized void dispose() { |
|
68 |
this.infoList.clear(); |
|
69 |
index = -1; |
|
70 |
} |
|
71 |
|
|
72 |
public synchronized boolean hasNext() { |
|
73 |
return (infoList.size() == 0 || index >= infoList.size()) ? false : true; |
|
74 |
} |
|
75 |
|
|
76 |
public synchronized Object next() { |
|
77 |
Object o = infoList.get(index); |
|
78 |
index ++; |
|
79 |
return o; |
|
80 |
} |
|
81 |
|
|
82 |
public synchronized void remove() { |
|
83 |
if(index < infoList.size() && index >= 0) { |
|
84 |
index --; |
|
85 |
infoList.remove(index); |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
public long getSize() { |
|
90 |
return infoList.size(); |
|
91 |
} |
|
92 |
} |
|
0 | 93 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/layer/DynObjectSetWMTSInfo.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.layer; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
25 |
import org.gvsig.tools.ToolsLocator; |
|
26 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
27 |
import org.gvsig.tools.dynobject.DynClass; |
|
28 |
import org.gvsig.tools.dynobject.DynObject; |
|
29 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
30 |
import org.gvsig.tools.dynobject.DynObjectSet; |
|
31 |
import org.gvsig.tools.exception.BaseException; |
|
32 |
import org.gvsig.tools.observer.Observable; |
|
33 |
import org.gvsig.tools.observer.Observer; |
|
34 |
import org.gvsig.tools.observer.impl.BaseWeakReferencingObservable; |
|
35 |
import org.gvsig.tools.visitor.Visitor; |
|
36 |
|
|
37 |
/** |
|
38 |
* {@link DynObject} implementation to facade of a {@link FeatureSet} and allow |
|
39 |
* to be used as a {@link DynObjectSet}. |
|
40 |
* |
|
41 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
42 |
* @version $Id$ |
|
43 |
*/ |
|
44 |
public class DynObjectSetWMTSInfo extends BaseWeakReferencingObservable |
|
45 |
implements DynObjectSet, Observer { |
|
46 |
public static final int TYPE_TEXT = 0; |
|
47 |
public static final int TYPE_HTML = 1; |
|
48 |
public static final int TYPE_XML = 2; |
|
49 |
private DynObjectIteratorWMTSInfo ite = null; |
|
50 |
|
|
51 |
public static void registerDynClass() { |
|
52 |
DynObjectManager manager = ToolsLocator.getDynObjectManager(); |
|
53 |
DynClass dynClass = manager.add("WMTSInfoByPoint", "WMTS InfoByPoint"); |
|
54 |
dynClass.setNamespace("InfoByPoint"); |
|
55 |
dynClass.addDynFieldString("info"); |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* Creates a new facade over a given info, with fast dynobject |
|
60 |
* iteration. |
|
61 |
*/ |
|
62 |
public DynObjectSetWMTSInfo(String txt, int type) { |
|
63 |
DynObjectManager manager = ToolsLocator.getDynObjectManager(); |
|
64 |
DynObject dynObject = manager.createDynObject("WMTSInfoByPoint"); |
|
65 |
dynObject.setDynValue("info", txt); |
|
66 |
ite = new DynObjectIteratorWMTSInfo(dynObject); |
|
67 |
} |
|
68 |
|
|
69 |
public void dispose() { |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
public void accept(final Visitor visitor, long firstValueIndex) throws BaseException { |
|
74 |
while(ite.hasNext()) { |
|
75 |
visitor.visit(ite.next()); |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
public void accept(final Visitor visitor) throws BaseException { |
|
80 |
while(ite.hasNext()) { |
|
81 |
visitor.visit(ite.next()); |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
public long getSize() throws BaseException { |
|
86 |
return ite.getSize(); |
|
87 |
} |
|
88 |
|
|
89 |
public DisposableIterator iterator(long index) throws BaseException { |
|
90 |
return iterator(); |
|
91 |
} |
|
92 |
|
|
93 |
public DisposableIterator iterator() throws BaseException { |
|
94 |
return ite; |
|
95 |
} |
|
96 |
|
|
97 |
public boolean isEmpty() throws BaseException { |
|
98 |
return (getSize() == 0); |
|
99 |
} |
|
100 |
|
|
101 |
public boolean isDeleteEnabled() { |
|
102 |
return true; |
|
103 |
} |
|
104 |
|
|
105 |
public void delete(DynObject dynObject) throws BaseException { |
|
106 |
|
|
107 |
} |
|
108 |
|
|
109 |
public boolean isUpdateEnabled() { |
|
110 |
return true; |
|
111 |
} |
|
112 |
|
|
113 |
public void update(DynObject dynObject) throws BaseException { |
|
114 |
System.out.println(); |
|
115 |
} |
|
116 |
|
|
117 |
public void update(Observable observable, Object notification) { |
|
118 |
System.out.println(); |
|
119 |
} |
|
120 |
} |
|
0 | 121 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/layer/FLyrWMTS.java | ||
---|---|---|
1 |
package org.gvsig.raster.wmts.app.wmtsclient.layer; |
|
2 |
|
|
3 |
import java.awt.Dimension; |
|
4 |
import java.awt.Graphics2D; |
|
5 |
import java.awt.Image; |
|
6 |
import java.awt.Point; |
|
7 |
import java.awt.geom.Point2D; |
|
8 |
import java.awt.geom.Rectangle2D; |
|
9 |
import java.awt.image.BufferedImage; |
|
10 |
import java.lang.ref.WeakReference; |
|
11 |
import java.net.URI; |
|
12 |
import java.net.URISyntaxException; |
|
13 |
import java.util.ArrayList; |
|
14 |
import java.util.HashMap; |
|
15 |
import java.util.Iterator; |
|
16 |
import java.util.List; |
|
17 |
|
|
18 |
import javax.print.attribute.PrintRequestAttributeSet; |
|
19 |
|
|
20 |
import org.cresques.cts.ICoordTrans; |
|
21 |
import org.cresques.cts.IProjection; |
|
22 |
import org.slf4j.Logger; |
|
23 |
import org.slf4j.LoggerFactory; |
|
24 |
|
|
25 |
import org.gvsig.fmap.dal.DALLocator; |
|
26 |
import org.gvsig.fmap.dal.DataManager; |
|
27 |
import org.gvsig.fmap.dal.DataParameters; |
|
28 |
import org.gvsig.fmap.dal.DataStore; |
|
29 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
30 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
31 |
import org.gvsig.fmap.dal.coverage.RasterManager; |
|
32 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
33 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
|
34 |
import org.gvsig.fmap.dal.coverage.datastruct.ViewPortData; |
|
35 |
import org.gvsig.fmap.dal.coverage.exception.FilePaletteException; |
|
36 |
import org.gvsig.fmap.dal.coverage.exception.InfoByPointException; |
|
37 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
38 |
import org.gvsig.fmap.dal.coverage.exception.QueryException; |
|
39 |
import org.gvsig.fmap.dal.coverage.grid.RasterFilter; |
|
40 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
|
41 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
|
42 |
import org.gvsig.fmap.dal.coverage.store.parameter.TileDataParameters; |
|
43 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
|
44 |
import org.gvsig.fmap.dal.exception.DataException; |
|
45 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
46 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
47 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
48 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
49 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
50 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
51 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
52 |
import org.gvsig.fmap.geom.GeometryManager; |
|
53 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
54 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
55 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
56 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
57 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
58 |
import org.gvsig.fmap.mapcontext.layers.operations.IHasImageLegend; |
|
59 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
60 |
import org.gvsig.raster.fmap.layers.DefaultFLyrRaster; |
|
61 |
import org.gvsig.raster.fmap.layers.IRasterLayerActions; |
|
62 |
import org.gvsig.raster.fmap.layers.NotAvailableStateException; |
|
63 |
import org.gvsig.raster.fmap.legend.ImageLegend; |
|
64 |
import org.gvsig.raster.util.CancelTaskImpl; |
|
65 |
import org.gvsig.raster.wmts.io.WMTSDataParameters; |
|
66 |
import org.gvsig.raster.wmts.io.WMTSServerExplorer; |
|
67 |
import org.gvsig.raster.wmts.io.WMTSServerExplorerParameters; |
|
68 |
import org.gvsig.tools.ToolsLocator; |
|
69 |
import org.gvsig.tools.dynobject.DynObjectSet; |
|
70 |
import org.gvsig.tools.dynobject.DynStruct; |
|
71 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
72 |
import org.gvsig.tools.persistence.PersistentState; |
|
73 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
74 |
import org.gvsig.tools.persistence.exception.PersistenceRuntimeException; |
|
75 |
import org.gvsig.tools.task.Cancellable; |
|
76 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
77 |
import org.gvsig.tools.task.TaskStatusManager; |
|
78 |
|
|
79 |
/** |
|
80 |
* WMTS Layer class. |
|
81 |
* |
|
82 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
83 |
* |
|
84 |
*/ |
|
85 |
public class FLyrWMTS extends DefaultFLyrRaster implements IHasImageLegend { |
|
86 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
87 |
private static final Logger logger = LoggerFactory.getLogger(FLyrWMTS.class); |
|
88 |
private List<WeakReference<Thread>> disableUpdateDrawVersion; |
|
89 |
private Envelope fullEnvelope = null; |
|
90 |
private boolean firstLoad = false; |
|
91 |
private RasterManager rManager = RasterLocator.getManager(); |
|
92 |
private DataStoreParameters params = null; |
|
93 |
private WMTSServerExplorer wmtsExplorer = null; |
|
94 |
private boolean deleteCache = false; |
|
95 |
|
|
96 |
/** |
|
97 |
* Register the persistence |
|
98 |
*/ |
|
99 |
public static void registerPersistent() { |
|
100 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
101 |
DynStruct definition = manager.getDefinition("FLyrWMTS_Persistent"); |
|
102 |
if( definition == null ) { |
|
103 |
if (manager.getDefinition(DefaultFLyrRaster.class) == null) { |
|
104 |
DefaultFLyrRaster.registerPersistence(); |
|
105 |
} |
|
106 |
|
|
107 |
definition = manager.addDefinition( |
|
108 |
FLyrWMTS.class, |
|
109 |
"FLyrWMTS_Persistent", |
|
110 |
"FLyrWMTS Persistent Definition", |
|
111 |
null, |
|
112 |
null |
|
113 |
); |
|
114 |
|
|
115 |
definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, DefaultFLyrRaster.PERSISTENT_NAME); |
|
116 |
} |
|
117 |
|
|
118 |
DefaultFLyrRaster.registerPersistence(definition); |
|
119 |
} |
|
120 |
|
|
121 |
/** |
|
122 |
* Constructor |
|
123 |
*/ |
|
124 |
public FLyrWMTS() { |
|
125 |
super(); |
|
126 |
this.updateDrawVersion(); |
|
127 |
try { |
|
128 |
enableAwake(); |
|
129 |
} catch (NotAvailableStateException e) { |
|
130 |
logger.error("Fallo el estado de open. Closed=" + isClosed() + " Awake=" + isAwake(), this, e); |
|
131 |
} |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* @param host |
|
136 |
* @param srs |
|
137 |
* @return the data store |
|
138 |
* @throws InitializeException |
|
139 |
*/ |
|
140 |
public static DataStore createDataStore(String host, IProjection srs) throws InitializeException { |
|
141 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
142 |
RasterDataParameters params = null; |
|
143 |
try { |
|
144 |
params = (RasterDataParameters)dataman.createServerExplorerParameters(WMTSServerExplorer.NAME); |
|
145 |
} catch (InitializeException e) { |
|
146 |
return null; |
|
147 |
} catch (ProviderNotRegisteredException e) { |
|
148 |
return null; |
|
149 |
} |
|
150 |
URI hostURI; |
|
151 |
try { |
|
152 |
hostURI = new URI(host); |
|
153 |
} catch (URISyntaxException e1) { |
|
154 |
logger.warn("Can't create URI from "+host, e1); |
|
155 |
throw new InitializeException(e1); |
|
156 |
} |
|
157 |
params.setURI(hostURI); |
|
158 |
params.setSRS(srs); |
|
159 |
|
|
160 |
try { |
|
161 |
return dataman.openStore(params.getDataStoreName(), params); |
|
162 |
} catch (ValidateDataParametersException e) { |
|
163 |
throw new InitializeException(e); |
|
164 |
} catch (ProviderNotRegisteredException e) { |
|
165 |
throw new InitializeException(e); |
|
166 |
} |
|
167 |
} |
|
168 |
|
|
169 |
public void loadFromState(PersistentState state) |
|
170 |
throws PersistenceException { |
|
171 |
try { |
|
172 |
super.loadFromState(state); |
|
173 |
|
|
174 |
/* |
|
175 |
* Needs to initialize variables using methods on setDataStore method of this class |
|
176 |
*/ |
|
177 |
this.setDataStore(getDataStore()); |
|
178 |
//this.setParameters(getDataStore().getParameters()); |
|
179 |
}catch (PersistenceRuntimeException e) { |
|
180 |
logger.debug("Unable to load store from persistence in layer: " + this.getName(), e); |
|
181 |
this.setAvailable(false); |
|
182 |
return; |
|
183 |
} catch (LoadLayerException e) { |
|
184 |
logger.debug("Unable to load store to layer: " + this.getName(), e); |
|
185 |
this.setAvailable(false); |
|
186 |
return; |
|
187 |
// } catch (InitializeException e) { |
|
188 |
// logger.debug("Unable to load store parameters to layer: " + this.getName(), e); |
|
189 |
// this.setAvailable(false); |
|
190 |
// return; |
|
191 |
} |
|
192 |
|
|
193 |
} |
|
194 |
|
|
195 |
public void setDataStore(DataStore dataStore) throws LoadLayerException { |
|
196 |
this.dataStore = (RasterDataStore) dataStore; |
|
197 |
try { |
|
198 |
enableOpen(); |
|
199 |
} catch (NotAvailableStateException e) { |
|
200 |
logger.error("Fallo el estado de open. Closed=" + isClosed() + " Awake=" + isAwake(), this, e); |
|
201 |
} |
|
202 |
if (this.dataStore != null) { |
|
203 |
setProjection(this.dataStore.getProjection()); |
|
204 |
setFullExtent(this.dataStore.getExtent().toRectangle2D()); |
|
205 |
} |
|
206 |
} |
|
207 |
|
|
208 |
@SuppressWarnings("deprecation") |
|
209 |
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
210 |
Cancellable cancel, double scale) throws ReadException { |
|
211 |
//CancelTaskImpl cancellable = new CancelTaskImpl(cancel); |
|
212 |
|
|
213 |
//Solo el zoom normal recalcula el nivel dependiendo de la escala. El zoom por niveles asigna |
|
214 |
//?l el nivel de zoom por lo que no habr? que recalcularlo. |
|
215 |
if(recalcLevel) { |
|
216 |
double pixelSize = viewPort.getExtent().getWidth() / (double)viewPort.getImageWidth(); |
|
217 |
zoomLevel = dataStore.getNearestLevel(pixelSize); |
|
218 |
} |
|
219 |
recalcLevel = true; |
|
220 |
|
|
221 |
if(!firstLoad) { |
|
222 |
try { |
|
223 |
initFilters(); |
|
224 |
try { |
|
225 |
if(!isOpen()) |
|
226 |
enableOpen(); |
|
227 |
} catch (NotAvailableStateException e) { |
|
228 |
throw new ReadException("Fallo el estado de open. Closed=" + isClosed() + " Awake=" + isAwake(), e); |
|
229 |
} |
|
230 |
} catch (FilePaletteException e) { |
|
231 |
throw new ReadException(e.getMessage(), e); |
|
232 |
} |
|
233 |
firstLoad = true; |
|
234 |
} |
|
235 |
|
|
236 |
enableStopped(); |
|
237 |
|
|
238 |
if (isWithinScale(scale)) { |
|
239 |
Envelope adjustedExtent = viewPort.getAdjustedEnvelope(); |
|
240 |
if (!adjustedExtent.intersects(getFullEnvelope())) { |
|
241 |
return; |
|
242 |
} |
|
243 |
Extent ext = rManager.getDataStructFactory().createExtent( |
|
244 |
adjustedExtent.getLowerCorner().getX(), |
|
245 |
adjustedExtent.getUpperCorner().getY(), |
|
246 |
adjustedExtent.getUpperCorner().getX(), |
|
247 |
adjustedExtent.getLowerCorner().getY()); |
|
248 |
Dimension imgSz = viewPort.getImageSize(); |
|
249 |
ViewPortData vp2 = rManager.getDataStructFactory().createViewPortData(viewPort.getProjection(), ext, imgSz ); |
|
250 |
vp2.setMat(viewPort.getAffineTransform()); |
|
251 |
vp2.setDPI((int)viewPort.getDPI()); |
|
252 |
|
|
253 |
TaskStatusManager manager = ToolsLocator.getTaskStatusManager(); |
|
254 |
SimpleTaskStatus taskStatus = new RasterTaskStatus("Drawing " + getName() + "...", cancel); |
|
255 |
manager.add(taskStatus); |
|
256 |
taskStatus.setAutoremove(true); |
|
257 |
|
|
258 |
try { |
|
259 |
WMTSDataParameters par = getWMTSParameters(getParameters()); |
|
260 |
//getParameters().setExtent(ext.toRectangle2D()); |
|
261 |
par.setWidth((int)viewPort.getImageSize().getWidth()); |
|
262 |
par.setHeight((int)viewPort.getImageSize().getHeight()); |
|
263 |
|
|
264 |
getRender().drawTiledService(g, vp2, viewPort.getImageSize(), taskStatus); |
|
265 |
} catch (ProcessInterruptedException e) { |
|
266 |
throw new ReadException("Problems drawing this layer: " + e.getMessage(), e); |
|
267 |
} catch (QueryException e) { |
|
268 |
throw new ReadException("Problems drawing this layer: " + e.getMessage(), e); |
|
269 |
} finally { |
|
270 |
taskStatus.terminate(); |
|
271 |
} |
|
272 |
} |
|
273 |
disableStopped(); |
|
274 |
} |
|
275 |
|
|
276 |
|
|
277 |
/** |
|
278 |
* @param g |
|
279 |
* @param viewPort |
|
280 |
* @param cancel |
|
281 |
* @param scale |
|
282 |
* @param properties |
|
283 |
* @throws ReadException |
|
284 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D, |
|
285 |
* com.iver.cit.gvsig.fmap.ViewPort, |
|
286 |
* com.iver.cit.gvsig.fmap.operations.Cancellable) |
|
287 |
*/ |
|
288 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintRequestAttributeSet properties) |
|
289 |
throws ReadException { |
|
290 |
|
|
291 |
|
|
292 |
} |
|
293 |
|
|
294 |
/** |
|
295 |
* @param g |
|
296 |
* @param viewPort |
|
297 |
* @param cancel |
|
298 |
* @param scale |
|
299 |
* @throws ReadException |
|
300 |
*/ |
|
301 |
public void _print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale) throws ReadException { |
|
302 |
draw(null, g, viewPort, cancel,scale); |
|
303 |
} |
|
304 |
|
|
305 |
/** |
|
306 |
* Inserta la extensi?n total de la capa. |
|
307 |
* |
|
308 |
* @param fullExtent |
|
309 |
* Rectangulo. |
|
310 |
*/ |
|
311 |
public void setFullExtent(Rectangle2D fullExtent) { |
|
312 |
this.setFullEnvelope(this.getEnvelopeFromRectable2D(fullExtent)); |
|
313 |
} |
|
314 |
|
|
315 |
/** |
|
316 |
* Inserta la extensi?n total de la capa en la proyeccion original. |
|
317 |
* @param envelope |
|
318 |
* |
|
319 |
*/ |
|
320 |
public void setFullEnvelope(Envelope envelope) { |
|
321 |
Envelope cur = this.getFullEnvelope(); |
|
322 |
if (cur == envelope) { |
|
323 |
return; |
|
324 |
} |
|
325 |
if (cur != null && cur.equals(envelope)) { |
|
326 |
return; |
|
327 |
} |
|
328 |
|
|
329 |
this.fullEnvelope = envelope; |
|
330 |
this.updateDrawVersion(); |
|
331 |
} |
|
332 |
|
|
333 |
/** |
|
334 |
* @return the properties. |
|
335 |
*/ |
|
336 |
public HashMap<String, Object> getProperties() { |
|
337 |
HashMap<String, Object> info = new HashMap<String, Object>(); |
|
338 |
WMTSDataParameters par = getWMTSParameters(getParameters()); |
|
339 |
String layerName = par.getLayer().getTitle(); |
|
340 |
try { |
|
341 |
info.put("name", getName()); |
|
342 |
info.put("selectedLayer", layerName); |
|
343 |
info.put("host", par.getURI()); |
|
344 |
info.put("srs", par.getSRSCode()); |
|
345 |
info.put("imageformat", par.getImageFormat()); |
|
346 |
info.put("infoformat", par.getInfoFormat()); |
|
347 |
//info.put("styles", getParameters().getStyles()); |
|
348 |
return info; |
|
349 |
} catch (Exception e) { |
|
350 |
e.printStackTrace(); |
|
351 |
} |
|
352 |
return null; |
|
353 |
} |
|
354 |
|
|
355 |
|
|
356 |
public String getTocImageIcon() { |
|
357 |
return "icon-layer-wmts"; |
|
358 |
} |
|
359 |
|
|
360 |
public boolean isActionEnabled(int action) { |
|
361 |
switch (action) { |
|
362 |
case IRasterLayerActions.ZOOM_PIXEL_RESOLUTION: |
|
363 |
case IRasterLayerActions.FLYRASTER_BAR_TOOLS: |
|
364 |
case IRasterLayerActions.BANDS_FILE_LIST: |
|
365 |
case IRasterLayerActions.COLOR_TABLE: |
|
366 |
case IRasterLayerActions.GEOLOCATION: |
|
367 |
case IRasterLayerActions.PANSHARPENING: |
|
368 |
case IRasterLayerActions.SAVE_COLORINTERP: |
|
369 |
case IRasterLayerActions.SAVEAS: |
|
370 |
case IRasterLayerActions.BANDS_RGB: |
|
371 |
case IRasterLayerActions.CLIPPING: |
|
372 |
case IRasterLayerActions.ENHANCED: |
|
373 |
case IRasterLayerActions.STATS: |
|
374 |
case IRasterLayerActions.NODATA: |
|
375 |
case IRasterLayerActions.HISTOGRAM: |
|
376 |
return false; |
|
377 |
case IRasterLayerActions.REMOTE_ACTIONS: |
|
378 |
return true; |
|
379 |
} |
|
380 |
|
|
381 |
return super.isActionEnabled(action); |
|
382 |
} |
|
383 |
|
|
384 |
public ILegend getLegend() { |
|
385 |
if(getDataStore() != null) |
|
386 |
return new ImageLegend(getDataStore().getImageLegend()); |
|
387 |
return null; |
|
388 |
} |
|
389 |
|
|
390 |
public boolean isRemote() { |
|
391 |
return true; |
|
392 |
} |
|
393 |
|
|
394 |
public boolean overviewsSupport() { |
|
395 |
return false; |
|
396 |
} |
|
397 |
|
|
398 |
protected void updateDrawVersion() { |
|
399 |
if (this.disableUpdateDrawVersion != null){ |
|
400 |
|
|
401 |
Thread curThread = Thread.currentThread(); |
|
402 |
|
|
403 |
Thread aThread; |
|
404 |
|
|
405 |
Iterator<WeakReference<Thread>> iter = this.disableUpdateDrawVersion.iterator(); |
|
406 |
while (iter.hasNext()){ |
|
407 |
aThread = (Thread) ((WeakReference<?>)iter.next()).get(); |
|
408 |
if (aThread == null){ |
|
409 |
iter.remove(); |
|
410 |
} else if(aThread.equals(curThread)){ |
|
411 |
return; |
|
412 |
} |
|
413 |
} |
|
414 |
} |
|
415 |
super.updateDrawVersion(); |
|
416 |
} |
|
417 |
|
|
418 |
protected void disableUpdateDrawVersion() { |
|
419 |
if (this.disableUpdateDrawVersion == null) { |
|
420 |
this.disableUpdateDrawVersion = new ArrayList<WeakReference<Thread>>(); |
|
421 |
} |
|
422 |
this.disableUpdateDrawVersion.add(new WeakReference<Thread>(Thread.currentThread())); |
|
423 |
} |
|
424 |
|
|
425 |
protected void enableUpdateDrawVersion() { |
|
426 |
if (this.disableUpdateDrawVersion == null) { |
|
427 |
return; |
|
428 |
} |
|
429 |
Thread curThread = Thread.currentThread(); |
|
430 |
Thread aThread; |
|
431 |
|
|
432 |
Iterator<WeakReference<Thread>> iter = this.disableUpdateDrawVersion.iterator(); |
|
433 |
while (iter.hasNext()) { |
|
434 |
aThread = (Thread) ((WeakReference<?>)iter.next()).get(); |
|
435 |
if (aThread == null) { |
|
436 |
iter.remove(); |
|
437 |
} else if(aThread.equals(curThread)) { |
|
438 |
iter.remove(); |
|
439 |
break; |
|
440 |
} |
|
441 |
} |
|
442 |
|
|
443 |
} |
|
444 |
|
|
445 |
@SuppressWarnings("unused") |
|
446 |
private Rectangle2D.Double getRectable2DFromEnvelope(Envelope env) { |
|
447 |
return new Rectangle2D.Double(env.getMinimum(0), env.getMinimum(1), env |
|
448 |
.getLength(0), env.getLength(1)); |
|
449 |
} |
|
450 |
|
|
451 |
private Envelope getEnvelopeFromRectable2D(Rectangle2D rect) { |
|
452 |
try { |
|
453 |
return geomManager.createEnvelope(rect.getMinX(), rect.getMinY(), |
|
454 |
rect.getMaxX(), rect.getMaxY(), |
|
455 |
SUBTYPES.GEOM2D); |
|
456 |
} catch (CreateEnvelopeException e) { |
|
457 |
logger.error("Error creating the envelope", e); |
|
458 |
} |
|
459 |
return null; |
|
460 |
} |
|
461 |
|
|
462 |
@Override |
|
463 |
public String getFileFormat() { |
|
464 |
return "WMTS"; |
|
465 |
} |
|
466 |
|
|
467 |
|
|
468 |
/** |
|
469 |
* Devuelve el envelope en la proyeccion de la vista |
|
470 |
*/ |
|
471 |
public Envelope getFullEnvelope() { |
|
472 |
Envelope rAux; |
|
473 |
rAux = this.fullEnvelope; |
|
474 |
|
|
475 |
// Esto es para cuando se crea una capa nueva con el fullExtent de ancho |
|
476 |
// y alto 0. |
|
477 |
if (rAux == null || rAux.getMaximum(0) - rAux.getMinimum(0) == 0 |
|
478 |
&& rAux.getMaximum(1) - rAux.getMinimum(1) == 0) { |
|
479 |
try { |
|
480 |
rAux = geomManager.createEnvelope(0, 0, 100, 100, SUBTYPES.GEOM2D); |
|
481 |
} catch (CreateEnvelopeException e) { |
|
482 |
logger.error("Error creating the envelope", e); |
|
483 |
} |
|
484 |
} |
|
485 |
// Si existe reproyecci?n, reproyectar el extent |
|
486 |
ICoordTrans ct = getCoordTrans(); |
|
487 |
if (ct != null) { |
|
488 |
Point2D pt1 = new Point2D.Double(rAux.getMinimum(0), rAux |
|
489 |
.getMinimum(1)); |
|
490 |
Point2D pt2 = new Point2D.Double(rAux.getMaximum(0), rAux |
|
491 |
.getMaximum(1)); |
|
492 |
pt1 = ct.convert(pt1, null); |
|
493 |
pt2 = ct.convert(pt2, null); |
|
494 |
try { |
|
495 |
rAux = geomManager.createEnvelope(pt1.getX(), pt1.getY(), pt2 |
|
496 |
.getX(), pt2.getY(), SUBTYPES.GEOM2D); |
|
497 |
} catch (CreateEnvelopeException e) { |
|
498 |
logger.error("Error creating the envelope", e); |
|
499 |
}// new |
|
500 |
// Rectangle2D.Double(); |
|
501 |
} |
|
502 |
return rAux; |
|
503 |
|
|
504 |
} |
|
505 |
|
|
506 |
public Extent getFullRasterExtent() { |
|
507 |
Envelope env = getFullEnvelope(); |
|
508 |
double minx = env.getMinimum(0); |
|
509 |
double miny = env.getMinimum(1); |
|
510 |
double maxx = env.getMaximum(0); |
|
511 |
double maxy = env.getMaximum(1); |
|
512 |
Point2D ul = new Point2D.Double(minx, maxy); |
|
513 |
Point2D ur = new Point2D.Double(maxx, maxy); |
|
514 |
Point2D ll = new Point2D.Double(minx, miny); |
|
515 |
Point2D lr = new Point2D.Double(maxx, miny); |
|
516 |
return rManager.getDataStructFactory().createExtent(ul, lr, ur, ll); |
|
517 |
} |
|
518 |
|
|
519 |
public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel) |
|
520 |
throws LoadLayerException, DataException { |
|
521 |
|
|
522 |
return null; |
|
523 |
} |
|
524 |
|
|
525 |
public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel, boolean fast) |
|
526 |
throws LoadLayerException, DataException { |
|
527 |
|
|
528 |
org.gvsig.fmap.geom.primitive.Point pReal = getMapContext().getViewPort().convertToMapPoint(p); |
|
529 |
String fInfo = null; |
|
530 |
try { |
|
531 |
fInfo = getDataStore().getInfoByPoint(pReal.getX(), pReal.getY(), new CancelTaskImpl(cancel)); |
|
532 |
} catch (InfoByPointException e) { |
|
533 |
throw new LoadLayerException("Error in getInfoByPoint", e); |
|
534 |
} |
|
535 |
int type = DynObjectSetWMTSInfo.TYPE_TEXT; |
|
536 |
WMTSDataParameters wmtsParams = getWMTSParameters(params); |
|
537 |
|
|
538 |
if(wmtsParams.getInfoFormat() != null) { |
|
539 |
if(wmtsParams.getInfoFormat().compareTo("text/html") == 0) |
|
540 |
type = DynObjectSetWMTSInfo.TYPE_HTML; |
|
541 |
if(wmtsParams.getInfoFormat().compareTo("application/vnd.ogc.gml") == 0) |
|
542 |
type = DynObjectSetWMTSInfo.TYPE_XML; |
|
543 |
} |
|
544 |
return new DynObjectSetWMTSInfo(fInfo, type); |
|
545 |
} |
|
546 |
|
|
547 |
/** |
|
548 |
* Sets the data store parameters |
|
549 |
* @param params |
|
550 |
* @throws InitializeException |
|
551 |
*/ |
|
552 |
public void setParameters(DataStoreParameters params) throws InitializeException { |
|
553 |
this.params = params; |
|
554 |
|
|
555 |
if(params instanceof TileDataParameters) { |
|
556 |
((TileDataParameters)params).deleteCache(deleteCache); |
|
557 |
} |
|
558 |
|
|
559 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
560 |
try { |
|
561 |
DataStore dStore = dataman.openStore(params.getDataStoreName(), params); |
|
562 |
this.setDataStore(dStore); |
|
563 |
|
|
564 |
if(params instanceof WMTSDataParameters) { |
|
565 |
this.setName(((WMTSDataParameters) params).getURI().getPath()); |
|
566 |
} |
|
567 |
|
|
568 |
if(params instanceof TileDataParameters) { |
|
569 |
DataParameters p = ((TileDataParameters) params).getDataParameters(); |
|
570 |
if(p instanceof WMTSDataParameters) { |
|
571 |
this.setName(((WMTSDataParameters) p).getURI().getPath()); |
|
572 |
} |
|
573 |
} |
|
574 |
|
|
575 |
} catch (ValidateDataParametersException e) { |
|
576 |
throw new InitializeException(e); |
|
577 |
} catch (ProviderNotRegisteredException e) { |
|
578 |
throw new InitializeException(e); |
|
579 |
} catch (InitializeException e) { |
|
580 |
throw new InitializeException(e); |
|
581 |
} catch (LoadLayerException e) { |
|
582 |
throw new InitializeException(e); |
|
583 |
} |
|
584 |
} |
|
585 |
|
|
586 |
/** |
|
587 |
* @return the data store parameters |
|
588 |
*/ |
|
589 |
@SuppressWarnings("deprecation") |
|
590 |
public DataStoreParameters getParameters() { |
|
591 |
if(params == null) { |
|
592 |
DataManager datamanager = DALLocator.getDataManager(); |
|
593 |
WMTSServerExplorerParameters explorerParams = null; |
|
594 |
try { |
|
595 |
explorerParams = (WMTSServerExplorerParameters) datamanager.createServerExplorerParameters(WMTSServerExplorer.NAME); |
|
596 |
explorerParams.setHost(""); |
|
597 |
wmtsExplorer = (WMTSServerExplorer) datamanager.createServerExplorer(explorerParams); |
|
598 |
params = wmtsExplorer.getStoredParameters(); |
|
599 |
} catch (InitializeException e) { |
|
600 |
} catch (ProviderNotRegisteredException e) { |
|
601 |
} catch (ValidateDataParametersException e) { |
|
602 |
} |
|
603 |
} |
|
604 |
return getWMTSParameters(params); |
|
605 |
} |
|
606 |
|
|
607 |
/** |
|
608 |
* Gets <code>WMTSDataParameters</code> |
|
609 |
* @param parameters |
|
610 |
* @return |
|
611 |
*/ |
|
612 |
private WMTSDataParameters getWMTSParameters(DataStoreParameters parameters) { |
|
613 |
WMTSDataParameters params = null; |
|
614 |
if(parameters instanceof WMTSDataParameters) { |
|
615 |
params = (WMTSDataParameters) parameters; |
|
616 |
} |
|
617 |
|
|
618 |
if(parameters instanceof TileDataParameters) { |
|
619 |
DataParameters p = ((TileDataParameters) parameters).getDataParameters(); |
|
620 |
if(p instanceof WMTSDataParameters) { |
|
621 |
params = (WMTSDataParameters) p; |
|
622 |
} |
|
623 |
} |
|
624 |
return params; |
|
625 |
} |
|
626 |
|
|
627 |
/** |
|
628 |
* Sets the explorer |
|
629 |
* @param explorer |
|
630 |
*/ |
|
631 |
public void setExplorer(WMTSServerExplorer explorer) { |
|
632 |
this.wmtsExplorer = explorer; |
|
633 |
} |
|
634 |
|
|
635 |
/** |
|
636 |
* Gets the explorer |
|
637 |
* @return the server explorer |
|
638 |
*/ |
|
639 |
public WMTSServerExplorer getExplorer() { |
|
640 |
return this.wmtsExplorer; |
|
641 |
} |
|
642 |
|
|
643 |
public Image getImageLegend() { |
|
644 |
return dataStore.getImageLegend(); |
|
645 |
} |
|
646 |
|
|
647 |
public String getPathImage() { |
|
648 |
return null; |
|
649 |
} |
|
650 |
|
|
651 |
public FLayer cloneLayer() throws Exception { |
|
652 |
RasterDataStore ds = dataStore.cloneDataStore(); |
|
653 |
FLyrWMTS newLayer = new FLyrWMTS(); |
|
654 |
newLayer.setName(getName()); |
|
655 |
newLayer.setOpenRasterStore(ds); |
|
656 |
newLayer.fullEnvelope = fullEnvelope; |
|
657 |
newLayer.params = params; |
|
658 |
newLayer.firstLoad = firstLoad; |
|
659 |
newLayer.wmtsExplorer = wmtsExplorer; |
|
660 |
|
|
661 |
List<RasterFilter> filters = getRender().getFilterList().getStatusCloned(); |
|
662 |
|
|
663 |
//Hacemos una copia de las bandas a renderizar |
|
664 |
ColorInterpretation ci = getRender().getRenderColorInterpretation(); |
|
665 |
if(ci != null) { |
|
666 |
newLayer.getRender().setRenderColorInterpretation(ci.cloneColorInterpretation()); |
|
667 |
} |
|
668 |
|
|
669 |
//Asignamos el entorno |
|
670 |
if(newLayer.getRender().getFilterList() == null) |
|
671 |
newLayer.getRender().setFilterList(RasterLocator.getManager().createEmptyFilterList(getRender().getFilterList().getInitDataType())); |
|
672 |
newLayer.getRender().getFilterList().setEnv(getRender().getFilterList().getEnv()); |
|
673 |
newLayer.getRender().getFilterList().setStatus(filters); |
|
674 |
|
|
675 |
// Asignamos los valores noData del original |
|
676 |
NoData nd = (NoData)getNoDataValue().clone(); |
|
677 |
newLayer.setNoDataValue(nd); |
|
678 |
newLayer.enableOpen(); |
|
679 |
|
|
680 |
return newLayer; |
|
681 |
} |
|
682 |
|
|
683 |
/** |
|
684 |
* Assigns the flag to delete this layer from the cache |
|
685 |
* @param deleteCache |
|
686 |
*/ |
|
687 |
public void deleteCache(boolean deleteCache) { |
|
688 |
this.deleteCache = deleteCache; |
|
689 |
} |
|
690 |
} |
|
0 | 691 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.230/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/gui/wizard/WMTSWizard.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.wizard; |
Also available in: Unified diff