"InvalidPoint"); request.setXPixel(x); request.setYPixel(y); } catch (NumberFormatException ex) {
@Test public void testWMSGetFeatureInfo() throws Exception { GetFeatureInfoRequest gfi = new GetFeatureInfoRequest(); GetMapRequest gm = new GetMapRequest(); gm.setHeight(330); gm.setWidth(780); Envelope env = new ReferencedEnvelope(-126.81851,-115.818992,44.852958,49.5066,null); CoordinateReferenceSystem crs = CRS.decode("EPSG:4326",true); CoordinateReferenceSystem logCrs = CRS.decode("EPSG:4326",false); gm.setBbox(env); gm.setCrs(crs); gfi.setGetMapRequest(gm); gfi.setXPixel(260); gfi.setYPixel(63); gfi.setVersion("1.1.1"); gfi.setQueryLayers(Arrays.asList(createMapLayer("foo", "acme"), createMapLayer("bar", "acme"))); callback.operationDispatched(new Request(), op("GetFeatureInfo", "WMS", "1.1.1", gfi)); assertEquals("acme:foo", data.getResources().get(0)); assertEquals("acme:bar", data.getResources().get(1)); BBoxAsserts.assertEqualsBbox(new ReferencedEnvelope(48.62,48.62,-123.15,-123.15,logCrs),data.getBbox(), 0.01); }
@Test public void testWMSGetFeatureInfo() throws Exception { GetFeatureInfoRequest gfi = new GetFeatureInfoRequest(); GetMapRequest gm = new GetMapRequest(); gm.setHeight(330); gm.setWidth(780); Envelope env = new ReferencedEnvelope(-126.81851, -115.818992, 44.852958, 49.5066, null); CoordinateReferenceSystem crs = CRS.decode("EPSG:4326", true); CoordinateReferenceSystem logCrs = CRS.decode("EPSG:4326", false); gm.setBbox(env); gm.setCrs(crs); gfi.setGetMapRequest(gm); gfi.setXPixel(260); gfi.setYPixel(63); gfi.setVersion("1.1.1"); gfi.setQueryLayers( Arrays.asList(createMapLayer("foo", "acme"), createMapLayer("bar", "acme"))); callback.operationDispatched(new Request(), op("GetFeatureInfo", "WMS", "1.1.1", gfi)); assertEquals("acme:foo", data.getResources().get(0)); assertEquals("acme:bar", data.getResources().get(1)); BBoxAsserts.assertEqualsBbox( new ReferencedEnvelope(48.62, 48.62, -123.15, -123.15, logCrs), data.getBbox(), 0.01); }
gm.setCrs(crs); gfi.setGetMapRequest(gm); gfi.setXPixel(259); gfi.setYPixel(241); gfi.setVersion("1.1.1");
/** Test hitArea does not overflow out of painted area. */ @Test public void testHitAreaSize() throws Exception { GetFeatureInfoRequest request = new GetFeatureInfoRequest(); GetMapRequest getMapRequest = new GetMapRequest(); List<MapLayerInfo> layers = new ArrayList<>(); layers.add(new MapLayerInfo(getCatalog().getLayerByName(MockData.BRIDGES.getLocalPart()))); getMapRequest.setLayers(layers); getMapRequest.setSRS("EPSG:4326"); getMapRequest.setBbox(new Envelope(0.0001955, 0.0002035, 0.000696, 0.000704)); getMapRequest.setWidth(100); getMapRequest.setHeight(100); getMapRequest.setFormat("image/png"); request.setGetMapRequest(getMapRequest); request.setQueryLayers(layers); // point is almost centered, but on the other side of the middle point request.setXPixel(45); request.setYPixel(45); FeatureInfoRequestParameters params = new FeatureInfoRequestParameters(request); VectorRenderingLayerIdentifier vrli = new VectorRenderingLayerIdentifier(getWMS(), null); assertEquals(0, vrli.identify(params, 10).size()); }
gm.setCrs(crs); gfi.setGetMapRequest(gm); gfi.setXPixel(259); gfi.setYPixel(241); gfi.setVersion("1.1.1");