Beispiel #1
0
 public static PhiLambda ArcSecondsToRadians(double phi, double lambda)
 {
     return(new PhiLambda
     {
         Lambda = ProjectionMath.ArcSecondsToRadians(lambda),
         Phi = ProjectionMath.ArcSecondsToRadians(phi)
     });
 }
Beispiel #2
0
 public static PhiLambda ArcSecondsToRadians(PhiLambda plInDegrees)
 {
     return(new PhiLambda
     {
         Lambda = ProjectionMath.ArcSecondsToRadians(plInDegrees.Lambda),
         Phi = ProjectionMath.ArcSecondsToRadians(plInDegrees.Phi)
     });
 }
Beispiel #3
0
 /// <summary>
 /// Creates an instance of this class with a <see cref="DatumTransformType.SevenParameters"/> datum transform
 /// </summary>
 /// <param name="code">The code</param>
 /// <param name="deltaX">The offset in x-direction</param>
 /// <param name="deltaY">The offset in y-direction</param>
 /// <param name="deltaZ">The offset in z-direction</param>
 /// <param name="rx">The rotation around the x-axis in arc-seconds</param>
 /// <param name="ry">The rotation around the y-axis in arc-seconds</param>
 /// <param name="rz">The rotation around the z-axis in arc-secinds</param>
 /// <param name="scaleFactor">Scale factor</param>
 /// <param name="ellipsoid">The ellipsoid for this <see cref="Datum"/></param>
 /// <param name="name">The name of the</param>
 /// <remarks>
 /// PROJ4 towgs84 7-parameter transform uses
 /// units of arc-seconds for the rotation factors,
 /// and parts-per-million for the scale factor.
 /// </remarks>
 public Datum(String code,
              double deltaX, double deltaY, double deltaZ,
              double rx, double ry, double rz, double scaleFactor,
              Ellipsoid ellipsoid, String name)
     : this(code, new[] { deltaX, deltaY, deltaZ,
                          ProjectionMath.ArcSecondsToRadians(rx),
                          ProjectionMath.ArcSecondsToRadians(ry),
                          ProjectionMath.ArcSecondsToRadians(rz),
                          (scaleFactor / Million) + 1 }, ellipsoid, name)
 {
 }
Beispiel #4
0
        internal override bool ReadData(GridTable table)
        {
            using (var sr = new StreamReader(OpenGridTableStream()))
            {
                //Skip first 2 lines
                sr.ReadLine();
                sr.ReadLine();

                var phiIndex    = -1;
                var lambdaIndex = 0;

                double phi = 0, lambda = 0;
                var    coeff = new PhiLambda[table.NumPhis][];
                while (!sr.EndOfStream)
                {
                    var line = sr.ReadLine();
                    if (string.IsNullOrEmpty(line))
                    {
                        continue;
                    }
                    var      posColon = line.IndexOf(':');
                    string[] values;
                    int      valueIndex;
                    if (posColon > 0)
                    {
                        phiIndex                  = int.Parse(line.Substring(0, posColon), NumberStyles.Integer);
                        coeff[phiIndex]           = new PhiLambda[table.NumLambdas];
                        line                      = line.Substring(posColon + 1);
                        values                    = line.Split(new[] { ' ' });
                        lambda                    = ProjectionMath.ArcSecondsToRadians(long.Parse(values[0], NumberStyles.Integer));
                        phi                       = ProjectionMath.ArcSecondsToRadians(long.Parse(values[1], NumberStyles.Integer));
                        coeff[phiIndex][0].Phi    = phi;
                        coeff[phiIndex][0].Lambda = lambda;
                        lambdaIndex               = 1;
                        valueIndex                = 2;
                    }
                    else
                    {
                        values     = line.Split(new[] { ' ' });
                        valueIndex = 0;
                    }

                    if (phiIndex >= 0)
                    {
                        while (lambdaIndex < table.NumLambdas)
                        {
                            lambda += ProjectionMath.ArcMicroSecondsToRadians(
                                long.Parse(values[valueIndex++], NumberStyles.Integer));
                            phi += ProjectionMath.ArcMicroSecondsToRadians(
                                long.Parse(values[valueIndex++], NumberStyles.Integer));

                            coeff[phiIndex][lambdaIndex].Phi    = phi;
                            coeff[phiIndex][lambdaIndex].Lambda = lambda;
                            lambdaIndex++;
                        }
                    }
                }
                table.Coefficients = coeff;
            }
            return(true);
        }