예제 #1
0
        // Create Observer Calls --------------------------------------------

        // Uses all data entered in the create tab to create the named observer
        unsafe private void buttonCreateObserver_Click(object sender, EventArgs e)
        {
            SIMCONNECT_DATA_OBSERVER observerData = new SIMCONNECT_DATA_OBSERVER();

            observerData.Position.Latitude  = TryParseDouble(textBoxCPosLat.Text);
            observerData.Position.Longitude = TryParseDouble(textBoxCPosLong.Text);
            observerData.Position.Altitude  = TryParseDouble(textBoxCPosAlt.Text);

            observerData.Rotation.Heading = TryParseDouble(textBoxCHeading.Text);
            observerData.Rotation.Pitch   = TryParseDouble(textBoxCPitch.Text);
            observerData.Rotation.Bank    = TryParseDouble(textBoxCBank.Text);

            observerData.FieldOfViewH = TryParseFloat(textBoxCFOVH.Text);
            observerData.FieldOfViewV = TryParseFloat(textBoxCFOVV.Text);

            observerData.LinearStep  = TryParseFloat(textBoxCSSLinear.Text);
            observerData.AngularStep = TryParseFloat(textBoxCSSAngular.Text);

            observerData.FocalLength = TryParseFloat(textBoxCFocalLength.Text);

            if (radioButtonCFocusPoint.Checked)
            {
                observerData.FocusFixed = (int)OBSERVER_FOCUS_TYPE.OBSERVER_FOCUS_LOCAL;
            }
            else
            {
                observerData.FocusFixed = (int)OBSERVER_FOCUS_TYPE.OBSERVER_FOCUS_WORLD;
            }

            if (checkBoxCGhostMode.Checked)
            {
                observerData.Regime = (int)OBSERVER_REGIME_TYPE.OBSERVER_GHOST;
            }
            else if (checkBoxCPassWater.Checked)
            {
                observerData.Regime = (int)OBSERVER_REGIME_TYPE.OBSERVER_TELLURIAN;
            }
            else
            {
                observerData.Regime = (int)OBSERVER_REGIME_TYPE.OBSERVER_TERRESTRIAL;
            }

            simconnect.CreateObserver(textBoxCObserverName.Text, observerData);

            displayText("Observer \"" + textBoxCObserverName.Text + "\" created");
        }