Beispiel #1
0
 private void AddSystem(SystemClass system, Data3DSetClass <PointData> dataset)
 {
     if (system != null && system.HasCoordinate)
     {
         dataset.Add(new PointData(system.x - CenterSystem.x, system.y - CenterSystem.y, CenterSystem.z - system.z));
     }
 }
        public void AddGridLines()
        {
            int unitSize = 1000;
            if (GridLines)
            {
                bool addstations = !Stations;
                var datasetGrid = new Data3DSetClass<LineData>("grid", (Color)System.Drawing.ColorTranslator.FromHtml("#296A6C"), 0.6f);

                for (float x = MinGridPos.X; x <= MaxGridPos.X; x += unitSize)
                {
                    datasetGrid.Add(new LineData(x, 0, MinGridPos.Y, x,0,MaxGridPos.Y));
                }
                for (float z = MinGridPos.Y; z <= MaxGridPos.Y; z += unitSize)
                {
                    datasetGrid.Add(new LineData(MinGridPos.X, 0, z, MaxGridPos.X, 0, z));
                }

                _datasets.Add(datasetGrid);
            }
        }
 private void AddSystem(SystemClass system, Data3DSetClass<PointData> dataset)
 {
     if (system != null && system.HasCoordinate)
     {
         dataset.Add(new PointData(system.x - CenterSystem.x, system.y - CenterSystem.y, CenterSystem.z - system.z));
     }
 }
        private void GenerateDataSetStandard()
        {
            InitGenerateDataSet();

            datasets = new List<IData3DSet>();

            var dataset = new Data3DSetClass<PointData>("stars", Color.White, 1.0f);

            foreach (SystemClass si in StarList)
            {
                AddSystem(si, dataset);
            }
            datasets.Add(dataset);

            if (visitedSystems != null && visitedSystems.Any())
            {
                dataset = new Data3DSetClass<PointData>("visitedstars", Color.Red, 2.0f);
                foreach (SystemClass sp in VisitedStars.Values)
                {
                    AddSystem(sp, dataset);
                }
                datasets.Add(dataset);
            }

            dataset = new Data3DSetClass<PointData>("Center", Color.Yellow, 5.0f);

            //GL.Enable(EnableCap.ProgramPointSize);
            dataset.Add(new PointData(0, 0, 0));
            datasets.Add(dataset);

            dataset = new Data3DSetClass<PointData>("Interest", Color.Purple, 10.0f);
            AddSystem("sol", dataset);
            AddSystem("sagittarius a*", dataset);
            //AddSystem("polaris", dataset);
            datasets.Add(dataset);

            if (ShowTril)
            {
                // For test only

                if (ReferenceSystems != null && ReferenceSystems.Any())
                {
                    var referenceLines = new Data3DSetClass<LineData>("CurrentReference", Color.Green, 5.0f);
                    foreach (var refSystem in ReferenceSystems)
                    {
                        referenceLines.Add(new LineData(0, 0, 0, refSystem.x - CenterSystem.x, refSystem.y - CenterSystem.y, CenterSystem.z - refSystem.z));
                    }

                    datasets.Add(referenceLines);
                }

                var lineSet = new Data3DSetClass<LineData>("SuggestedReference", Color.DarkOrange, 5.0f);

                Stopwatch sw = new Stopwatch();
                sw.Start();
                SuggestedReferences references = new SuggestedReferences(CenterSystem.x, CenterSystem.y, CenterSystem.z);

                for (int ii = 0; ii < 16; ii++)
                {
                    var rsys = references.GetCandidate();
                    if (rsys == null) break;
                    var system = rsys.System;
                    references.AddReferenceStar(system);
                    if (ReferenceSystems != null && ReferenceSystems.Any(s => s.name == system.name)) continue;
                    System.Diagnostics.Trace.WriteLine(string.Format("{0} Dist: {1} x:{2} y:{3} z:{4}", system.name, rsys.Distance.ToString("0.00"), system.x, system.y, system.z));
                    lineSet.Add(new LineData(0, 0, 0, system.x - CenterSystem.x, system.y - CenterSystem.y, CenterSystem.z - system.z));
                }
                sw.Stop();
                System.Diagnostics.Trace.WriteLine("Reference stars time " + sw.Elapsed.TotalSeconds.ToString("0.000s"));
                datasets.Add(lineSet);
            }
        }
Beispiel #5
0
        private void GenerateDataSetStandard()
        {
            InitGenerateDataSet();

            datasets = new List <IData3DSet>();

            var dataset = new Data3DSetClass <PointData>("stars", Color.White, 1.0f);

            foreach (SystemClass si in StarList)
            {
                AddSystem(si, dataset);
            }
            datasets.Add(dataset);


            if (visitedSystems != null && visitedSystems.Any())
            {
                dataset = new Data3DSetClass <PointData>("visitedstars", Color.Red, 2.0f);
                foreach (SystemClass sp in VisitedStars.Values)
                {
                    AddSystem(sp, dataset);
                }
                datasets.Add(dataset);
            }


            dataset = new Data3DSetClass <PointData>("Center", Color.Yellow, 5.0f);

            //GL.Enable(EnableCap.ProgramPointSize);
            dataset.Add(new PointData(0, 0, 0));
            datasets.Add(dataset);

            dataset = new Data3DSetClass <PointData>("Interest", Color.Purple, 10.0f);
            AddSystem("sol", dataset);
            AddSystem("sagittarius a*", dataset);
            //AddSystem("polaris", dataset);
            datasets.Add(dataset);

            if (ShowTril)
            {
                // For test only

                if (ReferenceSystems != null && ReferenceSystems.Any())
                {
                    var referenceLines = new Data3DSetClass <LineData>("CurrentReference", Color.Green, 5.0f);
                    foreach (var refSystem in ReferenceSystems)
                    {
                        referenceLines.Add(new LineData(0, 0, 0, refSystem.x - CenterSystem.x, refSystem.y - CenterSystem.y, CenterSystem.z - refSystem.z));
                    }

                    datasets.Add(referenceLines);
                }

                var lineSet = new Data3DSetClass <LineData>("SuggestedReference", Color.DarkOrange, 5.0f);


                Stopwatch sw = new Stopwatch();
                sw.Start();
                SuggestedReferences references = new SuggestedReferences(CenterSystem.x, CenterSystem.y, CenterSystem.z);

                for (int ii = 0; ii < 16; ii++)
                {
                    var rsys = references.GetCandidate();
                    if (rsys == null)
                    {
                        break;
                    }
                    var system = rsys.System;
                    references.AddReferenceStar(system);
                    if (ReferenceSystems != null && ReferenceSystems.Any(s => s.name == system.name))
                    {
                        continue;
                    }
                    System.Diagnostics.Trace.WriteLine(string.Format("{0} Dist: {1} x:{2} y:{3} z:{4}", system.name, rsys.Distance.ToString("0.00"), system.x, system.y, system.z));
                    lineSet.Add(new LineData(0, 0, 0, system.x - CenterSystem.x, system.y - CenterSystem.y, CenterSystem.z - system.z));
                }
                sw.Stop();
                System.Diagnostics.Trace.WriteLine("Reference stars time " + sw.Elapsed.TotalSeconds.ToString("0.000s"));
                datasets.Add(lineSet);
            }
        }
 private void AddSystem(ISystem system, Data3DSetClass<PointData> dataset)
 {
     if (system != null && system.HasCoordinate)
     {
         dataset.Add(new PointData(system.x, system.y, system.z));
     }
 }
        public void AddTrilaterationInfoToDataset()
        {
            if (ReferenceSystems != null && ReferenceSystems.Any())
            {
                var referenceLines = new Data3DSetClass<LineData>("CurrentReference", Color.Green, 5.0f);
                foreach (var refSystem in ReferenceSystems)
                {
                    referenceLines.Add(new LineData(CenterSystem.x, CenterSystem.y, CenterSystem.z, refSystem.x, refSystem.y, refSystem.z));
                }

                _datasets.Add(referenceLines);

                var lineSet = new Data3DSetClass<LineData>("SuggestedReference", Color.DarkOrange, 5.0f);


                Stopwatch sw = new Stopwatch();
                sw.Start();
                SuggestedReferences references = new SuggestedReferences(CenterSystem.x, CenterSystem.y, CenterSystem.z);

                for (int ii = 0; ii < 16; ii++)
                {
                    var rsys = references.GetCandidate();
                    if (rsys == null) break;
                    var system = rsys.System;
                    references.AddReferenceStar(system);
                    if (ReferenceSystems != null && ReferenceSystems.Any(s => s.name == system.name)) continue;
                    System.Diagnostics.Trace.WriteLine(string.Format("{0} Dist: {1} x:{2} y:{3} z:{4}", system.name, rsys.Distance.ToString("0.00"), system.x, system.y, system.z));
                    lineSet.Add(new LineData(CenterSystem.x, CenterSystem.y, CenterSystem.z, system.x, system.y, system.z));
                }
                sw.Stop();
                System.Diagnostics.Trace.WriteLine("Reference stars time " + sw.Elapsed.TotalSeconds.ToString("0.000s"));
                _datasets.Add(lineSet);
            }
        }
        // Planned change: Centered system will be marked but won't be "center" of the galaxy
        // dataset anymore. The origin will stay at Sol.
        public void AddCenterPointToDataset()
        {
            var dataset = new Data3DSetClass<PointData>("Center", Color.Yellow, 5.0f);

            //GL.Enable(EnableCap.ProgramPointSize);
            dataset.Add(new PointData(CenterSystem.x, CenterSystem.y, CenterSystem.z));
            _datasets.Add(dataset);
        }
        public void AddVisitedSystemsInformation()
        {
            if (VisitedSystems != null && VisitedSystems.Any())
            {
                ISystem lastknownps = LastKnownSystemPosition();

                // For some reason I am unable to fathom this errors during the session after DBUpgrade8
                // colours just resolves to an object reference not set error, but after a restart it works fine
                // Not going to waste any more time, a one time restart is hardly the worst workaround in the world...
                IEnumerable<IGrouping<int, SystemPosition>> colours =
                    from SystemPosition sysPos in VisitedSystems
                    group sysPos by sysPos.vs.MapColour;

                foreach (IGrouping<int, SystemPosition> colour in colours)
                {
                    if (DrawLines)
                    {
                        var datasetl = new Data3DSetClass<LineData>("visitedstars" + colour.Key.ToString(), Color.FromArgb(colour.Key), 2.0f);
                        foreach (SystemPosition sp in colour)
                        {
                            if (sp.curSystem != null && sp.curSystem.HasCoordinate && sp.lastKnownSystem != null && sp.lastKnownSystem.HasCoordinate)
                            {
                                datasetl.Add(new LineData(sp.curSystem.x, sp.curSystem.y, sp.curSystem.z,
                                    sp.lastKnownSystem.x , sp.lastKnownSystem.y, sp.lastKnownSystem.z));

                            }
                        }
                        _datasets.Add(datasetl);
                    }
                    else
                    {
                        var datasetvs = new Data3DSetClass<PointData>("visitedstars" + colour.Key.ToString(), Color.FromArgb(colour.Key), 2.0f);
                        foreach (SystemPosition sp in colour)
                        {
                            ISystem star = SystemData.GetSystem(sp.Name);
                            if (star != null && star.HasCoordinate)
                            {

                                AddSystem(star, datasetvs);
                            }
                        }
                        _datasets.Add(datasetvs);
                    }

                }
            }
        }