コード例 #1
0
ファイル: WCSInfo.cs プロジェクト: bluephoton/najm
        internal void HandleCardImage(CardImage ci)
        {
            string key = ci.Key;
            string val = ci.Value;

            char           alternative;
            Transformation t = null;

            if (key.StartsWith("WCSAXIS") || key.StartsWith("WCSNAME"))
            {
                alternative = ParseAlternative(ref key, 7);
                t           = alternative == '\0' ? _primaryTransformation : Alternative(alternative);
            }
            else if (ci.IsOneIndexForm("CRVAL") || ci.IsOneIndexForm("CRPIX") || ci.IsOneIndexForm("CDELT") ||
                     ci.IsOneIndexForm("CTYPE") || ci.IsOneIndexForm("CUNIT") || ci.IsOneIndexForm("CRDER") || ci.IsOneIndexForm("CSYER"))
            {
                alternative = ParseAlternative(ref key, 5);
                t           = alternative == '\0' ? _primaryTransformation : Alternative(alternative);
            }
            else if (ci.IsTwoIndexForm("PC") || ci.IsTwoIndexForm("CD") || ci.IsTwoIndexForm("PV") || ci.IsTwoIndexForm("PS"))
            {
                alternative = ParseAlternative(ref key, 2);
                t           = alternative == '\0' ? _primaryTransformation : Alternative(alternative);
            }
            if (t != null)
            {
                // we removed the alternate coordinate letter from the key. we need to update ci
                // with the new key as transformations are not aware of the althernatives letter
                CardImage copy = ci.Copy() as CardImage;
                copy.Key = key;
                t.HandleCardimage(copy);
            }
        }
コード例 #2
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
        #region privates and internals
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
        internal void HandleCardimage(CardImage ci)
        {
            string key   = ci.Key;
            string value = ci.Value;

            int i, j;

            if (ci.IsOneIndexForm("WCSAXIS"))
            {
                _numWCSAxes = int.Parse(value);
            }
            else if (ci.IsOneIndexForm("WCSNAME"))
            {
                _name = value;
            }
            else if (ci.IsOneIndexForm("CRVAL"))
            {
                AddElementToVectorElementList(ci, ref _worldRefElements);
            }
            else if (ci.IsOneIndexForm("CRPIX"))
            {
                AddElementToVectorElementList(ci, ref _pixelRefElements);
            }
            else if (ci.IsOneIndexForm("CDELT"))
            {
                AddElementToVectorElementList(ci, ref _pix2physElements);
            }
            else if (ci.IsOneIndexForm("CRDER"))
            {
                AddElementToVectorElementList(ci, ref _randErrElements);
            }
            else if (ci.IsOneIndexForm("CSYER"))
            {
                AddElementToVectorElementList(ci, ref _sysErrElements);
            }
            else if (ci.IsOneIndexForm("CTYPE"))
            {
                i = ParseIndex(key);
                WCSAxis a = GetOrCreateAxis(i);
                a.Type = value;
            }
            else if (ci.IsOneIndexForm("CUNIT"))
            {
                i = ParseIndex(key);
                WCSAxis a = GetOrCreateAxis(i);
                a.Unit = value;
            }
            else if (ci.IsTwoIndexForm("CROTA"))
            {
                AddElementToVectorElementList(ci, ref _oldRotationElements);
            }
            else if (ci.IsTwoIndexForm("PC"))
            {
                AddElementToMatrixRowList(ci, ref _PCij);
            }
            else if (ci.IsTwoIndexForm("CD"))
            {
                AddElementToMatrixRowList(ci, ref _PCij);
            }
            else if (ci.IsTwoIndexForm("PV"))
            {
                ParseTwoIndices(key, out i, out j);
                WCSAxis a = GetOrCreateAxis(i);
                a.AddNumericParam(j, double.Parse(value));
            }
            else if (ci.IsTwoIndexForm("PS"))
            {
                ParseTwoIndices(key, out i, out j);
                WCSAxis a = GetOrCreateAxis(i);
                a.AddTextParam(j, value);
            }
        }