01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library 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 GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.data.wms.test;
17:
18: import java.io.File;
19: import java.net.URL;
20:
21: import junit.framework.TestCase;
22:
23: import org.geotools.data.ows.Layer;
24: import org.geotools.data.wms.WebMapServer;
25: import org.geotools.geometry.GeneralDirectPosition;
26: import org.geotools.referencing.CRS;
27: import org.geotools.test.TestData;
28: import org.opengis.referencing.crs.CoordinateReferenceSystem;
29: import org.opengis.referencing.operation.MathTransform;
30: import org.opengis.geometry.DirectPosition;
31: import org.opengis.geometry.Envelope;
32:
33: /**
34: *
35: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/wms/src/test/java/org/geotools/data/wms/test/Geot553Test.java $
36: */
37: public class Geot553Test extends TestCase {
38:
39: public void testGeot553() throws Exception {
40: //-247941.17083210908,5334613.737657672,-194536.86526633866,5359024.191696413
41: double minx = -247941.17083210908;
42: double miny = 5334613.737657672;
43: double maxx = -194536.86526633866;
44: double maxy = 5359024.191696413;
45:
46: CoordinateReferenceSystem epsg26591 = CRS.decode("EPSG:26591");
47: CoordinateReferenceSystem epsg4326 = CRS.decode("EPSG:4326");
48:
49: MathTransform transform = CRS.findMathTransform(epsg26591,
50: epsg4326, true);
51: DirectPosition min = transform.transform(
52: new GeneralDirectPosition(minx, miny), null);
53: DirectPosition max = transform.transform(
54: new GeneralDirectPosition(maxx, maxy), null);
55: System.out.println(min);
56: System.out.println(max);
57:
58: File getCaps = TestData.file(this , "geot553capabilities.xml");
59:
60: URL getCapsURL = TestData.getResource(this ,
61: "geot553capabilities.xml");
62:
63: WebMapServer wms = new WebMapServer(getCapsURL);
64: Layer layer = wms.getCapabilities().getLayer().getChildren()[2];
65:
66: Envelope env = wms.getEnvelope(layer, CRS.decode("EPSG:3005"));
67:
68: assertNotNull(env);
69: }
70: }
|