Search in sources :

Example 11 with SingleCRS

use of org.opengis.referencing.crs.SingleCRS 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

SingleCRS (org.opengis.referencing.crs.SingleCRS)11 DefaultGeographicBoundingBox (org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox)3 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)3 TransformException (org.opengis.referencing.operation.TransformException)3 DefaultVerticalExtent (org.apache.sis.metadata.iso.extent.DefaultVerticalExtent)2 DefaultTemporalCRS (org.apache.sis.referencing.crs.DefaultTemporalCRS)2 Test (org.junit.Test)2 GeographicBoundingBox (org.opengis.metadata.extent.GeographicBoundingBox)2 GeographicCRS (org.opengis.referencing.crs.GeographicCRS)2 TemporalCRS (org.opengis.referencing.crs.TemporalCRS)2 VerticalCRS (org.opengis.referencing.crs.VerticalCRS)2 GeodeticDatum (org.opengis.referencing.datum.GeodeticDatum)2 Angle (javax.measure.quantity.Angle)1 ValidationException (javax.xml.bind.ValidationException)1 GeneralEnvelope (org.apache.sis.geometry.GeneralEnvelope)1 Convention (org.apache.sis.io.wkt.Convention)1 DefaultTemporalExtent (org.apache.sis.metadata.iso.extent.DefaultTemporalExtent)1 DefaultGeographicCRS (org.apache.sis.referencing.crs.DefaultGeographicCRS)1 DefaultProjectedCRS (org.apache.sis.referencing.crs.DefaultProjectedCRS)1 DependsOnMethod (org.apache.sis.test.DependsOnMethod)1