/** * Register a {@link Registry} in this {@code RegistryManager}. * @param registryClass */ public void addRegistry(Registry registryClass) { addRegistry(registryClass, false); }
/** * Check if the registry name (ie EPSG, IGNF...) is supported. * * @param registryName (ex : ESPG, IGNF, ESRI) */ public boolean isRegistrySupported(String registryName) throws RegistryException { if (getRegistryManager().contains(registryName.toLowerCase())) { return true; } else { throw new RegistryException("Registry '" + registryName + "' is not supported"); } }
/** * Register a {@link Registry} in this {@code RegistryManager}. * An existing registry can be replaced by a new one. * Registries are stored in a case-insensitive map (keys are uppercase) * * @param registry the Registry to add * @param replace whether an existing Registry with the same name should be * replaced or not. */ public void addRegistry(Registry registry, boolean replace) { LOGGER.trace("Adding a new registry " + registry.getRegistryName()); String registryName = registry.getRegistryName().toUpperCase(); if (!replace && registries.containsKey(registryName)) { throw new IllegalArgumentException("Registry " + registryName + " already exists"); } registries.put(registryName, registry); fireRegistryAdded(registry.getRegistryName()); }
/** * Return a list of supported codes according an registryName. * * @param registryName (ex : EPSG, IGNF, ESRI) */ public Set<String> getSupportedCodes(String registryName) throws RegistryException { return getRegistryManager().getRegistry(registryName).getSupportedCodes(); }
/** * Returns a {@link org.cts.crs.CoordinateReferenceSystem} corresponding to * an authority and a srid. * * @param authorityAndSrid the code of the desired CRS (for instance * EPSG:4326 or IGNF:LAMBE) * @return * @throws CRSException */ public CoordinateReferenceSystem getCRS(String authorityAndSrid) throws CRSException { CoordinateReferenceSystem crs = CRSPOOL.get(authorityAndSrid.toUpperCase()); if (crs == null) { try { String[] registryNameWithCode = splitRegistryNameAndCode(authorityAndSrid); String authority = registryNameWithCode[0]; String code = registryNameWithCode[1]; if (isRegistrySupported(authority)) { Registry registry = getRegistryManager().getRegistry(authority); crs = registry.getCoordinateReferenceSystem(new Identifier(authority, code, "")); if (crs != null) { CRSPOOL.put(authorityAndSrid.toUpperCase(), crs); } } } catch (RegistryException ex) { throw new CRSException("Cannot create the CRS", ex); } } return crs; }
crsf.getRegistryManager().addRegistry(srr);
crsf.getRegistryManager().addRegistry(srr);
crsf.getRegistryManager().addRegistry(srr);
crsf.getRegistryManager().addRegistry(srr);
crsf.getRegistryManager().addRegistry(srr);
crsf.getRegistryManager().addRegistry(srr);
crsf.getRegistryManager().addRegistry(srr);