private void _mapView_OnMakerDrag(double lat, double lon) { if (1 != _targets.SelectedItems.Count) { return; } ListViewItem item = _targets.SelectedItems[0]; JPEGFileItem jpegItem = item.Tag as JPEGFileItem; if (null == jpegItem) { return; } System.Diagnostics.Debug.Print("new pos {0},{1}", lat, lon); bykIFv1.Point point = jpegItem.NewLocation; bykIFv1.Point pnew; if (null != point) { pnew = new bykIFv1.Point(point.Time, lat, lon, double.NaN, 0, false); } else { pnew = new bykIFv1.Point(jpegItem.DateTimeOriginal, lat, lon, double.NaN, 0, false); } jpegItem.NewLocation = pnew; item.ForeColor = Color.Black; item.Checked = true; }
private void _previewImageContextMenu_Opening(object sender, CancelEventArgs e) { bool removeLocation = false; bool addLocation = false; bool rematching = false; if (1 == _targets.SelectedItems.Count) { ListViewItem item = _targets.SelectedItems[0]; JPEGFileItem jpegItem = item.Tag as JPEGFileItem; if (null != jpegItem) { if (null == jpegItem.NewLocation) { rematching = true; } if (null != jpegItem.NewLocation || null != jpegItem.CurrentLocation) { removeLocation = true; } else { addLocation = true; } } } else { e.Cancel = true; } _removeLocationToolStripMenuItem.Enabled = removeLocation; _addLocationToolStripMenuItem.Enabled = addLocation; _rematchingToolStripMenuItem.Enabled = rematching; }
private void LocationMatching() { foreach (ListViewItem item in _targets.Items) { JPEGFileItem jpegItem = item.Tag as JPEGFileItem; if (null == jpegItem) { continue; } jpegItem.NewLocation = _trackItemBag.FindPoint(jpegItem.DateTimeOriginal); if (null != jpegItem.NewLocation) { item.Checked = true; if (jpegItem.NewLocation.Time != jpegItem.DateTimeOriginal.ToUniversalTime()) { item.ForeColor = Color.Pink; } else { item.ForeColor = Color.Black; } } } }
private void _targets_SelectedIndexChanged(object sender, EventArgs e) { ListView lv = sender as ListView; if (null == lv) { return; } if (0 >= lv.SelectedItems.Count) { _previewImage.Image = null; _mapView.resetMarker(); return; } ListViewItem item = lv.SelectedItems[0]; JPEGFileItem jpegItem = item.Tag as JPEGFileItem; if (null == jpegItem) { return; } //Image bmp = Bitmap.FromFile(jpegItem.FilePath); Image bmp = null; using (FileStream fs = new FileStream(jpegItem.FilePath, FileMode.Open, FileAccess.Read)) { bmp = Bitmap.FromStream(fs); } _previewImage.Image = bmp; switch (jpegItem.Orientation) { case Orientation.Orientation_90: _previewImage.Image.RotateFlip(RotateFlipType.Rotate90FlipNone); break; case Orientation.Orientation_180: _previewImage.Image.RotateFlip(RotateFlipType.Rotate180FlipNone); break; case Orientation.Orientation_270: _previewImage.Image.RotateFlip(RotateFlipType.Rotate270FlipNone); break; } if (null != jpegItem.DisplayLocation) { _mapView.movePos(jpegItem.DisplayLocation.Latitude, jpegItem.DisplayLocation.Longitude); } else { _mapView.resetMarker(); } }
private void _targetsSel_Click(object sender, EventArgs e) { JPEGFileItem jpegItem = null; foreach (ListViewItem item in _targets.Items) { jpegItem = item.Tag as JPEGFileItem; if (null == jpegItem) { continue; } item.Checked = (jpegItem.IsModifed); } }
private void _update_Click(object sender, EventArgs e) { List <JPEGFileItem> items = new List <JPEGFileItem>(); foreach (ListViewItem lvItem in _targets.Items) { // チェックされていないのは保存対象外 if (!lvItem.Checked) { continue; } JPEGFileItem item = lvItem.Tag as JPEGFileItem; if (null == item) { continue; } items.Add(item); } NowProcessingForm <JPEGFileItem> npf = new NowProcessingForm <JPEGFileItem>(new UpdateJpegFile(), items.ToArray()); if (DialogResult.OK == npf.ShowDialog(this)) { // 更新できなので、チェックボックスを外します。 try { _targets.BeginUpdate(); foreach (ListViewItem lvItem in _targets.Items) { // チェックされていないのは保存対象外 if (!lvItem.Checked) { continue; } lvItem.Checked = false; } } finally { _targets.EndUpdate(); } MessageBox.Show(Properties.Resources.MSG3, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void DoProcess(string filePath) { DateTime debugTime = DateTime.Now; TimeSpan debugSpan; debugTime = DateTime.Now; JPEGFileItem jpegItem = new JPEGFileItem(filePath, _thumNailSize, _transColor); debugSpan = DateTime.Now - debugTime; System.Diagnostics.Debug.Print(string.Format("JPEGFileItem:{0}", debugSpan.TotalMilliseconds)); debugTime = DateTime.Now; debugSpan = DateTime.Now - debugTime; System.Diagnostics.Debug.Print(string.Format("FindPoint:{0}", debugSpan.TotalMilliseconds)); ListViewItem item = new ListViewItem(System.IO.Path.GetFileName(filePath)); item.Tag = jpegItem; _items.Add(item); }
private void _removeLocationToolStripMenuItem_Click(object sender, EventArgs e) { if (DialogResult.Yes == MessageBox.Show(Properties.Resources.MSG5, this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { if (1 != _targets.SelectedItems.Count) { return; } ListViewItem item = _targets.SelectedItems[0]; JPEGFileItem jpegItem = item.Tag as JPEGFileItem; if (null == jpegItem) { return; } jpegItem.RemoveLocation(); _mapView.resetMarker(); item.Checked = true; item.ForeColor = Color.Black; } }
private void LoadDropFiles(string[] dropFiles, bool add) { try { _targets.BeginUpdate(); if (!add) { _targets.Clear(); _targets.LargeImageList.Images.Clear(); } _targets.LargeImageList.TransparentColor = TRANS_COLOR; List <string> targetFiles = new List <string>(); foreach (string filePath in dropFiles) { // すでに登録されているものを二重登録しない bool match = false; foreach (ListViewItem item in _targets.Items) { JPEGFileItem jpegItem = item.Tag as JPEGFileItem; if (null == jpegItem) { continue; } if (filePath == jpegItem.FilePath) { match = true; break; } } if (match) { continue; } targetFiles.Add(filePath); } LoadJpegFile ljf = new LoadJpegFile(_targets.LargeImageList.ImageSize, TRANS_COLOR); NowProcessingForm <string> npf = new NowProcessingForm <string>(ljf, targetFiles.ToArray()); if (DialogResult.OK == npf.ShowDialog(this)) { // 画像を読み込んだので、位置情報の確定を行う foreach (ListViewItem item in ljf.Items) { JPEGFileItem jpegItem = item.Tag as JPEGFileItem; if (null != jpegItem) { jpegItem.NewLocation = _trackItemBag.FindPoint(jpegItem.DateTimeOriginal); if (null != jpegItem.NewLocation) { item.Checked = true; if (jpegItem.NewLocation.Time != jpegItem.DateTimeOriginal.ToUniversalTime()) { item.ForeColor = Color.Pink; } else { item.ForeColor = Color.Black; } } else { item.Checked = false; if (null != jpegItem.CurrentLocation) { item.ForeColor = Color.Blue; } } item.ImageIndex = _targets.LargeImageList.Images.Count; _targets.LargeImageList.Images.Add(jpegItem.ThumNail); _targets.Items.Add(item); } } } } finally { _targets.EndUpdate(); } }