private void ToTSXButton_Click(object sender, EventArgs e) { //Tries to look up the name in the target box. If found, then a new target plan is //opened. Disconnect the telescope (in case centering is forced), use the target box to find //and and center the star chart and FOV on the target. //If not throw a log entry and return; //Remove spaces from target name if any //PlanTargetBox.Text = PlanTargetBox.Text.Replace(" ", ""); LogEvent lg = new LogEvent(); SessionControl openSession = new SessionControl(); NHUtil.ButtonRed(SelectButton); TSXLink.Target tgt = TSXLink.StarChart.FindTarget(PlanTargetBox.Text); if (tgt != null) { TSXLink.Connection.DisconnectDevice(TSXLink.Connection.Devices.Mount); TargetPlan newtPlan = new TargetPlan(tgt.Name); newtPlan.TargetPA = TSXLink.FOVI.GetFOVPA; newtPlan.TargetAdjustEnabled = false; PlanTargetBox.Text = newtPlan.TargetName; TSXLink.StarChart.SetFOV(2); LoadTargetPlanList(); openSession.CurrentTargetName = newtPlan.TargetName; lg.LogIt("A new target plan has been created for " + newtPlan.TargetName); } else { lg.LogIt(PlanTargetBox.Text + ": target not found."); } NHUtil.ButtonGreen(SelectButton); Show(); }
private void FromTSXButton_Click(object sender, EventArgs e) { /* Method gets whatever target is showing in the find function in TSX * normally by using a click on a star chart object. If no object has been * choosen (Mouse click position) or simply no target (null) then return * Otherwise, clear the spaces out of the name and check for characters (like ":") * that won't work in a file name. If illegal characters, then return * Otherwise, find an existing or open new target plan for this target name * and make it the target plan for the current session */ LogEvent lg = new LogEvent(); SessionControl openSession = new SessionControl(); //get the current target name from TSX and save it. NHUtil.ButtonRed(AcquireButton); //Retrieve current target from TSX TSXLink.Target tgt = TSXLink.StarChart.FindTarget(); //Check to see if we're looking at a "Mouse Click Postion" // if so, just get out of this if ((tgt.Name != "Mouse click position") && (tgt != null)) { //Remove spaces from target name if any tgt.Name = tgt.Name.Replace(" ", ""); //Remove known "illegal" characters if (tgt.Name.Contains(":")) { lg.LogIt("Unsupported filename characters in target name " + tgt.Name); MessageBox.Show("Unsupported characters in target name : " + tgt.Name); } else { TargetPlan newtPlan = new TargetPlan(tgt.Name) { TargetAdjustEnabled = false, TargetRA = tgt.RA, TargetDec = tgt.Dec }; newtPlan.TargetPA = TSXLink.FOVI.GetFOVPA; PlanTargetBox.Text = newtPlan.TargetName; TSXLink.StarChart.SetFOV(2); LoadTargetPlanList(); openSession.CurrentTargetName = newtPlan.TargetName; lg.LogIt("A new target plan has been created for " + newtPlan.TargetName); } } NHUtil.ButtonGreen(AcquireButton); this.Show(); }
private void SolarSystemBodyCheckBox_CheckedChanged(object sender, EventArgs e) { if (!FormHumason.InitializingHumason) { SessionControl openSession = new SessionControl(); TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName) { SmallSolarSystemBodyEnabled = SolarSystemBodyCheckBox.Checked }; //If this is getting checked, then acquire the deltaRA and deltaDec rates // Find target name, then get rates TSXLink.Target tsxtgt = TSXLink.StarChart.FindTarget(openSession.CurrentTargetName); tPlan.DeltaRARate = tsxtgt.DeltaRARate; tPlan.DeltaDecRate = tsxtgt.DeltaDecRate; } }
public void UpdateSequence() { //Update Sequence will load the target name (or adjusted location) into the Find // function and update all the location information, then run a new calculation on times, etc SessionControl openSession = new SessionControl(); TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); sky6ObjectInformation tsxo = new sky6ObjectInformation(); string targetName = tPlan.TargetName; //if the targetName is null, then pull the targetName from TSX, load into the textbox and store in configuration file if (targetName == "") { tsxo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1); string tName = tsxo.ObjInfoPropOut; tPlan.TargetName = tName; TargetBox.Text = tName; return; } //if the adjust target is checked, then run FInd on the target coordinates //otherwise, run a find on the target name string targetTitle; if (tPlan.TargetAdjustEnabled) { targetTitle = tPlan.TargetRA.ToString() + "," + tPlan.TargetDec.ToString(); } else { targetTitle = targetName; } TSXLink.Target tgto = TSXLink.StarChart.FindTarget(targetTitle); //Update the target Name in box TargetBox.Text = targetName; TargetRABox.Value = (decimal)tgto.RA; TargetDecBox.Value = (decimal)tgto.Dec; //Update the start time in the target plan tPlan.SequenceStartTime = StartTimeBox.Value; tPlan.SequenceDawnTime = DawnTimeBox.Value; //Save the new configuration information UpdateFormFromPlan(); RegenerateSequence(); }
public Axess SpawnTargetPlanFromTSX(string targetName) { //perform search on substring of targetName preceding any "-" in order to work with mosaic target names SessionControl openSession = new SessionControl(); TSXLink.Target tgto = TSXLink.StarChart.FindTarget((targetName.Split('-'))[0]); if (tgto != null) { Axess defaultTargetPlanX = new Axess(openSession.DefaultTargetPlanPath); hTargetPlanX = new Axess(defaultTargetPlanX, TargetPlanPath); hTargetPlanX.SetItem(TargetNameXName, tgto.Name); hTargetPlanX.SetItem(TargetRAXName, tgto.RA.ToString()); hTargetPlanX.SetItem(TargetDecXName, tgto.Dec.ToString()); return(hTargetPlanX); } else { return(null); } }
private void AdjustButton_Click(object sender, EventArgs e) { //Adjust button depends on prior state: // if button green, then an adjustment of RA/Dec/PA is to be run // Reset the tPlan name to the orginal name, // and save tPlan RA/Dec/PA with those StarChart values (via TSXFind) // wait until button is pushed again, essentially // if button red, then an adjustment has been completed. // Get the current StarChart values from TSX // and saves tPlan RA/Dec/PA with those StarChart values. SessionControl openSession = new SessionControl(); if (NHUtil.IsButtonGreen(AdjustButton)) { NHUtil.ButtonRed(AdjustButton); this.AdjustButton.Text = "Save Adjustment"; TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); TSXLink.Target tgt = TSXLink.StarChart.FindTarget(tPlan.TargetName); double totalPA = AstroMath.Transform.NormalizeDegreeRange(Rotator.RealRotatorPA + TSXLink.FOVI.GetFOVPA); tPlan.TargetRA = tgt.RA; tPlan.TargetDec = tgt.Dec; tPlan.TargetPA = totalPA; tPlan.TargetAdjustEnabled = false; TSXLink.StarChart.SetFOV(2.0); } else { TSXLink tLink = new TSXLink(); TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName); double totalPA = AstroMath.Transform.NormalizeDegreeRange(Rotator.RealRotatorPA + TSXLink.FOVI.GetFOVPA); tPlan.TargetRA = TSXLink.StarChart.ChartRA; tPlan.TargetDec = TSXLink.StarChart.ChartDec; tPlan.TargetPA = totalPA; tPlan.TargetAdjustEnabled = true; UpdateHumasonSequencer(); NHUtil.ButtonGreen(AdjustButton); this.AdjustButton.Text = "Adjust Target"; } }