Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public String[] listSubNames() {
    throw new UnsupportedOperationException("Unsupported operation.");
}

public int getGridCoverageCount() {
    throw new UnsupportedOperationException("Unsupported operation.");
}

public final GeneralEnvelope getOriginalEnvelope() {
    ...
    return originalEnvelope;
 }

public final GridEnvelope getOriginalGridRange() {
    ...
    return originalGridRange; 
}

public final MathTransform getOriginalGridToWorld(final PixelInCell pixInCell) {
    ...
    return mathTransform;
}

public String[] getMetadataNames() {
    ...
    return metadataNames;
}

public String getMetadataValue(final String name) {
    ...
    return metadataValue;
}
  

AFTER:

Code Block
/**
 * @deprecated use {@link #getGridCoverageNames()}
 */
public String[] listSubNames() {
    return getGridCoverageNames();
}

public String[] getGridCoverageNames() {
    return coverageNames;
}

public int getGridCoverageCount() {
    return coveragesNumber;
} 

public final GeneralEnvelope getOriginalEnvelope() {
    if (coveragesNumber > 1) {
        throw new IllegalArgumentException("You must specify a coverage name");
    } else { 
        // Backward compatibility
        ...
        return originalEnvelope;
    }
}
 
/**
 * Get the envelope of the specified coverage 
 */
public final GeneralEnvelope getOriginalEnvelope(final String coverageName) {
    ...
}

public final GridEnvelope getOriginalGridRange() {
    if (coveragesNumber > 1) {
        throw new IllegalArgumentException("You must specify a coverage name");
    } else { 
        // Backward compatibility
        ...
        return originalGridRange; 
    }
}

/**
 * Get the gridRange of the specified coverage 
 */
public final GridEnvelope getOriginalGridRange(final String coverageName) {
    ...
}

public final MathTransform getOriginalGridToWorld(final PixelInCell pixInCell) {
    if (coveragesNumber > 1) {
        throw new IllegalArgumentException("You must specify a coverage name");
    } else { 
        // Backward compatibility
        ...
        return mathTransform;
    }
}

/**
 * Get the grid to world transformation of the specified coverage 
 */
public final MathTransform getOriginalGridToWorld(final String coverageName, final PixelInCell pixInCell) {
    ...
}

public String[] getMetadataNames() {
    if (coveragesNumber > 1) {
        throw new IllegalArgumentException("You must specify a coverage name");
    } else { 
        // Backward compatibility
        ...
        return metadataNames;
    }
}

/**
 *  Get the metadata names of the specified coverage
 */
public String[] getMetadataNames(final String coverageName) {
    ...
}

public String[] getMetadataValue(final String name) {
    if (coveragesNumber > 1) {
        throw new IllegalArgumentException("You must specify a coverage name");
    } else { 
        // Backward compatibility
        ...
        return metadataValue;;
    }
}

/**
 *  Get the metadata value related to the specified metadataName for the specified coverage
 */
public String[] getMetadataValue(final String coverageName, final String name) {
    ...
}

Code Examples

BEFORE:

Code Block
/** Sample code usage */
public void testSingleCoverageReader() {
    ...
    AbstractGridCoverage2DReader reader = ...; // Creating a reader

    // Getting the coverage's properties
    final GeneralEnvelope envelope = reader.getOriginalEnvelope();
    final GridEnvelope gridRange = reader.getOriginalGridRange();    
    ...

    // reading the coverage
    GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
    ...
}
 

...