public void ParseEsriStringWithoutBracketInSpheroidName()
        {
            Spheroid s = new Spheroid();

            Assert.DoesNotThrow(() => s.ParseEsriString("GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]"));
            Assert.AreEqual("WGS_1984", s.Name, "The Spheroid name does not equal WGS_1984.");
        }
Beispiel #2
0
        public void TestBltoxy()
        {
            {
                //Spheroid BJ = new Spheroid(6378245, 298.3);

                IProj proj = new GaussProj(Spheroid.CreateBeiJing1954());

                double B = SurMath.DMStoRAD(21.58470845);
                double l = SurMath.DMStoRAD(2.25314880);
                proj.Bltoxy(B, l, out double x, out double y, out _, out _);
                //B = 21 ◦ 58 ′ 47.0845 ′′ ,L = 113 ◦ 25 ′ 31.4880 ′′ ,
                //x = 2433586.692,y = 250547.403
                Assert.AreEqual(2433586.692, x, 1e-3);
                Assert.AreEqual(250547.403, y, 1e-3);
            }

            {
                //B = 21 ◦ 58 ′ 47.0845 ′′ ,L = 113 ◦ 25 ′ 31.4880 ′′ ,
                //x = 2433586.692,y = 250547.403
                IProj proj = new GaussProj(Spheroid.CreateBeiJing1954());

                double B  = SurMath.DMStoRAD(21.58470845);
                double L  = SurMath.DMStoRAD(113.25314880);
                double L0 = SurMath.DMStoRAD(111);
                proj.BLtoXYKM(B, L, L0, 0, 0, out double x, out double y);

                Assert.AreEqual(2433586.692, x, 1e-3);
                Assert.AreEqual(250547.403, y, 1e-3);
            }
        }
Beispiel #3
0
 void comboBoxCoordinateSystem_SelectedValueChanged(object sender, EventArgs e)
 {
     this.m_CurrentSpheroid = (Spheroid)int.Parse(this.comboBoxCoordinateSystem.SelectedValue.ToString());
     this.m_CoordHelper     = CoordinateFactory.CreateCoordinate(this.m_CurrentSpheroid);
     this.labela.Text       = this.m_CoordHelper.a.ToString();
     this.labelb.Text       = this.m_CoordHelper.b.ToString();
 }
Beispiel #4
0
 public GeomagnetismCalculator(Spheroid spheroid, IEnumerable <IGeomagneticModel> geomagneticModels)
 {
     _spheroid = spheroid;
     if (geomagneticModels != null)
     {
         _models.AddRange(geomagneticModels);
     }
 }
Beispiel #5
0
 public GeoContext(Spheroid spheroid)
 {
     Spheroid               = spheroid;
     GeodeticCalculator     = new SpheroidCalculator(spheroid);
     GeomagnetismCalculator = new GeomagnetismCalculator(spheroid);
     EqualityOptions        = new SpatialEqualityOptions();
     LongitudeWrapping      = false;
 }
 /// <summary>
 /// 拷贝构造函数。
 /// </summary>
 /// <param name="spheroid">地球椭球体对象。</param>
 /// <exception cref="ArgumentNullException">当地球椭球体对象为 Null 时抛出异常。</exception>
 public Spheroid(Spheroid spheroid)
 {
     if (spheroid == null) throw new ArgumentNullException();
     this.Axis = spheroid.Axis;
     this.Flatten = spheroid.Flatten;
     this.Name = spheroid.Name;
     this.Type = spheroid.Type;
 }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     currentMaterial = GetComponent <MeshRenderer>().material;
     parentSpheroid  = FindObjectOfType <Spheroid>(); //only showing one at the moment
     Reset();
     age = UnityEngine.Random.Range(1, 100);
     anInterestingParameter = (transform.position - new Vector3(4, 6, 2)).sqrMagnitude < 25 ? 1 : 0;
 }
        private void CmbEllipsoidSelectedIndexChanged(object sender, EventArgs e)
        {
            Proj4Ellipsoid ell = (Proj4Ellipsoid)Enum.Parse(typeof(Proj4Ellipsoid), (string)cmbEllipsoid.SelectedItem);
            Spheroid       sph = new Spheroid(ell);

            SelectedProjectionInfo.GeographicInfo.Datum.Spheroid = sph;
            dbA.Value = sph.EquatorialRadius;
            dbB.Value = sph.PolarRadius;
        }
Beispiel #9
0
        private static bool IsFalseWgs84(Spheroid spheroid)
        {
            if (spheroid.KnownEllipsoid != Proj4Ellipsoid.WGS_1984)
            {
                return(false);
            }

            return(spheroid.EquatorialRadius != 6378137.0 || spheroid.InverseFlattening != 298.257223563);
        }
 public bool Equals(LambertAzimuthalEqualAreaSpherical other)
 {
     return(!ReferenceEquals(other, null) &&
            (
                GeographicOrigin.Equals(other.GeographicOrigin) &&
                FalseProjectedOffset.Equals(other.FalseProjectedOffset) &&
                Spheroid.Equals(other.Spheroid)
            ));
 }
        public static Spheroid Create(ISpheroidInfo spheroidInfo)
        {
            if (spheroidInfo == null)
            {
                throw new ArgumentNullException("spheroidInfo");
            }
            Contract.Ensures(Contract.Result <Spheroid>() != null);

            var aMeters = spheroidInfo.A;
            var bMeters = spheroidInfo.B;

            if (spheroidInfo.AxisUnit != null)
            {
                var conversion = SimpleUnitConversionGenerator.FindConversion(spheroidInfo.AxisUnit, Proj4LinearUnit.Meter);
                if (conversion != null && !(conversion is UnitUnityConversion))
                {
                    aMeters = conversion.TransformValue(aMeters);
                    bMeters = conversion.TransformValue(bMeters);
                }
            }

            Spheroid result;

            if (aMeters == bMeters)
            {
                var knownMatch = AllKnownSpheroids
                                 .Where(k => k.PolarRadius == aMeters)
                                 .OrderByDescending(k => SpheroidNameNormalizedComparer.Default.Equals(k.Name, spheroidInfo.Name))
                                 .FirstOrDefault();
                if (knownMatch != null)
                {
                    return(knownMatch);
                }

                result             = new Spheroid(Proj4Ellipsoid.Custom);
                result.PolarRadius = aMeters;
            }
            else
            {
                var knownMatch = AllKnownSpheroids
                                 .Where(k => k.EquatorialRadius == aMeters && (k.InverseFlattening == spheroidInfo.InvF || k.PolarRadius == bMeters))
                                 .OrderByDescending(k => SpheroidNameNormalizedComparer.Default.Equals(k.Name, spheroidInfo.Name))
                                 .FirstOrDefault();
                if (knownMatch != null)
                {
                    return(knownMatch);
                }

                result = new Spheroid(Proj4Ellipsoid.Custom);
                result.EquatorialRadius = aMeters;
                // NOTE: do not directly set the InverseFlattening as it is stored as PolarRadius
                result.PolarRadius = bMeters;
            }
            result.Name = spheroidInfo.Name;
            return(result);
        }
Beispiel #12
0
 public bool Equals(CassiniSoldner other)
 {
     return(!ReferenceEquals(other, null) &&
            (
                NaturalOrigin.Equals(other.NaturalOrigin) &&
                FalseProjectedOffset.Equals(other.FalseProjectedOffset) &&
                Spheroid.Equals(other.Spheroid)
            )
            );
 }
	public LambertConformalConic(double centralMeridian, double originLatitude,
			double standardParallel1, double standardParallel2, Spheroid spheroid)
	{
		_centralMeridian = centralMeridian * RadiansPerDegree;
		_originLatitude = originLatitude * RadiansPerDegree;
		_standardParallel1 = standardParallel1 * RadiansPerDegree;
		_standardParallel2 = standardParallel2 * RadiansPerDegree;
		_spheroid = spheroid;

		Initialize();
	}
    public LambertConformalConic(double centralMeridian, double originLatitude,
                                 double standardParallel1, double standardParallel2, Spheroid spheroid)
    {
        _centralMeridian   = centralMeridian * RadiansPerDegree;
        _originLatitude    = originLatitude * RadiansPerDegree;
        _standardParallel1 = standardParallel1 * RadiansPerDegree;
        _standardParallel2 = standardParallel2 * RadiansPerDegree;
        _spheroid          = spheroid;

        Initialize();
    }
Beispiel #15
0
 public bool Equals(LambertConicConformal1Sp other)
 {
     return(!ReferenceEquals(other, null) &&
            (
                GeographicOrigin.Equals(other.GeographicOrigin)
                // ReSharper disable CompareOfFloatsByEqualityOperator
                && OriginScaleFactor == other.OriginScaleFactor
                // ReSharper restore CompareOfFloatsByEqualityOperator
                && FalseProjectedOffset.Equals(other.FalseProjectedOffset) &&
                Spheroid.Equals(other.Spheroid)
            )
            );
 }
Beispiel #16
0
        static void Main(string[] args)
        {
            int THREADS = 2;
            int OBJECTS = 2;

            if (args.Length != 0)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i] == "--threads")
                    {
                        i++;
                        if (int.Parse(args[i]) > THREADS)
                        {
                            THREADS = int.Parse(args[i]);
                        }
                    }

                    if (args[i] == "--objects")
                    {
                        i++;
                        OBJECTS = int.Parse(args[i]);
                    }
                }
            }

            Console.WriteLine("Using {0} threads", THREADS);
            Console.WriteLine("Creating {0} objects", OBJECTS);
            Thread.Sleep(1000);

            Random rand = new Random();

            System.Collections.ArrayList objs      = new System.Collections.ArrayList();
            PhysicsSimulation            m_Physics = new PhysicsSimulation(THREADS);

            for (int i = 0; i < OBJECTS; i++)
            {
                Spheroid m_Spheroid = new Spheroid(
                    new Vector3(rand.Next(-100, 100), rand.Next(-100, 100), rand.Next(-100, 100)),
                    new Vector3(1, 1, 1),
                    rand.Next(1, 9));
                objs.Add(m_Spheroid);
            }
            Console.SetCursorPosition(0, Console.CursorTop);
            Console.Write(">");

            ControlPlane control = new ControlPlane(objs, THREADS);

            control.Start();
        }
Beispiel #17
0
    public TransverseMercator(double centralMeridian, double originLatitude, double scaleFactor, Spheroid spheroid)
    {
        if ((originLatitude < -MaxLatitude) || (originLatitude > MaxLatitude))
        {
            throw new ArgumentException("Origin latitude out of range");
        }

        if (centralMeridian > 180)
        {
            centralMeridian -= 360;
        }

        if ((centralMeridian < -180) || (centralMeridian > 180))
        {
            throw new ArgumentException("Origin longitude out of range");
        }

        if ((scaleFactor < MinScaleFactor) || (scaleFactor > MaxScaleFactor))
        {
            throw new ArgumentException("Scale factor out of range");
        }

        _centralMeridian = centralMeridian * RadiansPerDegree;
        _originLatitude  = originLatitude * RadiansPerDegree;
        _scaleFactor     = scaleFactor;
        _spheroid        = spheroid;

        _es  = _spheroid.Eccentricity * _spheroid.Eccentricity;
        _ebs = (1.0 / (1.0 - _es)) - 1.0;

        double b   = _spheroid.SemiMinorAxis;
        double tn  = (_spheroid.SemiMajorAxis - b) / (_spheroid.SemiMajorAxis + b);
        double tn2 = tn * tn;
        double tn3 = tn2 * tn;
        double tn4 = tn3 * tn;
        double tn5 = tn4 * tn;

        _ap = _spheroid.SemiMajorAxis * (1.0 - tn + 5.0 * (tn2 - tn3) / 4.0 + 81.0 * (tn4 - tn5) / 64.0);
        _bp = 3.0 * _spheroid.SemiMajorAxis * (tn - tn2 + 7.0 * (tn3 - tn4) / 8.0 + 55.0 * tn5 / 64.0) / 2.0;
        _cp = 15.0 * _spheroid.SemiMajorAxis * (tn2 - tn3 + 3.0 * (tn4 - tn5) / 4.0) / 16.0;
        _dp = 35.0 * _spheroid.SemiMajorAxis * (tn3 - tn4 + 11.0 * tn5 / 16.0) / 48.0;
        _ep = 315.0 * _spheroid.SemiMajorAxis * (tn4 - tn5) / 512.0;

        double n;

        ToProjected(centralMeridian, MaxLatitude, out n, out _deltaNorthing);
        ToProjected(centralMeridian + MaxDeltaLongitude, 0, out _deltaEasting, out n);

        _tmdo = GetTrueMeridianalDistance(_originLatitude);
    }
Beispiel #18
0
 public void CollectionAguments()
 {
     if (!String.IsNullOrEmpty(cmbDatumName.Text) && cmbDatumName.Text != "<自定义>")
     {
         _datumName = cmbDatumName.Text;
     }
     else
     {
         throw new ArgumentNullException("基准面的名字为空");
     }
     paramSpheroid.CollectionAguments();
     _datumSpheroid = new Spheroid(paramSpheroid.SpheroidName, paramSpheroid.SpheroidSemimajorAxis,
                                   paramSpheroid.SpheroidSemiminorAxis, paramSpheroid.SpheroidInverseFlattening);
 }
Beispiel #19
0
 public bool Equals(LambertConicConformal2Sp other)
 {
     return(!ReferenceEquals(other, null) &&
            (
                GeographicOrigin.Equals(other.GeographicOrigin)
                // ReSharper disable CompareOfFloatsByEqualityOperator
                && FirstParallel == other.FirstParallel &&
                SecondParallel == other.SecondParallel
                // ReSharper restore CompareOfFloatsByEqualityOperator
                && FalseProjectedOffset.Equals(other.FalseProjectedOffset) &&
                Spheroid.Equals(other.Spheroid)
            )
            );
 }
Beispiel #20
0
	public TransverseMercator(double centralMeridian, double originLatitude, double scaleFactor, Spheroid spheroid)
	{
		if ((originLatitude < -MaxLatitude) || (originLatitude > MaxLatitude))
		{
			throw new ArgumentException("Origin latitude out of range");
		}

		if (centralMeridian > 180)
		{
			centralMeridian -= 360;
		}

		if ((centralMeridian < -180) || (centralMeridian > 180))
		{
			throw new ArgumentException("Origin longitude out of range");
		}

		if ((scaleFactor < MinScaleFactor) || (scaleFactor > MaxScaleFactor))
		{
			throw new ArgumentException("Scale factor out of range");
		}

		_centralMeridian = centralMeridian * RadiansPerDegree;
		_originLatitude = originLatitude * RadiansPerDegree;
		_scaleFactor = scaleFactor;
		_spheroid = spheroid;

		_es = _spheroid.Eccentricity * _spheroid.Eccentricity;
		_ebs = (1.0 / (1.0 - _es)) - 1.0;

		double b = _spheroid.SemiMinorAxis;
		double tn = (_spheroid.SemiMajorAxis - b) / (_spheroid.SemiMajorAxis + b);
		double tn2 = tn * tn;
		double tn3 = tn2 * tn;
		double tn4 = tn3 * tn;
		double tn5 = tn4 * tn;

		_ap = _spheroid.SemiMajorAxis * (1.0 - tn + 5.0 * (tn2 - tn3) / 4.0 + 81.0 * (tn4 - tn5) / 64.0);
		_bp = 3.0 * _spheroid.SemiMajorAxis * (tn - tn2 + 7.0 * (tn3 - tn4) / 8.0 + 55.0 * tn5 / 64.0) / 2.0;
		_cp = 15.0 * _spheroid.SemiMajorAxis * (tn2 - tn3 + 3.0 * (tn4 - tn5) / 4.0) / 16.0;
		_dp = 35.0 * _spheroid.SemiMajorAxis * (tn3 - tn4 + 11.0 * tn5 / 16.0) / 48.0;
		_ep = 315.0 * _spheroid.SemiMajorAxis * (tn4 - tn5) / 512.0;

		double n;
		ToProjected(centralMeridian, MaxLatitude, out n, out _deltaNorthing);
		ToProjected(centralMeridian + MaxDeltaLongitude, 0, out _deltaEasting, out n);

		_tmdo = GetTrueMeridianalDistance(_originLatitude);
	}
Beispiel #21
0
        public void TestxytoBl()
        {
            {
                //B = 21 ◦ 58 ′ 47.0845 ′′ ,L = 113 ◦ 25 ′ 31.4880 ′′ ,

                IProj proj = new GaussProj(Spheroid.CreateBeiJing1954());

                double x = 2433586.692, y = 250547.403;
                proj.xytoBl(x, y, out double B, out double l, out _, out _);

                B = SurMath.RADtoDMS(B);
                l = SurMath.RADtoDMS(l);

                Assert.AreEqual(21.58470845, B, 1e-8);
                Assert.AreEqual(2.25314880, l, 1e-8);
            }
        }
Beispiel #22
0
 public bool Equals(Mercator other)
 {
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(!ReferenceEquals(other, null) &&
            (
                // ReSharper disable CompareOfFloatsByEqualityOperator
                CentralMeridian == other.CentralMeridian &&
                ScaleFactor == other.ScaleFactor
                // ReSharper restore CompareOfFloatsByEqualityOperator
                && FalseProjectedOffset.Equals(other.FalseProjectedOffset) &&
                Spheroid.Equals(other.Spheroid)
            )
            );
 }
        /// <summary>
        /// Initializes the transform using the parameters from the specified coordinate system information
        /// </summary>
        /// <param name="projInfo">A ProjectionInfo class contains all the standard and custom parameters needed to initialize this transform</param>
        protected override void OnInit(ProjectionInfo projInfo)
        {
            if (projInfo.AuxiliarySphereType == AuxiliarySphereType.AuthalicWithConvertedLatitudes)
            {
                throw new NotSupportedException("The conversion which requries latitude conversion to authalic latitudes is not yet supported");
            }
            double phits   = 0.0;
            bool   isPhits = false;

            if (projInfo.StandardParallel1 != null)
            {
                isPhits = true;
                phits   = projInfo.Phi1;
                if (phits >= HALF_PI)
                {
                    throw new ProjectionException(-24);
                }
            }

            if (IsElliptical)
            { /* ellipsoid */
                if (isPhits)
                {
                    K0 = Proj.Msfn(Math.Sin(phits), Math.Cos(phits), Es);
                }
            }
            else
            { /* sphere */
                if (isPhits)
                {
                    K0 = Math.Cos(phits);
                }
            }

            if (projInfo.AuxiliarySphereType == AuxiliarySphereType.AuthalicWithConvertedLatitudes)
            {
                Spheroid sph = new Spheroid(Proj4Ellipsoid.WGS_1984);
                _ae = Math.Acos(sph.PolarRadius / sph.EquatorialRadius);
                _geodeticToAuthalic = true;
            }
        }
Beispiel #24
0
        private void buttonExportTFHCoord_Click(object sender, EventArgs e)
        {
            this.m_CurrentSpheroid = (Spheroid)int.Parse(this.comboBoxCoordinateSystem.SelectedValue.ToString());
            this.m_CoordHelper     = CoordinateFactory.CreateCoordinate(this.m_CurrentSpheroid);

            SaveFileDialog saveDialog = new SaveFileDialog();

            saveDialog.Filter           = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
            saveDialog.FilterIndex      = 1;
            saveDialog.RestoreDirectory = true;
            if (saveDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string fileName = saveDialog.FileName;
                Stream fs       = saveDialog.OpenFile();
                using (StreamWriter sw = new StreamWriter(fs))
                {
                    List <string> xyList = new List <string>();
                    foreach (TFHObject obj in this.m_AllTFHS)
                    {
                        string[] xys = obj.Extent.Split(',');
                        if (xys.Length == 4)
                        {
                            double ltl = double.Parse(xys[0]);
                            double ltb = double.Parse(xys[1]);
                            double rbl = double.Parse(xys[2]);
                            double rbb = double.Parse(xys[3]);

                            double  ltYe, ltXn, rbYe, rbXn;
                            LonWide lw    = (LonWide)int.Parse(this.comboBoxLonWide.SelectedValue.ToString());
                            int     delno = int.Parse(this.textBoxDELNO.Text.Trim());
                            this.m_CoordHelper.GaussPrjCalculate(ltl, ltb, lw, delno, out ltYe, out ltXn);
                            this.m_CoordHelper.GaussPrjCalculate(rbl, rbb, lw, delno, out rbYe, out rbXn);
                            string lbinfo  = string.Format("{0} {1} {2} {3}", ltl, ltb, rbl, rbb);
                            string xyinfo  = string.Format("{0} {1} {2} {3}", ltYe, ltXn, rbYe, rbXn);
                            string tfhinfo = string.Format("{0},{1},{2}", obj.TFH, lbinfo, xyinfo);
                            sw.WriteLine(tfhinfo);
                        }
                    }
                }
            }
        }
Beispiel #25
0
        public static ICoordinate CreateCoordinate(Spheroid s)
        {
            ICoordinate coordinate;

            switch (s)
            {
            case Spheroid.Beijing54:
                coordinate = new Beijing54();
                break;

            case Spheroid.WGS84:
                coordinate = new WGS84();
                break;

            case Spheroid.Xian80:
                coordinate = new Xian80();
                break;

            default:
                coordinate = null;
                break;
            }
            return(coordinate);
        }
Beispiel #26
0
 public GeomagnetismCalculator(Spheroid spheroid) : this(spheroid, null)
 {
 }
Beispiel #27
0
        private void buttonExportXYTFHShape_Click(object sender, EventArgs e)
        {
            if (this.m_AllTFHS.Count > 0)
            {
                this.m_CurrentSpheroid = (Spheroid)int.Parse(this.comboBoxCoordinateSystem.SelectedValue.ToString());
                this.m_CoordHelper     = CoordinateFactory.CreateCoordinate(this.m_CurrentSpheroid);
                MapScaleObject scaleObj = this.comboBoxLTRBMapScale.SelectedItem as MapScaleObject;

                SaveFileDialog saveDialog = new SaveFileDialog();
                saveDialog.Filter           = "Shape文件(*.shp)|*.*|所有文件(*.*)|*.*";
                saveDialog.FilterIndex      = 1;
                saveDialog.RestoreDirectory = true;
                saveDialog.FileName         = "XY-" + scaleObj.Scale.ToString();
                if (saveDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string        fileName = saveDialog.FileName;
                    List <string> xyList   = new List <string>();
                    //获取第一个和最后一格
                    TFHObject firstTFHObj = null;
                    TFHObject endTFHObj   = null;
                    int       tmpHs       = 0;
                    int       tmpLs       = 0;
                    firstTFHObj = this.m_AllTFHS[0];
                    endTFHObj   = this.m_AllTFHS[this.m_AllTFHS.Count - 1];
                    for (int i = 0; i < this.m_AllTFHS.Count; i++)
                    {
                        if (this.m_AllTFHS[i].H1 == firstTFHObj.H1)
                        {
                            tmpLs++;
                        }
                        else
                        {
                            break;
                        }
                    }
                    tmpHs = this.m_AllTFHS.Count / tmpLs;

                    double   ltYe, ltXn, rbYe, rbXn;
                    LonWide  lw         = (LonWide)int.Parse(this.comboBoxLonWide.SelectedValue.ToString());
                    int      delno      = int.Parse(this.textBoxDELNO.Text.Trim());
                    string[] firstTLXYs = firstTFHObj.Extent.Split(',');
                    string[] endRBXYs   = endTFHObj.Extent.Split(',');
                    double   ltl        = double.Parse(firstTLXYs[0]);
                    double   ltb        = double.Parse(firstTLXYs[1]);
                    double   rbl        = double.Parse(endRBXYs[2]);
                    double   rbb        = double.Parse(endRBXYs[3]);
                    this.m_CoordHelper.GaussPrjCalculate(ltl, ltb, lw, delno, out ltYe, out ltXn);
                    this.m_CoordHelper.GaussPrjCalculate(rbl, rbb, lw, delno, out rbYe, out rbXn);
                    double rXn = 0, rYe = 0;
                    rXn = Math.Abs((ltXn - rbXn) / tmpHs);
                    rYe = Math.Abs((rbYe - ltYe) / tmpLs);

                    for (int i = 0; i < this.m_AllTFHS.Count; i++)
                    {
                        double tmpLTYe = 0, tmpLTXn = 0, tmpRBYe = 0, tmpRBXn = 0;
                        int    tmpH = (int)(Math.Floor((double)(i / tmpLs)));
                        int    tmpL = (int)(i % tmpLs);
                        string xy   = string.Empty;

                        tmpLTYe = ltYe + rYe * tmpL;
                        tmpLTXn = ltXn - rXn * tmpH;
                        tmpRBYe = ltYe + rYe * (tmpL + 1);
                        tmpRBXn = ltXn - rXn * (tmpH + 1);

                        xy += string.Format("{0},", this.m_AllTFHS[i].TFH);
                        xy += string.Format("{0} {1},", tmpLTYe, tmpRBXn);
                        xy += string.Format("{0} {1},", tmpLTYe, tmpLTXn);
                        xy += string.Format("{0} {1},", tmpRBYe, tmpLTXn);
                        xy += string.Format("{0} {1},", tmpRBYe, tmpRBXn);
                        xy += string.Format("{0} {1}", tmpLTYe, tmpRBXn);
                        xyList.Add(xy);
                    }
                    try
                    {
                        ShapeUtility.ExportShapeFile(fileName, xyList);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
 public Proj4SpheroidWrapper(Spheroid spheroid)
     : base(spheroid.Name ?? "Unknown", new AuthorityTag("PROJ4", spheroid.Code))
 {
     Contract.Requires(spheroid != null);
     Core = spheroid;
 }
Beispiel #29
0
 private static bool IsInvalidSpheroid(Spheroid spheroid)
 {
     return(spheroid.InverseFlattening == 0);
 }
 private void cmbEllipsoid_SelectedIndexChanged(object sender, EventArgs e)
 {
     Proj4Ellipsoid ell = (Proj4Ellipsoid)Enum.Parse(typeof(Proj4Ellipsoid), (string)cmbEllipsoid.SelectedItem);
     Spheroid sph = new Spheroid(ell);
     _selectedProjectionInfo.GeographicInfo.Datum.Spheroid = sph;
     dbA.Value = sph.EquatorialRadius;
     dbB.Value = sph.PolarRadius;
 }
Beispiel #31
0
 public IgrfGeomagnetismCalculator(Spheroid spheroid) : base(spheroid, IgrfModelFactory.GetModels())
 {
 }
        /// <summary>
        /// Initializes the transform using the parameters from the specified coordinate system information
        /// </summary>
        /// <param name="projInfo">A ProjectionInfo class contains all the standard and custom parameters needed to initialize this transform</param>
        protected override void OnInit(ProjectionInfo projInfo)
        {
            if (projInfo.AuxiliarySphereType == AuxiliarySphereType.AuthalicWithConvertedLatitudes)
            {
                throw new NotSupportedException("The conversion which requries latitude conversion to authalic latitudes is not yet supported");
            }
            double phits = 0.0;
            bool isPhits = false;
            if (projInfo.StandardParallel1 != null)
            {
                isPhits = true;
                phits = projInfo.Phi1;
                if (phits >= HALF_PI) throw new ProjectionException(-24);
            }

            if (IsElliptical)
            { /* ellipsoid */
                if (isPhits) K0 = Proj.Msfn(Math.Sin(phits), Math.Cos(phits), Es);
            }
            else
            { /* sphere */
                if (isPhits) K0 = Math.Cos(phits);
            }

            if (projInfo.AuxiliarySphereType == AuxiliarySphereType.AuthalicWithConvertedLatitudes)
            {
                Spheroid sph = new Spheroid(Proj4Ellipsoid.WGS_1984);
                _ae = Math.Acos(sph.PolarRadius / sph.EquatorialRadius);
                _geodeticToAuthalic = true;
            }
        }
Beispiel #33
0
 public WmmGeomagnetismCalculator(Spheroid spheroid) : base(spheroid, GeomagneticModels)
 {
 }
Beispiel #34
0
 float TestO2ThresholdPositionBased(Spheroid parent)
 {
     return((transform.position - parentSpheroid.transform.position).sqrMagnitude);
 }