Package org.opengis.referencing

Examples of org.opengis.referencing.FactoryException


        filter.addTargetDimension(sourceGG.axisDimensionY);
        candidate = filter.separate(transform);
        if (candidate instanceof MathTransform2D) {
            return (MathTransform2D) candidate;
        }
        throw new FactoryException(Errors.format(ErrorKeys.NO_TRANSFORM2D_AVAILABLE));
    }
View Full Code Here


//                return warp;
//            }
//            // The loop below intentionally tries one more iteration than the constant in case we need
//            // to apply slightly more than the above scale and translation because of rounding errors.
        } while (step++ <= EMPIRICAL_ADJUSTMENT_STEPS);
        throw new FactoryException(Errors.format(ErrorKeys.CANT_REPROJECT_$1, name));
    }
View Full Code Here

            return (AbstractAuthorityFactory) candidate;
        }
        if (caller == null) {
            return null;
        }
        throw new FactoryException(Errors.format(
                    ErrorKeys.GEOTOOLS_EXTENSION_REQUIRED_$1, caller));
    }
View Full Code Here

                if (grid != null) {
                    gridCache.put(key, grid); // - Cache
                    return grid; // - Return
                }
            }
            throw new FactoryException("NTv2 Grid " + latGridURL + ", " + longGridURL
                    + " could not be created.");
        }
    }
View Full Code Here

                return loadBinaryGrid(latGridURL, longGridURL);
            } else if ((latGridName.endsWith(".laa") && longGridName.endsWith(".loa"))
                    || (latGridName.endsWith(".LAA") && longGridName.endsWith(".LOA"))) {
                return loadTextGrid(latGridURL, longGridURL);
            } else {
                throw new FactoryException(Errors.format(ErrorKeys.UNSUPPORTED_FILE_TYPE_$2,
                        latGridName.substring(latGridName.lastIndexOf('.') + 1),
                        longGridName.substring(longGridName.lastIndexOf('.') + 1)));
                // Note: the +1 above hide the dot, but also make sure that the code is
                // valid even if the path do not contains '.' at all (-1 + 1 == 0).
            }
        } catch (IOException exception) {
            final Throwable cause = exception.getCause();
            if (cause instanceof FactoryException) {
                throw (FactoryException) cause;
            }
            throw new FactoryException(exception.getLocalizedMessage(), exception);
        }
    }
View Full Code Here

          // check that latitude grid header is the same as for latitude grid
          if ((nc != longBuffer.getInt()) || (nr != longBuffer.getInt())
                  || (nz != longBuffer.getInt()) || (xmin != longBuffer.getFloat())
                  || (dx != longBuffer.getFloat()) || (ymin != longBuffer.getFloat())
                  || (dy != longBuffer.getFloat()) || (angle != longBuffer.getFloat())) {
              throw new FactoryException(Errors.format(ErrorKeys.GRID_LOCATIONS_UNEQUAL));
          }
 
          // //////////////////////
          // read grid shift data into LocalizationGrid
          // //////////////////////
View Full Code Here

        latLine = latBr.readLine(); // skip header description
        latLine = latBr.readLine();
        latSt = new StringTokenizer(latLine, " ");

        if (latSt.countTokens() != 8) {
            throw new FactoryException(Errors.format(ErrorKeys.HEADER_UNEXPECTED_LENGTH_$1,
                    String.valueOf(latSt.countTokens())));
        }

        int nc = Integer.parseInt(latSt.nextToken());
        int nr = Integer.parseInt(latSt.nextToken());
        int nz = Integer.parseInt(latSt.nextToken());

        float xmin = Float.parseFloat(latSt.nextToken());
        float dx = Float.parseFloat(latSt.nextToken());
        float ymin = Float.parseFloat(latSt.nextToken());
        float dy = Float.parseFloat(latSt.nextToken());

        float angle = Float.parseFloat(latSt.nextToken());
        float xmax = xmin + ((nc - 1) * dx);
        float ymax = ymin + ((nr - 1) * dy);

        // now read long shift grid
        longLine = longBr.readLine(); // skip header description
        longLine = longBr.readLine();
        longSt = new StringTokenizer(longLine, " ");

        if (longSt.countTokens() != 8) {
            throw new FactoryException(Errors.format(ErrorKeys.HEADER_UNEXPECTED_LENGTH_$1,
                    String.valueOf(longSt.countTokens())));
        }

        // check that latitude grid header is the same as for latitude grid
        if ((nc != Integer.parseInt(longSt.nextToken()))
                || (nr != Integer.parseInt(longSt.nextToken()))
                || (nz != Integer.parseInt(longSt.nextToken()))
                || (xmin != Float.parseFloat(longSt.nextToken()))
                || (dx != Float.parseFloat(longSt.nextToken()))
                || (ymin != Float.parseFloat(longSt.nextToken()))
                || (dy != Float.parseFloat(longSt.nextToken()))
                || (angle != Float.parseFloat(longSt.nextToken()))) {
            throw new FactoryException(Errors.format(ErrorKeys.GRID_LOCATIONS_UNEQUAL));
        }

        // //////////////////////
        // read grid shift data into LocalizationGrid
        // //////////////////////
View Full Code Here

     * @return the grid
     * @throws FactoryException if grid cannot be created
     */
    public GridShiftFile createNTv2Grid(URL gridLocation) throws FactoryException {
        if(gridLocation == null) {
            throw new FactoryException("The grid location must be not null");
        }
       
        synchronized (ntv2GridCache) { // Prevent simultaneous threads trying to load same grid
            GridShiftFile grid = ntv2GridCache.get(gridLocation.toExternalForm());
            if (grid != null) { // Cached:
                return grid; // - Return
            } else { // Not cached:
                if (gridLocation != null) {
                    grid = loadNTv2Grid(gridLocation); // - Load
                    if (grid != null) {
                        ntv2GridCache.put(gridLocation.toExternalForm(), grid); // - Cache
                        return grid; // - Return
                    }
                }
                throw new FactoryException("NTv2 Grid " + gridLocation + " could not be created.");
            }
        }
    }
View Full Code Here

        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
            return null;
        } catch (IllegalArgumentException e) {
            LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
            throw new FactoryException(e.getLocalizedMessage(), e);
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
View Full Code Here

            if (crs instanceof ProjectedCRS) {
                modified = crsFactory.createProjectedCRS(properties,
                        (GeographicCRS) baseCRS, fromBase, (CartesianCS) cs);
            } else {
                // TODO: Need a createDerivedCRS method.
                throw new FactoryException(Errors.format(
                        ErrorKeys.UNSUPPORTED_CRS_$1, crs.getName().getCode()));
            }
        } else if (sameCS) {
            return crs;
        } else {
            final Map properties = getProperties(crs);
            final ReferencingFactoryContainer factories = getFactoryContainer(true);
            final CRSFactory crsFactory = factories.getCRSFactory();
            if (crs instanceof GeographicCRS) {
                modified = crsFactory.createGeographicCRS(properties,
                        (GeodeticDatum) datum, (EllipsoidalCS) cs);
            } else if (crs instanceof GeocentricCRS) {
                final GeodeticDatum gd = (GeodeticDatum) datum;
                if (cs instanceof CartesianCS) {
                    modified = crsFactory.createGeocentricCRS(properties, gd, (CartesianCS) cs);
                } else {
                    modified = crsFactory.createGeocentricCRS(properties, gd, (SphericalCS) cs);
                }
            } else if (crs instanceof VerticalCRS) {
                modified = crsFactory.createVerticalCRS(properties,
                        (VerticalDatum) datum, (VerticalCS) cs);
            } else if (crs instanceof TemporalCRS) {
                modified = crsFactory.createTemporalCRS(properties,
                        (TemporalDatum) datum, (TimeCS) cs);
            } else if (crs instanceof ImageCRS) {
                modified = crsFactory.createImageCRS(properties,
                        (ImageDatum) datum, (AffineCS) cs);
            } else if (crs instanceof EngineeringCRS) {
                modified = crsFactory.createEngineeringCRS(properties,
                        (EngineeringDatum) datum, cs);
            } else if (crs instanceof CompoundCRS) {
                final List/* <CoordinateReferenceSystem> */elements =
                        ((CompoundCRS) crs).getCoordinateReferenceSystems();
                final CoordinateReferenceSystem[] m = new CoordinateReferenceSystem[elements.size()];
                for (int i=0; i<m.length; i++) {
                    m[i] = replace((CoordinateReferenceSystem) elements.get(i));
                }
                modified = crsFactory.createCompoundCRS(properties, m);
            } else {
                throw new FactoryException(Errors.format(
                        ErrorKeys.UNSUPPORTED_CRS_$1, crs.getName().getCode()));
            }
        }
        modified = (CoordinateReferenceSystem) pool.unique(modified);
        return modified;
View Full Code Here

TOP

Related Classes of org.opengis.referencing.FactoryException

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.