Exemple #1
0
 private HdrFile.Envelope GetEnvelopeByAttr(string leftUpStr, string RightDownStr)
 {
     HdrFile.Envelope env   = new HdrFile.Envelope();
     string[]         split = leftUpStr.Replace("(", "").Replace(")", "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
     env.MaxY = double.Parse(split[1]);
     env.MinX = double.Parse(split[0]);
     split    = RightDownStr.Replace("(", "").Replace(")", "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
     env.MinY = double.Parse(split[1]);
     env.MaxX = double.Parse(split[0]);
     return(env);
 }
Exemple #2
0
        private bool CheckRegion(string filename, Hdf4Operator oper, out HdrFile.Envelope envelope)
        {
            envelope = null;
            string lefrupArg = "";

            SetAttr(oper.GetAttributes(), _leftupPointNames, ref lefrupArg);
            if (string.IsNullOrEmpty(lefrupArg))
            {
                AddLog(Path.GetFileName(filename) + "左上角坐标未找到!");
                return(false);
            }
            string ringhtDownArg = "";

            SetAttr(oper.GetAttributes(), _rightDownPointNames, ref ringhtDownArg);
            if (string.IsNullOrEmpty(ringhtDownArg))
            {
                AddLog(Path.GetFileName(filename) + "右下角坐标未找到!");
                return(false);
            }
            envelope = GetEnvelopeByAttr(lefrupArg, ringhtDownArg);
            return(true);
        }
Exemple #3
0
        private bool CheckResultion(string filename, ref float lonResultion, ref float latResultion, HdrFile.Envelope srcEnvelope, Size srcSize)
        {
            float maxCY            = 0.0001f;
            float currLonResultion = (float)((srcEnvelope.MaxX - srcEnvelope.MinX) / srcSize.Width);
            float currLatResultion = (float)((srcEnvelope.MaxY - srcEnvelope.MinY) / srcSize.Height);

            if (lonResultion == 0)
            {
                lonResultion = currLonResultion;
            }
            if (latResultion == 0)
            {
                latResultion = currLatResultion;
            }
            if (lonResultion != 0 && latResultion != 0)
            {
                if (lonResultion - currLonResultion > maxCY ||
                    latResultion - currLatResultion > maxCY)
                {
                    AddLog(Path.GetFileName(filename) + "分辨率不一致!");
                    return(false);
                }
            }
            return(true);
        }