protected List<String> getOtherSRS(FeatureTypeInfo featureType) { List<String> extraSRS; if (featureType.isOverridingServiceSRS()) { extraSRS = featureType.getResponseSRS(); } else { extraSRS = wfs.getSRS(); } return extraSRS; }
public DomainType getSrsParameter(WFSInfo wfs) { List<String> extraSRS = wfs.getSRS(); Set<String> srsParameterValues; GMLInfo gml = wfs.getGML().get(WFSInfo.Version.V_20); String prefix = gml.getSrsNameStyle().getPrefix(); Function<String, String> epsgMapper = srs -> qualifySRS(prefix, srs); if (extraSRS != null && !extraSRS.isEmpty()) { srsParameterValues = extraSRS.stream() .map(epsgMapper) .collect(Collectors.toCollection(LinkedHashSet::new)); } else { srsParameterValues = new LinkedHashSet<>(); } // add values from feature types gs.getCatalog() .getFeatureTypes() .forEach( ft -> { String srs = epsgMapper.apply(ft.getSRS()); srsParameterValues.add(srs); }); // build the parameter DomainType srsParameter = new DomainType("srsName", new ArrayList<>(srsParameterValues)); return srsParameter; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (!(obj instanceof WFSInfo)) return false; final WFSInfo other = (WFSInfo) obj; if (gml == null) { if (other.getGML() != null) return false; } else if (!gml.equals(other.getGML())) return false; if (maxFeatures != other.getMaxFeatures()) return false; if (featureBounding != other.isFeatureBounding()) return false; if (canonicalSchemaLocation != other.isCanonicalSchemaLocation()) return false; if (serviceLevel == null) { if (other.getServiceLevel() != null) return false; } else if (!serviceLevel.equals(other.getServiceLevel())) return false; if (encodeFeatureMember != other.isEncodeFeatureMember()) return false; if (hitsIgnoreMaxFeatures != other.isHitsIgnoreMaxFeatures()) return false; if (srs == null) { if (other.getSRS() != null) return false; } else if (!srs.equals(other.getSRS())) return false; return true; } }
addGml(service, WFSInfo.Version.V_20, SrsNameStyle.URN2, false); if (service.getSRS() == null) { ((WFSInfoImpl) service).setSRS(new ArrayList<String>());
@Test public void testOtherSRS() throws Exception { WFSInfo wfs = getGeoServer().getService(WFSInfo.class); wfs.getSRS().add("EPSG:4326"); // this one corresponds to the native one, should not be wfs.getSRS().add("EPSG:3857"); wfs.getSRS().add("EPSG:3003"); try { getGeoServer().save(wfs); wfs.getSRS().clear(); getGeoServer().save(wfs);
@Test public void testOtherCRS() throws Exception { WFSInfo wfs = getGeoServer().getService(WFSInfo.class); wfs.getSRS().add("4326"); // this one corresponds to the native one, should not be generated wfs.getSRS().add("3857"); wfs.getSRS().add("3003"); try { getGeoServer().save(wfs); wfs.getSRS().clear(); getGeoServer().save(wfs);
@Test public void testOtherSRSSingleTypeOverride() throws Exception { WFSInfo wfs = getGeoServer().getService(WFSInfo.class); wfs.getSRS().add("4326"); // this one corresponds to the native one, should not be generated wfs.getSRS().add("3857"); wfs.getSRS().add("3003"); String polygonsName = getLayerId(MockData.POLYGONS); FeatureTypeInfo polygons = getCatalog().getFeatureTypeByName(polygonsName); polygons.getResponseSRS().add("32632"); polygons.setOverridingServiceSRS(true); try { getGeoServer().save(wfs); getCatalog().save(polygons); // check for this layer we have a different list Document doc = getAsDOM("wfs?service=WFS&version=2.0.0&request=getCapabilities"); String base = "//wfs:FeatureType[wfs:Name =\"" + polygonsName + "\"]"; XMLAssert.assertXpathExists(base, doc); assertXpathEvaluatesTo("1", "count(" + base + "/wfs:OtherCRS)", doc); XMLAssert.assertXpathExists( base + "[wfs:OtherCRS = 'urn:ogc:def:crs:EPSG::32632']", doc); } finally { wfs.getSRS().clear(); getGeoServer().save(wfs); polygons.setOverridingServiceSRS(false); polygons.getResponseSRS().clear(); getCatalog().save(polygons); } }
@Test public void testOtherSRSSingleTypeOverride() throws Exception { WFSInfo wfs = getGeoServer().getService(WFSInfo.class); wfs.getSRS().add("EPSG:4326"); // this one corresponds to the native one, should not be wfs.getSRS().add("EPSG:3857"); wfs.getSRS().add("EPSG:3003"); String polygonsName = getLayerId(MockData.POLYGONS); FeatureTypeInfo polygons = getCatalog().getFeatureTypeByName(polygonsName); base + "[wfs:OtherSRS = 'urn:x-ogc:def:crs:EPSG:32632']", doc); } finally { wfs.getSRS().clear(); getGeoServer().save(wfs); polygons.setOverridingServiceSRS(false);