Package org.osgeo.proj4j

Examples of org.osgeo.proj4j.ProjectionException


        if (t >= 1.)
          lp.y = y < 0. ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI;
        else
          lp.y = Math.asin(y);
        lp.x = x / scaleFactor;
      } else throw new ProjectionException();
    } else {
      lp.y = ProjectionMath.authlat(Math.asin( 2. * y * scaleFactor / qp), apa);
      lp.x = x / scaleFactor;
    }
    return lp;
View Full Code Here


      switch (mode) {
      case EQUATOR:
        xy.y = 1. + cosphi * coslam;
        if (xy.y <= EPS10)
          throw new ProjectionException();
        xy.x = (xy.y = akm1 / xy.y) * cosphi * sinlam;
        xy.y *= sinphi;
        break;
      case OBLIQUE:
        xy.y = 1. + sinphi0 * sinphi + cosphi0 * cosphi * coslam;
        if (xy.y <= EPS10)
          throw new ProjectionException();
        xy.x = (xy.y = akm1 / xy.y) * cosphi * sinlam;
        xy.y *= cosphi0 * sinphi - sinphi0 * cosphi * coslam;
        break;
      case NORTH_POLE:
        coslam = - coslam;
        phi = - phi;
      case SOUTH_POLE:
        if (Math.abs(phi - ProjectionMath.HALFPI) < TOL)
          throw new ProjectionException();
        xy.x = sinlam * ( xy.y = akm1 * Math.tan(ProjectionMath.QUARTERPI + .5 * phi) );
        xy.y *= coslam;
        break;
      }
    } else {
View Full Code Here

  public void initialize() {
    super.initialize();
//    n = pj_param(params, "dn").f;
    if (n < 0. || n > 1.)
      throw new ProjectionException("-99");
    n1 = 1. - n;
  }
View Full Code Here

    lp.x = x / FXC;
    lp.y = Math.abs(y / FYC);
    if (lp.y >= 1.0) {
      if (lp.y > 1.000001) {
        throw new ProjectionException();
      } else {
        lp.y = y < 0. ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI;
        lp.x /= X[4*NODES];
      }
    } else {
View Full Code Here

  }

  public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) {
    double rho;
    if ((rho = c - (!spherical ? n * ProjectionMath.qsfn(Math.sin(lpphi), e, one_es) : n2 * Math.sin(lpphi))) < 0.)
      throw new ProjectionException("F");
    rho = dd * Math.sqrt(rho);
    out.x = rho * Math.sin( lplam *= n );
    out.y = rho0 - rho * Math.cos(lplam);
    return out;
  }
View Full Code Here

      lpphi =  rho / dd;
      if (!spherical) {
        lpphi = (c - lpphi * lpphi) / n;
        if (Math.abs(ec - Math.abs(lpphi)) > TOL7) {
          if ((lpphi = phi1_(lpphi, e, one_es)) == Double.MAX_VALUE)
            throw new ProjectionException("I");
        } else
          lpphi = lpphi < 0. ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI;
      } else if (Math.abs(out.y = (c - lpphi * lpphi) / n2) <= 1.)
        lpphi = Math.asin(lpphi);
      else
View Full Code Here

    phi1 = projectionLatitude1;
    phi2 = projectionLatitude2;

    if (Math.abs(phi1 + phi2) < EPS10)
      throw new ProjectionException("-21");
    n = sinphi = Math.sin(phi1);
    cosphi = Math.cos(phi1);
    secant = Math.abs(phi1 - phi2) >= EPS10;
    //spherical = es > 0.0;
    if (!spherical) {
      double ml1, m1;

      if ((en = ProjectionMath.enfn(es)) == null)
        throw new ProjectionException("0");
      m1 = ProjectionMath.msfn(sinphi, cosphi, es);
      ml1 = ProjectionMath.qsfn(sinphi, e, one_es);
      if (secant) { /* secant cone */
        double ml2, m2;

View Full Code Here

  public ProjCoordinate projectInverse(double x, double y, ProjCoordinate lp) {
    double  rh, cosc, sinc;

    if ((sinc = (rh = ProjectionMath.distance(x, y))) > 1.) {
      if ((sinc - 1.) > EPS10) throw new ProjectionException();
        sinc = 1.;
    }
    cosc = Math.sqrt(1. - sinc * sinc); /* in this range OK */
    if (Math.abs(rh) <= EPS10)
      lp.y = projectionLatitude;
View Full Code Here

          tp = Math.tan(lpphi);
          lpphi -= (dphi = (xyy * (lpphi * tp + 1.) - lpphi -
            .5 * ( lpphi * lpphi + B) * tp) /
            ((lpphi - xyy) / tp - 1.));
        } while (Math.abs(dphi) > CONV && --i > 0);
        if (i == 0) throw new ProjectionException("I");
        out.x = Math.asin(xyx * Math.tan(lpphi)) / Math.sin(lpphi);
        out.y = lpphi;
      }
    } else {
      xyy += ml0;
      if (Math.abs(xyy) <= TOL) { out.x = xyx; out.y = 0.; }
      else {
        double r, c, sp, cp, s2ph, ml, mlb, mlp, dPhi;
        int i;

        r = xyy * xyy + xyx * xyx;
        for (lpphi = xyy, i = I_ITER; i > 0; --i) {
          sp = Math.sin(lpphi);
          s2ph = sp * ( cp = Math.cos(lpphi));
          if (Math.abs(cp) < ITOL)
            throw new ProjectionException("I");
          c = sp * (mlp = Math.sqrt(1. - es * sp * sp)) / cp;
          ml = ProjectionMath.mlfn(lpphi, sp, cp, en);
          mlb = ml * ml + r;
          mlp = (1.0 / es) / (mlp * mlp * mlp);
          lpphi += ( dPhi =
            ( ml + ml + c * mlb - 2. * xyy * (c * ml + 1.) ) / (
            es * s2ph * (mlb - 2. * xyy * ml) / c +
            2.* (xyy - ml) * (c * mlp - 1. / s2ph) - mlp - mlp ));
          if (Math.abs(dPhi) <= ITOL)
            break;
        }
        if (i == 0)
          throw new ProjectionException("I");
        c = Math.sin(lpphi);
        out.x = Math.asin(xyx * Math.tan(lpphi) * Math.sqrt(1. - es * c * c)) / Math.sin(lpphi);
        out.y = lpphi;
      }
    }
View Full Code Here

    super.initialize();
spherical = true;//FIXME
    if (!spherical) {
      en = ProjectionMath.enfn(es);
      if (en == null)
        throw new ProjectionException("E");
      ml0 = ProjectionMath.mlfn(projectionLatitude, Math.sin(projectionLatitude), Math.cos(projectionLatitude), en);
    } else {
      ml0 = -projectionLatitude;
    }
  }
View Full Code Here

TOP

Related Classes of org.osgeo.proj4j.ProjectionException

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.