internal override void OnNewMapPointEvent(object obj) { base.OnNewMapPointEvent(obj); if (!IsActiveTab) { return; } var point = obj as IPoint; if (point != null && ToolMode == MapPointToolMode.Target) { if (IsMapClick) { if (!(IsValidPoint(point, true))) { IsMapClick = false; return; } } var color = new RgbColorClass() { Red = 255 } as IColor; var guid = AddGraphicToMap(point, color, true, esriSimpleMarkerStyle.esriSMSSquare); var addInPoint = new AddInPoint() { Point = point, GUID = guid }; bool isValid = IsValidPoint(point, false); if (!isValid) { TargetOutExtentPoints.Insert(0, addInPoint); } else { TargetInExtentPoints.Insert(0, addInPoint); } TargetAddInPoints.Insert(0, addInPoint); IsMapClick = false; } ValidateLLOS_LayerSelection(); }
/// <summary> /// Method override to handle new map points /// Here we must take of targets in addition to observers /// </summary> /// <param name="obj">MapPoint</param> internal override async void OnNewMapPointEvent(object obj) { base.OnNewMapPointEvent(obj); if (!IsActiveTab) { return; } var point = obj as MapPoint; if (point != null && ToolMode == MapPointToolMode.Target) { if (IsMapClick) { if (!(await IsValidPoint(point, true))) { IsMapClick = false; return; } } var guid = await AddGraphicToMap(point, ColorFactory.Instance.RedRGB, true, 5.0, markerStyle : SimpleMarkerStyle.Square, tag : "target"); var addInPoint = new AddInPoint() { Point = point, GUID = guid }; bool isValid = await IsValidPoint(point, false); Application.Current.Dispatcher.Invoke(() => { if (!isValid) { TargetOutExtentPoints.Insert(0, addInPoint); } else { TargetInExtentPoints.Insert(0, addInPoint); } TargetAddInPoints.Insert(0, addInPoint); }); IsMapClick = false; } ValidateLLOS_LayerSelection(); }