Пример #1
0
        //Spawn an instance by creating or overwriting from another instance
        public Axess(Axess sourceAxess, string newXMLFilePath)
        {
            XElement sourceX = XElement.Load(sourceAxess.axessXMLFilePath);

            sourceX.Save(newXMLFilePath);
            axessXMLFilePath = newXMLFilePath;
        }
Пример #2
0
        public SessionControl()
        {
            //Create the Humason folder path for the base folder.
            DocumentsDirectoryPath     = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            HumasonDirectoryPath       = DocumentsDirectoryPath + "\\" + HumasonFolderName;
            DatabaseQueryDirectoryPath = DocumentsDirectoryPath + "\\" + SBQueryFolder;
            FocuserDataFolder          = DocumentsDirectoryPath + "\\" + SBFocusDataFolder;
            FOVIDataFolder             = DocumentsDirectoryPath + "\\" + SBFOVIDataFolder;

            //Install the TSX DBQ to clean out the Observing List
            InstallDBQ(DatabaseQueryDirectoryPath);

            //Create the Humason folder, if it doesnt exist
            if (!Directory.Exists(HumasonDirectoryPath))
            {
                Directory.CreateDirectory(HumasonDirectoryPath);
            }

            //Create the session control file, if it doesn't exist, and save the token
            string sCtlPath = HumasonDirectoryPath + "\\" + HumasonSessionControlFilename;

            DirectXcess = new Axess(sCtlPath, HumasonSessionControlXCName);

            //Create the session summary xml file if it doesn't exist
            string tSumPath = HumasonDirectoryPath + "\\" + HumasonSummaryFilename;
            Axess  tSum     = new Axess(tSumPath, HumasonSummaryXCName);

            DirectXcess.ReplaceItem(SummaryFilePathXName, tSumPath);

            //Create the default target plan path
            DefaultTargetPlanPath = HumasonDirectoryPath + "\\" + HumasonDefaultPlanFileName;
        }
Пример #3
0
        public FlatManager()
        {
            //Create the folder path for the base folder.
            SessionControl openSession = new SessionControl();

            nhDir = openSession.HumasonDirectoryPath;
            //Create the flats request xml file, if it doesn't exist
            fReq = new Axess(nhDir + "\\" + HumasonFlatStackFilename, HumasonFlatsXCName);
        }
Пример #4
0
        public Axess SpawnTargetPlan(string targetName)
        {
            //This command will save a copy of the current tPlan
            //under the name targetname.configuration.xml
            string spawnTargetPlanPath = hDirectoryPath + "\\" + targetName.Replace('/', '_') + "." + HumasonTargetPlanFilename;
            Axess  sourceTargetPlanX   = new Axess(TargetPlanPath);

            hTargetPlanX = new Axess(sourceTargetPlanX, spawnTargetPlanPath);
            return(hTargetPlanX);
        }
Пример #5
0
        public TargetPlan(string targetName)
        {
            /* Creates a target plan object for accessing the class
             * Several outcomes can occur depending upon the targetName.
             * If the targetName is empty then the target is assumed to be "Default"
             *      and this instantiation is set up for the "Default" file
             * else if the targetName is Default then the target is assumed to be "Default"
             *      and this instantiation is set up for the "Default" file
             * otherwise,
             *      if the targetName has a file, then get an Axess instance for it.
             *      otherwise check tSX for the targetName
             *          if found, then a new target plan file is created from cloning the
             *              default target pland merged with the TSX data
             *          otherwise (no plan, no target, no nothing) do nothing
             */
            SessionControl openSession = new SessionControl();

            //Store the Humason directory path so we don't have to keep looking it up when using this instance
            hDirectoryPath = openSession.HumasonDirectoryPath;
            //If the target name is empty for some reason, just set a path to the default file
            if ((targetName == "") || (targetName == null) || (targetName == "Default"))
            {
                targetName = "Default";
                //Set up a folder path for the presumed target -- we still don't know if anything is there
                TargetPlanPath  = hDirectoryPath + "\\" + targetName.Replace('/', '_') + "." + HumasonTargetPlanFilename;
                DefaultPlanPath = TargetPlanPath;
                if (File.Exists(TargetPlanPath))
                {
                    hTargetPlanX = new Axess(TargetPlanPath);
                }
                else
                {
                    hTargetPlanX = CreateDefaultTargetPlan();
                }
            }
            else  //Got a target name, look for a file
            {
                TargetPlanPath = hDirectoryPath + "\\" + targetName.Replace('/', '_') + "." + HumasonTargetPlanFilename;
                //if the plan file for this target already exists.
                //   Just set up XML access for it.
                if (File.Exists(TargetPlanPath))
                {
                    hTargetPlanX = new Axess(TargetPlanPath);
                }
                else
                //The plan file doesn't exist, look for a TSX match
                //  If the target can be found, Create the file, Populate with the target position info, and expand with default plan
                {
                    hTargetPlanX = SpawnTargetPlanFromTSX(targetName);
                }
                //no tsx data either, just return with a null target file path
            }
        }
Пример #6
0
        public void MergeXFileContents(Axess sourceAxess, string mergeXMLFilePath)
        {
            //Called  to add the fields of a default file into a sparse target plan
            //Get the contents of the file associated with this class instance
            XElement thisFileX = XElement.Load(axessXMLFilePath);
            //Get the contents of the file to be added in
            XElement mergeIntoX = XElement.Load(mergeXMLFilePath);

            foreach (XElement tpX in thisFileX.Elements())
            {
                if (!(thisFileX.Elements().Contains(tpX)))
                {
                    thisFileX.Add(tpX);
                }
            }
            thisFileX.Save(axessXMLFilePath);
        }
Пример #7
0
        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);
            }
        }
Пример #8
0
        private Axess CreateDefaultTargetPlan()
        {
            Axess defaultTP = new Axess(TargetPlanPath, HumasonTargetPlanXCName);

            defaultTP.SetItem(TargetNameXName, "Default");
            defaultTP.SetItem(TargetRAXName, 0);
            defaultTP.SetItem(TargetDecXName, 0);
            defaultTP.SetItem(TargetPAXName, 0);
            defaultTP.SetItem(TargetAdjustCheckedXName, false);

            defaultTP.SetItem(FocusExposureXName, 5);
            defaultTP.SetItem(FocusFilterXName, 3);
            defaultTP.SetItem(AtFocusCheckedXName, false);

            defaultTP.SetItem(GuideExposureTimeXName, 5);
            defaultTP.SetItem(MinGuideExposureTimeXName, 0.5);
            defaultTP.SetItem(MaxGuideExposureTimeXName, 10);
            defaultTP.SetItem(GuideCycleTimeXName, 0);
            defaultTP.SetItem(GuideStarADUXName, 1000);
            defaultTP.SetItem(AOCheckedXName, false);
            defaultTP.SetItem(GuiderFocuserCheckedXName, false);
            defaultTP.SetItem(XAxisMoveTimeXName, 30);
            defaultTP.SetItem(YAxisMoveTimeXName, 30);
            defaultTP.SetItem(GuideStarXXName, 0);
            defaultTP.SetItem(GuideStarYXName, 0);
            defaultTP.SetItem(GuiderBinningXName, 1);
            defaultTP.SetItem(GuiderSubframeEnabledXName, false);

            defaultTP.SetItem(CalVectorXPosXComponentXName, 0);
            defaultTP.SetItem(CalVectorXPosYComponentXName, 0);
            defaultTP.SetItem(CalVectorYPosXComponentXName, 0);
            defaultTP.SetItem(CalVectorYPosYComponentXName, 0);
            defaultTP.SetItem(CalVectorXNegXComponentXName, 0);
            defaultTP.SetItem(CalVectorXNegYComponentXName, 0);
            defaultTP.SetItem(CalVectorYNegXComponentXName, 0);
            defaultTP.SetItem(CalVectorYNegYComponentXName, 0);

            defaultTP.SetItem(TargetNameXName, "Default");
            defaultTP.SetItem(TargetAdjustCheckedXName, false);
            defaultTP.SetItem(SequenceStartTimeXName, 0);
            defaultTP.SetItem(SequenceEndTimeXName, 0);
            defaultTP.SetItem(AutoDarkCheckedXName, false);
            defaultTP.SetItem(ImageExposureTimeXName, 10);
            defaultTP.SetItem(LoopsXName, 4);
            defaultTP.SetItem(LRGBRatioXName, 4);
            defaultTP.SetItem(DelayXName, 0);
            defaultTP.SetItem(MakeFlatsCheckedXName, false);
            defaultTP.SetItem(SmallSolarSystemBodyXName, false);

            defaultTP.SetItem(AutoFocusCheckedXName, false);
            defaultTP.SetItem(AutoGuideCheckedXName, false);
            defaultTP.SetItem(RotatorCheckedXName, false);
            defaultTP.SetItem(RecalibrateAfterFlipCheckedXName, false);
            defaultTP.SetItem(DitherCheckedXName, false);
            defaultTP.SetItem(GuiderAutoDarkCheckedXName, true);
            defaultTP.SetItem(CalibrateCheckedXName, false);
            defaultTP.SetItem(ResyncCheckedXName, false);
            defaultTP.SetItem(ClearFilterXName, 3);
            defaultTP.SetItem(OverheadXName, 0);
            defaultTP.SetItem(CameraTemperatureSetXName, 0);
            defaultTP.SetItem(AtFocusPickedXName, 1);

            defaultTP.SetItem(PlateSolveExposureTimeXName, 10);
            defaultTP.SetItem(RotatorDirectionXName, -1);

            //defaultTP.SetItem( FilterSetXName,0);
            return(defaultTP);
        }