コード例 #1
0
ファイル: DrillDown.cs プロジェクト: rrskybox/SuperScan
        private int FindClosestLightSource(ccdsoftImage tsxim, double sRA, double sDec, int pDistance)
        {
            //Searches for a "near" light source to the location SRA, SDec and returns it//s index
            //if not, then -1 is returned

            tsxim.RADecToXY(sRA, sDec);
            double tLocX = tsxim.RADecToXYResultX();
            double tLocY = tsxim.RADecToXYResultY();

            double tLhighX = tLocX + pDistance;
            double tLlowX  = tLocX - pDistance;
            double tLhighY = tLocY + pDistance;
            double tLlowY  = tLocY - pDistance;

            var rXArr = tsxim.InventoryArray((int)ccdsoftInventoryIndex.cdInventoryX);
            var rYArr = tsxim.InventoryArray((int)ccdsoftInventoryIndex.cdInventoryY);

            for (int iR = 0; iR < rXArr.Length; iR++)
            {
                if ((rXArr[iR] < tLhighX) &&
                    (rXArr[iR] > tLlowX) &&
                    (rYArr[iR] < tLhighY) &&
                    (rYArr[iR] > tLlowY))
                {
                    return(iR);
                }
            }
            return(-1);   //Error return
        }
コード例 #2
0
            public RADecToXY(string wcsfilepath, double tRA, double tDec)
            {
                //Open reference image in TSX.  Plate solve.
                ccdsoftImage tsx_img = new ccdsoftImage();

                tsx_img.Path = wcsfilepath;
                tsx_img.Open();
                tsx_img.DetachOnClose = 0;
                try
                {
                    tsx_img.InsertWCS(true);
                }
                catch
                {
                    tsx_img.Close();
                    plateSolveResult = false;
                    return;
                }
                tsx_img.RADecToXY(tRA, tDec);
                targetX     = Convert.ToInt32(tsx_img.RADecToXYResultX());
                targetY     = Convert.ToInt32(tsx_img.RADecToXYResultY());
                northangle  = tsx_img.NorthAngle;
                imagescale  = tsx_img.ScaleInArcsecondsPerPixel;
                imagewidth  = tsx_img.WidthInPixels;
                imageheight = tsx_img.HeightInPixels;
                //Check for some catastrophic problem with the image link result
                if ((targetX < 0) || (targetX > imagewidth) || (targetY < 0) || (targetY > imageheight))
                {
                    plateSolveResult = false;
                }
                else
                {
                    plateSolveResult = true;
                };

                tsx_img.Close();
                return;
            }