예제 #1
0
        public string ToEnviProjectionInfoString()
        {
            if (_prjCoordSystem == null)
            {
                return("projection info = {1}");
            }
            EnviPrjInfoArgDef enviDef = null;

            using (IPrjStdsMapTableParser map = new PrjStdsMapTableParser())
                enviDef = map.GetEnviPrjInfoArgDef(int.Parse(_prjCoordSystem.Name.ENVIName));
            if (enviDef == null)
            {
                throw new ArgumentException("ENVI空间参考参数格式设置错误!");
            }
            StringBuilder sb = new StringBuilder();

            string[] paras = enviDef.Args;
            foreach (string para in paras)
            {
                NameValuePair v = _prjCoordSystem.GetParaByName(para);
                if (v == null)
                {
                    sb.Append(GetEnviParaDefaultValue(para).ToString() + ",");
                }
                else
                {
                    sb.Append(v.Value + ",");
                }
            }
            Datum datum = _geoCoordSystem.Datum != null ? _geoCoordSystem.Datum : new Datum();

            return("projection info = {" + _prjCoordSystem.Name.ENVIName + "," + sb.ToString() + datum.Name + "," + (Name ?? string.Empty) + ",Meters}");
        }
예제 #2
0
        public void ToEnviProjectionInfoString(out float[] argValues, out string units)
        {
            EnviPrjInfoArgDef enviDef = null;

            using (IPrjStdsMapTableParser map = new PrjStdsMapTableParser())
                enviDef = map.GetEnviPrjInfoArgDef(int.Parse(_prjCoordSystem.Name.ENVIName));
            if (enviDef == null)
            {
                throw new ArgumentException("ENVI空间参考参数格式设置错误!");
            }
            StringBuilder sb = new StringBuilder();

            string[]     paras        = enviDef.Args;
            List <float> retargValues = new List <float>();

            foreach (string para in paras)
            {
                NameValuePair v = _prjCoordSystem.GetParaByName(para);
                if (v == null)
                {
                    retargValues.Add((float)GetEnviParaDefaultValue(para));
                }
                else
                {
                    retargValues.Add((float)v.Value);
                }
            }
            argValues = retargValues.ToArray();
            units     = "Meters";
        }