示例#1
0
 public void InitByPath(string imageFilePath)
 {
     filePath = imageFilePath.ToLower();
     if (filePath.EndsWith(".doqq") || filePath.EndsWith(".doq"))
     {
         fileType = MESourceFileType.doqq;
     }
     else if (filePath.EndsWith("~j"))
     {
         fileType = MESourceFileType.doqqc;
     }
     else if (filePath.EndsWith(".tif") || filePath.EndsWith(".tiff"))
     {
         fileType = MESourceFileType.tif;
     }
     else if (filePath.EndsWith(".jpg") || filePath.EndsWith(".jpeg"))
     {
         fileType = MESourceFileType.jpg;
     }
     else if (filePath.EndsWith(".png"))
     {
         fileType = MESourceFileType.png;
     }
     else
     {
         fileType = MESourceFileType.unknown;
     }
 }
示例#2
0
        /// <summary>
        /// get utm info from source file and return a guessed date of the image file
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="fileType"></param>
        /// <returns></returns>
        public void InitByUtmSourceFile(string filePath, MESourceFileType fileType, string srcProjection, string dstProjection)
        {
            this.filePath = filePath.ToLower();
            switch (fileType)
            {
            case MESourceFileType.doqq:
                MUtilities.ReadUtmMetaFromDoqq(filePath, ref metaInfo, ref guessedDate);
                metaInfo.fileType = MESourceFileType.doqq;
                break;

            case MESourceFileType.doqqc:
                MUtilities.ReadUtmMetaFromDoqq(filePath, ref metaInfo, ref guessedDate);
                metaInfo.fileType = MESourceFileType.doqqc;
                break;

            case MESourceFileType.tif:
                metaInfo          = MUtilities.ReadUtmMetaFromTiff(filePath);
                metaInfo.fileType = MESourceFileType.tif;
                break;

            default:
                throw new Exception("Can only get utm info from doqq, doqqc and tif files");
            }

            // convert projection
            if (srcProjection != "")
            {
                MUtilities.TransformProjection(srcProjection, dstProjection, ref metaInfo.x, ref metaInfo.y);
            }

            guessedDate = guessedDate.Replace(" ", "");
            guessedDate = guessedDate.Substring(0, Math.Min(guessedDate.Length, 12));
        }
示例#3
0
        public void InitByRecordString(string recordString)
        {
            Regex reg = new Regex(@"^(.*)\s+(.*)");
            Match m   = reg.Match(recordString);

            if (!m.Success)
            {
                throw new Exception("LoadDraftRecord: can not parse load record from string");
            }
            fileType = (MESourceFileType)Enum.Parse(typeof(MESourceFileType), m.Groups[1].Value);
            filePath = m.Groups[2].Value;
        }