Search in sources :

Example 1 with GridCoordinates

use of org.opengis.coverage.grid.GridCoordinates in project geotoolkit by Geomatys.

the class GetCoverageType method getSize.

/**
 * {@inheritDoc}
 */
@Override
public Dimension getSize() {
    if (domainSubset == null || domainSubset.getSpatialSubSet() == null || domainSubset.getSpatialSubSet().getGrid() == null || domainSubset.getSpatialSubSet().getGrid().getLimits() == null || domainSubset.getSpatialSubSet().getGrid().getLimits().getGridEnvelope() == null) {
        return null;
    }
    final GridEnvelopeType gridEnv = domainSubset.getSpatialSubSet().getGrid().getLimits().getGridEnvelope();
    GridCoordinates high = gridEnv.getHigh();
    if (high == null) {
        return null;
    }
    if (high.getCoordinateValues().length < 2) {
        return null;
    }
    final int width = Math.toIntExact(high.getCoordinateValue(0));
    final int height = Math.toIntExact(high.getCoordinateValue(1));
    return new Dimension(width, height);
}
Also used : GridCoordinates(org.opengis.coverage.grid.GridCoordinates) GridEnvelopeType(org.geotoolkit.gml.xml.v311.GridEnvelopeType) Dimension(java.awt.Dimension)

Aggregations

Dimension (java.awt.Dimension)1 GridEnvelopeType (org.geotoolkit.gml.xml.v311.GridEnvelopeType)1 GridCoordinates (org.opengis.coverage.grid.GridCoordinates)1