Package org.osgeo.proj4j

Examples of org.osgeo.proj4j.ProjectionException


          xy.y = cosphi * coslam;
        else
          xy.y = sinphi0 * sinphi + cosphi0 * cosphi * coslam;
        if (Math.abs(Math.abs(xy.y) - 1.) < TOL)
          if (xy.y < 0.)
            throw new ProjectionException();
          else
            xy.x = xy.y = 0.;
        else {
          xy.y = Math.acos(xy.y);
          xy.y /= Math.sin(xy.y);
          xy.x = xy.y * cosphi * Math.sin(lam);
          xy.y *= (mode == EQUATOR) ? sinphi :
               cosphi0 * sinphi - sinphi0 * cosphi * coslam;
        }
        break;
      case NORTH_POLE:
        phi = -phi;
        coslam = -coslam;
      case SOUTH_POLE:
        if (Math.abs(phi - ProjectionMath.HALFPI) < EPS10)
          throw new ProjectionException();
        xy.x = (xy.y = (ProjectionMath.HALFPI + phi)) * Math.sin(lam);
        xy.y *= coslam;
        break;
      }
    } else {
View Full Code Here


    if (spherical) {
      double cosc, c_rh, sinc;

      if ((c_rh = ProjectionMath.distance(x, y)) > Math.PI) {
        if (c_rh - EPS10 > Math.PI)
          throw new ProjectionException();
        c_rh = Math.PI;
      } else if (c_rh < EPS10) {
        lp.y = projectionLatitude;
        lp.x = 0.;
        return lp;
View Full Code Here

  public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) {
    double t = 0;

    double lpphi = RYC * xyy;
    if (Math.abs(lpphi) > 1.) {
      if (Math.abs(lpphi) > ONETOLthrow new ProjectionException("I");
      else if (lpphi < 0.) { t = -1.; lpphi = -Math.PI; }
      else { t = 1.; lpphi = Math.PI; }
    } else
      lpphi = 2. * Math.asin(t = lpphi);
    out.x = RXC * xyx / (1. + 2. * Math.cos(lpphi)/Math.cos(0.5 * lpphi));
    lpphi = RC * (t + Math.sin(lpphi));
    if (Math.abs(lpphi) > 1.)
      if (Math.abs(lpphi) > ONETOL)
        throw new ProjectionException("I");
      else
        lpphi = lpphi < 0. ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI;
    else
      lpphi = Math.asin(lpphi);
    out.y = lpphi;
View Full Code Here

      cdlam = Math.cos(sdlam = lplam + R110);
      sdlam = Math.sin(sdlam);
      z = S20 * sphi + C20 * cphi * cdlam;
      if (Math.abs(z) > 1.) {
        if (Math.abs(z) > ONEEPS)
          throw new ProjectionException("F");
        else z = z < 0. ? -1. : 1.;
      } else
        z = Math.acos(z);
      if (tphi != Double.MAX_VALUE)
        Az = Math.atan2(sdlam, (C20 * tphi - S20 * cdlam));
      Av = Azab;
      out.y = rhoc;
    } else {
      z = S45 * (sphi + cphi * cdlam);
      if (Math.abs(z) > 1.) {
        if (Math.abs(z) > ONEEPS)
          throw new ProjectionException("F");
        else z = z < 0. ? -1. : 1.;
      } else
        z = Math.acos(z);
      Av = Azba;
      out.y = -rhoc;
    }
    if (z < 0.) throw new ProjectionException("F");
    r = F * (t = Math.pow(Math.tan(.5 * z), n));
    if ((al = .5 * (R104 - z)) < 0.)
      throw new ProjectionException("F");
    al = (t + Math.pow(al, n)) / T;
    if (Math.abs(al) > 1.) {
      if (Math.abs(al) > ONEEPS)
        throw new ProjectionException("F");
      else al = al < 0. ? -1. : 1.;
    } else
      al = Math.acos(al);
    if (Math.abs(t = n * (Av - Az)) < al)
      r /= Math.cos(al + (tag ? t : -t));
View Full Code Here

        r = rp * Math.cos(al + (neg ? Az : -Az));
      if (Math.abs(rl - r) < EPS)
        break;
      rl = r;
    }
    if (i == 0) throw new ProjectionException("I");
    Az = Av - Az / n;
    out.y = Math.asin(s * Math.cos(z) + c * Math.sin(z) * Math.cos(Az));
    out.x = Math.atan2(Math.sin(Az), c / Math.tan(z) - s * Math.cos(Az));
    if (neg)
      out.x -= R110;
View Full Code Here

      xy.y = lpphi < 0 ? -2. : 2.;
    } else {
      lpphi = Math.sin(lpphi);
      v = a1 * Math.pow((1. + lpphi)/(1. - lpphi), hrw);
      if ((c = 0.5 * (v + 1./v) + Math.cos(lplam *= rw)) < TOL)
        throw new ProjectionException();
      xy.x = 2. * Math.sin(lplam) / c;
      xy.y = (v - 1./v) / c;
    }
    return xy;
  }
View Full Code Here

  }

  public void initialize() {
    super.initialize();
    if (rw <= 0)
      throw new ProjectionException("-27");
    hrw = 0.5 * (rw = 1. / rw);
    phi1 = projectionLatitude1;
    if (Math.abs(Math.abs(phi1 = Math.sin(phi1)) - 1.) < TOL)
      throw new ProjectionException("-22");
    a1 = Math.pow((1. - phi1)/(1. + phi1), hrw);
  }
View Full Code Here

  public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) {
    double th;

    th = xyy * ( xyy < 0. ? RYCS : RYCN);
    if (Math.abs(th) > 1.)
      if (Math.abs(th) > ONETOLthrow new ProjectionException("I");
      else      th = th > 0. ? ProjectionMath.HALFPI : - ProjectionMath.HALFPI;
    else
      th = Math.asin(th);
    out.x = RXC * xyx / Math.cos(th);
    th += th;
    out.y = (th + Math.sin(th)) * (xyy < 0. ? RCS : RCN);
    if (Math.abs(out.y) > 1.)
      if (Math.abs(out.y) > ONETOLthrow new ProjectionException("I");
      else      out.y = out.y > 0. ? ProjectionMath.HALFPI : - ProjectionMath.HALFPI;
    else
      out.y = Math.asin(out.y);
    return out;
  }
View Full Code Here

  }

  public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) {
    out.y = xyy / FYC;
    if (Math.abs(out.y) >= 1.) {
      if (Math.abs(out.y) > ONEEPSthrow new ProjectionException("I");
      else  out.y = (out.y < 0.) ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI;
    } else
      out.y = Math.asin(out.y);
    out.x = xyx / ( FXC * (2. * Math.cos(C23 * (out.y *= 3.)) - 1.) );
    if (Math.abs(out.y = Math.sin(out.y) / CS) >= 1.) {
      if (Math.abs(out.y) > ONEEPSthrow new ProjectionException("I");
      else  out.y = (out.y < 0.) ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI;
    } else
      out.y = Math.asin(out.y);
    return out;
  }
View Full Code Here

    minLatitude = Math.toRadians(-80);
    maxLatitude = Math.toRadians(80);
  }
 
  public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) {
    if (Math.abs(Math.abs(lpphi) - ProjectionMath.HALFPI) <= EPS10) throw new ProjectionException("F");
    out.x = lplam;
    out.y = Math.tan(lpphi);
    return out;
  }
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.