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)); } }
//TODO: If we reintroduce this, I recommend extracting this out to DatasetBuilder where we can unit test it and keep // it out of FormMap's hair private void GenerateDataSetsGovernment() { var datadict = new Dictionary <int, Data3DSetClass <PointData> >(); InitStarLists(); _datasets = new List <IData3DSet>(); datadict[(int)EDGovernment.Anarchy] = Data3DSetClass <PointData> .Create(EDGovernment.Anarchy.ToString(), Color.Yellow, 1.0f); datadict[(int)EDGovernment.Colony] = Data3DSetClass <PointData> .Create(EDGovernment.Colony.ToString(), Color.YellowGreen, 1.0f); datadict[(int)EDGovernment.Democracy] = Data3DSetClass <PointData> .Create(EDGovernment.Democracy.ToString(), Color.Green, 1.0f); datadict[(int)EDGovernment.Imperial] = Data3DSetClass <PointData> .Create(EDGovernment.Imperial.ToString(), Color.DarkGreen, 1.0f); datadict[(int)EDGovernment.Corporate] = Data3DSetClass <PointData> .Create(EDGovernment.Corporate.ToString(), Color.LawnGreen, 1.0f); datadict[(int)EDGovernment.Communism] = Data3DSetClass <PointData> .Create(EDGovernment.Communism.ToString(), Color.DarkOliveGreen, 1.0f); datadict[(int)EDGovernment.Feudal] = Data3DSetClass <PointData> .Create(EDGovernment.Feudal.ToString(), Color.LightBlue, 1.0f); datadict[(int)EDGovernment.Dictatorship] = Data3DSetClass <PointData> .Create(EDGovernment.Dictatorship.ToString(), Color.Blue, 1.0f); datadict[(int)EDGovernment.Theocracy] = Data3DSetClass <PointData> .Create(EDGovernment.Theocracy.ToString(), Color.DarkBlue, 1.0f); datadict[(int)EDGovernment.Cooperative] = Data3DSetClass <PointData> .Create(EDGovernment.Cooperative.ToString(), Color.Purple, 1.0f); datadict[(int)EDGovernment.Patronage] = Data3DSetClass <PointData> .Create(EDGovernment.Patronage.ToString(), Color.LightCyan, 1.0f); datadict[(int)EDGovernment.Confederacy] = Data3DSetClass <PointData> .Create(EDGovernment.Confederacy.ToString(), Color.Red, 1.0f); datadict[(int)EDGovernment.Prison_Colony] = Data3DSetClass <PointData> .Create(EDGovernment.Prison_Colony.ToString(), Color.Orange, 1.0f); datadict[(int)EDGovernment.None] = Data3DSetClass <PointData> .Create(EDGovernment.None.ToString(), Color.Gray, 1.0f); datadict[(int)EDGovernment.Unknown] = Data3DSetClass <PointData> .Create(EDGovernment.Unknown.ToString(), Color.DarkGray, 1.0f); foreach (SystemClass si in _starList) { if (si.HasCoordinate) { datadict[(int)si.primary_economy].Add(new PointData(si.x - CenterSystem.x, si.y - CenterSystem.y, CenterSystem.z - si.z)); } } foreach (var ds in datadict.Values) { _datasets.Add(ds); } datadict[(int)EDGovernment.None].Visible = false; datadict[(int)EDGovernment.Unknown].Visible = false; }
public void AddStandardSystems() { if (AllSystems && StarList != null) { bool addstations = !Stations; var datasetS = new Data3DSetClass<PointData>("stars", Color.White, 1.0f); foreach (ISystem si in StarList) { if (addstations || si.population == 0) AddSystem(si, datasetS); } _datasets.Add(datasetS); } }
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); } }
//TODO: If we reintroduce this, I recommend extracting this out to DatasetBuilder where we can unit test it and keep // it out of FormMap's hair private void GenerateDataSetsAllegiance() { var datadict = new Dictionary <int, Data3DSetClass <PointData> >(); InitStarLists(); _datasets = new List <IData3DSet>(); datadict[(int)EDAllegiance.Alliance] = Data3DSetClass <PointData> .Create(EDAllegiance.Alliance.ToString(), Color.Green, 1.0f); datadict[(int)EDAllegiance.Anarchy] = Data3DSetClass <PointData> .Create(EDAllegiance.Anarchy.ToString(), Color.Purple, 1.0f); datadict[(int)EDAllegiance.Empire] = Data3DSetClass <PointData> .Create(EDAllegiance.Empire.ToString(), Color.Blue, 1.0f); datadict[(int)EDAllegiance.Federation] = Data3DSetClass <PointData> .Create(EDAllegiance.Federation.ToString(), Color.Red, 1.0f); datadict[(int)EDAllegiance.Independent] = Data3DSetClass <PointData> .Create(EDAllegiance.Independent.ToString(), Color.Yellow, 1.0f); datadict[(int)EDAllegiance.None] = Data3DSetClass <PointData> .Create(EDAllegiance.None.ToString(), Color.LightGray, 1.0f); datadict[(int)EDAllegiance.Unknown] = Data3DSetClass <PointData> .Create(EDAllegiance.Unknown.ToString(), Color.DarkGray, 1.0f); foreach (SystemClass si in _starList) { if (si.HasCoordinate) { datadict[(int)si.allegiance].Add(new PointData(si.x - CenterSystem.x, si.y - CenterSystem.y, CenterSystem.z - si.z)); } } foreach (var ds in datadict.Values) { _datasets.Add(ds); } datadict[(int)EDAllegiance.None].Visible = false; datadict[(int)EDAllegiance.Unknown].Visible = false; }
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 AddSystem(string systemName, Data3DSetClass<PointData> dataset) { AddSystem(SystemData.GetSystem(systemName), dataset); }
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(string systemName, Data3DSetClass <PointData> dataset) { AddSystem(SystemData.GetSystem(systemName), dataset); }
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); } }
public void AddStations() { if (Stations) { var datasetS = new Data3DSetClass<PointData>("stations", Color.RoyalBlue, 1.0f); foreach (ISystem si in StarList) { if (si.population > 0) AddSystem(si, datasetS); } _datasets.Add(datasetS); } }
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); } }
public void AddPOIsToDataset() { var dataset = new Data3DSetClass<PointData>("Interest", Color.Purple, 10.0f); AddSystem("sol", dataset); AddSystem("sagittarius a*", dataset); //AddSystem("polaris", dataset); _datasets.Add(dataset); }
// 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); } } } }