GetVesselLattitude() public static method

public static GetVesselLattitude ( Vessel vessel ) : float
vessel Vessel
return float
Example #1
0
        public GeoCoordinates(Vessel vessel)
        {
            this.Lat    = (double)VesselUtils.GetVesselLattitude(vessel);
            this.Lng    = (double)VesselUtils.GetVesselLongitude(vessel);
            this.Vessel = vessel;

            Body = vessel.mainBody;
        }
Example #2
0
        public override object GetSuffix(string suffixName)
        {
            if (suffixName == "DIRECTION")
            {
                var vector = (target.GetWorldPos3D() - context.Vessel.GetWorldPos3D());
                return(new Direction(vector, false));
            }

            if (suffixName == "DISTANCE")
            {
                return((float)GetDistance());
            }
            if (suffixName == "BEARING")
            {
                return(VesselUtils.GetTargetBearing(context.Vessel, target));
            }
            if (suffixName == "HEADING")
            {
                return(VesselUtils.GetTargetHeading(context.Vessel, target));
            }
            if (suffixName == "PROGRADE")
            {
                return(GetPrograde());
            }
            if (suffixName == "RETROGRADE")
            {
                return(GetRetrograde());
            }
            if (suffixName == "MAXTHRUST")
            {
                return(VesselUtils.GetMaxThrust(target));
            }
            if (suffixName == "VELOCITY")
            {
                return(new VesselVelocity(target));
            }
            if (suffixName == "GEOPOSITION")
            {
                return(new GeoCoordinates(target));
            }
            if (suffixName == "LATITUDE")
            {
                return(VesselUtils.GetVesselLattitude(target));
            }
            if (suffixName == "LONGITUDE")
            {
                return(VesselUtils.GetVesselLongitude(target));
            }
            if (suffixName == "FACING")
            {
                return(GetFacing());
            }
            if (suffixName == "UP")
            {
                return(new Direction(target.upAxis, false));
            }
            if (suffixName == "NORTH")
            {
                return(new Direction(VesselUtils.GetNorthVector(target), false));
            }
            if (suffixName == "BODY")
            {
                return(target.mainBody.bodyName);
            }
            if (suffixName == "ANGULARMOMENTUM")
            {
                return(new Direction(target.angularMomentum, true));
            }
            if (suffixName == "ANGULARVEL")
            {
                return(new Direction(target.angularVelocity, true));
            }
            if (suffixName == "MASS")
            {
                return(target.GetTotalMass());
            }
            if (suffixName == "VERTICALSPEED")
            {
                return(target.verticalSpeed);
            }
            if (suffixName == "SURFACESPEED")
            {
                return(target.horizontalSrfSpeed);
            }
            if (suffixName == "AIRSPEED")
            {
                return((target.orbit.GetVel() - FlightGlobals.currentMainBody.getRFrmVel(target.GetWorldPos3D())).magnitude);                          //the velocity of the vessel relative to the air);
            }
            if (suffixName == "VESSELNAME")
            {
                return(target.vesselName);
            }
            if (suffixName == "ALTITUDE")
            {
                return(target.altitude);
            }
            if (suffixName == "APOAPSIS")
            {
                return(target.orbit.ApA);
            }
            if (suffixName == "PERIAPSIS")
            {
                return(target.orbit.PeA);
            }
            if (suffixName == "SENSOR")
            {
                return(new VesselSensors(target));
            }
            if (suffixName == "TERMVELOCITY")
            {
                return(VesselUtils.GetTerminalVelocity(target));
            }

            // Is this a resource?
            double dblValue;

            if (VesselUtils.TryGetResource(target, suffixName, out dblValue))
            {
                return(dblValue);
            }

            return(base.GetSuffix(suffixName));
        }