示例#1
0
        private void SendAltitudeToSimconnect(double altitude)
        {
            SimConnectDataStruct planeStructure = (SimConnectDataStruct)_planeVM;

            planeStructure.altitude = altitude;
            FSXConnectionManager.Instance.SendDataToSimconnect(planeStructure);
        }
示例#2
0
        private void SendLatLonToSimconnect(double lat, double lng)
        {
            SimConnectDataStruct planeStructure = (SimConnectDataStruct)_planeVM;

            planeStructure.latitude  = lat;
            planeStructure.longitude = lng;
            _mapVM.RemoveMarkers();
            FSXConnectionManager.Instance.SendDataToSimconnect(planeStructure);
        }
 public bool SendDataToSimconnect(SimConnectDataStruct data)
 {
     if (_simConnect != null)
     {
         _simConnect.SetDataOnSimObject(SIMCONNECT_DATA_DEFINITION_ID.planeLocation, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_DATA_SET_FLAG.DEFAULT, data);
         return(true);
     }
     else
     {
         return(false);
     }
 }
        private void SetupPulling()
        {
            foreach (var simConnectDataMember in SimConnectDataStruct.GetMetaData())
            {
                _simConnect.AddToDataDefinition(SIMCONNECT_DATA_DEFINITION_ID.planeLocation, simConnectDataMember.Header, simConnectDataMember.Unit, simConnectDataMember.Type, simConnectDataMember.FEpsilon, SimConnect.SIMCONNECT_UNUSED);
            }
            _simConnect.MapClientEventToSimEvent(EVENT_ID.EVENT_PAUSE, "pause_toggle");
            _simConnect.MapClientEventToSimEvent(EVENT_ID.EVENT_BRAKES, "brakes");


            _simConnect.RegisterDataDefineStruct <SimConnectDataStruct>(SIMCONNECT_DATA_DEFINITION_ID.planeLocation);
            _simConnect.RequestDataOnSimObject(DATA_REQUEST_ID.REQUEST_1, SIMCONNECT_DATA_DEFINITION_ID.planeLocation, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD.SECOND, 0, 0, 0, 0);
        }
 public void Update(SimConnectDataStruct planeStructure)
 {
     Longitude     = planeStructure.longitude;
     Latitude      = planeStructure.latitude;
     Altitude      = planeStructure.altitude;
     Airspeed      = planeStructure.airspeed;
     Pitch         = planeStructure.pitch;
     Bank          = planeStructure.bank;
     Delta         = planeStructure.delta;
     Turn          = planeStructure.turn;
     Heading       = planeStructure.heading;
     VerticalSpeed = planeStructure.verticalSpeed;
     GroundSpeed   = planeStructure.groundSpeed;
 }
示例#6
0
        private void ProcessSimConnectMessage(SimConnectDataStruct dataStruct)
        {
            _planeVM.Update(dataStruct);

            Location planePoint = new Location(_planeVM.Latitude, _planeVM.Longitude);

            lock (_planeLocationLock)
            {
                _planeLocation = planePoint;
            }
            _mapVM.AddLocationToPolygon(planePoint);

            if (_autoMapCenter)
            {
                _mapVM.Center = planePoint;
                _zoom         = (int)Math.Min(_maxZoom - Math.Ceiling(_planeVM.GroundSpeed / (_maxZoom - _minZoom)), _maxZoom);
                _mapVM.Zoom   = _zoom;
            }
        }