Implementing ICoordinateSystemChooserService

This class will be the one that instantiates your implementation of ICoordinateSystemChooser. You have a couple of options here. First, you can simply instantiate your ICoordinateSystemChooser. Alternatively, you could ask the user if they wish to use one of your specific coordinate systems, or the built in INTViewer ones.

There are two methods that you must implement:

public ICoordinateSystemChooser createChooser(String epsgCode, int i);
public ICoordinateSystemChooser createAliasChooser(String wkt, int displayMode);

The createChooser method is the one that will be creating your ICoordinateSystemChooser. If you wish to allow the user to select between your implementation or INTViewer's implementation the following code can be used:

    @Override
    public ICoordinateSystemChooser createChooser(String epsgCode, int displayMode) {
        int confirm = DialogManager.getDefault().showConfirmDialog("Do you want to use a company specific CRS ?", "Choose CRS",
                DialogManager.YES_NO_CANCEL_OPTION);
       
        if (confirm == DialogManager.YES_OPTION) {
            return new MyCoordinateSystemChooser();
        } else if (confirm == DialogManager.NO_OPTION) {
            GisCoordinateSystemChooserService gisCoordinateSystemChooserService =
                    new com.interactive.intviewer.gislib.crs.GisCoordinateSystemChooserService();
           
            return gisCoordinateSystemChooserService.createChooser(epsgCode, displayMode);
        } else {
            throw new CancellationException();
        }
    }

The getCoordinateSystemName method is pretty self explanatory.

The addAliasEPSGCode and getAliasEPSGCode methods are used to add and get code aliases given the epsg code.