Revision 4168
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.15/org.gvsig.raster.wmts.app.wmtsclient/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.raster.wmts.app.wmtsclient</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>Formats: WMTS support</name> |
|
8 |
<description>Web Map Tile Service support</description> |
|
9 |
|
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.raster.wmts</artifactId> |
|
13 |
<version>2.2.15</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<dependencies> |
|
17 |
<dependency> |
|
18 |
<groupId>org.gvsig</groupId> |
|
19 |
<artifactId>org.gvsig.raster.wmts.swing.api</artifactId> |
|
20 |
<scope>compile</scope> |
|
21 |
</dependency> |
|
22 |
<dependency> |
|
23 |
<groupId>org.gvsig</groupId> |
|
24 |
<artifactId>org.gvsig.raster.wmts.swing.impl</artifactId> |
|
25 |
<scope>runtime</scope> |
|
26 |
</dependency> |
|
27 |
<dependency> |
|
28 |
<groupId>org.gvsig</groupId> |
|
29 |
<artifactId>org.gvsig.about.api</artifactId> |
|
30 |
<scope>compile</scope> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>org.gvsig</groupId> |
|
34 |
<artifactId>org.gvsig.raster.wmts.io</artifactId> |
|
35 |
</dependency> |
|
36 |
<dependency> |
|
37 |
<groupId>org.gvsig</groupId> |
|
38 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
39 |
<type>test-jar</type> |
|
40 |
<scope>test</scope> |
|
41 |
</dependency> |
|
42 |
<dependency> |
|
43 |
<groupId>org.gvsig</groupId> |
|
44 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
45 |
<scope>compile</scope> |
|
46 |
</dependency> |
|
47 |
<dependency> |
|
48 |
<groupId>org.gvsig</groupId> |
|
49 |
<artifactId>org.gvsig.raster.lib.api</artifactId> |
|
50 |
<scope>compile</scope> |
|
51 |
</dependency> |
|
52 |
<dependency> |
|
53 |
<groupId>org.gvsig</groupId> |
|
54 |
<artifactId>org.gvsig.raster.swing.api</artifactId> |
|
55 |
<scope>compile</scope> |
|
56 |
</dependency> |
|
57 |
<dependency> |
|
58 |
<groupId>org.gvsig</groupId> |
|
59 |
<artifactId>org.gvsig.raster.fmap</artifactId> |
|
60 |
<scope>compile</scope> |
|
61 |
</dependency> |
|
62 |
<dependency> |
|
63 |
<groupId>org.gvsig</groupId> |
|
64 |
<artifactId>org.gvsig.raster.lib.impl</artifactId> |
|
65 |
<scope>compile</scope> |
|
66 |
</dependency> |
|
67 |
<dependency> |
|
68 |
<groupId>org.gvsig</groupId> |
|
69 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
70 |
<scope>compile</scope> |
|
71 |
</dependency> |
|
72 |
<dependency> |
|
73 |
<groupId>org.gvsig</groupId> |
|
74 |
<artifactId>org.gvsig.utils</artifactId> |
|
75 |
<scope>compile</scope> |
|
76 |
</dependency> |
|
77 |
<dependency> |
|
78 |
<groupId>org.gvsig</groupId> |
|
79 |
<artifactId>org.gvsig.ui</artifactId> |
|
80 |
<scope>compile</scope> |
|
81 |
</dependency> |
|
82 |
<dependency> |
|
83 |
<groupId>org.gvsig</groupId> |
|
84 |
<artifactId>org.gvsig.symbology.lib.api</artifactId> |
|
85 |
<scope>compile</scope> |
|
86 |
</dependency> |
|
87 |
<dependency> |
|
88 |
<groupId>org.gvsig</groupId> |
|
89 |
<artifactId>org.gvsig.symbology.lib.impl</artifactId> |
|
90 |
<scope>compile</scope> |
|
91 |
</dependency> |
|
92 |
<dependency> |
|
93 |
<groupId>org.gvsig</groupId> |
|
94 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
95 |
<scope>compile</scope> |
|
96 |
</dependency> |
|
97 |
<dependency> |
|
98 |
<groupId>org.gvsig</groupId> |
|
99 |
<artifactId>org.gvsig.raster.wmts.ogc.api</artifactId> |
|
100 |
<scope>compile</scope> |
|
101 |
</dependency> |
|
102 |
<dependency> |
|
103 |
<groupId>org.gvsig</groupId> |
|
104 |
<artifactId>org.gvsig.raster.wmts.ogc.impl</artifactId> |
|
105 |
<scope>runtime</scope> |
|
106 |
</dependency> |
|
107 |
|
|
108 |
|
|
109 |
<dependency> |
|
110 |
<groupId>org.gvsig</groupId> |
|
111 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
112 |
<scope>compile</scope> |
|
113 |
</dependency> |
|
114 |
<dependency> |
|
115 |
<groupId>org.gvsig</groupId> |
|
116 |
<artifactId>org.gvsig.fmap.mapcontext.impl</artifactId> |
|
117 |
<scope>runtime</scope> |
|
118 |
</dependency> |
|
119 |
<dependency> |
|
120 |
<groupId>org.gvsig</groupId> |
|
121 |
<artifactId>org.gvsig.fmap.mapcontext.operation</artifactId> |
|
122 |
<scope>runtime</scope> |
|
123 |
</dependency> |
|
124 |
|
|
125 |
<dependency> |
|
126 |
<groupId>org.gvsig</groupId> |
|
127 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
128 |
<scope>compile</scope> |
|
129 |
</dependency> |
|
130 |
<dependency> |
|
131 |
<groupId>org.gvsig</groupId> |
|
132 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
133 |
<scope>runtime</scope> |
|
134 |
</dependency> |
|
135 |
<dependency> |
|
136 |
<groupId>org.gvsig</groupId> |
|
137 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
138 |
<scope>compile</scope> |
|
139 |
</dependency> |
|
140 |
<dependency> |
|
141 |
<groupId>org.gvsig</groupId> |
|
142 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
143 |
<scope>compile</scope> |
|
144 |
</dependency> |
|
145 |
<dependency> |
|
146 |
<groupId>org.gvsig</groupId> |
|
147 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
148 |
<scope>compile</scope> |
|
149 |
</dependency> |
|
150 |
<dependency> |
|
151 |
<groupId>org.gvsig</groupId> |
|
152 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
153 |
<scope>compile</scope> |
|
154 |
</dependency> |
|
155 |
<dependency> |
|
156 |
<groupId>org.gvsig</groupId> |
|
157 |
<artifactId>org.gvsig.fmap.dal.file.lib</artifactId> |
|
158 |
<scope>compile</scope> |
|
159 |
</dependency> |
|
160 |
<dependency> |
|
161 |
<groupId>org.gvsig</groupId> |
|
162 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
163 |
<scope>compile</scope> |
|
164 |
</dependency> |
|
165 |
<dependency> |
|
166 |
<groupId>org.gvsig</groupId> |
|
167 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
168 |
<scope>compile</scope> |
|
169 |
</dependency> |
|
170 |
<!-- |
|
171 |
<dependency> |
|
172 |
<groupId>org.gvsig</groupId> |
|
173 |
<artifactId>org.gvsig.fmap.geometry.generalpath</artifactId> |
|
174 |
<scope>runtime</scope> |
|
175 |
</dependency> |
|
176 |
<dependency> |
|
177 |
<groupId>org.gvsig</groupId> |
|
178 |
<artifactId>org.gvsig.fmap.geometry.operation</artifactId> |
|
179 |
<scope>runtime</scope> |
|
180 |
</dependency> |
|
181 |
--> |
|
182 |
</dependencies> |
|
183 |
|
|
184 |
<properties> |
|
185 |
<gvsig.package.info.state>final</gvsig.package.info.state> |
|
186 |
<gvsig.package.info.dependencies>required: org.gvsig.raster.tilecache.app -ge 2, required: org.gvsig.raster.mainplugin -ge 2</gvsig.package.info.dependencies> |
|
187 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/Raster/pool</gvsig.package.info.poolURL> |
|
188 |
<gvsig.package.info.categories>OGC,Remote Services,Raster</gvsig.package.info.categories> |
|
189 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
190 |
</properties> |
|
191 |
</project> |
|
0 | 192 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.15/org.gvsig.raster.wmts.app.wmtsclient/buildNumber.properties | ||
---|---|---|
1 |
#Tue Nov 03 21:02:21 CET 2015 |
|
2 |
buildNumber=67 |
|
0 | 3 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.15/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.15/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.15/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.15/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.15/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.util.ArrayList; |
|
12 |
import java.util.HashMap; |
|
13 |
import java.util.Iterator; |
|
14 |
import java.util.List; |
|
15 |
|
|
16 |
import javax.print.attribute.PrintRequestAttributeSet; |
|
17 |
|
|
18 |
import org.cresques.cts.ICoordTrans; |
|
19 |
import org.cresques.cts.IProjection; |
|
20 |
import org.gvsig.fmap.dal.DALLocator; |
|
21 |
import org.gvsig.fmap.dal.DataManager; |
|
22 |
import org.gvsig.fmap.dal.DataParameters; |
|
23 |
import org.gvsig.fmap.dal.DataStore; |
|
24 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
25 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
26 |
import org.gvsig.fmap.dal.coverage.RasterManager; |
|
27 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
28 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
|
29 |
import org.gvsig.fmap.dal.coverage.datastruct.ViewPortData; |
|
30 |
import org.gvsig.fmap.dal.coverage.exception.FilePaletteException; |
|
31 |
import org.gvsig.fmap.dal.coverage.exception.InfoByPointException; |
|
32 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
33 |
import org.gvsig.fmap.dal.coverage.exception.QueryException; |
|
34 |
import org.gvsig.fmap.dal.coverage.grid.RasterFilter; |
|
35 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
|
36 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
|
37 |
import org.gvsig.fmap.dal.coverage.store.parameter.TileDataParameters; |
|
38 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
|
39 |
import org.gvsig.fmap.dal.exception.DataException; |
|
40 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
41 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
42 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
43 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
44 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
45 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
46 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
47 |
import org.gvsig.fmap.geom.GeometryManager; |
|
48 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
49 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
50 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
51 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
52 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
53 |
import org.gvsig.fmap.mapcontext.layers.operations.IHasImageLegend; |
|
54 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
55 |
import org.gvsig.raster.fmap.layers.DefaultFLyrRaster; |
|
56 |
import org.gvsig.raster.fmap.layers.IRasterLayerActions; |
|
57 |
import org.gvsig.raster.fmap.layers.NotAvailableStateException; |
|
58 |
import org.gvsig.raster.fmap.legend.ImageLegend; |
|
59 |
import org.gvsig.raster.util.CancelTaskImpl; |
|
60 |
import org.gvsig.raster.wmts.io.WMTSDataParameters; |
|
61 |
import org.gvsig.raster.wmts.io.WMTSServerExplorer; |
|
62 |
import org.gvsig.raster.wmts.io.WMTSServerExplorerParameters; |
|
63 |
import org.gvsig.tools.ToolsLocator; |
|
64 |
import org.gvsig.tools.dynobject.DynObjectSet; |
|
65 |
import org.gvsig.tools.dynobject.DynStruct; |
|
66 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
67 |
import org.gvsig.tools.task.Cancellable; |
|
68 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
69 |
import org.gvsig.tools.task.TaskStatusManager; |
|
70 |
import org.slf4j.Logger; |
|
71 |
import org.slf4j.LoggerFactory; |
|
72 |
|
|
73 |
/** |
|
74 |
* WMTS Layer class. |
|
75 |
* |
|
76 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
77 |
* |
|
78 |
*/ |
|
79 |
public class FLyrWMTS extends DefaultFLyrRaster implements IHasImageLegend { |
|
80 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
81 |
private static final Logger logger = LoggerFactory.getLogger(FLyrWMTS.class); |
|
82 |
private List<WeakReference<Thread>> disableUpdateDrawVersion; |
|
83 |
private Envelope fullEnvelope = null; |
|
84 |
private boolean firstLoad = false; |
|
85 |
private RasterManager rManager = RasterLocator.getManager(); |
|
86 |
private DataStoreParameters params = null; |
|
87 |
private WMTSServerExplorer wmtsExplorer = null; |
|
88 |
private boolean deleteCache = false; |
|
89 |
|
|
90 |
public static void registerPersistent() { |
|
91 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
92 |
DynStruct definition = manager.getDefinition("FLyrWMTS_Persistent"); |
|
93 |
if( definition == null ) { |
|
94 |
if (manager.getDefinition(DefaultFLyrRaster.class) == null) { |
|
95 |
DefaultFLyrRaster.registerPersistence(); |
|
96 |
} |
|
97 |
|
|
98 |
definition = manager.addDefinition( |
|
99 |
FLyrWMTS.class, |
|
100 |
"FLyrWMTS_Persistent", |
|
101 |
"FLyrWMTS Persistent Definition", |
|
102 |
null, |
|
103 |
null |
|
104 |
); |
|
105 |
|
|
106 |
definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, DefaultFLyrRaster.PERSISTENT_NAME); |
|
107 |
} |
|
108 |
|
|
109 |
DefaultFLyrRaster.registerPersistence(definition); |
|
110 |
} |
|
111 |
|
|
112 |
public FLyrWMTS() { |
|
113 |
super(); |
|
114 |
this.updateDrawVersion(); |
|
115 |
try { |
|
116 |
enableAwake(); |
|
117 |
} catch (NotAvailableStateException e) { |
|
118 |
logger.error("Fallo el estado de open. Closed=" + isClosed() + " Awake=" + isAwake(), this, e); |
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
public static DataStore createDataStore(String host, IProjection srs) throws InitializeException { |
|
123 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
124 |
RasterDataParameters params = null; |
|
125 |
try { |
|
126 |
params = (RasterDataParameters)dataman.createServerExplorerParameters(WMTSServerExplorer.NAME); |
|
127 |
} catch (InitializeException e) { |
|
128 |
return null; |
|
129 |
} catch (ProviderNotRegisteredException e) { |
|
130 |
return null; |
|
131 |
} |
|
132 |
params.setURI(host); |
|
133 |
params.setSRS(srs); |
|
134 |
|
|
135 |
try { |
|
136 |
return dataman.openStore(params.getDataStoreName(), params); |
|
137 |
} catch (ValidateDataParametersException e) { |
|
138 |
throw new InitializeException(e); |
|
139 |
} catch (ProviderNotRegisteredException e) { |
|
140 |
throw new InitializeException(e); |
|
141 |
} |
|
142 |
} |
|
143 |
|
|
144 |
public void setDataStore(DataStore dataStore) throws LoadLayerException { |
|
145 |
this.dataStore = (RasterDataStore) dataStore; |
|
146 |
try { |
|
147 |
enableOpen(); |
|
148 |
} catch (NotAvailableStateException e) { |
|
149 |
logger.error("Fallo el estado de open. Closed=" + isClosed() + " Awake=" + isAwake(), this, e); |
|
150 |
} |
|
151 |
setProjection(this.dataStore.getProjection()); |
|
152 |
setFullExtent(this.dataStore.getExtent().toRectangle2D()); |
|
153 |
} |
|
154 |
|
|
155 |
@SuppressWarnings("deprecation") |
|
156 |
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
157 |
Cancellable cancel, double scale) throws ReadException { |
|
158 |
//CancelTaskImpl cancellable = new CancelTaskImpl(cancel); |
|
159 |
|
|
160 |
//Solo el zoom normal recalcula el nivel dependiendo de la escala. El zoom por niveles asigna |
|
161 |
//?l el nivel de zoom por lo que no habr? que recalcularlo. |
|
162 |
if(recalcLevel) { |
|
163 |
double pixelSize = viewPort.getExtent().getWidth() / (double)viewPort.getImageWidth(); |
|
164 |
zoomLevel = dataStore.getNearestLevel(pixelSize); |
|
165 |
} |
|
166 |
recalcLevel = true; |
|
167 |
|
|
168 |
if(!firstLoad) { |
|
169 |
try { |
|
170 |
initFilters(); |
|
171 |
try { |
|
172 |
if(!isOpen()) |
|
173 |
enableOpen(); |
|
174 |
} catch (NotAvailableStateException e) { |
|
175 |
throw new ReadException("Fallo el estado de open. Closed=" + isClosed() + " Awake=" + isAwake(), e); |
|
176 |
} |
|
177 |
} catch (FilePaletteException e) { |
|
178 |
throw new ReadException(e.getMessage(), e); |
|
179 |
} |
|
180 |
firstLoad = true; |
|
181 |
} |
|
182 |
|
|
183 |
enableStopped(); |
|
184 |
|
|
185 |
if (isWithinScale(scale)) { |
|
186 |
if (!viewPort.getAdjustedExtent().intersects(getFullEnvelope())) |
|
187 |
return; |
|
188 |
Envelope adjustedExtent = viewPort.getAdjustedEnvelope(); |
|
189 |
Extent ext = rManager.getDataStructFactory().createExtent( |
|
190 |
adjustedExtent.getLowerCorner().getX(), |
|
191 |
adjustedExtent.getUpperCorner().getY(), |
|
192 |
adjustedExtent.getUpperCorner().getX(), |
|
193 |
adjustedExtent.getLowerCorner().getY()); |
|
194 |
Dimension imgSz = viewPort.getImageSize(); |
|
195 |
ViewPortData vp2 = rManager.getDataStructFactory().createViewPortData(viewPort.getProjection(), ext, imgSz ); |
|
196 |
vp2.setMat(viewPort.getAffineTransform()); |
|
197 |
vp2.setDPI((int)viewPort.getDPI()); |
|
198 |
|
|
199 |
TaskStatusManager manager = ToolsLocator.getTaskStatusManager(); |
|
200 |
SimpleTaskStatus taskStatus = new RasterTaskStatus("Drawing " + getName() + "...", cancel); |
|
201 |
manager.add(taskStatus); |
|
202 |
taskStatus.setAutoremove(true); |
|
203 |
|
|
204 |
try { |
|
205 |
WMTSDataParameters par = getWMTSParameters(getParameters()); |
|
206 |
//getParameters().setExtent(ext.toRectangle2D()); |
|
207 |
par.setWidth((int)viewPort.getImageSize().getWidth()); |
|
208 |
par.setHeight((int)viewPort.getImageSize().getHeight()); |
|
209 |
|
|
210 |
getRender().drawTiledService(g, vp2, viewPort.getImageSize(), taskStatus); |
|
211 |
} catch (ProcessInterruptedException e) { |
|
212 |
throw new ReadException("Problems drawing this layer: " + e.getMessage(), e); |
|
213 |
} catch (QueryException e) { |
|
214 |
throw new ReadException("Problems drawing this layer: " + e.getMessage(), e); |
|
215 |
} finally { |
|
216 |
taskStatus.terminate(); |
|
217 |
} |
|
218 |
} |
|
219 |
disableStopped(); |
|
220 |
} |
|
221 |
|
|
222 |
|
|
223 |
/** |
|
224 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D, |
|
225 |
* com.iver.cit.gvsig.fmap.ViewPort, |
|
226 |
* com.iver.cit.gvsig.fmap.operations.Cancellable) |
|
227 |
*/ |
|
228 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintRequestAttributeSet properties) |
|
229 |
throws ReadException { |
|
230 |
|
|
231 |
} |
|
232 |
|
|
233 |
public void _print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
|
234 |
double scale) throws ReadException { |
|
235 |
draw(null, g, viewPort, cancel,scale); |
|
236 |
} |
|
237 |
|
|
238 |
/** |
|
239 |
* Inserta la extensi?n total de la capa. |
|
240 |
* |
|
241 |
* @param fullExtent |
|
242 |
* Rectangulo. |
|
243 |
*/ |
|
244 |
public void setFullExtent(Rectangle2D fullExtent) { |
|
245 |
this.setFullEnvelope(this.getEnvelopeFromRectable2D(fullExtent)); |
|
246 |
} |
|
247 |
|
|
248 |
/** |
|
249 |
* Inserta la extensi?n total de la capa en la proyeccion original. |
|
250 |
* |
|
251 |
* @param fullExtent |
|
252 |
* Rect?ngulo. |
|
253 |
*/ |
|
254 |
public void setFullEnvelope(Envelope envelope) { |
|
255 |
Envelope cur = this.getFullEnvelope(); |
|
256 |
if (cur == envelope) { |
|
257 |
return; |
|
258 |
} |
|
259 |
if (cur != null && cur.equals(envelope)) { |
|
260 |
return; |
|
261 |
} |
|
262 |
|
|
263 |
this.fullEnvelope = envelope; |
|
264 |
this.updateDrawVersion(); |
|
265 |
} |
|
266 |
|
|
267 |
public HashMap<String, Object> getProperties() { |
|
268 |
HashMap<String, Object> info = new HashMap<String, Object>(); |
|
269 |
WMTSDataParameters par = getWMTSParameters(getParameters()); |
|
270 |
String layerName = par.getLayer().getTitle(); |
|
271 |
try { |
|
272 |
info.put("name", getName()); |
|
273 |
info.put("selectedLayer", layerName); |
|
274 |
info.put("host", par.getURI()); |
|
275 |
info.put("srs", par.getSRSCode()); |
|
276 |
info.put("imageformat", par.getImageFormat()); |
|
277 |
info.put("infoformat", par.getInfoFormat()); |
|
278 |
//info.put("styles", getParameters().getStyles()); |
|
279 |
return info; |
|
280 |
} catch (Exception e) { |
|
281 |
e.printStackTrace(); |
|
282 |
} |
|
283 |
return null; |
|
284 |
} |
|
285 |
|
|
286 |
|
|
287 |
public String getTocImageIcon() { |
|
288 |
return "icon-layer-wmts"; |
|
289 |
} |
|
290 |
|
|
291 |
public boolean isActionEnabled(int action) { |
|
292 |
switch (action) { |
|
293 |
case IRasterLayerActions.ZOOM_PIXEL_RESOLUTION: |
|
294 |
case IRasterLayerActions.FLYRASTER_BAR_TOOLS: |
|
295 |
case IRasterLayerActions.BANDS_FILE_LIST: |
|
296 |
case IRasterLayerActions.COLOR_TABLE: |
|
297 |
case IRasterLayerActions.GEOLOCATION: |
|
298 |
case IRasterLayerActions.PANSHARPENING: |
|
299 |
case IRasterLayerActions.SAVE_COLORINTERP: |
|
300 |
case IRasterLayerActions.SAVEAS: |
|
301 |
case IRasterLayerActions.BANDS_RGB: |
|
302 |
case IRasterLayerActions.CLIPPING: |
|
303 |
case IRasterLayerActions.ENHANCED: |
|
304 |
case IRasterLayerActions.STATS: |
|
305 |
case IRasterLayerActions.NODATA: |
|
306 |
case IRasterLayerActions.HISTOGRAM: |
|
307 |
return false; |
|
308 |
case IRasterLayerActions.REMOTE_ACTIONS: |
|
309 |
return true; |
|
310 |
} |
|
311 |
|
|
312 |
return super.isActionEnabled(action); |
|
313 |
} |
|
314 |
|
|
315 |
public ILegend getLegend() { |
|
316 |
if(getDataStore() != null) |
|
317 |
return new ImageLegend(getDataStore().getImageLegend()); |
|
318 |
return null; |
|
319 |
} |
|
320 |
|
|
321 |
public boolean isRemote() { |
|
322 |
return true; |
|
323 |
} |
|
324 |
|
|
325 |
public boolean overviewsSupport() { |
|
326 |
return false; |
|
327 |
} |
|
328 |
|
|
329 |
protected void updateDrawVersion() { |
|
330 |
if (this.disableUpdateDrawVersion != null){ |
|
331 |
|
|
332 |
Thread curThread = Thread.currentThread(); |
|
333 |
|
|
334 |
Thread aThread; |
|
335 |
|
|
336 |
Iterator<WeakReference<Thread>> iter = this.disableUpdateDrawVersion.iterator(); |
|
337 |
while (iter.hasNext()){ |
|
338 |
aThread = (Thread) ((WeakReference<?>)iter.next()).get(); |
|
339 |
if (aThread == null){ |
|
340 |
iter.remove(); |
|
341 |
} else if(aThread.equals(curThread)){ |
|
342 |
return; |
|
343 |
} |
|
344 |
} |
|
345 |
} |
|
346 |
super.updateDrawVersion(); |
|
347 |
} |
|
348 |
|
|
349 |
protected void disableUpdateDrawVersion() { |
|
350 |
if (this.disableUpdateDrawVersion == null) { |
|
351 |
this.disableUpdateDrawVersion = new ArrayList<WeakReference<Thread>>(); |
|
352 |
} |
|
353 |
this.disableUpdateDrawVersion.add(new WeakReference<Thread>(Thread.currentThread())); |
|
354 |
} |
|
355 |
|
|
356 |
protected void enableUpdateDrawVersion() { |
|
357 |
if (this.disableUpdateDrawVersion == null) { |
|
358 |
return; |
|
359 |
} |
|
360 |
Thread curThread = Thread.currentThread(); |
|
361 |
Thread aThread; |
|
362 |
|
|
363 |
Iterator<WeakReference<Thread>> iter = this.disableUpdateDrawVersion.iterator(); |
|
364 |
while (iter.hasNext()) { |
|
365 |
aThread = (Thread) ((WeakReference<?>)iter.next()).get(); |
|
366 |
if (aThread == null) { |
|
367 |
iter.remove(); |
|
368 |
} else if(aThread.equals(curThread)) { |
|
369 |
iter.remove(); |
|
370 |
break; |
|
371 |
} |
|
372 |
} |
|
373 |
|
|
374 |
} |
|
375 |
|
|
376 |
@SuppressWarnings("unused") |
|
377 |
private Rectangle2D.Double getRectable2DFromEnvelope(Envelope env) { |
|
378 |
return new Rectangle2D.Double(env.getMinimum(0), env.getMinimum(1), env |
|
379 |
.getLength(0), env.getLength(1)); |
|
380 |
} |
|
381 |
|
|
382 |
private Envelope getEnvelopeFromRectable2D(Rectangle2D rect) { |
|
383 |
try { |
|
384 |
return geomManager.createEnvelope(rect.getMinX(), rect.getMinY(), |
|
385 |
rect.getMaxX(), rect.getMaxY(), |
|
386 |
SUBTYPES.GEOM2D); |
|
387 |
} catch (CreateEnvelopeException e) { |
|
388 |
logger.error("Error creating the envelope", e); |
|
389 |
} |
|
390 |
return null; |
|
391 |
} |
|
392 |
|
|
393 |
@Override |
|
394 |
public String getFileFormat() { |
|
395 |
return "WMTS"; |
|
396 |
} |
|
397 |
|
|
398 |
|
|
399 |
/** |
|
400 |
* Devuelve el envelope en la proyeccion de la vista |
|
401 |
*/ |
|
402 |
public Envelope getFullEnvelope() { |
|
403 |
Envelope rAux; |
|
404 |
rAux = this.fullEnvelope; |
|
405 |
|
|
406 |
// Esto es para cuando se crea una capa nueva con el fullExtent de ancho |
|
407 |
// y alto 0. |
|
408 |
if (rAux == null || rAux.getMaximum(0) - rAux.getMinimum(0) == 0 |
|
409 |
&& rAux.getMaximum(1) - rAux.getMinimum(1) == 0) { |
|
410 |
try { |
|
411 |
rAux = geomManager.createEnvelope(0, 0, 100, 100, SUBTYPES.GEOM2D); |
|
412 |
} catch (CreateEnvelopeException e) { |
|
413 |
logger.error("Error creating the envelope", e); |
|
414 |
} |
|
415 |
} |
|
416 |
// Si existe reproyecci?n, reproyectar el extent |
|
417 |
ICoordTrans ct = getCoordTrans(); |
|
418 |
if (ct != null) { |
|
419 |
Point2D pt1 = new Point2D.Double(rAux.getMinimum(0), rAux |
|
420 |
.getMinimum(1)); |
|
421 |
Point2D pt2 = new Point2D.Double(rAux.getMaximum(0), rAux |
|
422 |
.getMaximum(1)); |
|
423 |
pt1 = ct.convert(pt1, null); |
|
424 |
pt2 = ct.convert(pt2, null); |
|
425 |
try { |
|
426 |
rAux = geomManager.createEnvelope(pt1.getX(), pt1.getY(), pt2 |
|
427 |
.getX(), pt2.getY(), SUBTYPES.GEOM2D); |
|
428 |
} catch (CreateEnvelopeException e) { |
|
429 |
logger.error("Error creating the envelope", e); |
|
430 |
}// new |
|
431 |
// Rectangle2D.Double(); |
|
432 |
} |
|
433 |
return rAux; |
|
434 |
|
|
435 |
} |
|
436 |
|
|
437 |
public Extent getFullRasterExtent() { |
|
438 |
Envelope env = getFullEnvelope(); |
|
439 |
double minx = env.getMinimum(0); |
|
440 |
double miny = env.getMinimum(1); |
|
441 |
double maxx = env.getMaximum(0); |
|
442 |
double maxy = env.getMaximum(1); |
|
443 |
Point2D ul = new Point2D.Double(minx, maxy); |
|
444 |
Point2D ur = new Point2D.Double(maxx, maxy); |
|
445 |
Point2D ll = new Point2D.Double(minx, miny); |
|
446 |
Point2D lr = new Point2D.Double(maxx, miny); |
|
447 |
return rManager.getDataStructFactory().createExtent(ul, lr, ur, ll); |
|
448 |
} |
|
449 |
|
|
450 |
public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel) |
|
451 |
throws LoadLayerException, DataException { |
|
452 |
|
|
453 |
return null; |
|
454 |
} |
|
455 |
|
|
456 |
public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel, boolean fast) |
|
457 |
throws LoadLayerException, DataException { |
|
458 |
|
|
459 |
Point2D pReal = getMapContext().getViewPort().toMapPoint(p); |
|
460 |
String fInfo = null; |
|
461 |
try { |
|
462 |
fInfo = getDataStore().getInfoByPoint(pReal.getX(), pReal.getY(), new CancelTaskImpl(cancel)); |
|
463 |
} catch (InfoByPointException e) { |
|
464 |
throw new LoadLayerException("Error in getInfoByPoint", e); |
|
465 |
} |
|
466 |
int type = DynObjectSetWMTSInfo.TYPE_TEXT; |
|
467 |
WMTSDataParameters wmtsParams = getWMTSParameters(params); |
|
468 |
|
|
469 |
if(wmtsParams.getInfoFormat() != null) { |
|
470 |
if(wmtsParams.getInfoFormat().compareTo("text/html") == 0) |
|
471 |
type = DynObjectSetWMTSInfo.TYPE_HTML; |
|
472 |
if(wmtsParams.getInfoFormat().compareTo("application/vnd.ogc.gml") == 0) |
|
473 |
type = DynObjectSetWMTSInfo.TYPE_XML; |
|
474 |
} |
|
475 |
return new DynObjectSetWMTSInfo(fInfo, type); |
|
476 |
} |
|
477 |
|
|
478 |
/** |
|
479 |
* Sets the data store parameters |
|
480 |
* @param params |
|
481 |
* @throws InitializeException |
|
482 |
*/ |
|
483 |
public void setParameters(DataStoreParameters params) throws InitializeException { |
|
484 |
this.params = params; |
|
485 |
|
|
486 |
if(params instanceof TileDataParameters) { |
|
487 |
((TileDataParameters)params).deleteCache(deleteCache); |
|
488 |
} |
|
489 |
|
|
490 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
491 |
try { |
|
492 |
DataStore dStore = dataman.openStore(params.getDataStoreName(), params); |
|
493 |
this.setDataStore(dStore); |
|
494 |
|
|
495 |
if(params instanceof WMTSDataParameters) { |
|
496 |
this.setName(((WMTSDataParameters) params).getURI()); |
|
497 |
} |
|
498 |
|
|
499 |
if(params instanceof TileDataParameters) { |
|
500 |
DataParameters p = ((TileDataParameters) params).getDataParameters(); |
|
501 |
if(p instanceof WMTSDataParameters) { |
|
502 |
this.setName(((WMTSDataParameters) p).getURI()); |
|
503 |
} |
|
504 |
} |
|
505 |
|
|
506 |
} catch (ValidateDataParametersException e) { |
|
507 |
throw new InitializeException(e); |
|
508 |
} catch (ProviderNotRegisteredException e) { |
|
509 |
throw new InitializeException(e); |
|
510 |
} catch (InitializeException e) { |
|
511 |
throw new InitializeException(e); |
|
512 |
} catch (LoadLayerException e) { |
|
513 |
throw new InitializeException(e); |
|
514 |
} |
|
515 |
} |
|
516 |
|
|
517 |
@SuppressWarnings("deprecation") |
|
518 |
public DataStoreParameters getParameters() { |
|
519 |
if(params == null) { |
|
520 |
DataManager datamanager = DALLocator.getDataManager(); |
|
521 |
WMTSServerExplorerParameters explorerParams = null; |
|
522 |
try { |
|
523 |
explorerParams = (WMTSServerExplorerParameters) datamanager.createServerExplorerParameters(WMTSServerExplorer.NAME); |
|
524 |
explorerParams.setHost(""); |
|
525 |
wmtsExplorer = (WMTSServerExplorer) datamanager.createServerExplorer(explorerParams); |
|
526 |
params = wmtsExplorer.getStoredParameters(); |
|
527 |
} catch (InitializeException e) { |
|
528 |
} catch (ProviderNotRegisteredException e) { |
|
529 |
} catch (ValidateDataParametersException e) { |
|
530 |
} |
|
531 |
} |
|
532 |
return getWMTSParameters(params); |
|
533 |
} |
|
534 |
|
|
535 |
/** |
|
536 |
* Gets <code>WMTSDataParameters</code> |
|
537 |
* @param parameters |
|
538 |
* @return |
|
539 |
*/ |
|
540 |
private WMTSDataParameters getWMTSParameters(DataStoreParameters parameters) { |
|
541 |
WMTSDataParameters params = null; |
|
542 |
if(parameters instanceof WMTSDataParameters) { |
|
543 |
params = (WMTSDataParameters) parameters; |
|
544 |
} |
|
545 |
|
|
546 |
if(parameters instanceof TileDataParameters) { |
|
547 |
DataParameters p = ((TileDataParameters) parameters).getDataParameters(); |
|
548 |
if(p instanceof WMTSDataParameters) { |
|
549 |
params = (WMTSDataParameters) p; |
|
550 |
} |
|
551 |
} |
|
552 |
return params; |
|
553 |
} |
|
554 |
|
|
555 |
/** |
|
556 |
* Sets the explorer |
|
557 |
* @param explorer |
|
558 |
*/ |
|
559 |
public void setExplorer(WMTSServerExplorer explorer) { |
|
560 |
this.wmtsExplorer = explorer; |
|
561 |
} |
|
562 |
|
|
563 |
/** |
|
564 |
* Gets the explorer |
|
565 |
* @return |
|
566 |
*/ |
|
567 |
public WMTSServerExplorer getExplorer() { |
|
568 |
return this.wmtsExplorer; |
|
569 |
} |
|
570 |
|
|
571 |
public Image getImageLegend() { |
|
572 |
return dataStore.getImageLegend(); |
|
573 |
} |
|
574 |
|
|
575 |
public String getPathImage() { |
|
576 |
return null; |
|
577 |
} |
|
578 |
|
|
579 |
public FLayer cloneLayer() throws Exception { |
|
580 |
RasterDataStore ds = dataStore.cloneDataStore(); |
|
581 |
FLyrWMTS newLayer = new FLyrWMTS(); |
|
582 |
newLayer.setName(getName()); |
|
583 |
newLayer.setOpenRasterStore(ds); |
|
584 |
newLayer.fullEnvelope = fullEnvelope; |
|
585 |
newLayer.params = params; |
|
586 |
newLayer.firstLoad = firstLoad; |
|
587 |
newLayer.wmtsExplorer = wmtsExplorer; |
|
588 |
|
|
589 |
List<RasterFilter> filters = getRender().getFilterList().getStatusCloned(); |
|
590 |
|
|
591 |
//Hacemos una copia de las bandas a renderizar |
|
592 |
ColorInterpretation ci = getRender().getRenderColorInterpretation(); |
|
593 |
if(ci != null) { |
|
594 |
newLayer.getRender().setRenderColorInterpretation(ci.cloneColorInterpretation()); |
|
595 |
} |
|
596 |
|
|
597 |
//Asignamos el entorno |
|
598 |
if(newLayer.getRender().getFilterList() == null) |
|
599 |
newLayer.getRender().setFilterList(RasterLocator.getManager().createEmptyFilterList(getRender().getFilterList().getInitDataType())); |
|
600 |
newLayer.getRender().getFilterList().setEnv(getRender().getFilterList().getEnv()); |
|
601 |
newLayer.getRender().getFilterList().setStatus(filters); |
|
602 |
|
|
603 |
// Asignamos los valores noData del original |
|
604 |
NoData nd = (NoData)getNoDataValue().clone(); |
|
605 |
newLayer.setNoDataValue(nd); |
|
606 |
newLayer.enableOpen(); |
|
607 |
|
|
608 |
return newLayer; |
|
609 |
} |
|
610 |
|
|
611 |
/** |
|
612 |
* Assigns the flag to delete this layer from the cache |
|
613 |
* @param selected |
|
614 |
*/ |
|
615 |
public void deleteCache(boolean deleteCache) { |
|
616 |
this.deleteCache = deleteCache; |
|
617 |
} |
|
618 |
} |
|
0 | 619 |
org.gvsig.raster.wmts/tags/org.gvsig.raster.wmts-2.2.15/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; |
|
24 |
|
|
25 |
import java.awt.GridBagConstraints; |
|
26 |
import java.awt.GridBagLayout; |
|
27 |
import java.awt.event.ActionEvent; |
|
28 |
import java.awt.event.ActionListener; |
|
29 |
import java.io.File; |
|
30 |
import java.io.FileInputStream; |
|
31 |
import java.io.FileNotFoundException; |
|
32 |
import java.io.IOException; |
|
33 |
import java.net.MalformedURLException; |
|
34 |
import java.net.URL; |
|
35 |
import java.util.ArrayList; |
|
36 |
import java.util.List; |
|
37 |
import java.util.Properties; |
|
38 |
import java.util.prefs.Preferences; |
|
39 |
|
|
40 |
import javax.swing.JOptionPane; |
|
41 |
|
|
42 |
import org.apache.commons.io.IOUtils; |
|
43 |
import org.cresques.cts.IProjection; |
|
44 |
import org.gvsig.andami.PluginServices; |
|
45 |
import org.gvsig.andami.PluginsLocator; |
|
46 |
import org.gvsig.andami.PluginsManager; |
|
47 |
import org.gvsig.andami.persistence.serverData.ServerDataPersistence; |
|
48 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
49 |
import org.gvsig.app.gui.WizardPanel; |
|
50 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
51 |
import org.gvsig.compat.net.ICancellable; |
|
52 |
import org.gvsig.fmap.dal.DALLocator; |
|
53 |
import org.gvsig.fmap.dal.DataManager; |
|
54 |
import org.gvsig.fmap.dal.DataParameters; |
|
55 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
56 |
import org.gvsig.fmap.dal.coverage.exception.ConnectException; |
|
57 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
|
58 |
import org.gvsig.fmap.dal.coverage.store.parameter.TileDataParameters; |
|
59 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
60 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
61 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
62 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
63 |
import org.gvsig.gui.beans.Messages; |
|
64 |
import org.gvsig.raster.util.CancelTaskImpl; |
|
65 |
import org.gvsig.raster.wmts.app.wmtsclient.WMTSClientExtension; |
|
66 |
import org.gvsig.raster.wmts.app.wmtsclient.layer.FLyrWMTS; |
|
67 |
import org.gvsig.raster.wmts.io.WMTSDataParameters; |
|
68 |
import org.gvsig.raster.wmts.io.WMTSServerExplorer; |
|
69 |
import org.gvsig.raster.wmts.io.WMTSServerExplorerParameters; |
|
70 |
import org.gvsig.raster.wmts.ogc.struct.WMTSServiceIdentification; |
|
71 |
import org.gvsig.raster.wmts.swing.AddServerPanel; |
|
72 |
import org.gvsig.raster.wmts.swing.NextPrevPanel; |
|
73 |
import org.gvsig.raster.wmts.swing.WMTSSwingLocator; |
|
74 |
import org.gvsig.raster.wmts.swing.WMTSWizardListener; |
|
75 |
import org.gvsig.raster.wmts.swing.WmtsGUI; |
|
76 |
import org.gvsig.tools.dynobject.DynObject; |
|
77 |
import org.gvsig.utils.swing.jcomboServer.ServerData; |
|
78 |
import org.slf4j.Logger; |
|
79 |
import org.slf4j.LoggerFactory; |
|
80 |
|
|
81 |
/** |
|
82 |
* The WMTS properties container panel. |
|
83 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
84 |
*/ |
|
85 |
@SuppressWarnings({ "unused", "deprecation" }) |
|
86 |
public class WMTSWizard extends WizardPanel implements ActionListener { |
|
87 |
private static final long serialVersionUID = 1L; |
|
88 |
private static Logger logger = LoggerFactory.getLogger(WMTSWizard.class); |
|
89 |
private String pluginName = "org.gvsig.raster.wmts.app.wmtsclient"; |
|
90 |
private File pluginPersistenceFile = null; |
|
91 |
private File serverPropertiesFile = null; |
|
92 |
private ServerDataPersistence serverDataPersistence = null; |
|
93 |
private String serversPropsFilename = "servers.properties"; |
|
94 |
|
|
95 |
protected int page = 0; |
|
96 |
protected boolean connected = false; |
|
97 |
private AddServerPanel serverPanel = null; |
|
98 |
private NextPrevPanel nextPrevPanel = null; |
|
99 |
protected WmtsGUI wmtsParamsPanel = null; |
|
100 |
|
|
101 |
private WMTSWizardListenerImpl listenerSupport = null; |
|
102 |
private static Preferences fPrefs = Preferences.userRoot().node( "gvsig.wmts-wizard" ); |
|
103 |
private boolean refreshing = fPrefs.getBoolean("refresh_capabilities", false); |
|
104 |
protected int firstPage = 0; |
|
105 |
private IProjection proj = null; |
|
106 |
private ICancellable cancel = null; |
|
107 |
private WMTSDataParameters storeParams = null; |
|
108 |
private WMTSServerExplorer explorer = null; |
|
109 |
|
|
110 |
private PluginServices plugin = null; |
|
111 |
|
|
112 |
public class WMTSWizardListenerImpl implements WMTSWizardListener { |
|
113 |
|
|
114 |
public void correctlyConfiguredEvent(boolean finishable) { |
|
115 |
callStateChanged(finishable); |
|
116 |
} |
|
117 |
|
|
118 |
public void addLayerEvent() { |
|
119 |
activarVisualizarBotones(); |
|
120 |
} |
|
121 |
|
|
122 |
public void removeLayerEvent() { |
|
123 |
activarVisualizarBotones(); |
|
124 |
} |
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* This is the default constructor |
|
129 |
*/ |
|
130 |
public WMTSWizard() { |
|
131 |
super(); |
|
132 |
firstPage = 0; |
|
133 |
page = firstPage; |
|
134 |
initialize(); |
|
135 |
|
|
136 |
IWindow[] windows = PluginServices.getMDIManager().getAllWindows(); |
|
137 |
for (int i = 0; i < windows.length; i++) { |
|
138 |
if(windows[i] instanceof AbstractViewPanel) |
|
139 |
proj = ((AbstractViewPanel)windows[i]).getProjection(); |
|
140 |
} |
|
141 |
cancel = new CancelTaskImpl(); |
|
142 |
} |
|
143 |
|
|
144 |
/** |
|
145 |
* This method initializes this |
|
146 |
*/ |
|
147 |
private void initialize() { |
|
148 |
PluginsManager pluginsManager = PluginsLocator.getManager(); |
|
149 |
this.plugin = pluginsManager.getPlugin(WMTSClientExtension.class); |
|
150 |
|
|
151 |
setTabName("WMTS"); |
|
152 |
setLayout(new GridBagLayout()); |
|
153 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
|
154 |
gridBagConstraints1.fill = GridBagConstraints.BOTH; |
|
155 |
gridBagConstraints1.weightx = 1.0; |
|
156 |
gridBagConstraints1.weighty = 1.0; |
|
157 |
gridBagConstraints1.insets = new java.awt.Insets(2, 12, 10, 12); |
|
158 |
|
|
159 |
setVisible(true); |
|
160 |
add(getIserverPanel(), gridBagConstraints1); |
|
161 |
|
|
162 |
gridBagConstraints1.insets = new java.awt.Insets(2, 0, 10, 0); |
|
163 |
add(getPanelPage2(), gridBagConstraints1); |
|
164 |
gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL; |
|
165 |
gridBagConstraints1.anchor = GridBagConstraints.EAST; |
|
166 |
gridBagConstraints1.weighty = 0; |
|
167 |
gridBagConstraints1.gridy = 1; |
|
168 |
add(getNextPrevPanel(), gridBagConstraints1); |
|
169 |
activarVisualizarBotones(); |
|
170 |
getIserverPanel().getTxtHost().setServerList(getServerDataPersistence().getArrayOfServerData()); |
|
171 |
} |
|
172 |
|
|
173 |
/** |
|
174 |
* This method checks for the options selected within the configuration |
|
175 |
* dialog are correct. |
|
176 |
* |
|
177 |
* @return true if you're done, false if not. |
|
178 |
*/ |
|
179 |
public boolean areSettingsValid() { |
|
180 |
return getPanelPage2().isCorrectlyConfigured(); |
|
181 |
} |
|
182 |
|
|
183 |
private WMTSWizardListenerImpl getWizardListenerSupport() { |
|
184 |
if(listenerSupport == null) { |
|
185 |
listenerSupport = new WMTSWizardListenerImpl(); |
|
186 |
} |
|
187 |
return listenerSupport; |
|
188 |
} |
|
189 |
|
|
190 |
/** |
|
191 |
* Thread to connect to a WMTS server |
|
192 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
193 |
*/ |
|
194 |
public class ConnectThread extends Thread { |
|
195 |
private ICancellable cancel = null; |
|
196 |
private WMTSServerExplorer explorer = null; |
|
197 |
private WMTSWizard wizard = null; |
|
198 |
|
|
199 |
public ConnectThread(ICancellable cancel, WMTSServerExplorer explorer, WMTSWizard wizard) { |
|
200 |
this.cancel = cancel; |
|
201 |
this.explorer = explorer; |
|
202 |
this.wizard = wizard; |
|
203 |
} |
|
204 |
|
|
205 |
public void run() { |
|
206 |
if(!checkHostAndNetwork()) |
|
207 |
return; |
|
208 |
|
|
209 |
try { |
|
210 |
explorer.connect(cancel); |
|
211 |
saveServerListFromComboBox(); |
|
212 |
} catch (ConnectException e) { |
|
213 |
getIserverPanel().setTextInfo("Connection closed... \n" + e.getMessage()); |
|
214 |
JOptionPane.showMessageDialog(null, Messages.getText("wmts_cant_connect"), Messages.getText("Error"), JOptionPane.ERROR_MESSAGE); |
|
215 |
return; |
|
216 |
} finally { |
|
217 |
((CancelTaskImpl)cancel).setCanceled(false); |
|
218 |
} |
|
219 |
|
|
220 |
DataStoreParameters parameters = explorer.getStoredParameters(); |
|
221 |
if(parameters instanceof WMTSDataParameters) { |
|
222 |
storeParams = (WMTSDataParameters) parameters; |
|
223 |
} |
|
224 |
|
|
225 |
if(parameters instanceof TileDataParameters) { |
|
226 |
DataParameters p = ((TileDataParameters) parameters).getDataParameters(); |
|
227 |
if(p instanceof WMTSDataParameters) |
|
228 |
storeParams = (WMTSDataParameters) p; |
|
229 |
} |
|
230 |
|
|
231 |
wizard.rellenarControles(); |
|
232 |
} |
|
233 |
} |
|
234 |
|
|
235 |
/** |
|
236 |
* Checks if the network and host are reachable |
|
237 |
* @return true if both are reachable and false if they are not |
|
238 |
*/ |
|
239 |
private boolean checkHostAndNetwork() { |
|
240 |
if(!explorer.isHostReachable()) { |
|
241 |
JOptionPane.showMessageDialog(null, Messages.getText("host_unreachable"), Messages.getText("Error"), JOptionPane.ERROR_MESSAGE); |
|
242 |
getIserverPanel().setTextInfo("Connection closed... \n"); |
|
243 |
return false; |
|
244 |
} |
|
245 |
return true; |
|
246 |
} |
|
247 |
|
|
248 |
/** |
|
249 |
* DOCUMENT ME! |
|
250 |
*/ |
|
251 |
private void rellenarControles() { |
|
252 |
try { |
|
253 |
String host = getIserverPanel().getTxtHost().getModel().getSelectedItem().toString(); |
|
254 |
WMTSServiceIdentification id = explorer.getOGCClient().getServiceIdentification(); |
|
255 |
|
|
256 |
getIserverPanel().setTitle(id.getTitle()); |
|
257 |
getNextPrevPanel().getJLabelServerTypeValue().setText(id.getServiceType()); |
|
258 |
getIserverPanel().setTextInfo(id.getAbstract()); |
|
259 |
|
|
260 |
getPanelPage2().setWizardData(explorer); |
|
261 |
connected = true; |
|
262 |
activarVisualizarBotones(); |
|
263 |
} catch (Exception e) { |
|
264 |
if (e.getMessage() == null) { |
|
265 |
getIserverPanel().setTextInfo(Messages.getText("error")); |
|
266 |
} else { |
|
267 |
getIserverPanel().setTextInfo(e.getMessage()); |
|
268 |
} |
|
269 |
getNextPrevPanel().getBtnNext().setEnabled(false); |
|
270 |
getNextPrevPanel().getBtnPrev().setEnabled(true); |
|
271 |
} finally { |
|
272 |
getIserverPanel().getBtnCancel().setEnabled(false); |
|
273 |
} |
|
274 |
} |
|
275 |
|
|
276 |
public void actionPerformed(ActionEvent e) { |
|
277 |
if(e.getSource() == getIserverPanel().getBtnConnect()) { |
|
278 |
getIserverPanel().getBtnCancel().setEnabled(true); |
|
279 |
getIserverPanel().setTextInfo("Trying to connect..."); |
|
280 |
|
|
281 |
String host = getIserverPanel().getTxtHost().getModel().getSelectedItem().toString(); |
|
282 |
try { |
|
283 |
DataManager datamanager = DALLocator.getDataManager(); |
|
284 |
WMTSServerExplorerParameters explorerParams = (WMTSServerExplorerParameters) datamanager.createServerExplorerParameters(WMTSServerExplorer.NAME); |
|
285 |
explorerParams.setHost(host); |
|
286 |
explorerParams.setLongitudeFirst(getIserverPanel().getChkInvertAxisOrder().isSelected()); |
|
287 |
|
|
288 |
explorer = (WMTSServerExplorer) datamanager.createServerExplorer(explorerParams); |
|
289 |
|
|
290 |
((CancelTaskImpl)cancel).setCanceled(false); |
|
291 |
new ConnectThread(cancel, explorer, this).start(); |
|
292 |
|
|
293 |
} catch (InitializeException e1) { |
|
294 |
getIserverPanel().setTextInfo("Error creating WMTS layer"); |
Also available in: Unified diff