Coordinate System Chooser Service Extension

INTViewer provides a mechanism to allow users to select a coordinate reference system.

The ICoordinateSystemChooserService and ICoordinateSystemChooser interfaces must be implemented to add a CoordinateSystemChooserService. Implementations of ICoordinateSystemChooserService provide a factory method to create ICoordinateSystemChooser instances and also let the platform know how to map epsg codes to coordinate system names. Implementations of ICoordinateSystemChooser describe how a coordinate system is choosen.

public class GisCoordinateSystemChooserService implements ICoordinateSystemChooserService {
    @Override
    public ICoordinateSystemChooser createChooser(String epsgCode) {
        return new GisCoordinateSystemChooser(epsgCode);
    }
    @Override
    public String getCoordinateSystemName(String epsgCode) {
        String name = ...
        if (name == null)
           name = "Unknown epsgCode (" + epsgCode + ");
        return name;
    }
}
public class GisCoordinateSystemChooser implements ICoordinateSystemChooser {
    private final String epsgCode;
    public GisCoordinateSystemChooser(String epsgCode) {
        this.epsgCode = epsgCode;
    }
    @Override
    public void display(final ICoordinateSystemSelectionListener l) {
        String epsgCode = ...
        if (epsgCode != null) // user selected a epsgCode
            l.coordinateSystemSelected(epsgCode);
    }
}
public void addAliasEPSGCode(String uniqueProjectionName, String aliasEPSGCode, cgRect areaOfUse) {
    // ignored
}
public String getAliasEPSGCode(String uniqueProjectionName, cgRect areaOfUse) {
    // ignored
}

To register a coordinate system chooser service add the following to the layer.xml of the plugin that will provide the service.

<folder name="CoordinateSystemChooserService">
    <file name="com-interactive-gis-plugins-GisCoordinateSystemChooserService.instance"/>
</folder>