Exemple #1
0
 /// <summary>
 /// Interpret the vector given as a 3D position, and return the geocoordinates directly underneath it on this body.
 /// </summary>
 /// <param name="position">Vector to use as the 3D position in ship-raw coords</param>
 /// <returns>The GeoCoordinates under the position.</returns>
 public GeoCoordinates GeoCoordinatesFromPosition(Vector position)
 {
     Vector3d unityWorldPosition = Shared.Vessel.findWorldCenterOfMass() + position.ToVector3D();
     double lat = Body.GetLatitude(unityWorldPosition);
     double lng = Body.GetLongitude(unityWorldPosition);
     return new GeoCoordinates(Body, Shared, lat, lng);
 }
Exemple #2
0
        /// <summary>
        /// Interpret the vector given as a 3D position, and return the geocoordinates directly underneath it on this body.
        /// </summary>
        /// <param name="position">Vector to use as the 3D position in ship-raw coords</param>
        /// <returns>The GeoCoordinates under the position.</returns>
        public GeoCoordinates GeoCoordinatesFromPosition(Vector position)
        {
            Vector3d unityWorldPosition = Shared.Vessel.CoMD + position.ToVector3D();
            double   lat = Body.GetLatitude(unityWorldPosition);
            double   lng = Body.GetLongitude(unityWorldPosition);

            return(new GeoCoordinates(Body, Shared, lat, lng));
        }
Exemple #3
0
        /// <summary>
        /// Interpret the vector given as a 3D position, and return the altitude above sea level of this body.
        /// </summary>
        /// <param name="position">Vector to use as the 3D position in ship-raw coords</param>
        /// <returns>The altitude above 'sea level'.</returns>
        public ScalarValue AltitudeFromPosition(Vector position)
        {
            Vector3d unityWorldPosition = Shared.Vessel.CoMD + position.ToVector3D();

            return(Body.GetAltitude(unityWorldPosition));
        }
Exemple #4
0
 /// <summary>
 /// Interpret the vector given as a 3D position, and return the altitude above sea level of this body.
 /// </summary>
 /// <param name="position">Vector to use as the 3D position in ship-raw coords</param>
 /// <returns>The altitude above 'sea level'.</returns>
 public double AltitudeFromPosition(Vector position)
 {
     Vector3d unityWorldPosition = Shared.Vessel.findWorldCenterOfMass() + position.ToVector3D();
     return Body.GetAltitude(unityWorldPosition);
 }
Exemple #5
0
 /// <summary>
 /// Interpret the vector given as a 3D position, and return the altitude above sea level of this body.
 /// </summary>
 /// <param name="position">Vector to use as the 3D position in ship-raw coords</param>
 /// <returns>The altitude above 'sea level'.</returns>
 public ScalarValue AltitudeFromPosition(Vector position)
 {
     Vector3d unityWorldPosition = Shared.Vessel.CoMD + position.ToVector3D();
     return Body.GetAltitude(unityWorldPosition);
 }
Exemple #6
0
        /// <summary>
        /// Interpret the vector given as a 3D position, and return the altitude above sea level of this body.
        /// </summary>
        /// <param name="position">Vector to use as the 3D position in ship-raw coords</param>
        /// <returns>The altitude above 'sea level'.</returns>
        public double AltitudeFromPosition(Vector position)
        {
            Vector3d unityWorldPosition = Shared.Vessel.findWorldCenterOfMass() + position.ToVector3D();

            return(Body.GetAltitude(unityWorldPosition));
        }
Exemple #7
0
        public override bool SetSuffix(string suffixName, object value)
        {
            double dblValue    = 0.0;
            bool   boolValue   = false;
            string strValue    = "";
            var    rgbaValue   = new RgbaColor(1, 1, 1);
            var    vectorValue = new Vector(0, 0, 0);

            // When the wrong type of value is given, attempt
            // to make at least SOME value out of it that won't crash
            // the system.  This was added because now the value can
            // be a wide variety of different types and this check
            // used to deny any of them being usable other than doubles.
            // This is getting a bit silly looking and something else
            // needs to be done, I think.
            if (value is double || value is int || value is float || value is long)
            {
                dblValue  = Convert.ToDouble(value);
                boolValue = (Convert.ToBoolean(value));
            }
            else if (value is bool)
            {
                boolValue = (bool)value;
                dblValue  = ((bool)value) ? 1.0 : 0.0;
            }
            else if (value is RgbaColor)
            {
                rgbaValue = (RgbaColor)value;
            }
            else if (value is Vector)
            {
                vectorValue = (Vector)value;
            }
            else if (value is String)
            {
                strValue = value.ToString();
            }
            else if (!double.TryParse(value.ToString(), out dblValue))
            {
                return(false);
            }

            switch (suffixName)
            {
            case "VEC":
            case "VECTOR":
                Vector = vectorValue.ToVector3D();
                RenderPointCoords();
                return(true);

            case "SHOW":
                SetShow(boolValue);
                return(true);

            case "COLOR":
            case "COLOUR":
                Color = rgbaValue;
                RenderColor();
                return(true);

            case "START":
                Start = vectorValue.ToVector3D();
                RenderPointCoords();
                return(true);

            case "SCALE":
                Scale = dblValue;
                RenderPointCoords();
                return(true);

            case "LABEL":
                SetLabel(strValue);
                return(true);

            case "WIDTH":
                Width = dblValue;
                RenderPointCoords();
                return(true);
            }

            return(base.SetSuffix(suffixName, value));
        }