/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("\r\n<div class=\"content-container\">\r\n "); #line 5 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoDiv.tt" this.Write(this.ToStringHelper.ToStringWithCulture(PictureInformation.PictureFigureWithCaptionTag("100vw"))); #line default #line hidden this.Write("\r\n "); #line 7 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoDiv.tt" this.Write(this.ToStringHelper.ToStringWithCulture(PhotoDetails.PhotoDetailsDiv(DbEntry).ToString())); #line default #line hidden this.Write("\r\n "); #line 9 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoDiv.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.PostBodyDiv(DbEntry).ToString())); #line default #line hidden this.Write("\r\n "); #line 10 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoDiv.tt" this.Write(this.ToStringHelper.ToStringWithCulture(BodyContentReferences.RelatedContentTag(DbEntry.ContentId, "").Result)); #line default #line hidden this.Write("\r\n</div>\r\n"); return(this.GenerationEnvironment.ToString()); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("\r\n<div class=\"content-container\" data-contentversion=\""); #line 5 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\ImageHtml\SingleImageDiv.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.ContentVersion.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffff"))); #line default #line hidden this.Write("\">\r\n "); #line 6 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\ImageHtml\SingleImageDiv.tt" this.Write(this.ToStringHelper.ToStringWithCulture(PictureInformation.PictureFigureWithCaptionTag("100vw"))); #line default #line hidden this.Write("\r\n "); #line 8 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\ImageHtml\SingleImageDiv.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.PostBodyDiv(DbEntry).ToString())); #line default #line hidden this.Write("\r\n "); #line 9 "C:\Code\PointlessWaymarksCms05\PointlessWaymarksCmsData\Html\ImageHtml\SingleImageDiv.tt" this.Write(this.ToStringHelper.ToStringWithCulture(BodyContentReferences.RelatedContentTag(DbEntry, GenerationVersion).Result)); #line default #line hidden this.Write("\r\n</div>\r\n"); return(this.GenerationEnvironment.ToString()); }
private void Bind() { if (!string.IsNullOrEmpty(funName)) { int totalRecords = 0; switch (funName) { case "CommunionPicture": CommunionPicture communionpBll = new CommunionPicture(); rpData.DataSource = communionpBll.GetList(pageIndex, pageSize, out totalRecords, "", null); rpData.DataBind(); break; case "UserHeadPicture": UserHeadPicture uhpBll = new UserHeadPicture(); rpData.DataSource = uhpBll.GetList(pageIndex, pageSize, out totalRecords, "", null); rpData.DataBind(); break; case "ActivityPhotoPicture": ActivityPhotoPicture appBll = new ActivityPhotoPicture(); rpData.DataSource = appBll.GetList(pageIndex, pageSize, out totalRecords, "", null); rpData.DataBind(); break; case "ActivityPlayerPhotoPicture": ActivityPlayerPhotoPicture apppBll = new ActivityPlayerPhotoPicture(); rpData.DataSource = apppBll.GetList(pageIndex, pageSize, out totalRecords, "", null); rpData.DataBind(); break; case "PictureScratchLotto": PictureScratchLotto pslBll = new PictureScratchLotto(); rpData.DataSource = pslBll.GetList(pageIndex, pageSize, out totalRecords, "", null); rpData.DataBind(); break; case "InformationPicture": PictureInformation piBll = new PictureInformation(); rpData.DataSource = piBll.GetList(pageIndex, pageSize, out totalRecords, "", null); rpData.DataBind(); break; default: break; } myDataAppend.Replace("{TotalRecord}", totalRecords.ToString()); myDataAppend.Replace("{PageIndex}", pageIndex.ToString()); myDataAppend.Replace("{PageSize}", pageSize.ToString()); } }
public Dictionary<string, PictureInformation> doworkGPSOFFSET(string logFile, string dirWithImages, float offset) { // Lets start over Dictionary<string, PictureInformation> picturesInformationTemp = new Dictionary<string, PictureInformation>(); //logFile = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM\2011-10-01 11-48 1.log"; TXT_outputlog.AppendText("Reading log for GPS-ATT Messages\n"); // Read Vehicle Locations from log. GPS Messages. Will have to do it anyway if (vehicleLocations == null || vehicleLocations.Count <= 0) vehicleLocations = readGPSMsgInLog(logFile); if (vehicleLocations == null) { TXT_outputlog.AppendText("Log file problem. Aborting....\n"); return null; } //dirWithImages = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM"; TXT_outputlog.AppendText("Read images\n"); List<string> filelist = new List<string>(); string[] exts = PHOTO_FILES_FILTER.Split(';'); foreach (var ext in exts) { filelist.AddRange(Directory.GetFiles(dirWithImages, ext)); } string[] files = filelist.ToArray(); TXT_outputlog.AppendText("Images read : " + files.Length + "\n"); // Check that we have at least one picture if (files.Length <= 0) { TXT_outputlog.AppendText("Not enought files found. Aborting..... \n"); return null; } Array.Sort(files, Comparer.DefaultInvariant); // Each file corresponds to one CAM message // We assume that picture names are in ascending order in time for (int i = 0; i < files.Length; i++) { string filename = files[i]; PictureInformation p = new PictureInformation(); // Fill shot time in Picture p.ShotTimeReportedByCamera = getPhotoTime(filename); // Lookfor corresponding Location in vehicleLocationList DateTime correctedTime = p.ShotTimeReportedByCamera.AddSeconds(-offset); VehicleLocation shotLocation = LookForLocation(correctedTime, vehicleLocations); if (shotLocation == null) { TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(filename) + " NOT PROCESSED. No GPS match in the log file. Please take care\n"); } else { p.Lat = shotLocation.Lat; p.Lon = shotLocation.Lon; p.AltAMSL = shotLocation.AltAMSL; p.RelAlt = shotLocation.RelAlt; p.Pitch = shotLocation.Pitch; p.Roll = shotLocation.Roll; p.Yaw = shotLocation.Yaw; p.Time = shotLocation.Time; p.Path = filename; picturesInformationTemp.Add(filename, p); TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(filename) + " PROCESSED with GPS position found " + (shotLocation.Time - correctedTime).Milliseconds + " ms away\n"); } } return picturesInformationTemp; }
public Dictionary<string, PictureInformation> doworkCAM(string logFile, string dirWithImages) { // Lets start over Dictionary<string, PictureInformation> picturesInformationTemp = new Dictionary<string,PictureInformation>(); TXT_outputlog.AppendText("Using AMSL Altitude " + useAMSLAlt + "\n"); // If we are required to use AMSL then GPS messages should be used until CAM messages includes AMSL in the coming AC versions // Or if the user enter shutter lag and thus we have to look for GPS messages ahead in time if (useAMSLAlt || millisShutterLag > 0) { TXT_outputlog.AppendText("Reading log for GPS Messages in order to get AMSL Altitude\n"); if (vehicleLocations == null || vehicleLocations.Count <= 0) { vehicleLocations = readGPSMsgInLog(logFile); if (vehicleLocations == null || vehicleLocations.Count <= 0) { TXT_outputlog.AppendText("Log file problem. Aborting....\n"); return null; } } TXT_outputlog.AppendText("Log Read for GPS Messages\n"); } //logFile = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM\2011-10-01 11-48 1.log"; TXT_outputlog.AppendText("Reading log for CAM Messages\n"); List<string[]> list = readCAMMsgInLog(logFile); if (list == null) { TXT_outputlog.AppendText("Log file problem. Aborting....\n"); return null; } TXT_outputlog.AppendText("Log Read with - " + list.Count + " - CAM Messages found\n"); //dirWithImages = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM"; TXT_outputlog.AppendText("Read images\n"); string[] files = Directory.GetFiles(dirWithImages, "*.jpg"); TXT_outputlog.AppendText("Images read : " + files.Length + "\n"); // Check that we have same number of CAMs than files if (files.Length != list.Count) { TXT_outputlog.AppendText("CAM Msgs and Files discrepancy. Check it! Aborting..... \n"); return null; } Array.Sort(files, Comparer.DefaultInvariant); // Each file corresponds to one CAM message // We assume that picture names are in ascending order in time for (int i = 0; i < list.Count; i++) { string[] currentCAM = list[i]; PictureInformation p = new PictureInformation(); DateTime dCAMMsgTime = GetTimeFromGps(int.Parse(getValueFromStringArray(currentCAM, weekCAMPos), CultureInfo.InvariantCulture), int.Parse(getValueFromStringArray(currentCAM, timeCAMpos), CultureInfo.InvariantCulture)); if (millisShutterLag == 0) { // Lets puts GPS time p.Time = dCAMMsgTime; p.Lat = double.Parse(getValueFromStringArray(currentCAM, latCAMpos), CultureInfo.InvariantCulture); p.Lon = double.Parse(getValueFromStringArray(currentCAM, lngCAMpos), CultureInfo.InvariantCulture); p.AltAMSL = double.Parse(getValueFromStringArray(currentCAM, altCAMpos), CultureInfo.InvariantCulture); p.RelAlt = double.Parse(getValueFromStringArray(currentCAM, altCAMpos), CultureInfo.InvariantCulture); VehicleLocation cameraLocationFromGPSMsg = null; string logAltMsg = "RelAlt"; if (useAMSLAlt) { cameraLocationFromGPSMsg = LookForLocation(p.Time, vehicleLocations); if (cameraLocationFromGPSMsg != null) { logAltMsg = "AMSL Alt " + (cameraLocationFromGPSMsg.Time - p.Time).Milliseconds + " ms away"; p.AltAMSL = cameraLocationFromGPSMsg.AltAMSL; } else logAltMsg = "AMSL Alt NOT found"; } p.Pitch = float.Parse(getValueFromStringArray(currentCAM, pitchCAMATT), CultureInfo.InvariantCulture); p.Roll = float.Parse(getValueFromStringArray(currentCAM, rollCAMATT), CultureInfo.InvariantCulture); p.Yaw = float.Parse(getValueFromStringArray(currentCAM, yawCAMATT), CultureInfo.InvariantCulture); p.Path = files[i]; string picturePath = files[i]; picturesInformationTemp.Add(picturePath, p); TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(picturePath) + " processed from CAM Msg with " + millisShutterLag + " ms shutter lag. " + logAltMsg + "\n"); } else { // Look fot GPS Message ahead DateTime dCorrectedWithLagPhotoTime = dCAMMsgTime; dCorrectedWithLagPhotoTime = dCorrectedWithLagPhotoTime.AddMilliseconds(millisShutterLag); VehicleLocation cameraLocationFromGPSMsg = LookForLocation(dCorrectedWithLagPhotoTime, vehicleLocations); // Check which GPS Position is closer in time. if (cameraLocationFromGPSMsg != null) { System.TimeSpan diffGPSTimeCAMTime = cameraLocationFromGPSMsg.Time - dCAMMsgTime; if (diffGPSTimeCAMTime.Milliseconds > 2 * millisShutterLag) { // Stay with CAM Message as it is closer to CorrectedTime p.Time = dCAMMsgTime; p.Lat = double.Parse(getValueFromStringArray(currentCAM, latCAMpos), CultureInfo.InvariantCulture); p.Lon = double.Parse(getValueFromStringArray(currentCAM, lngCAMpos), CultureInfo.InvariantCulture); p.AltAMSL = double.Parse(getValueFromStringArray(currentCAM, altCAMpos), CultureInfo.InvariantCulture); p.RelAlt = double.Parse(getValueFromStringArray(currentCAM, altCAMpos), CultureInfo.InvariantCulture); string logAltMsg = "RelAlt"; cameraLocationFromGPSMsg = null; if (useAMSLAlt) { cameraLocationFromGPSMsg = LookForLocation(p.Time, vehicleLocations); if (cameraLocationFromGPSMsg != null) { logAltMsg = "AMSL Alt " + (cameraLocationFromGPSMsg.Time - p.Time).Milliseconds + " ms away"; p.AltAMSL = cameraLocationFromGPSMsg.AltAMSL; } else logAltMsg = "AMSL Alt NOT found"; } TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(files[i]) + " processed with CAM Msg. Shutter lag too small. " + logAltMsg + "\n"); } else { // Get GPS Time as it is closer to CorrectedTime // Lets puts GPS time p.Time = cameraLocationFromGPSMsg.Time; p.Lat = cameraLocationFromGPSMsg.Lat; p.Lon = cameraLocationFromGPSMsg.Lon; p.AltAMSL = cameraLocationFromGPSMsg.AltAMSL; p.RelAlt = cameraLocationFromGPSMsg.RelAlt; string logAltMsg = useAMSLAlt ? "AMSL Alt" : "RelAlt"; TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(files[i]) + " processed with GPS Msg : " + diffGPSTimeCAMTime.Milliseconds + " ms ahead of CAM Msg. " + logAltMsg + "\n"); } p.Pitch = float.Parse(getValueFromStringArray(currentCAM, pitchCAMATT), CultureInfo.InvariantCulture); p.Roll = float.Parse(getValueFromStringArray(currentCAM, rollCAMATT), CultureInfo.InvariantCulture); p.Yaw = float.Parse(getValueFromStringArray(currentCAM, yawCAMATT), CultureInfo.InvariantCulture); p.Path = files[i]; string picturePath = files[i]; picturesInformationTemp.Add(picturePath, p); } else { TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(files[i]) + " NOT Processed. Time not found in log. Too large Shutter Lag? Try setting it to 0\n"); } } } return picturesInformationTemp; }
public Dictionary<string, PictureInformation> doworkGPSOFFSET(string logFile, string dirWithImages, float offset) { // Lets start over Dictionary<string, PictureInformation> picturesInformationTemp = new Dictionary<string, PictureInformation>(); //logFile = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM\2011-10-01 11-48 1.log"; TXT_outputlog.AppendText("Reading log for GPS-ATT Messages\n"); // Read Vehicle Locations from log. GPS Messages. Will have to do it anyway if (vehicleLocations == null || vehicleLocations.Count <= 0) vehicleLocations = readGPSMsgInLog(logFile); if (vehicleLocations == null) { TXT_outputlog.AppendText("Log file problem. Aborting....\n"); return null; } //dirWithImages = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM"; TXT_outputlog.AppendText("Read images\n"); string[] files = Directory.GetFiles(dirWithImages, "*.jpg"); TXT_outputlog.AppendText("Images read : " + files.Length + "\n"); // Check that we have at least one picture if (files.Length <= 0) { TXT_outputlog.AppendText("Not enought files found. Aborting..... \n"); return null; } Array.Sort(files, Comparer.DefaultInvariant); // Each file corresponds to one CAM message // We assume that picture names are in ascending order in time for (int i = 0; i < files.Length; i++) { string filename = files[i]; PictureInformation p = new PictureInformation(); // Fill shot time in Picture p.ShotTimeReportedByCamera = getPhotoTime(filename); // Lookfor corresponding Location in vehicleLocationList VehicleLocation shotLocation = LookForLocation(p.ShotTimeReportedByCamera.AddSeconds(-offset), vehicleLocations); if (shotLocation == null) { TXT_outputlog.AppendText("File time not found in Log. Aborting..... \n"); return null; } p.Lat = shotLocation.Lat; p.Lon = shotLocation.Lon; p.AltAMSL = shotLocation.AltAMSL; p.RelAlt = shotLocation.RelAlt; p.Pitch = shotLocation.Pitch; p.Roll = shotLocation.Roll; p.Yaw = shotLocation.Yaw; p.Time = shotLocation.Time; p.Path = filename; picturesInformationTemp.Add(filename, p); TXT_outputlog.AppendText("Photo " + filename + " processed\n"); } return picturesInformationTemp; }
public Dictionary<string, PictureInformation> doworkCAM(string logFile, string dirWithImages) { // Lets start over Dictionary<string, PictureInformation> picturesInformationTemp = new Dictionary<string,PictureInformation>(); TXT_outputlog.AppendText("Using AMSL Altitude " + useAMSLAlt + "\n"); // If we are required to use AMSL then GPS messages should be used until CAM messages includes AMSL in the coming AC versions if (useAMSLAlt) { TXT_outputlog.AppendText("Reading log for GPS Messages in order to get AMSL Altitude\n"); if (vehicleLocations == null || vehicleLocations.Count <= 0) { vehicleLocations = readGPSMsgInLog(logFile); if (vehicleLocations == null || vehicleLocations.Count <= 0) { TXT_outputlog.AppendText("Log file problem. Aborting....\n"); return null; } } TXT_outputlog.AppendText("Log Read for GPS Messages\n"); } //logFile = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM\2011-10-01 11-48 1.log"; TXT_outputlog.AppendText("Reading log for CAM Messages\n"); List<string[]> list = readCAMMsgInLog(logFile); if (list == null) { TXT_outputlog.AppendText("Log file problem. Aborting....\n"); return null; } TXT_outputlog.AppendText("Log Read with - " + list.Count + " - CAM Messages found\n"); //dirWithImages = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM"; TXT_outputlog.AppendText("Read images\n"); string[] files = Directory.GetFiles(dirWithImages, "*.jpg"); TXT_outputlog.AppendText("Images read : " + files.Length + "\n"); // Check that we have same number of CAMs than files if (files.Length != list.Count) { TXT_outputlog.AppendText("CAM Msgs and Files discrepancy. Check it! Aborting..... \n"); return null; } Array.Sort(files, Comparer.DefaultInvariant); // Each file corresponds to one CAM message // We assume that picture names are in ascending order in time for (int i = 0; i < list.Count; i++) { string[] currentCAM = list[i]; PictureInformation p = new PictureInformation(); // Lets puts GPS time p.Time = GetTimeFromGps(int.Parse(currentCAM[weekCAMPos]), int.Parse(currentCAM[timeCAMpos])); p.Lat = double.Parse(currentCAM[latCAMpos]); p.Lon = double.Parse(currentCAM[lngCAMpos]); p.AltAMSL = double.Parse(currentCAM[altCAMpos]); p.RelAlt = double.Parse(currentCAM[altCAMpos]); VehicleLocation cameraLocationFromGPSMsg = null; if (useAMSLAlt) { cameraLocationFromGPSMsg = LookForLocation(p.Time, vehicleLocations); if (cameraLocationFromGPSMsg != null) p.AltAMSL = cameraLocationFromGPSMsg.AltAMSL; } p.Pitch = float.Parse(currentCAM[pitchCAMATT]); p.Roll = float.Parse(currentCAM[rollCAMATT]); p.Yaw = float.Parse(currentCAM[yawCAMATT]); p.Path = files[i]; string picturePath = files[i]; picturesInformationTemp.Add(picturePath, p); TXT_outputlog.AppendText("Photo " + picturePath + " processed\n"); } return picturesInformationTemp; }
private void OnUploadInformationPicture(HttpContext context) { context.Response.ContentType = "text/plain"; string errorMsg = ""; try { HttpFileCollection files = context.Request.Files; if (files.Count == 0) { context.Response.Write("{\"success\": false,\"message\": \"未找到任何可上传的文件,请检查!\"}"); return; } int effect = 0; UploadFilesHelper ufh = new UploadFilesHelper(); ImagesHelper ih = new ImagesHelper(); using (TransactionScope scope = new TransactionScope()) { foreach (string item in files.AllKeys) { HttpPostedFile file = files[item]; if (file == null || file.ContentLength == 0) { continue; } int fileSize = file.ContentLength; int uploadFileSize = int.Parse(ConfigHelper.GetValueByKey("UploadFileSize")); if (fileSize > uploadFileSize) { throw new ArgumentException("文件【" + file.FileName + "】大小超出字节" + uploadFileSize + ",无法上传,请正确操作!"); } if (!UploadFilesHelper.IsFileValidated(file.InputStream, fileSize)) { throw new ArgumentException("文件【" + file.FileName + "】为受限制的文件,请正确操作!"); } string fileName = file.FileName; PictureInformation bll = new PictureInformation(); if (bll.IsExist(file.FileName, fileSize)) { throw new ArgumentException("文件【" + file.FileName + "】已存在,请勿重复上传!"); } string originalUrl = UploadFilesHelper.UploadOriginalFile(file, "InformationPicture"); //获取随机生成的文件名代码 string randomFolder = string.Format("{0}_{1}", DateTime.Now.ToString("MMdd"), UploadFilesHelper.GetRandomFolder("ip")); PictureInformationInfo model = new PictureInformationInfo(); model.FileName = VirtualPathUtility.GetFileName(originalUrl); model.FileSize = fileSize; model.FileExtension = VirtualPathUtility.GetExtension(originalUrl).ToLower(); model.FileDirectory = VirtualPathUtility.GetDirectory(originalUrl.Replace("~", "")); model.RandomFolder = randomFolder; model.LastUpdatedDate = DateTime.Now; bll.Insert(model); string rndDirFullPath = context.Server.MapPath(string.Format("~{0}{1}", model.FileDirectory, model.RandomFolder)); if (!Directory.Exists(rndDirFullPath)) { Directory.CreateDirectory(rndDirFullPath); } File.Copy(context.Server.MapPath(originalUrl), string.Format("{0}\\{1}{2}", rndDirFullPath, randomFolder, model.FileExtension), true); string[] platformNames = Enum.GetNames(typeof(EnumData.Platform)); foreach (string name in platformNames) { string platformUrl = string.Format("{0}/{1}/{2}", model.FileDirectory, model.RandomFolder, name); string platformUrlFullPath = context.Server.MapPath("~" + platformUrl); if (!Directory.Exists(platformUrlFullPath)) { Directory.CreateDirectory(platformUrlFullPath); } string sizeAppend = ConfigHelper.GetValueByKey(name); string[] sizeArr = sizeAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < sizeArr.Length; i++) { string bmsPicUrl = string.Format("{0}\\{1}_{2}{3}", platformUrlFullPath, model.RandomFolder, i, model.FileExtension); string[] wh = sizeArr[i].Split('*'); ih.CreateThumbnailImage(context.Server.MapPath(originalUrl), bmsPicUrl, int.Parse(wh[0]), int.Parse(wh[1]), "DB", model.FileExtension); } } effect++; } scope.Complete(); } if (effect == 0) { context.Response.Write("{\"success\": false,\"message\": \"未找到任何可上传的文件,请检查!\"}"); return; } context.Response.Write("{\"success\": true,\"message\": \"已成功上传文件数:" + effect + "个\"}"); return; } catch (Exception ex) { errorMsg = ex.Message; } context.Response.Write("{\"success\": false,\"message\": \"" + errorMsg + "\"}"); }
public Dictionary<string, PictureInformation> doworkCAM(string logFile, string dirWithImages) { // Lets start over Dictionary<string, PictureInformation> picturesInformationTemp = new Dictionary<string,PictureInformation>(); TXT_outputlog.AppendText("使用海拔高度 " + useAMSLAlt + "\n"); // If we are required to use AMSL then GPS messages should be used until CAM messages includes AMSL in the coming AC versions // Or if the user enter shutter lag and thus we have to look for GPS messages ahead in time if (useAMSLAlt || millisShutterLag > 0) { TXT_outputlog.AppendText("读取log文件中GPS信息中海拔高度\n"); if (vehicleLocations == null || vehicleLocations.Count <= 0) { vehicleLocations = readGPSMsgInLog(logFile); if (vehicleLocations == null || vehicleLocations.Count <= 0) { TXT_outputlog.AppendText("Log文件损坏. 取消中....\n"); return null; } } TXT_outputlog.AppendText("读取Log文件中GPS信息\n"); } //logFile = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM\2011-10-01 11-48 1.log"; TXT_outputlog.AppendText("从Log文件中读取CAM信息\n"); //List<string[]> list = readCAMMsgInLogString(logFile); var list = readCAMMsgInLog(logFile); if (list == null) { TXT_outputlog.AppendText("Log文件损坏. 取消中....\n"); return null; } TXT_outputlog.AppendText("Log文件中获取 - " + list.Count + " 条 - CAM 信息\n"); //dirWithImages = @"C:\Users\hog\Pictures\farm 1-10-2011\100SSCAM"; TXT_outputlog.AppendText("读取照片\n"); string[] files = Directory.GetFiles(dirWithImages, "*.jpg"); TXT_outputlog.AppendText("照片数量: " + files.Length + "\n"); // Check that we have same number of CAMs than files if (files.Length != list.Count) { TXT_outputlog.AppendText("CAM信息与文件不匹配. 请检查!\n"); return null; } Array.Sort(files, Comparer.DefaultInvariant); // Each file corresponds to one CAM message // We assume that picture names are in ascending order in time //for (int i = 0; i < list.Count; i++) //{ // string[] currentCAM = list[i]; // PictureInformation p = new PictureInformation(); // // Fill shot time in Picture // p.ShotTimeReportedByCamera = getPhotoTime(files[i]); // DateTime dCAMMsgTime = GetTimeFromGps(int.Parse(getValueFromStringArray(currentCAM, weekCAMPos), CultureInfo.InvariantCulture), int.Parse(getValueFromStringArray(currentCAM, timeCAMpos), CultureInfo.InvariantCulture)); // if (millisShutterLag == 0) // { // // Lets puts GPS time // p.Time = dCAMMsgTime; // p.Lat = double.Parse(getValueFromStringArray(currentCAM, latCAMpos), CultureInfo.InvariantCulture); // p.Lon = double.Parse(getValueFromStringArray(currentCAM, lngCAMpos), CultureInfo.InvariantCulture); // p.AltAMSL = double.Parse(getValueFromStringArray(currentCAM, altCAMpos), CultureInfo.InvariantCulture); // p.RelAlt = double.Parse(getValueFromStringArray(currentCAM, altCAMpos), CultureInfo.InvariantCulture); // VehicleLocation cameraLocationFromGPSMsg = null; // string logAltMsg = "RelAlt"; // if (useAMSLAlt) // { // cameraLocationFromGPSMsg = LookForLocation(p.Time, vehicleLocations); // if (cameraLocationFromGPSMsg != null) // { // logAltMsg = "AMSL Alt " + (cameraLocationFromGPSMsg.Time - p.Time).Milliseconds + " ms away" + " offset: " + (p.ShotTimeReportedByCamera - dCAMMsgTime).TotalSeconds; // p.AltAMSL = cameraLocationFromGPSMsg.AltAMSL; // } // else // logAltMsg = "AMSL Alt NOT found"; // } // p.Pitch = float.Parse(getValueFromStringArray(currentCAM, pitchCAMATT), CultureInfo.InvariantCulture); // p.Roll = float.Parse(getValueFromStringArray(currentCAM, rollCAMATT), CultureInfo.InvariantCulture); // p.Yaw = float.Parse(getValueFromStringArray(currentCAM, yawCAMATT), CultureInfo.InvariantCulture); // p.Path = files[i]; // string picturePath = files[i]; // picturesInformationTemp.Add(picturePath, p); // TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(picturePath) + " processed from CAM Msg with " + millisShutterLag + " ms shutter lag. " + logAltMsg +"\n"); // } // else // { // // Look fot GPS Message ahead // DateTime dCorrectedWithLagPhotoTime = dCAMMsgTime; // dCorrectedWithLagPhotoTime = dCorrectedWithLagPhotoTime.AddMilliseconds(millisShutterLag); // VehicleLocation cameraLocationFromGPSMsg = LookForLocation(dCorrectedWithLagPhotoTime, vehicleLocations); // // Check which GPS Position is closer in time. // if (cameraLocationFromGPSMsg != null) // { // System.TimeSpan diffGPSTimeCAMTime = cameraLocationFromGPSMsg.Time - dCAMMsgTime; // if (diffGPSTimeCAMTime.Milliseconds > 2 * millisShutterLag) // { // // Stay with CAM Message as it is closer to CorrectedTime // p.Time = dCAMMsgTime; // p.Lat = double.Parse(getValueFromStringArray(currentCAM, latCAMpos), CultureInfo.InvariantCulture); // p.Lon = double.Parse(getValueFromStringArray(currentCAM, lngCAMpos), CultureInfo.InvariantCulture); // p.AltAMSL = double.Parse(getValueFromStringArray(currentCAM, altCAMpos), CultureInfo.InvariantCulture); // p.RelAlt = double.Parse(getValueFromStringArray(currentCAM, altCAMpos), CultureInfo.InvariantCulture); // string logAltMsg = "RelAlt"; // cameraLocationFromGPSMsg = null; // if (useAMSLAlt) // { // cameraLocationFromGPSMsg = LookForLocation(p.Time, vehicleLocations); // if (cameraLocationFromGPSMsg != null) // { // logAltMsg = "AMSL Alt " + (cameraLocationFromGPSMsg.Time - p.Time).Milliseconds + " ms away"; // p.AltAMSL = cameraLocationFromGPSMsg.AltAMSL; // } // else // logAltMsg = "AMSL Alt NOT found"; // } // TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(files[i]) + " processed with CAM Msg. Shutter lag too small. " + logAltMsg + "\n"); // } // else // { // // Get GPS Time as it is closer to CorrectedTime // // Lets puts GPS time // p.Time = cameraLocationFromGPSMsg.Time; // p.Lat = cameraLocationFromGPSMsg.Lat; // p.Lon = cameraLocationFromGPSMsg.Lon; // p.AltAMSL = cameraLocationFromGPSMsg.AltAMSL; // p.RelAlt = cameraLocationFromGPSMsg.RelAlt; // string logAltMsg = useAMSLAlt ? "AMSL Alt" : "RelAlt"; // TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(files[i]) + " processed with GPS Msg : " + diffGPSTimeCAMTime.Milliseconds + " ms ahead of CAM Msg. " + logAltMsg + "\n"); // } // p.Pitch = float.Parse(getValueFromStringArray(currentCAM, pitchCAMATT), CultureInfo.InvariantCulture); // p.Roll = float.Parse(getValueFromStringArray(currentCAM, rollCAMATT), CultureInfo.InvariantCulture); // p.Yaw = float.Parse(getValueFromStringArray(currentCAM, yawCAMATT), CultureInfo.InvariantCulture); // p.Path = files[i]; // string picturePath = files[i]; // picturesInformationTemp.Add(picturePath, p); // } // else // { // TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(files[i]) + " NOT Processed. Time not found in log. Too large Shutter Lag? Try setting it to 0\n"); // } // } //} int i = -1; foreach (var currentCAM in list.Values) { i++; PictureInformation p = new PictureInformation(); // Fill shot time in Picture p.ShotTimeReportedByCamera = getPhotoTime(files[i]); DateTime dCAMMsgTime = currentCAM.Time; if (millisShutterLag == 0) { // Lets puts GPS time p.Time = dCAMMsgTime; p.Lat = currentCAM.Lat; p.Lon = currentCAM.Lon; p.AltAMSL = currentCAM.AltAMSL; p.RelAlt = currentCAM.RelAlt; VehicleLocation cameraLocationFromGPSMsg = null; string logAltMsg = "RelAlt"; if (useAMSLAlt) { cameraLocationFromGPSMsg = LookForLocation(p.Time, vehicleLocations); if (cameraLocationFromGPSMsg != null) { logAltMsg = "AMSL Alt " + (cameraLocationFromGPSMsg.Time - p.Time).Milliseconds + " ms away" + " offset: " + (p.ShotTimeReportedByCamera - dCAMMsgTime).TotalSeconds; p.AltAMSL = cameraLocationFromGPSMsg.AltAMSL; } else logAltMsg = "海拔高度未找到"; } p.Pitch = currentCAM.Pitch; p.Roll = currentCAM.Roll; p.Yaw = currentCAM.Yaw; p.Path = files[i]; string picturePath = files[i]; picturesInformationTemp.Add(picturePath, p); TXT_outputlog.AppendText(" 使用Cam信息处理照片" + Path.GetFileNameWithoutExtension(picturePath) + ",用时"+ millisShutterLag + "毫秒. " + logAltMsg + "\n"); } else { // Look fot GPS Message ahead DateTime dCorrectedWithLagPhotoTime = dCAMMsgTime; dCorrectedWithLagPhotoTime = dCorrectedWithLagPhotoTime.AddMilliseconds(millisShutterLag); VehicleLocation cameraLocationFromGPSMsg = LookForLocation(dCorrectedWithLagPhotoTime, vehicleLocations); // Check which GPS Position is closer in time. if (cameraLocationFromGPSMsg != null) { System.TimeSpan diffGPSTimeCAMTime = cameraLocationFromGPSMsg.Time - dCAMMsgTime; if (diffGPSTimeCAMTime.Milliseconds > 2 * millisShutterLag) { // Stay with CAM Message as it is closer to CorrectedTime p.Time = dCAMMsgTime; p.Lat = currentCAM.Lat; p.Lon = currentCAM.Lon; p.AltAMSL = currentCAM.AltAMSL; p.RelAlt = currentCAM.RelAlt; string logAltMsg = "RelAlt"; cameraLocationFromGPSMsg = null; if (useAMSLAlt) { cameraLocationFromGPSMsg = LookForLocation(p.Time, vehicleLocations); if (cameraLocationFromGPSMsg != null) { logAltMsg = "AMSL Alt " + (cameraLocationFromGPSMsg.Time - p.Time).Milliseconds + " ms away"; p.AltAMSL = cameraLocationFromGPSMsg.AltAMSL; } else logAltMsg = "AMSL Alt NOT found"; } TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(files[i]) + " processed with CAM Msg. Shutter lag too small. " + logAltMsg + "\n"); } else { // Get GPS Time as it is closer to CorrectedTime // Lets puts GPS time p.Time = cameraLocationFromGPSMsg.Time; p.Lat = cameraLocationFromGPSMsg.Lat; p.Lon = cameraLocationFromGPSMsg.Lon; p.AltAMSL = cameraLocationFromGPSMsg.AltAMSL; p.RelAlt = cameraLocationFromGPSMsg.RelAlt; string logAltMsg = useAMSLAlt ? "AMSL Alt" : "RelAlt"; TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(files[i]) + " processed with GPS Msg : " + diffGPSTimeCAMTime.Milliseconds + " ms ahead of CAM Msg. " + logAltMsg + "\n"); } p.Pitch = currentCAM.Pitch; p.Roll = currentCAM.Roll; p.Yaw = currentCAM.Yaw; p.Path = files[i]; string picturePath = files[i]; picturesInformationTemp.Add(picturePath, p); } else { TXT_outputlog.AppendText("Photo " + Path.GetFileNameWithoutExtension(files[i]) + " NOT Processed. Time not found in log. Too large Shutter Lag? Try setting it to 0\n"); } } } return picturesInformationTemp; }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { this.Write("<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"utf-8\">\r\n <title" + ">"); #line 7 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.Title.HtmlEncode())); #line default #line hidden this.Write("</title>\r\n <meta name=\"description\" content=\""); #line 8 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.Summary.HtmlEncode())); #line default #line hidden this.Write("\">\r\n <meta name=\"author\" content=\""); #line 9 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.CreatedBy.HtmlEncode())); #line default #line hidden this.Write("\">\r\n <meta name=\"keywords\" content=\""); #line 10 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.Tags.HtmlEncode())); #line default #line hidden this.Write("\" >\r\n\r\n <meta property=\"og:site_name\" content=\""); #line 12 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(SiteName.HtmlEncode())); #line default #line hidden this.Write("\" />\r\n <meta property=\"og:url\" content=\"https:"); #line 13 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(PageUrl)); #line default #line hidden this.Write("\" />\r\n <meta property=\"og:type\" content=\"article\" />\r\n <meta property=\"og:t" + "itle\" content=\""); #line 15 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.Title.HtmlEncode())); #line default #line hidden this.Write("\" />\r\n <meta property=\"og:description\" content=\""); #line 16 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.Summary.HtmlEncode())); #line default #line hidden this.Write("\" />\r\n\r\n "); #line 18 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.OpenGraphImageMetaTags(PictureInformation))); #line default #line hidden this.Write("\r\n\r\n <link rel = \"schema.DC\" href = \"http://purl.org/DC/elements/1.0/\">\r\n <" + "meta name=\"DC.Title\" content=\""); #line 22 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.Title.HtmlEncode())); #line default #line hidden this.Write("\">\r\n <meta name =\"DC.Creator\" content=\""); #line 23 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.CreatedBy.HtmlEncode())); #line default #line hidden this.Write("\">\r\n <meta name =\"DC.Publisher\" content=\""); #line 24 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(SiteName.HtmlEncode())); #line default #line hidden this.Write("\">\r\n <meta name=\"DC.Description\" content=\""); #line 25 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.Summary.HtmlEncode())); #line default #line hidden this.Write("\">\r\n <meta name=\"DC.Date\" content=\""); #line 26 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(DbEntry.CreatedOn.ToString("yyyy-MM-dd").HtmlEncode())); #line default #line hidden this.Write("\">\r\n <meta name=\"DC.Format\" content=\"text/html\">\r\n <meta name=\"DC.Language\"" + " content=\"en-US\">\r\n\r\n <link rel=\"alternate\" type=\"application/rss+xml\" \r\n " + " title=\""); #line 32 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture($"RSS Feed for {UserSettingsSingleton.CurrentSettings().SiteName} - Photos".HtmlEncode())); #line default #line hidden this.Write("\"\r\n href=\"https:"); #line 34 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(UserSettingsSingleton.CurrentSettings().PhotoRssUrl())); #line default #line hidden this.Write("\" />\r\n\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"" + ">\r\n\r\n "); #line 39 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.CssStyleFileString())); #line default #line hidden this.Write("\r\n "); #line 40 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.FavIconFileString())); #line default #line hidden this.Write("\r\n\r\n</head>\r\n\r\n<body class=\"single-photo-body\">\r\n "); #line 45 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(PictureInformation.PictureFigureWithTitleCaptionTag("100vw"))); #line default #line hidden this.Write("\r\n <div class=\"information-section\">\r\n "); #line 48 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(PhotoDetails.PhotoDetailsDiv(DbEntry).ToString())); #line default #line hidden this.Write("\r\n "); #line 50 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.PostBodyDiv(DbEntry).ToString())); #line default #line hidden this.Write("\r\n "); #line 51 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.TagList(DbEntry).ToString())); #line default #line hidden this.Write("\r\n "); #line 52 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(BodyContentReferences.RelatedContentTag(DbEntry.ContentId, "").Result)); #line default #line hidden this.Write("\r\n "); #line 54 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.CreatedByAndUpdatedOnDiv(DbEntry).ToString())); #line default #line hidden this.Write("\r\n "); #line 56 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Tags.UpdateNotesDiv(DbEntry).ToString())); #line default #line hidden this.Write("\r\n </div>\r\n "); #line 58 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(HorizontalRule.StandardRule())); #line default #line hidden this.Write("\r\n "); #line 59 "C:\Code\PointlessWaymarksCmsSpatiaLite\PointlessWaymarksCmsData\Html\PhotoHtml\SinglePhotoPage.tt" this.Write(this.ToStringHelper.ToStringWithCulture(Footer.StandardFooterDiv())); #line default #line hidden this.Write("\r\n</body>\r\n\r\n</html>"); return(this.GenerationEnvironment.ToString()); }