/** * Register a {@link Registry} in this {@code RegistryManager}. * @param registryClass */ public void addRegistry(Registry registryClass) { addRegistry(registryClass, false); }
/** * Informs listeners that a registry has been added. * * @param registryName name of the registry */ private void fireRegistryAdded(String registryName) { for (RegistryManagerListener listener : listeners) { listener.registryAdded(registryName); } }
/** * 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(); }
/** * Return the registry name and the code in a string array. * * @param authorityAndSrid a string following the pattern "name:code" * @return an array of two strings (ex. {"EPSG", "4326"}) * @throws RegistryException */ public String[] splitRegistryNameAndCode(String authorityAndSrid) throws RegistryException { String[] registryAndCode = authorityAndSrid.split(":"); if (registryAndCode.length == 2) { return registryAndCode; } else { throw new RegistryException("The registry pattern '" + authorityAndSrid + "' is not supported"); } }
public CoordinateReferenceSystem getCoordinateReferenceSystem(Identifier identifier) throws RegistryException, CRSException { Map<String,String> params = getParameters(identifier.getAuthorityKey()); if (!identifier.getAuthorityName().equalsIgnoreCase(getRegistryName())) { throw new RegistryException("CRS code '" + identifier.getCode() + "' does not match this registry name : " + getRegistryName()); } if (params == null) { throw new CRSException("Registry '" + getRegistryName() + "' contains no parameter for " + identifier); } // try to set a name from params to the identifier if identifier name is empty if (identifier.getName() == null || identifier.getName().isEmpty()) { String title = params.get(ProjKeyParameters.title); if (title != null && !title.isEmpty()) { identifier = new Identifier(identifier.getAuthorityName(), identifier.getAuthorityKey(), title); } } return CRSHelper.createCoordinateReferenceSystem(identifier, params); }
/** * 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()); }
/** * Gets all registered registry names * The returned array contains a case-sensitive version of registry names. * * @return an array of names */ public String[] getRegistryNames() { LOGGER.trace("Getting all registry names"); List<String> names = new ArrayList<String>(); for (Registry r : registries.values()) { names.add(r.getRegistryName()); } return names.toArray(new String[names.size()]); }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(ESRI_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the ESRI registry", ex); } } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(NAD83_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the NAD83 registry", ex); } } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, IGNF_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the IGNF registry", ex); } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(WORLD_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the world registry", ex); } } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(EPSG_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the EPSG registry", ex); } } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, NAD83_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the NAD83 registry", ex); } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(IGNF_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the IGNF registry", ex); } } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, NAD27_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the NAD27 registry", ex); } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(NAD27_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the NAD27 registry", ex); } } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, ESRI_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the ESRI registry", ex); } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, WORLD_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the world registry", ex); } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, EPSG_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the EPSG registry", ex); } }