コード例 #1
0
        public static void PopulateNearbyCoordinate(DataGridView dataGridView, int columnIndex,
                                                    int timeZoneShift, int accepedIntervalSecound, DateTime date, DateTime?dateTaken, DateTime?locationDate)
        {
            List <Metadata> metadatasLocationBasedOnBestGuess = DatabaseGoogleLocationHistory.FindLocationBasedOtherMediaFiles
                                                                    (locationDate, dateTaken, date, //UseSmartDate ? metadata?.FileSmartDate(allowedDateFormats) : metadata?.FileDate,
                                                                    AccepedIntervalSecound);

            int count = 0;

            foreach (Metadata metadataLocationBasedOnBestGuess in metadatasLocationBasedOnBestGuess)
            {
                string tag = tagCoordinatesNearByPhotos + (count == 0 ? "" : " " + count.ToString());
                if (metadataLocationBasedOnBestGuess != null && metadataLocationBasedOnBestGuess.LocationLatitude != null && metadataLocationBasedOnBestGuess.LocationLongitude != null)
                {
                    int rowIndex = AddRow(dataGridView, columnIndex, new DataGridViewGenericRow(headerNearByLocations, tag), metadataLocationBasedOnBestGuess.LocationCoordinate, true);
                    DataGridViewHandler.SetCellToolTipText(dataGridView, columnIndex, rowIndex,
                                                           "Date: " + (date == null ? "(Empty)" : date.ToString()) + "\r\n" +
                                                           (metadataLocationBasedOnBestGuess.FileDateCreated == null ? "" : "Date: " + metadataLocationBasedOnBestGuess.FileDateCreated.ToString() + " on found media\r\n") +

                                                           "MediaTaken: " + (dateTaken == null ? "(Empty)" : dateTaken.ToString()) + "\r\n" +
                                                           (metadataLocationBasedOnBestGuess.MediaDateTaken == null ? "" : "MediaTaken: " + metadataLocationBasedOnBestGuess.MediaDateTaken.ToString() + " on found media\r\n") +

                                                           "LocationDate: " + (locationDate == null ? "(Empty)" : locationDate.ToString()) + "\r\n" +
                                                           (metadataLocationBasedOnBestGuess.LocationDateTime == null ? "" : "LocationDate: " + metadataLocationBasedOnBestGuess.LocationDateTime.ToString() + " on found media\r\n")
                                                           );
                    dataGridView.ShowCellToolTips = true;
                }
                else
                {
                    AddRow(dataGridView, columnIndex, new DataGridViewGenericRow(headerNearByLocations, tag), "Not found", true);
                }
                count++;
            }
        }
コード例 #2
0
        public static void PopulateGoogleHistoryCoordinate(DataGridView dataGridViewMap, int columnIndexMap,
                                                           int timeZoneShift, int accepedIntervalSecound, DateTime?dateTaken, DateTime?locationDate, Metadata metadata)
        {
            string cameraOwner = GetUserInputCameraOwner(dataGridViewMap, columnIndexMap);

            if (string.IsNullOrWhiteSpace(cameraOwner))
            {
                DataGridViewHandler.SetCellValue(dataGridViewMap, columnIndexMap, headerGoogleLocations, tagGoogleCoordinateUTC, "Need select camera owner");
                return;
            }

            Metadata metadataLocation;

            if (locationDate != null)
            {
                metadataLocation = DatabaseGoogleLocationHistory.FindLocationBasedOnTime(cameraOwner, (DateTime)locationDate, accepedIntervalSecound);
                if (metadataLocation != null)
                {
                    AddRow(dataGridViewMap, columnIndexMap, new DataGridViewGenericRow(headerGoogleLocations, tagGoogleCoordinateUTC), metadataLocation.LocationCoordinate, true);
                }
                else
                {
                    AddRow(dataGridViewMap, columnIndexMap, new DataGridViewGenericRow(headerGoogleLocations, tagGoogleCoordinateUTC),
                           "Not found: Coordinates timestamp " + ((DateTime)locationDate).ToShortDateString() + " " + ((DateTime)locationDate).ToShortTimeString()
                           + " +/- " + accepedIntervalSecound + " secounds not found", true);
                }
            }
            else
            {
                DataGridViewHandler.SetCellValue(dataGridViewMap, columnIndexMap, headerGoogleLocations, tagGoogleCoordinateUTC, "Missing UTC date");
            }

            if (dateTaken != null)
            {
                DateTime mediaCreateUTC = new DateTime(((DateTime)dateTaken).Ticks, DateTimeKind.Utc).AddHours(timeZoneShift);

                metadataLocation = DatabaseGoogleLocationHistory.FindLocationBasedOnTime(cameraOwner, mediaCreateUTC, accepedIntervalSecound);
                if (metadataLocation != null)
                {
                    AddRow(dataGridViewMap, columnIndexMap, new DataGridViewGenericRow(headerGoogleLocations, TagGoogleCoordinateDateTaken(timeZoneShift)), metadataLocation.LocationCoordinate, true);
                }
                else
                {
                    AddRow(dataGridViewMap, columnIndexMap, new DataGridViewGenericRow(headerGoogleLocations, TagGoogleCoordinateDateTaken(timeZoneShift)),
                           "Not found: Coordinates timestamp " + mediaCreateUTC.ToShortDateString() + " " + mediaCreateUTC.ToShortTimeString()
                           + " +/- " + accepedIntervalSecound + " secounds not found", true);
                }
            }
            else
            {
                DataGridViewHandler.SetCellValue(dataGridViewMap, columnIndexMap, headerGoogleLocations, TagGoogleCoordinateDateTaken(timeZoneShift), "Missing DateTaken");
            }
        }