Package org.osgeo.proj4j

Examples of org.osgeo.proj4j.ProjectionException


  public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) {
    double  al, al2, g, g2, p2;

    p2 = Math.abs(lpphi / ProjectionMath.HALFPI);
    if ((p2 - TOL) > 1.) throw new ProjectionException("F");
    if (p2 > 1.)
      p2 = 1.;
    if (Math.abs(lpphi) <= TOL) {
      out.x = lplam;
      out.y = 0.;
    } else if (Math.abs(lplam) <= TOL || Math.abs(p2 - 1.) < TOL) {
      out.x = 0.;
      out.y = Math.PI * Math.tan(.5 * Math.asin(p2));
      if (lpphi < 0.) out.y = -out.y;
    } else {
      al = .5 * Math.abs(Math.PI / lplam - lplam / Math.PI);
      al2 = al * al;
      g = Math.sqrt(1. - p2 * p2);
      g = g / (p2 + g - 1.);
      g2 = g * g;
      p2 = g * (2. / p2 - 1.);
      p2 = p2 * p2;
      out.x = g - p2; g = p2 + al2;
      out.x = Math.PI * (al * out.x + Math.sqrt(al2 * out.x * out.x - g * (g2 - p2))) / g;
      if (lplam < 0.) out.x = -out.x;
      out.y = Math.abs(out.x / Math.PI);
      out.y = 1. - out.y * (out.y + 2. * al);
      if (out.y < -TOL) throw new ProjectionException("F");
      if (out.y < 0.)
        out.y = 0.;
      else
        out.y = Math.sqrt(out.y) * (lpphi < 0. ? -Math.PI : Math.PI);
    }
View Full Code Here


      if (xyy < 0.) out.y = -out.y;
      t = r2 + TPISQ * (x2 - y2 + HPISQ);
      out.x = Math.abs(xyx) <= TOL ? 0. :
         .5 * (r - PISQ + (t <= 0. ? 0. : Math.sqrt(t))) / xyx;
    } else
      throw new ProjectionException("I");
    return out;
  }
View Full Code Here

        if (mode == EQUIT)
          out.y = 1. + cosphi * coslam;
        else
          out.y = 1. + sinph0 * sinphi + cosph0 * cosphi * coslam;

        if (out.y <= EPS10) throw new ProjectionException("F");
        out.x = (out.y = Math.sqrt(2. / out.y)) * cosphi * Math.sin(lplam);
        out.y *= mode == EQUIT ? sinphi :
           cosph0 * sinphi - sinph0 * cosphi * coslam;
        break;
      case N_POLE:
        coslam = -coslam;
      case S_POLE:
        if (Math.abs(lpphi + phi0) < EPS10) throw new ProjectionException("F");;
        out.y = ProjectionMath.QUARTERPI - lpphi * .5;
        out.y = 2. * (mode == S_POLE ? Math.cos(out.y) : Math.sin(out.y));
        out.x = out.y * Math.sin(lplam);
        out.y *= coslam;
        break;
View Full Code Here

      case S_POLE:
        b = lpphi - ProjectionMath.HALFPI;
        q = qp + q;
        break;
      }
      if (Math.abs(b) < EPS10) throw new ProjectionException("F");
     
      switch (mode) {
      case OBLIQ:
      case EQUIT:
        if (mode == OBLIQ) {
View Full Code Here

    public void projectInverse_s(double xyx, double xyy, ProjCoordinate out) {
      double  cosz=0.0, rh, sinz=0.0;
      double lpphi, lplam;
     
      rh = Math.hypot(xyx, xyy);
      if ((lpphi = rh * .5 ) > 1.) throw new ProjectionException("I_ERROR");
      lpphi = 2. * Math.asin(lpphi);
      if (mode == OBLIQ || mode == EQUIT) {
        sinz = Math.sin(lpphi);
        cosz = Math.cos(lpphi);
      }
View Full Code Here

    }
    if (i != 0) {
      lpphi = phip;
      lplam = lamp / c;
    } else {
      throw new ProjectionException("I_ERROR");
    }
    lp.x = lplam;
    lp.y = lpphi;
   
    return lp;
View Full Code Here

  public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) {
    double lpphi = xyy / FYC - 1.;
    if (Math.abs(out.y = 1. - lpphi * lpphi) < 1.)
      out.y = Math.asin(lpphi);
    else if (Math.abs(lpphi) > ONEEPS) throw new ProjectionException("I");
    else  out.y = lpphi < 0. ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI;
    if ((out.x = 1. - Math.sin(lpphi)) <= 0.)
      out.x = 0.;
    else
      out.x = xyx / (FXC * Math.sqrt(out.x));
 
View Full Code Here

  public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) {
    double b, bt;

    b = Math.cos(lpphi) * Math.sin(lplam);
    if ((bt = 1. - b * b) < EPS10)
      throw new ProjectionException("F");
    out.x = b / Math.sqrt(bt);
    out.y = Math.atan2(Math.tan(lpphi), Math.cos(lplam));
    return out;
  }
View Full Code Here

  }

  public void initialize() {
    super.initialize();
    if ((w = Math.abs(w)) <= 0.)
      throw new ProjectionException("-27");
    else
      w = .5;
    if ((m = Math.abs(m)) <= 0.)
      throw new ProjectionException("-27");
    else
      m = 1.;
    rm = 1. / m;
    m /= w;
    es = 0.;
View Full Code Here

    case NORTH_POLE:
      xy.y = sinphi;
      break;
    }
    if (Math.abs(xy.y) <= EPS10)
      throw new ProjectionException();
    xy.x = (xy.y = 1. / xy.y) * cosphi * Math.sin(lam);
    switch (mode) {
    case EQUATOR:
      xy.y *= sinphi;
      break;
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.