Example usage for java.awt.image RenderedImage getTileGridYOffset

List of usage examples for java.awt.image RenderedImage getTileGridYOffset

Introduction

In this page you can find the example usage for java.awt.image RenderedImage getTileGridYOffset.

Prototype

int getTileGridYOffset();

Source Link

Document

Returns the Y offset of the tile grid relative to the origin, i.e., the Y coordinate of the upper-left pixel of tile (0, 0).

Usage

From source file:it.geosolutions.geobatch.destination.vulnerability.VulnerabilityComputation.java

/**
 * This method calculates the vulnerability for the levels 1 and 2
 * /*from  w ww . j  a  va 2  s .co  m*/
 * @param currentImage
 * @param currentBPT
 * @param keySet
 * @param targetID
 * @param minTileX
 * @param maxTileX
 * @param minTileY
 * @param maxTileY
 * @param skipArcs
 * @param xStart
 * @param yStart
 * @param xStop
 * @param yStop
 * @param idStart
 * @param bbox
 * @param outFeatureName
 * @param trace
 * @param vse
 * @param statsMap
 * @param transaction
 * @param vulnerabilityObj
 * @param concreteOperation
 * @param monitor
 * @param inputFeature
 * @param allDistances
 * @param reportingLoopStep
 * @param geoName
 * @param total
 * @throws NoninvertibleTransformException
 * @throws TransformException
 * @throws IOException
 */
private void vulnerabilityLevel12(RenderedImage currentImage, Map<Integer, TargetInfo> currentBPT,
        String targetID, int minTileX, int maxTileX, int minTileY, int maxTileY, boolean skipArcs,
        Integer xStart, Integer yStart, Integer xStop, Integer yStop, String idStart, Envelope2D bbox,
        String outFeatureName, int trace, VulnerabilityStatsEngine vse, Transaction transaction,
        OutputObject vulnerabilityObj, VulnerabilityOperation concreteOperation, VulnerabilityMonitor monitor,
        List<Double> allDistances, int reportingLoopStep, String geoName,
        ConcurrentSkipListSet<BigDecimal> arcIdsSet)
        throws NoninvertibleTransformException, TransformException, IOException {

    // Preliminary checks
    if (minTileX > maxTileX) {
        int temp = minTileX;
        minTileX = maxTileX;
        maxTileX = temp;
    }
    if (minTileY > maxTileY) {
        int temp = minTileY;
        minTileY = maxTileY;
        maxTileY = temp;
    }

    // Load the Transformation associated with the selected
    // target and calculate the inverse
    TargetInfo firstInfo = currentBPT.get(0);
    MathTransform w2g = firstInfo.getGG2D().getCRSToGrid2D(PixelOrientation.UPPER_LEFT);
    MathTransform g2w = w2g.inverse();
    // Load the target dimensions for modifying the spatial
    // filter

    // Definition of the dimensions associated to the input image
    int tileWidth = currentImage.getTileWidth();
    int tileHeight = currentImage.getTileHeight();
    int tileGridX = currentImage.getTileGridXOffset();
    int tileGridY = currentImage.getTileGridYOffset();
    // Variables used for mapping the tile in the model space

    // Iteration on image tiles
    for (int x = minTileX; x < maxTileX; x++) {

        // For each tile, the points are transformed in the
        // world crs
        int minX = PlanarImage.tileXToX(x, tileGridX, tileWidth);

        if (xStart != null && xStart > x) {
            continue;
        }

        if (xStop != null && xStop < x) {
            continue;
        }

        for (int y = minTileY; y < maxTileY; y++) {

            int minY = PlanarImage.tileYToY(y, tileGridY, tileHeight);

            if (yStart != null && yStart > y) {
                continue;
            }

            if (yStop != null && yStop < y) {
                continue;
            }

            Envelope2D worldEnvelope = calculateWorldEnvelope(minX, minY, tileWidth, tileHeight, g2w);
            calculateTile(worldEnvelope, bbox, x, y, xStart, yStart, idStart, concreteOperation, monitor,
                    arcIdsSet, vse, currentBPT, allDistances, currentImage, targetID, outFeatureName,
                    vulnerabilityObj);
        }
    }

}