Revision 4181 org.gvsig.raster.wms/trunk/org.gvsig.raster.wms/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/wmc/ImportWebMapContextExtension.java

View differences:

ImportWebMapContextExtension.java
2 2
*
3 3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4 4
* of the Valencian Government (CIT)
5
* 
5
*
6 6
* This program is free software; you can redistribute it and/or
7 7
* modify it under the terms of the GNU General Public License
8 8
* as published by the Free Software Foundation; either version 2
9 9
* of the License, or (at your option) any later version.
10
* 
10
*
11 11
* This program is distributed in the hope that it will be useful,
12 12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
* GNU General Public License for more details.
15
* 
15
*
16 16
* You should have received a copy of the GNU General Public License
17 17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
* MA  02110-1301, USA.
20
* 
20
*
21 21
*/
22
 
22

  
23 23
package org.gvsig.raster.wms.app.wmsclient.wmc;
24 24

  
25 25
import java.awt.Component;
......
160 160
			// the project.
161 161
//			dstView = ProjectFactory.createView(null);
162 162
			dstView = (DefaultViewDocument) ProjectManager.getInstance().createDocument(ViewManager.TYPENAME);
163
			
163

  
164 164
			dstView.setName(wmc.title);
165 165
			dstView.setComment("Created from WebMapContext file: " + wmcFile.getName());
166 166

  
......
181 181
			if (wmc.layerList.get(i) instanceof FLyrWMS) {
182 182
				FLyrWMS layer = wmc.layerList.get(i);
183 183
				WMSDataParameters params = wmc.paramsList.get(i);
184
				
184

  
185 185
				DataManager datamanager = DALLocator.getDataManager();
186
				
186

  
187 187
				/*
188 188
				 * will connect to get the online resources defined by
189 189
				 * server, because WMC only defines the original URL for
......
191 191
				 */
192 192
				try {
193 193
					WMSServerExplorerParameters explorerParams = (WMSServerExplorerParameters) datamanager.createServerExplorerParameters(WMSServerExplorer.NAME);
194
					explorerParams.setHost(params.getURI());
195
					
194
					explorerParams.setHost(params.getURI().getPath());
195

  
196 196
					WMSServerExplorer explorer = (WMSServerExplorer) datamanager.createServerExplorer(explorerParams);
197
					
197

  
198 198
					layer.setExplorer(explorer);
199 199
					params.setOverrideHost(false);
200 200
					explorer.connect(null, true);
201
					
201

  
202 202
					params.setOnlineResources(explorer.getOnlineResources());
203 203
					layer.setParameters(params);
204
					
204

  
205 205
					Rectangle2D rec = wmc.bBox;
206 206
					Envelope envelope = GeometryLocator.getGeometryManager().createEnvelope(rec.getX(),rec.getY(),rec.getMaxX(),rec.getMaxY(), Geometry.SUBTYPES.GEOM2D);
207 207
					dstView.getMapContext().getViewPort().setEnvelope(envelope);
......
211 211
					" ["+new Date(System.currentTimeMillis()).toString()+"]",
212 212
					e);
213 213
				}
214
				
214

  
215 215
				dstView.getMapContext().getLayers().addLayer(layer);
216 216
			}
217 217
		}

Also available in: Unified diff