Package org.opengis.geometry

Examples of org.opengis.geometry.MismatchedDimensionException


                return derivative((Point2D) null);
            }
        } else {
            final int dimPoint = point.getDimension();
            if (dimPoint != dimSource) {
                throw new MismatchedDimensionException(constructMessage("point", dimPoint, dimSource));
            }
            if (dimSource == 2) {
                if (point instanceof Point2D) {
                    return derivative((Point2D) point);
                }
View Full Code Here


        final int dimension = getDimension();
        for (int i=0; i<points.length; i++) {
            final DirectPosition point = points[i];
            final int pointDim = point.getDimension();
            if (pointDim != dimension) {
                throw new MismatchedDimensionException(Errors.format(
                        ErrorKeys.MISMATCHED_DIMENSION_$3, label + '[' + i + ']', pointDim, dimension));
            }
            crs = getCoordinateReferenceSystem(point, crs);
        }
        if (crs != null) {
View Full Code Here

   *
   * @param values Array of doubles. values[0] will be added to the X ordinate, values[1] to the Y value and an optional values[2] to the Z value.
   */
  public void add(double[] values) {
    if (this.coordinate.length != values.length)
      throw new MismatchedDimensionException();
   
    for (int i=0; i < this.coordinate.length; i++) {
      if (Double.compare(this.coordinate[i], Double.NaN) == 0) {
        this.coordinate[i] = values[i];
      }
View Full Code Here

   *
   * @param otherDP DirectPosition which ordinates shall be added to this DirectPosition
   */
  public void add(DirectPositionImpl otherDP) {
    if (this.coordinate.length != otherDP.getDimension())
      throw new MismatchedDimensionException();
   
    for (int i=0; i < this.coordinate.length; i++) {
      if (Double.compare(this.coordinate[i], Double.NaN) == 0) {
        this.coordinate[i] = otherDP.getOrdinate(i);
      }
View Full Code Here

        /*
         * Checks argument validity: envelope and math transform dimensions must be consistent.
         */
        final int sourceDim = transform.getSourceDimensions();
        if (envelope.getDimension() != sourceDim) {
            throw new MismatchedDimensionException(Errors.format(ErrorKeys.MISMATCHED_DIMENSION_$2,
                      sourceDim, envelope.getDimension()));
        }
        int coordinateNumber = 0;
        GeneralEnvelope transformed = null;
        if (targetPt == null) {
View Full Code Here

        final int dimTarget = baseToDerived.getTargetDimensions();
        int dim1, dim2;
        if ((dim1=dimSource) != (dim2=base.getCoordinateSystem().getDimension()) ||
            (dim1=dimTarget) != (dim2=derivedCS.getDimension()))
        {
            throw new MismatchedDimensionException(Errors.format(
                    ErrorKeys.MISMATCHED_DIMENSION_$2, dim1, dim2));
        }
    }
View Full Code Here

     */
    private static double distance(final DirectPosition source, final DirectPosition target) {
        final int otherDim  = source.getDimension();
        final int dimension = target.getDimension();
        if (otherDim != dimension) {
            throw new MismatchedDimensionException(Errors.format(ErrorKeys.MISMATCHED_DIMENSION_$2,
                        otherDim, dimension));
        }
        double sum = 0;
        for (int i=0; i<dimension; i++) {
            final double delta = source.getOrdinate(i) - target.getOrdinate(i);
View Full Code Here

  public DirectPosition createDirectPosition(double[] coord) {
    // Test ok
    if (coord == null)
      throw new IllegalArgumentException("Parameter coord is null"); //$NON-NLS-1$
    if (coord.length != this.getDimension())
      throw new MismatchedDimensionException();
    // Create a DirectPosition which references to a COPY of the given double array
    return (DirectPosition) positionFactory.createDirectPosition(coord);
  }
View Full Code Here

   * @return PositionImpl
   */
  public PositionImpl createPosition(double[] coord) {
    // TODO Test
    if (coord.length != this.getDimension())
      throw new MismatchedDimensionException();

    return (PositionImpl) createPosition(createDirectPosition(coord));
  }
View Full Code Here

   * @param Coordinate c of a point p. The created envelope will have this coordinate as lower and upper corner
   * @return EnvelopeImpl The created envelope will have the coordinate as lower and upper corner.
   */
  public EnvelopeImpl createEnvelope(double[] c) {
    if (c.length != this.getDimension())
      throw new MismatchedDimensionException();
   
    return new EnvelopeImpl(createDirectPosition(c));
  }
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.