레이더 윈도우 리프레쉬 예제 소스
2021. 9. 23. 17:30ㆍ프로그래밍
반응형
다른 분야에 활용 가능한 리프레쉬 예제
private void RefreshRadarWindow()
{
try
{
if (radarWind == null || DataManagerUnit3.uVisibleRadar == 0) return;
NAVINF_SHIP_NAVIGATION_INFO nsni = new NAVINF_SHIP_NAVIGATION_INFO();
nsni.copy_from(DataManager._NAVINF_SHIP_NAVIGATION_INFO);
Tuple<int, int> pos = new Tuple<int, int>(0, 0);
if (nsni.stDateTime.unYear == 0)
{
pos = ViewModel.Presentation.GetChart().LL2XY(127, 36);
}
else
{
Tuple<double, double> OwnShipitem = ViewModel.Presentation.GetOwnShipLayer().GetOwnShipLocation();
if (OwnShipitem.Item1 < -180 ||
OwnShipitem.Item1 > 180) return;
if (OwnShipitem.Item2 < -90 ||
OwnShipitem.Item2 > 90) return;
pos = ViewModel.Presentation.GetChart().LL2XY(OwnShipitem.Item1, OwnShipitem.Item2);
}
if (pos.Item1.Equals(0) && pos.Item2.Equals(0))
return;
double locX = pos.Item1 - radarWind.Width / 2.0;
double locY = pos.Item2 - radarWind.Height / 2.0;
if (radarWind != null && (!radarWind.Location.X.Equals(locX) || !radarWind.Location.Y.Equals(locY)))
{
radarWind.Location = new Point(locX, locY); radarWind.RefreshLocation();
Rect wRect = new Rect(0, 0, this.Width, this.Height);
Rect rRect = new Rect(new Point(locX, locY), new Size(radarWind.Width, radarWind.Height));
if (rRect.Left < 0 || rRect.Top < 0 || rRect.Left + rRect.Width > this.Width || rRect.Top + rRect.Height > this.Height)
{
wRect.Intersect(rRect);
if (wRect.Equals(Rect.Empty)) {
radarWind.Hide();
return;
}
radarWind.Show();
radarWind.Clip = new RectangleGeometry(new Rect(locX < 0 ? -locX : 0, locY < 0 ? -locY : 0, wRect.Width, wRect.Height));
}
else {
radarWind.Show();
radarWind.Clip = null;
}
}
}
catch (Exception ee)
{
TraceManager.AddLog(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
System.Diagnostics.Debug.WriteLine(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
}
}
반응형
'프로그래밍' 카테고리의 다른 글
WaterfallInfo에 따른 그래프 변경 함수 예제 (2) | 2021.10.16 |
---|---|
타겟 추적 알고리즘 예제 소스 (0) | 2021.10.10 |
현 모드 체크 후 상황에 맞춰 업데이트 실행 예제 (0) | 2021.09.17 |
C# 윈도우폼 콤보박스 클릭 시 처리 예제 (0) | 2021.09.11 |
UpdateList_AttendList SQLDB 활용 예제 (0) | 2021.09.05 |