• R/O
  • SSH
  • HTTPS

wheretrainbuild: Commit


Commit MetaInfo

Revision56 (tree)
Zeit2020-07-16 11:57:57
Autordangerouswoo

Log Message

(empty log message)

Ändern Zusammenfassung

Diff

--- WhereTrainBuild/MapForm.cs (revision 55)
+++ WhereTrainBuild/MapForm.cs (revision 56)
@@ -909,6 +909,69 @@
909909 };
910910 popupmenu.Items.Add(delpathitem);
911911
912+ ToolStripMenuItem delmultipathitem = new ToolStripMenuItem("駅一括削除");
913+ delmultipathitem.Click += (sender, args) =>
914+ {
915+ double HitDistance = 5.0;
916+
917+ StationInfoData endstation = null;
918+ SetSelectPoint((viewrequestinfo, viewpoint, dLat, dLng) =>
919+ {
920+ //対象駅探索
921+ var result = new Dictionary<TrainPath.Position, double>();
922+
923+ foreach (var ostation in Factory.GetStationManager().StationList())
924+ {
925+ if (station == ostation)
926+ continue;
927+
928+ //画面座標変換
929+ var mypoint = viewrequestinfo.LatLongToViewPoint(ostation.Latitude, ostation.Longitude);
930+
931+ //距離算出
932+ double dDistance = Math.Sqrt((mypoint.X - viewpoint.X) * (mypoint.X - viewpoint.X) + (mypoint.Y - viewpoint.Y) * (mypoint.Y - viewpoint.Y));
933+ if (HitDistance >= dDistance)
934+ {
935+ endstation = ostation;
936+ break;
937+ }
938+ }
939+ if(endstation != null )
940+ {
941+ var listtable = Factory.GetNetwork().BuildLine(station, endstation);
942+ if (listtable.Count == 0)
943+ return;
944+
945+ if (listtable.Count >= 2)
946+ {
947+ MessageBox.Show("複数経路があるので削除出来ません。");
948+ return;
949+ }
950+
951+ var deletetable = new Dictionary<int, StationInfoData>();
952+ var deletelist = listtable[0];
953+ foreach( var tpath in deletelist )
954+ {
955+ if( tpath.StationA != null )
956+ {
957+ if(deletetable.ContainsKey(tpath.StationA.UniqID) == false )
958+ deletetable[tpath.StationA.UniqID] = tpath.StationA;
959+ }
960+ if (tpath.StationB != null)
961+ {
962+ if (deletetable.ContainsKey(tpath.StationB.UniqID) == false)
963+ deletetable[tpath.StationB.UniqID] = tpath.StationB;
964+ }
965+ }
966+ deletetable.Values.ToList().ForEach(pstation => DeleteStation(pstation));
967+ }
968+ });
969+
970+ MapViewCnt.RefreshImage();
971+ };
972+ popupmenu.Items.Add(delmultipathitem);
973+
974+
912975 popupmenu.Show(Cursor.Position);
913976 }
914977
Show on old repository browser