private void toolStripButtonMap_Click(object sender, EventArgs e)
        {
            var centerSystem = TargetSystem;

            if (centerSystem == null || !centerSystem.HasCoordinate)
            {
                centerSystem = _discoveryForm.history.GetLastWithPosition.System;
            }

            var map = _discoveryForm.Map;

            map.Prepare(centerSystem, _discoveryForm.GetHomeSystem(), centerSystem,
                        _discoveryForm.settings.MapZoom, _discoveryForm.history.FilterByTravel);

            map.Show();
        }
        private void toolStripButtonShowOn3DMap_Click(object sender, EventArgs e)
        {
            var map = _discoveryForm.Map;

            var route = dataGridViewRouteSystems.Rows.OfType <DataGridViewRow>().Select(s => s.Cells[0].Tag as SystemClass).Where(s => s != null && s.HasCoordinate).ToList();

            if (route.Count >= 2)
            {
                _discoveryForm.history.FillInPositionsFSDJumps();
                map.Prepare(route[0], _discoveryForm.GetHomeSystem(), route[0], 400 / CalculateRouteMaxDistFromOrigin(), _discoveryForm.history.FilterByTravel);
                map.SetPlanned(route);
                map.Show();
            }
            else
            {
                EDDiscovery.Forms.MessageBoxTheme.Show("No route set up, retry", "No Route", MessageBoxButtons.OK);
                return;
            }
        }
Exemple #3
0
        private void cmd3DMap_Click(object sender, EventArgs e)
        {
            var map = _discoveryForm.Map;

            if (routeSystems != null && routeSystems.Any())
            {
                float dist;
                if (!float.TryParse(textBox_Distance.Text, out dist))       // in case text is crap
                {
                    dist = 30;
                }

                _discoveryForm.history.FillInPositionsFSDJumps();
                map.Prepare(routeSystems.First(), _discoveryForm.GetHomeSystem(), routeSystems.First(), 400 / dist, _discoveryForm.history.FilterByTravel);
                map.SetPlanned(routeSystems);
                map.Show();
            }
            else
            {
                ExtendedControls.MessageBoxTheme.Show("No route set up, retry", "No Route", MessageBoxButtons.OK);
                return;
            }
        }
        public void ShowSystemInformation(DataGridViewRow rw)
        {
            StoreSystemNote(true);      // save any previous note

            HistoryEntry he = null;

            if (rw == null)
            {
                textBoxSystem.Text         = textBoxBody.Text = textBoxX.Text = textBoxY.Text = textBoxZ.Text =
                    textBoxAllegiance.Text = textBoxEconomy.Text = textBoxGovernment.Text =
                        textBoxVisits.Text = textBoxState.Text = textBoxHomeDist.Text = richTextBoxNote.Text = textBoxSolDist.Text = "";
                buttonRoss.Enabled         = buttonEDDB.Enabled = false;
            }
            else
            {
                he = userControlTravelGrid.GetHistoryEntry(rw.Index);     // reload, it may have changed
                Debug.Assert(he != null);

                _discoveryForm.history.FillEDSM(he, reload: true); // Fill in any EDSM info we have, force it to try again.. in case system db updated

                notedisplayedhe = he;

                textBoxSystem.Text = he.System.name;
                textBoxBody.Text   = he.WhereAmI;

                if (he.System.HasCoordinate)         // cursystem has them?
                {
                    textBoxX.Text = he.System.x.ToString(SingleCoordinateFormat);
                    textBoxY.Text = he.System.y.ToString(SingleCoordinateFormat);
                    textBoxZ.Text = he.System.z.ToString(SingleCoordinateFormat);

                    ISystem homesys = _discoveryForm.GetHomeSystem();

                    toolTipEddb.SetToolTip(textBoxHomeDist, $"Distance to home system ({homesys.name})");
                    textBoxHomeDist.Text = SystemClassDB.Distance(he.System, homesys).ToString(SingleCoordinateFormat);
                    textBoxSolDist.Text  = SystemClassDB.Distance(he.System, 0, 0, 0).ToString(SingleCoordinateFormat);
                }
                else
                {
                    textBoxX.Text        = "?";
                    textBoxY.Text        = "?";
                    textBoxZ.Text        = "?";
                    textBoxHomeDist.Text = "";
                    textBoxSolDist.Text  = "";
                }

                int count = _discoveryForm.history.GetVisitsCount(he.System.name);
                textBoxVisits.Text = count.ToString();

                bool enableedddross = (he.System.id_eddb > 0);  // Only enable eddb/ross for system that it knows about

                buttonRoss.Enabled = buttonEDDB.Enabled = enableedddross;

                textBoxAllegiance.Text = he.System.allegiance.ToNullUnknownString();
                textBoxEconomy.Text    = he.System.primary_economy.ToNullUnknownString();
                textBoxGovernment.Text = he.System.government.ToNullUnknownString();
                textBoxState.Text      = he.System.state.ToNullUnknownString();
                richTextBoxNote.Text   = he.snc != null ? he.snc.Note : "";

                _discoveryForm.CalculateClosestSystems(he.System, (s, d) => NewStarListComputed(s.name, d));
            }

            if (OnTravelSelectionChanged != null)
            {
                OnTravelSelectionChanged(he, _discoveryForm.history);
            }
        }