void DoCoordinatePicking()
        {
            if (pickingPositionTarget && !MapView.MapIsEnabled)
            {
                StopPickPositionTargetOnMap();  //stop picking on leaving map view
            }
            if (!pickingPositionTarget)
            {
                return;
            }

            if (MapView.MapIsEnabled && vessel.isActiveVessel)
            {
                if (!GuiUtils.MouseIsOverWindow(core))
                {
                    Coordinates mouseCoords = GuiUtils.GetMouseCoordinates(mainBody);

                    if (mouseCoords != null)
                    {
                        GLUtils.DrawGroundMarker(mainBody, mouseCoords.latitude, mouseCoords.longitude, new Color(1.0f, 0.56f, 0.0f), true, 60);

                        string biome = mainBody.GetExperimentBiomeSafe(mouseCoords.latitude, mouseCoords.longitude);
                        GUI.Label(new Rect(Input.mousePosition.x + 15, Screen.height - Input.mousePosition.y, 200, 50), mouseCoords.ToStringDecimal() + "\n" + biome);

                        if (Input.GetMouseButtonDown(0))
                        {
                            SetPositionTarget(mainBody, mouseCoords.latitude, mouseCoords.longitude);
                            StopPickPositionTargetOnMap();
                        }
                    }
                }
            }
        }
        void DrawMapViewTarget()
        {
            if (HighLogic.LoadedSceneIsEditor)
            {
                return;
            }
            if (!MapView.MapIsEnabled)
            {
                return;
            }
            if (!vessel.isActiveVessel || vessel.GetMasterMechJeb() != core)
            {
                return;
            }

            if (target == null)
            {
                return;
            }
            if (!(target is PositionTarget) && !(target is Vessel))
            {
                return;
            }
            if ((target is Vessel) && (!((Vessel)target).LandedOrSplashed || (((Vessel)target).mainBody != vessel.mainBody)))
            {
                return;
            }
            if (target is DirectionTarget)
            {
                return;
            }

            GLUtils.DrawGroundMarker(targetBody, targetLatitude, targetLongitude, Color.red, true);
        }
示例#3
0
        void DoMapView()
        {
            if ((MapView.MapIsEnabled || camTrajectory) && !vessel.LandedOrSplashed && this.enabled)
            {
                ReentrySimulation.Result drawnResult = Result;
                if (drawnResult != null)
                {
                    if (drawnResult.outcome == ReentrySimulation.Outcome.LANDED)
                    {
                        GLUtils.DrawGroundMarker(drawnResult.body, drawnResult.endPosition.latitude, drawnResult.endPosition.longitude, Color.blue, MapView.MapIsEnabled, 60);
                    }

                    if (showTrajectory && drawnResult.outcome != ReentrySimulation.Outcome.ERROR && drawnResult.outcome != ReentrySimulation.Outcome.NO_REENTRY)
                    {
                        double interval = Math.Max(Math.Min((drawnResult.endUT - drawnResult.input_UT) / 1000, 10), 0.1);
                        //using (var list = drawnResult.WorldTrajectory(interval, worldTrajectory && MapView.MapIsEnabled))
                        using (var list = drawnResult.WorldTrajectory(interval, worldTrajectory))
                        {
                            if (!MapView.MapIsEnabled && (noSkipToFreefall || vessel.staticPressurekPa > 0))
                            {
                                list.value[0] = vesselState.CoM;
                            }
                            GLUtils.DrawPath(drawnResult.body, list.value, Color.red, MapView.MapIsEnabled);
                        }
                    }
                }
            }
        }