Changeset 9974 in josm


Ignore:
Timestamp:
2016-03-13T00:16:36+01:00 (8 years ago)
Author:
Don-vip
Message:

sonar - rename fields to match code conventions, remove empty instruction

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/relation/AddSelectionToRelations.java

    r9366 r9974  
    4949                    tr("<html><strong>Add selection to relation</strong>: Control every single relation to avoid damage!"))
    5050                    .setIcon(JOptionPane.WARNING_MESSAGE)
    51                     .show();;
     51                    .show();
    5252        }
    5353    }
  • trunk/src/org/openstreetmap/josm/data/projection/proj/DoubleStereographic.java

    r9628 r9974  
    3535    private double c;
    3636    private double chi0;
    37     private double R;
     37    private double r;
    3838
    3939    private static final double EPSILON = 1e-12;
     
    6161        double phi0 = toRadians(lat_0);
    6262        double e2 = ellps.e2;
    63         R = sqrt(1-e2) / (1 - e2*pow(sin(phi0), 2));
     63        r = sqrt(1-e2) / (1 - e2*pow(sin(phi0), 2));
    6464        n = sqrt(1 + ellps.eb2 * pow(cos(phi0), 4));
    6565        double S1 = (1 + sin(phi0)) / (1 - sin(phi0));
     
    8080        double chi = asin((w - 1) / (w + 1));
    8181        double B = 1 + sin(chi) * sin(chi0) + cos(chi) * cos(chi0) * cos(Lambda);
    82         double x = 2 * R * cos(chi) * sin(Lambda) / B;
    83         double y = 2 * R * (sin(chi) * cos(chi0) - cos(chi) * sin(chi0) * cos(Lambda)) / B;
     82        double x = 2 * r * cos(chi) * sin(Lambda) / B;
     83        double y = 2 * r * (sin(chi) * cos(chi0) - cos(chi) * sin(chi0) * cos(Lambda)) / B;
    8484        return new double[] {x, y};
    8585    }
     
    8888    public double[] invproject(double x, double y) {
    8989        double e2 = ellps.e2;
    90         double g = 2 * R * tan(PI/4 - chi0/2);
    91         double h = 4 * R * tan(chi0) + g;
     90        double g = 2 * r * tan(PI/4 - chi0/2);
     91        double h = 4 * r * tan(chi0) + g;
    9292        double i = atan(x/(h + y));
    9393        double j = atan(x/(g - y)) - i;
    94         double chi = chi0 + 2 * atan((y - x * tan(j/2)) / (2 * R));
     94        double chi = chi0 + 2 * atan((y - x * tan(j/2)) / (2 * r));
    9595        double Lambda = j + 2*i;
    9696        double lambda = Lambda / n;
  • trunk/src/org/openstreetmap/josm/data/projection/proj/LambertAzimuthalEqualArea.java

    r9970 r9974  
    5757
    5858    /** Coefficients for authalic latitude. */
    59     private double APA0, APA1, APA2;
     59    private double aPA0, aPA1, aPA2;
    6060
    6161    private double latitudeOfOrigin;
     
    9595        final double es2 = e2 * e2;
    9696        final double es3 = e2 * es2;
    97         APA0 = P02 * es3 + P01 * es2 + P00 * e2;
    98         APA1 = P11 * es3 + P10 * es2;
    99         APA2 = P20 * es3;
     97        aPA0 = P02 * es3 + P01 * es2 + P00 * e2;
     98        aPA1 = P11 * es3 + P10 * es2;
     99        aPA2 = P20 * es3;
    100100
    101101        final double sinphi;
     
    272272    private double authlat(final double beta) {
    273273        final double t = beta + beta;
    274         return beta + APA0 * Math.sin(t) + APA1 * Math.sin(t+t) + APA2 * Math.sin(t+t+t);
     274        return beta + aPA0 * Math.sin(t) + aPA1 * Math.sin(t+t) + aPA2 * Math.sin(t+t+t);
    275275    }
    276276
  • trunk/src/org/openstreetmap/josm/data/projection/proj/ObliqueMercator.java

    r9970 r9974  
    159159     * Constants used in the transformation.
    160160     */
    161     private double B, A, E;
    162 
    163     /**
    164      * Convenience values equal to {@link #A} / {@link #B},
    165      * {@link #A}&times;{@link #B}, and {@link #B} / {@link #A}.
    166      */
    167     private double ArB, AB, BrA;
     161    private double b, a, e;
     162
     163    /**
     164     * Convenience values equal to {@link #a} / {@link #b},
     165     * {@link #a}&times;{@link #b}, and {@link #b} / {@link #a}.
     166     */
     167    private double arb, ab, bra;
    168168
    169169    /**
    170170     * <var>v</var> values when the input latitude is a pole.
    171171     */
    172     private double v_pole_n, v_pole_s;
     172    private double vPoleN, vPoleS;
    173173
    174174    /**
     
    189189     * the oblique mercator case. The <var>v</var> value of the central point is 0.0.
    190190     */
    191     private double u_c;
     191    private double uc;
    192192
    193193    /**
     
    227227        final double con = 1. - e2 * sinph0 * sinph0;
    228228        double temp = cosph0 * cosph0;
    229         B = Math.sqrt(1.0 + e2 * (temp * temp) / (1.0 - e2));
    230         A = B * com / con;
    231         final double D = B * com / (cosph0 * Math.sqrt(con));
    232         double F = D * D - 1.0;
    233         if (F < 0.0) {
    234             F = 0.0;
     229        b = Math.sqrt(1.0 + e2 * (temp * temp) / (1.0 - e2));
     230        a = b * com / con;
     231        final double d = b * com / (cosph0 * Math.sqrt(con));
     232        double f = d * d - 1.0;
     233        if (f < 0.0) {
     234            f = 0.0;
    235235        } else {
    236             F = Math.sqrt(F);
     236            f = Math.sqrt(f);
    237237            if (latCenter < 0.0) {
    238                 F = -F;
    239             }
    240         }
    241         E = F += D;
    242         E = F * Math.pow(tsfn(latCenter, sinph0), B);
     238                f = -f;
     239            }
     240        }
     241        e = f += d;
     242        e = f * Math.pow(tsfn(latCenter, sinph0), b);
    243243
    244244        /*
     
    276276             * The coefficients for the "two points" case.
    277277             */
    278             final double H = Math.pow(tsfn(lat1, Math.sin(lat1)), B);
    279             final double L = Math.pow(tsfn(lat2, Math.sin(lat2)), B);
    280             final double Fp = E / H;
    281             final double P = (L - H) / (L + H);
    282             double J = E * E;
    283             J = (J - L * H) / (J + L * H);
     278            final double h = Math.pow(tsfn(lat1, Math.sin(lat1)), b);
     279            final double l = Math.pow(tsfn(lat2, Math.sin(lat2)), b);
     280            final double fp = e / h;
     281            final double p = (l - h) / (l + h);
     282            double j = e * e;
     283            j = (j - l * h) / (j + l * h);
    284284            double diff = lon1 - lon2;
    285285            if (diff < -Math.PI) {
     
    289289            }
    290290            centralMeridian = normalizeLonRad(0.5 * (lon1 + lon2) -
    291                      Math.atan(J * Math.tan(0.5 * B * (lon1 - lon2)) / P) / B);
    292             gamma0 = Math.atan(2.0 * Math.sin(B * normalizeLonRad(lon1 - centralMeridian)) /
    293                      (Fp - 1.0 / Fp));
    294             azimuth = Math.asin(D * Math.sin(gamma0));
     291                     Math.atan(j * Math.tan(0.5 * b * (lon1 - lon2)) / p) / b);
     292            gamma0 = Math.atan(2.0 * Math.sin(b * normalizeLonRad(lon1 - centralMeridian)) /
     293                     (fp - 1.0 / fp));
     294            azimuth = Math.asin(d * Math.sin(gamma0));
    295295            rectifiedGridAngle = azimuth;
    296296        } else {
     
    315315                rectifiedGridAngle = azimuth;
    316316            }
    317             gamma0 = Math.asin(Math.sin(azimuth) / D);
     317            gamma0 = Math.asin(Math.sin(azimuth) / d);
    318318            // Check for asin(+-1.00000001)
    319             temp = 0.5 * (F - 1.0 / F) * Math.tan(gamma0);
     319            temp = 0.5 * (f - 1.0 / f) * Math.tan(gamma0);
    320320            if (Math.abs(temp) > 1.0) {
    321321                if (Math.abs(Math.abs(temp) - 1.0) > EPSILON) {
     
    324324                temp = (temp > 0) ? 1.0 : -1.0;
    325325            }
    326             centralMeridian = lonCenter - Math.asin(temp) / B;
     326            centralMeridian = lonCenter - Math.asin(temp) / b;
    327327        }
    328328
     
    334334        sinrot    = Math.sin(rectifiedGridAngle);
    335335        cosrot    = Math.cos(rectifiedGridAngle);
    336         ArB       = A / B;
    337         AB        = A * B;
    338         BrA       = B / A;
    339         v_pole_n  = ArB * Math.log(Math.tan(0.5 * (Math.PI/2.0 - gamma0)));
    340         v_pole_s  = ArB * Math.log(Math.tan(0.5 * (Math.PI/2.0 + gamma0)));
     336        arb       = a / b;
     337        ab        = a * b;
     338        bra       = b / a;
     339        vPoleN  = arb * Math.log(Math.tan(0.5 * (Math.PI/2.0 - gamma0)));
     340        vPoleS  = arb * Math.log(Math.tan(0.5 * (Math.PI/2.0 + gamma0)));
    341341        boolean hotine = params.no_off != null && params.no_off;
    342342        if (hotine) {
    343             u_c = 0.0;
     343            uc = 0.0;
    344344        } else {
    345345            if (Math.abs(Math.abs(azimuth) - Math.PI/2.0) < EPSILON_LATITUDE) {
     
    348348                    throw new ProjectionConfigurationException("assertion error");
    349349                }
    350                 u_c = A * (lonCenter - centralMeridian);
     350                uc = a * (lonCenter - centralMeridian);
    351351            } else {
    352                 double u_c = Math.abs(ArB * Math.atan2(Math.sqrt(D * D - 1.0), Math.cos(azimuth)));
     352                double uC = Math.abs(arb * Math.atan2(Math.sqrt(d * d - 1.0), Math.cos(azimuth)));
    353353                if (latCenter < 0.0) {
    354                     u_c = -u_c;
     354                    uC = -uC;
    355355                }
    356                 this.u_c = u_c;
     356                this.uc = uC;
    357357            }
    358358        }
     
    367367        double u, v;
    368368        if (Math.abs(Math.abs(y) - Math.PI/2.0) > EPSILON) {
    369             double Q = E / Math.pow(tsfn(y, Math.sin(y)), B);
    370             double temp = 1.0 / Q;
    371             double S = 0.5 * (Q - temp);
    372             double V = Math.sin(B * x);
    373             double U = (S * singamma0 - V * cosgamma0) / (0.5 * (Q + temp));
     369            double q = e / Math.pow(tsfn(y, Math.sin(y)), b);
     370            double temp = 1.0 / q;
     371            double s = 0.5 * (q - temp);
     372            double V = Math.sin(b * x);
     373            double U = (s * singamma0 - V * cosgamma0) / (0.5 * (q + temp));
    374374            if (Math.abs(Math.abs(U) - 1.0) < EPSILON) {
    375375                v = 0; // this is actually an error and should be reported to the caller somehow
    376376            } else {
    377                 v = 0.5 * ArB * Math.log((1.0 - U) / (1.0 + U));
    378             }
    379             temp = Math.cos(B * x);
     377                v = 0.5 * arb * Math.log((1.0 - U) / (1.0 + U));
     378            }
     379            temp = Math.cos(b * x);
    380380            if (Math.abs(temp) < EPSILON_LATITUDE) {
    381                 u = AB * x;
     381                u = ab * x;
    382382            } else {
    383                 u = ArB * Math.atan2(S * cosgamma0 + V * singamma0, temp);
     383                u = arb * Math.atan2(s * cosgamma0 + V * singamma0, temp);
    384384            }
    385385        } else {
    386             v = y > 0 ? v_pole_n : v_pole_s;
    387             u = ArB * y;
    388         }
    389         u -= u_c;
     386            v = y > 0 ? vPoleN : vPoleS;
     387            u = arb * y;
     388        }
     389        u -= uc;
    390390        x = v * cosrot + u * sinrot;
    391391        y = u * cosrot - v * sinrot;
     
    396396    public double[] invproject(double x, double y) {
    397397        double v = x * cosrot - y * sinrot;
    398         double u = y * cosrot + x * sinrot + u_c;
    399         double Qp = Math.exp(-BrA * v);
    400         double temp = 1.0 / Qp;
    401         double Sp = 0.5 * (Qp - temp);
    402         double Vp = Math.sin(BrA * u);
    403         double Up = (Vp * cosgamma0 + Sp * singamma0) / (0.5 * (Qp + temp));
    404         if (Math.abs(Math.abs(Up) - 1.0) < EPSILON) {
     398        double u = y * cosrot + x * sinrot + uc;
     399        double qp = Math.exp(-bra * v);
     400        double temp = 1.0 / qp;
     401        double sp = 0.5 * (qp - temp);
     402        double vp = Math.sin(bra * u);
     403        double up = (vp * cosgamma0 + sp * singamma0) / (0.5 * (qp + temp));
     404        if (Math.abs(Math.abs(up) - 1.0) < EPSILON) {
    405405            x = 0.0;
    406             y = Up < 0.0 ? -Math.PI / 2.0 : Math.PI / 2.0;
     406            y = up < 0.0 ? -Math.PI / 2.0 : Math.PI / 2.0;
    407407        } else {
    408             y = Math.pow(E / Math.sqrt((1. + Up) / (1. - Up)), 1.0 / B);  //calculate t
     408            y = Math.pow(e / Math.sqrt((1. + up) / (1. - up)), 1.0 / b);  //calculate t
    409409            y = cphi2(y);
    410             x = -Math.atan2(Sp * cosgamma0 - Vp * singamma0, Math.cos(BrA * u)) / B;
     410            x = -Math.atan2(sp * cosgamma0 - vp * singamma0, Math.cos(bra * u)) / b;
    411411        }
    412412        return new double[] {y, x};
Note: See TracChangeset for help on using the changeset viewer.