Package org.opengis.referencing.operation

Examples of org.opengis.referencing.operation.TransformException


       
        if (gridShift == null) { // Create grid when first needed.
            try {
                gridShift = FACTORY.createNTv2Grid(gridLocation);
            } catch (FactoryException e) {
                throw new TransformException("NTv2 Grid " + gridLocation +
                        " Could not be created", e);
            }
        }
       
        try {
            GridShift shift = new GridShift();
            while(--numPts >= 0) {
                shift.setLonPositiveEastDegrees(srcPts[srcOff++]);
                shift.setLatDegrees(srcPts[srcOff++]);
                if (forward) {
                    shifted = gridShift.gridShiftForward(shift);
                } else {
                    shifted = gridShift.gridShiftReverse(shift);
                }
                if (shifted) {
                    dstPts[dstOff++]=shift.getShiftedLonPositiveEastDegrees();
                    dstPts[dstOff++]=shift.getShiftedLatDegrees();
                } else {
                    if(LOGGER.isLoggable(Level.FINE)) {
                        LOGGER.log(Level.FINE, "Point (" + srcPts[srcOff-2] + ", " + srcPts[srcOff-1] +
                                ") is not covered by '" + this.grid + "' NTv2 grid," +
                        " it will not be shifted.");
                    }
                    dstPts[dstOff++]=srcPts[srcOff-2];
                    dstPts[dstOff++]=srcPts[srcOff-1];
                }
            }
        } catch (IOException e) {
            throw new TransformException(e.getLocalizedMessage(), e);
        }
    }
View Full Code Here


                    inverseTransform(source, target);
                }
                return;
            }
        } catch (NoninvertibleTransformException exception) {
            final TransformException e;
            e = new TransformException(Errors.format(ErrorKeys.NONINVERTIBLE_TRANSFORM));
            e.initCause(exception);
            throw e;
        }
        throw new TransformException(Errors.format(ErrorKeys.NO_CONVERGENCE));
    }
View Full Code Here

                                               range.getMinValue(), range.getMaxValue()));
        }
        /*
         * Now initialize the geophysics category.
         */
        TransformException cause = null;
        try {
            if (sampleToGeophysics == null) {
                inverse = new GeophysicsCategory(this, false);
                transform = createLinearTransform(0, inverse.minimum); // sample to geophysics
                return;
View Full Code Here

                    final CoordinateOperationFactory factory = getCoordinateOperationFactory(true);
                    final CoordinateOperation operation;
                    try {
                        operation = factory.createOperation(sourceCRS, targetCRS);
                    } catch (FactoryException exception) {
                        throw new TransformException(Errors.format(
                                ErrorKeys.CANT_TRANSFORM_ENVELOPE), exception);
                    }
                    if (!operation.getMathTransform().isIdentity()) {
                        envelope = transform(operation, envelope);
                    } else if(!equalsIgnoreMetadata(envelope.getCoordinateReferenceSystem(), targetCRS)) {
View Full Code Here

        if (!(value >= category.minimum  &&  value <= category.maximum) &&
             Double.doubleToRawLongBits(value) != Double.doubleToRawLongBits(category.minimum))
        {
            category = getCategory(value);
            if (category == null) {
                throw new TransformException(Errors.format(ErrorKeys.NO_CATEGORY_FOR_VALUE_$1, value));
            }
            last = category;
        }
        return category.transform.derivative(value);
    }
View Full Code Here

        if (!(value >= category.minimum  &&  value <= category.maximum) &&
             Double.doubleToRawLongBits(value) != Double.doubleToRawLongBits(category.minimum))
        {
            category = getCategory(value);
            if (category == null) {
                throw new TransformException(Errors.format(ErrorKeys.NO_CATEGORY_FOR_VALUE_$1, value));
            }
            last = category;
        }
        value = category.transform.transform(value);
        if (overflowFallback != null) {
View Full Code Here

            if (numPts < 0) {
                break;
            }
            category = getCategory(value);
            if (category == null) {
                throw new TransformException(Errors.format(ErrorKeys.NO_CATEGORY_FOR_VALUE_$1, value));
            }
            maximum = category.maximum;
            minimum = category.minimum;
            rawBits = Double.doubleToRawLongBits(minimum);
            srcOff  = peekOff;
View Full Code Here

        }
        allSteps2D = toMathTransform2D(allSteps, mtFactory, targetGG);
        if (!(allSteps2D instanceof MathTransform2D)) {
            // Should not happen with Geotools implementations. May happen
            // with some external implementations, but should stay unusual.
            throw new TransformException(Errors.format(ErrorKeys.NO_TRANSFORM2D_AVAILABLE));
        }

        ////////////////////////////////////////////////////////////////////////////////////////
        ////                                                                                ////
        ////            STEP 1: Extracts needed informations from the parameters            ////
View Full Code Here

            CoordinateOperation coordOp = cof.createOperation(oldCRS, newCRS);
            MathTransform mt = coordOp.getMathTransform();
            return transform(newCRS, mt);
        }
        catch (OperationNotFoundException e) {
            throw new TransformException("Unable to find an operation", e);
        }
        catch (FactoryException e) {
            throw new TransformException("Factory exception", e);
        }
    }
View Full Code Here

            // Use '!' for catching NaN.
            if (!(Math.abs(transformedSource.getOrdinate(i) -
                              targetPosition.getOrdinate(i))
                  <= tolerance[Math.min(i, tolerance.length-1)]))
            {
                throw new TransformException("Expected " + targetPosition + " but got " + transformedSource);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.opengis.referencing.operation.TransformException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.