Package org.opengis.geometry

Examples of org.opengis.geometry.MismatchedDimensionException


      // Primitives gilt, dass getDimension die Dimension des Objektes,
      // und getCoordinateDimension die Dimension des Koordinatensystems,
      // in welchem das Objekt instanziert wurde, wiedergibt
      // if (this.getDimension() != orientableCurve.getDimension(null)) {
      if (this.getDimension() != orientableCurve.getCoordinateDimension()) {
        throw new MismatchedDimensionException();
      }
      if (!CRS.equalsIgnoreMetadata(this.getCoordinateReferenceSystem(), orientableCurve
          .getCoordinateReferenceSystem()) ) {
        throw new MismatchedReferenceSystemException();
      }
View Full Code Here


    if (interiors == null && exterior == null)
      throw new NullPointerException();
    CoordinateReferenceSystem thisCRS = this.getCoordinateReferenceSystem();
    if (exterior != null) {
      if (this.getDimension() != exterior.getCoordinateDimension()) {
        throw new MismatchedDimensionException();
      }
      CoordinateReferenceSystem exteriorCRS = exterior
          .getCoordinateReferenceSystem();
      if (!CRS.equalsIgnoreMetadata(thisCRS,exteriorCRS)) {
        throw new MismatchedReferenceSystemException();
      }
    }
    if (interiors != null) {
      for (Ring ring : interiors) {
        if (ring != null) {
          if (this.getDimension() != ring.getCoordinateDimension()) {
            throw new MismatchedDimensionException();
          }
          if (!CRS.equalsIgnoreMetadata(thisCRS, ring
              .getCoordinateReferenceSystem()) ) {
            throw new MismatchedReferenceSystemException();
          }
View Full Code Here

              envelope.getSpan(0), envelope.getSpan(1));

        // TODO: check below should be first, if only Sun could fix RFE #4093999.
        final int dimension = envelope.getDimension();
        if (dimension != 2) {
            throw new MismatchedDimensionException(Errors.format(
                    ErrorKeys.NOT_TWO_DIMENSIONAL_$1, dimension));
        }
        setCoordinateReferenceSystem(envelope.getCoordinateReferenceSystem());
    }
View Full Code Here

    protected void test() throws TransformException, MismatchedDimensionException {
        final DirectPosition transformedSource = transform.transform(sourcePosition, null);
        final int sourceDim = transformedSource.getDimension();
        final int targetDim =    targetPosition.getDimension();
        if (sourceDim != targetDim) {
            throw new MismatchedDimensionException(Errors.format(ErrorKeys.MISMATCHED_DIMENSION_$2,
                        sourceDim, targetDim));
        }
        for (int i=0; i<sourceDim; i++) {
            // Use '!' for catching NaN.
            if (!(Math.abs(transformedSource.getOrdinate(i) -
View Full Code Here

  public Point createPoint(double[] ordinates) throws MismatchedDimensionException {
    if (ordinates == null)
      throw new NullPointerException("Ordinates required to create a point");
    int dimension = this.getCoordinateReferenceSystem().getCoordinateSystem().getDimension();
        if (ordinates.length != dimension)
      throw new MismatchedDimensionException("Create point requires "+dimension+" ordinates ("+ordinates.length+" provided");

    return getPrimitiveFactory().createPoint(ordinates);
  }
View Full Code Here

     * Makes sure the specified dimensions are identical.
     */
    private static void ensureSameDimension(final int dim1, final int dim2)
            throws MismatchedDimensionException {
        if (dim1 != dim2) {
            throw new MismatchedDimensionException(Errors.format(ErrorKeys.MISMATCHED_DIMENSION_$2,
                    dim1, dim2));
        }
    }
View Full Code Here

                    ordinates.length));
        }
        final int dimension = ordinates.length >>> 1;
        final int check = this.ordinates.length >>> 1;
        if (dimension != check) {
            throw new MismatchedDimensionException(Errors.format(ErrorKeys.MISMATCHED_DIMENSION_$3,
                    "ordinates", dimension, check));
        }
        checkCoordinates(ordinates);
        System.arraycopy(ordinates, 0, this.ordinates, 0, ordinates.length);
    }
View Full Code Here

     * @param  point The new coordinate for this point.
     * @throws MismatchedDimensionException if this coordinate point is not two-dimensional.
     */
    public final void setLocation(final Point2D point) throws MismatchedDimensionException {
        if (ordinates.length != 2) {
            throw new MismatchedDimensionException(Errors.format(
                    ErrorKeys.NOT_TWO_DIMENSIONAL_$1, ordinates.length));
        }
        ordinates[0] = point.getX();
        ordinates[1] = point.getY();
    }
View Full Code Here

            throws MismatchedDimensionException
    {
        if (crs != null) {
            final int dimension = crs.getCoordinateSystem().getDimension();
            if (dimension != expected) {
                throw new MismatchedDimensionException(Errors.format(ErrorKeys.MISMATCHED_DIMENSION_$3,
                          crs.getName().getCode(), dimension, expected));
            }
        }
    }
View Full Code Here

                                     final int dimension,
                                     final int expectedDimension)
            throws MismatchedDimensionException
    {
        if (dimension != expectedDimension) {
            throw new MismatchedDimensionException(Errors.format(ErrorKeys.MISMATCHED_DIMENSION_$3,
                        name, dimension, expectedDimension));
        }
    }
View Full Code Here

TOP

Related Classes of org.opengis.geometry.MismatchedDimensionException

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.