private void tbSpectrumTimestamp_TextChanged(object sender, EventArgs e) { if (_inhibitTimestampUpdate) { return; } _inhibitTimestampUpdate = true; DateTime d; if (!DateTime.TryParse(tbSpectrumTimestamp.Text, out d)) { tbSpectrumTimestamp.ForeColor = Color.Red; _inhibitTimestampUpdate = false; return; } var timestamp = TimeUtilities.DateTimeToTime42(d); var idx = _timestampManager.GetIndexOfTimestamp(timestamp); if (idx < 0) { tbSpectrumTimestamp.ForeColor = Color.Red; _inhibitTimestampUpdate = false; return; } UpdateToTime(timestamp); udActivity.Value = _timestampManager.GetActivityOfIndex(idx); udSequenceNumber.Value = _timestampManager.GetSequenceNumberOfIndex(idx); udActivity.ForeColor = Color.Gray; udSequenceNumber.ForeColor = Color.Gray; tbSpectrumTimestamp.ForeColor = Color.Gray; _inhibitTimestampUpdate = false; }
internal int GetIndexOfTimestamp(string timestamp) { DateTime d; if (DateTime.TryParse(timestamp, out d)) { return(GetIndexOfTimestamp(TimeUtilities.DateTimeToTime42(d))); } return(-1); }
private void tbDateSlider_Scroll(object sender, EventArgs evt) { if (!_scenarioUpdated) { SetScenarioTimes(TheWorld.Fetcher.Frame, _scenarioStart, _scenarioEnd); } var b = TimeUtilities.DateTimeToTime42(_scenarioStart); var e = TimeUtilities.DateTimeToTime42(_scenarioEnd); var t = b + (long)((e - b) * (tbDateSlider.Value / (double)tbDateSlider.Maximum)); _scenarioInhibit = true; tbCurrentTime.Text = TimeUtilities.Time42ToSTK(t); _scenarioInhibit = false; UpdateToTime(t); }
private void tbCurrentTime_TextChanged(object sender, EventArgs e) { if (_scenarioInhibit) { return; } DateTime d; if (DateTime.TryParse(tbCurrentTime.Text, out d)) { UpdateToTime(TimeUtilities.DateTimeToTime42(d)); tbCurrentTime.ForeColor = Color.Gray; } else { tbCurrentTime.ForeColor = Color.Red; } }
public void SetScenarioTimes(LadeeStateFetcher.StateFrame frame, DateTime start, DateTime stop) { _scenarioInhibit = true; TheWorld.Frame = frame; _scenarioStart = start; _scenarioEnd = stop; var start42 = TimeUtilities.DateTimeToTime42(_scenarioStart); var stop42 = TimeUtilities.DateTimeToTime42(_scenarioEnd); tbScenarioBegin.Text = TimeUtilities.Time42ToSTK(start42); tbScenarioEnd.Text = TimeUtilities.Time42ToSTK(stop42); TheWorld.Trajectory.Frame = frame; TheWorld.Trajectory.DrawStart = start42; TheWorld.Trajectory.DrawStop = stop42; _scenarioUpdated = true; _scenarioInhibit = false; }
private void glControl1_Load(object sender, EventArgs e) { glControl1.Loaded = true; CreateShaders(); glControl1.MakeCurrent(); //WavefrontShape.MakeCone(20); STKModel.MakeCone(20); glControl1.TheWorld = TheWorld; LoadObjects(); GL.ClearColor(Color.Black); //SetupViewport(); GL.Enable(EnableCap.Lighting); // Turn off lighting to get color GL.Enable(EnableCap.Light0); GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); //?? GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.ShadeModel(ShadingModel.Smooth); // Enable Light 0 and set its parameters. //GL.Light(LightName.Light0, LightParameter.Position, SunPosition); const float ambient = 0.1f; GL.Light(LightName.Light0, LightParameter.Ambient, new[] { ambient, ambient, ambient, 1.0f }); //GL.Light(LightName.Light0, LightParameter.Ambient, new[] { 0.6f, 0.6f, 0.6f, 1.0f }); GL.Light(LightName.Light0, LightParameter.Diffuse, new[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.Light(LightName.Light0, LightParameter.Specular, new[] { 1f, 1f, 1f, 1.0f }); GL.Light(LightName.Light0, LightParameter.SpotExponent, new[] { 1.0f, 1.0f, 1.0f, 1.0f }); GL.LightModel(LightModelParameter.LightModelAmbient, new[] { 0f, 0f, 0f, 1.0f }); GL.LightModel(LightModelParameter.LightModelLocalViewer, 0); GL.LightModel(LightModelParameter.LightModelTwoSide, 0); //GL.Material(MaterialFace.Front, MaterialParameter.Ambient, new float[] { 0.3f, 0.3f, 0.3f, 1.0f }); //GL.Material(MaterialFace.Front, MaterialParameter.Diffuse, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }); //GL.Material(MaterialFace.Front, MaterialParameter.Specular, new float[] { 0.5f, 0.5f, 0.5f, 1.0f }); //GL.Material(MaterialFace.Front, MaterialParameter.Emission, new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.ColorMaterial); // lets me use colors rather than changing materials GL.Enable(EnableCap.CullFace); GL.Enable(EnableCap.Normalize); // Do I need this? (this make a difference, although I don't know why) GL.PointSize(5f); GL.Enable(EnableCap.PointSmooth); GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest); var start = TheWorld.Fetcher.SpiceStartDate.AddDays(0); SetScenarioTimes(LadeeStateFetcher.StateFrame.MoonFixed, start, TheWorld.Fetcher.SpiceStartDate.AddDays(70)); var t = TimeUtilities.DateTimeToTime42(start); UpdateToTime(t); glControl1.CameraMode = new ArcBall(glControl1, TheWorld.LADEE) { RelativePosition = new Vector3d(0d, 100 * Meters, 0d) }; TheWorld.Tick(); }