Exemplo n.º 1
0
        void sc_OnRecvSimobjectData(BeatlesBlog.SimConnect.SimConnect sender, BeatlesBlog.SimConnect.SIMCONNECT_RECV_SIMOBJECT_DATA data)
        {
            SampleData sample = (SampleData)data.dwData;

            Samples.Insert(0, sample);  // store this sample in the main collection

            if (polyline.Locations.Count == 0)
            {   // stick the first point in twice, so we can start updating the zeroeth position right now
                polyline.Locations.Add(sample.Location);
                polyline.Locations.Add(sample.Location);
            }

            if ((Samples.Count % 6) == 0)
            {   // create a new polyline point every 6 samples
                polyline.Locations.Insert(0, sample.Location);
            }

            polyline.Locations[0] = sample.Location;    // update zeroeth sample in polyline to current location
            mapMain.Center        = sample.Location;    // update map cener to current location
        }
Exemplo n.º 2
0
        void sc_OnRecvSimobjectData(BeatlesBlog.SimConnect.SimConnect sender, BeatlesBlog.SimConnect.SIMCONNECT_RECV_SIMOBJECT_DATA data)
        {
            Console.WriteLine("OnRecvSimobjectData");
            switch ((Requests)data.dwRequestID)
            {
            case Requests.WeatherAtLocation:
                // SimObjectData related to Weather At User's Location, request interpolated observation
            {
                VehiclePosition ap = (VehiclePosition)data.dwData;
                sc.WeatherRequestInterpolatedObservation(Requests.WeatherObservation, ap.latitude, ap.longitude, ap.altitude);
            }
            break;

            case Requests.WeatherNearestLocation:
                // SimObjectData related to Weather Station Nearest User's Location, request observation at nearest station
            {
                VehiclePosition ap = (VehiclePosition)data.dwData;
                sc.WeatherRequestObservationAtNearestStation(Requests.WeatherObservationNearestStation, ap.latitude, ap.longitude);
            }
            break;
            }
        }