Search in sources :

Example 1 with DefaultGeodeticDatum

use of org.geotools.referencing.datum.DefaultGeodeticDatum in project hale by halestudio.

the class SelectCRSDialog method updateMessage.

/**
 * Update the dialog message
 */
private void updateMessage() {
    if (radioCRS.getSelection()) {
        if (wktWarning != null) {
            wktWarning.setVisible(false);
        }
        updateMessage(crsField);
    } else {
        if (wktField.isValid()) {
            setErrorMessage(null);
            CoordinateReferenceSystem wktCrs = wktField.getCRSDefinition().getCRS();
            boolean bursaWolfApplicable = false;
            boolean bursaWolfAvailable = false;
            if (wktCrs instanceof SingleCRS && ((SingleCRS) wktCrs).getDatum() instanceof DefaultGeodeticDatum) {
                // Check for Bursa-Wolf parameters
                bursaWolfApplicable = true;
                DefaultGeodeticDatum datum = (DefaultGeodeticDatum) ((SingleCRS) wktCrs).getDatum();
                bursaWolfAvailable = datum.getBursaWolfParameters().length > 0;
            }
            boolean showWktWarning = bursaWolfApplicable && !bursaWolfAvailable;
            setMessage(wktField.getCRSDefinition().getCRS().getName().toString(), showWktWarning ? IMessageProvider.WARNING : IMessageProvider.INFORMATION);
            if (wktWarning != null) {
                wktWarning.setVisible(showWktWarning);
            }
        } else {
            setErrorMessage(wktField.getErrorMessage());
            setMessage(DEF_MESSAGE, IMessageProvider.INFORMATION);
            wktWarning.setVisible(false);
        }
    }
}
Also used : SingleCRS(org.opengis.referencing.crs.SingleCRS) DefaultGeodeticDatum(org.geotools.referencing.datum.DefaultGeodeticDatum) CoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem)

Aggregations

DefaultGeodeticDatum (org.geotools.referencing.datum.DefaultGeodeticDatum)1 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)1 SingleCRS (org.opengis.referencing.crs.SingleCRS)1