public StaticAnalysisGraphGUI(EditorSimManager simManager, GUIDropDown <int> flapSettingDropDown, GUIDropDown <CelestialBody> bodySettingDropdown)
        {
            this.simManager          = simManager;
            this.flapSettingDropdown = flapSettingDropDown;
            this.bodySettingDropdown = bodySettingDropdown;

            //Set up defaults for AoA Sweep
            aoASweepInputs              = new GraphInputs();
            aoASweepInputs.lowerBound   = "0";
            aoASweepInputs.upperBound   = "25";
            aoASweepInputs.numPts       = "100";
            aoASweepInputs.flapSetting  = 0;
            aoASweepInputs.pitchSetting = "0";
            aoASweepInputs.otherInput   = "0.2";

            //Set up defaults for Mach Sweep
            machSweepInputs              = new GraphInputs();
            machSweepInputs.lowerBound   = "0";
            machSweepInputs.upperBound   = "3";
            machSweepInputs.numPts       = "100";
            machSweepInputs.flapSetting  = 0;
            machSweepInputs.pitchSetting = "0";
            machSweepInputs.otherInput   = "2";

            _graph.SetBoundaries(0, 25, 0, 2);
            _graph.SetGridScaleUsingValues(5, 0.5);
            _graph.horizontalLabel = Localizer.Format("FAREditorStaticGraphAoA");
            _graph.verticalLabel   = Localizer.Format("FAREditorStaticGraphCoeff");
            _graph.Update();
        }
Esempio n. 2
0
        void Start()
        {
            if (CompatibilityChecker.IsAllCompatible() && instance == null)
            {
                instance = this;
            }
            else
            {
                GameObject.Destroy(this);
                return;
            }

            showGUI = false;
            if (FARDebugAndSettings.FARDebugButtonStock)
            {
                FARDebugAndSettings.FARDebugButtonStock.SetFalse(false);
            }

            _vehicleAero = new VehicleAerodynamics();

            guiRect = new Rect(Screen.width / 4, Screen.height / 6, 10, 10);

            _instantSim = new InstantConditionSim();
            GUIDropDown <int>           flapSettingDropDown   = new GUIDropDown <int>(new string[] { Localizer.Format("FARFlapSetting0"), Localizer.Format("FARFlapSetting1"), Localizer.Format("FARFlapSetting2"), Localizer.Format("FARFlapSetting3") }, new int[] { 0, 1, 2, 3 }, 0);
            GUIDropDown <CelestialBody> celestialBodyDropdown = CreateBodyDropdown();

            modeDropdown = new GUIDropDown <FAREditorMode>(FAReditorMode_str, new FAREditorMode[] { FAREditorMode.STATIC, FAREditorMode.STABILITY, FAREditorMode.SIMULATION, FAREditorMode.AREA_RULING });

            _simManager = new EditorSimManager(_instantSim);

            _editorGraph     = new StaticAnalysisGraphGUI(_simManager, flapSettingDropDown, celestialBodyDropdown);
            _stabDeriv       = new StabilityDerivGUI(_simManager, flapSettingDropDown, celestialBodyDropdown);
            _stabDerivLinSim = new StabilityDerivSimulationGUI(_simManager);

            Color crossSection = GUIColors.GetColor(3);

            crossSection.a = 0.8f;

            Color crossSectionDeriv = GUIColors.GetColor(2);

            crossSectionDeriv.a = 0.8f;

            _areaRulingOverlay = EditorAreaRulingOverlay.CreateNewAreaRulingOverlay(new Color(0.05f, 0.05f, 0.05f, 0.7f), crossSection, crossSectionDeriv, 10, 5);
            guiRect.height     = 500;
            guiRect.width      = 650;


            //GameEvents.onEditorVariantApplied.Add(UpdateGeometryEvent); // Rodhern: Downgrade to KSP 1.3.1
            GameEvents.onEditorPartEvent.Add(UpdateGeometryEvent);
            GameEvents.onEditorUndo.Add(ResetEditorEvent);
            GameEvents.onEditorRedo.Add(ResetEditorEvent);
            GameEvents.onEditorShipModified.Add(ResetEditorEvent);
            GameEvents.onEditorLoad.Add(ResetEditorEvent);

            GameEvents.onGUIEngineersReportReady.Add(AddDesignConcerns);
            GameEvents.onGUIEngineersReportDestroy.Add(RemoveDesignConcerns);

            RequestUpdateVoxel();
        }
 public void Dispose()
 {
     aoASweepInputs      = machSweepInputs = null;
     flapSettingDropdown = null;
     bodySettingDropdown = null;
     simManager          = null;
     _graph = null;
 }
        public StabilityDerivGUI(EditorSimManager simManager, GUIDropDown <int> flapSettingDropDown, GUIDropDown <CelestialBody> bodySettingDropdown)
        {
            this.simManager      = simManager;
            _flapSettingDropdown = flapSettingDropDown;
            _bodySettingDropdown = bodySettingDropdown;

            stabDerivOutput = new StabilityDerivOutput();
        }
Esempio n. 5
0
        void Start()
        {
            if (CompatibilityChecker.IsAllCompatible() && instance == null)
            {
                instance = this;
            }
            else
            {
                GameObject.Destroy(this);
                return;
            }

            _vehicleAero = new VehicleAerodynamics();

            guiRect = new Rect(Screen.width / 4, Screen.height / 6, 10, 10);

            _instantSim = new InstantConditionSim();
            GUIDropDown <int>           flapSettingDropDown   = new GUIDropDown <int>(new string[] { "0 (up)", "1 (init climb)", "2 (takeoff)", "3 (landing)" }, new int[] { 0, 1, 2, 3 }, 0);
            GUIDropDown <CelestialBody> celestialBodyDropdown = CreateBodyDropdown();

            modeDropdown = new GUIDropDown <FAREditorMode>(FAReditorMode_str, new FAREditorMode[] { FAREditorMode.STATIC, FAREditorMode.STABILITY, FAREditorMode.SIMULATION, FAREditorMode.AREA_RULING });

            _simManager = new EditorSimManager(_instantSim);

            _editorGraph     = new StaticAnalysisGraphGUI(_simManager, flapSettingDropDown, celestialBodyDropdown);
            _stabDeriv       = new StabilityDerivGUI(_simManager, flapSettingDropDown, celestialBodyDropdown);
            _stabDerivLinSim = new StabilityDerivSimulationGUI(_simManager);

            Color crossSection = GUIColors.GetColor(3);

            crossSection.a = 0.8f;

            Color crossSectionDeriv = GUIColors.GetColor(2);

            crossSectionDeriv.a = 0.8f;

            _areaRulingOverlay = EditorAreaRulingOverlay.CreateNewAreaRulingOverlay(new Color(0.05f, 0.05f, 0.05f, 0.7f), crossSection, crossSectionDeriv, 10, 5);
            guiRect.height     = 500;
            guiRect.width      = 650;


            GameEvents.onEditorPartEvent.Add(UpdateGeometryEvent);
            GameEvents.onEditorUndo.Add(ResetEditorEvent);
            GameEvents.onEditorRedo.Add(ResetEditorEvent);
            GameEvents.onEditorShipModified.Add(ResetEditorEvent);
            GameEvents.onEditorLoad.Add(ResetEditorEvent);

            GameEvents.onGUIEngineersReportReady.Add(AddDesignConcerns);
            GameEvents.onGUIEngineersReportDestroy.Add(RemoveDesignConcerns);

            RequestUpdateVoxel();
        }
        public StabilityDerivSimulationGUI(EditorSimManager simManager)
        {
            this.simManager = simManager;

            lonConditions = new InitialConditions(new string[] { "0", "0", "0", "0" }, new string[] { "w", "u", "q", "θ" }, new double[] { 1, 1, Math.PI / 180, Math.PI / 180 }, "0.01", "10");
            latConditions = new InitialConditions(new string[] { "0", "0", "0", "0" }, new string[] { "β", "p", "r", "φ" }, new double[] { Math.PI / 180, Math.PI / 180, Math.PI / 180, Math.PI / 180 }, "0.01", "10");

            _graph.SetBoundaries(0, 10, 0, 2);
            _graph.SetGridScaleUsingValues(1, 0.25);
            _graph.horizontalLabel = Localizer.Format("FAREditorSimGraphTime");
            _graph.verticalLabel   = Localizer.Format("FAREditorSimGraphParams");
            _graph.Update();
        }
 public void Dispose()
 {
     simManager = null;
     _graph     = null;
 }