/// <summary>
        /// Override this event to collect observer points based on tool mode
        /// </summary>
        /// <param name="obj">MapPointToolMode</param>
        internal override async void OnNewMapPointEvent(object obj)
        {
            if (!IsActiveTab)
            {
                return;
            }

            var point = obj as MapPoint;

            // ok, we have a point
            if (point != null && ToolMode == MapPointToolMode.Observer)
            {
                if (IsMapClick)
                {
                    if (!(await IsValidPoint(point, true)))
                    {
                        IsMapClick = false;
                        return;
                    }
                }
                // in tool mode "Observer" we add observer points
                // otherwise ignore

                var guid = await AddGraphicToMap(point, ColorFactory.Instance.BlueRGB, true, 5.0);

                var addInPoint = new AddInPoint()
                {
                    Point = point, GUID = guid
                };
                bool isValid = await IsValidPoint(point, false);

                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (!isValid)
                    {
                        ObserverOutExtentPoints.Insert(0, addInPoint);
                    }
                    else
                    {
                        ObserverInExtentPoints.Insert(0, addInPoint);
                    }

                    ObserverAddInPoints.Insert(0, addInPoint);
                });
                IsMapClick = false;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Override this event to collect observer points based on tool mode
        /// </summary>
        /// <param name="obj">MapPointToolMode</param>
        internal override void OnNewMapPointEvent(object obj)
        {
            if (!IsActiveTab)
            {
                return;
            }

            var point = obj as IPoint;

            // ok, we have a point
            if (ToolMode == MapPointToolMode.Observer)
            {
                if (IsMapClick)
                {
                    if (!(IsValidPoint(point, true)))
                    {
                        IsMapClick = false;
                        return;
                    }
                }
                // in tool mode "Observer" we add observer points
                // otherwise ignore

                var color = new RgbColorClass()
                {
                    Blue = 255
                } as IColor;
                var guid       = AddGraphicToMap(point, color, true);
                var addInPoint = new AddInPoint()
                {
                    Point = point, GUID = guid
                };
                bool isValid = IsValidPoint(point, false);
                if (!isValid)
                {
                    ObserverOutExtentPoints.Insert(0, addInPoint);
                }
                else
                {
                    ObserverInExtentPoints.Insert(0, addInPoint);
                }

                ObserverAddInPoints.Insert(0, addInPoint);
                IsMapClick = false;
            }
        }
        /// <summary>
        /// Override this event to collect observer points based on tool mode
        /// </summary>
        /// <param name="obj">MapPointToolMode</param>
        internal override async void OnNewMapPointEvent(object obj)
        {
            if (!IsActiveTab)
            {
                return;
            }

            //if (string.IsNullOrEmpty(SelectedSurfaceName))
            //{
            //    MessageBox.Show(VisibilityLibrary.Properties.Resources.MsgSurfaceLayerNotFound,
            //        VisibilityLibrary.Properties.Resources.CaptionError, MessageBoxButton.OK);
            //    return;
            //}

            //IsElevationSurfaceValid = ValidateElevationSurface(MapView.Active.Map, SelectedSurfaceName);
            //if (!await IsElevationSurfaceValid)
            //{
            //    MessageBox.Show(VisibilityLibrary.Properties.Resources.LOSDataFrameMatch, VisibilityLibrary.Properties.Resources.LOSSpatialReferenceCaption);
            //    SelectedSurfaceTooltip = VisibilityLibrary.Properties.Resources.LOSDataFrameMatch;
            //    SetErrorTemplate(false);
            //    return;
            //}

            var point = obj as MapPoint;

            // ok, we have a point
            if (point != null && ToolMode == MapPointToolMode.Observer)
            {
                if (IsMapClick)
                {
                    if (!(await IsValidPoint(point, true)))
                    {
                        IsMapClick = false;
                        return;
                    }
                }
                // in tool mode "Observer" we add observer points
                // otherwise ignore

                var guid = await AddGraphicToMap(point, ColorFactory.Instance.BlueRGB, true, 5.0);

                var addInPoint = new AddInPoint()
                {
                    Point = point, GUID = guid
                };
                bool isValid = await IsValidPoint(point, false);

                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (!isValid)
                    {
                        ObserverOutExtentPoints.Insert(0, addInPoint);
                    }
                    else
                    {
                        ObserverInExtentPoints.Insert(0, addInPoint);
                    }

                    ObserverAddInPoints.Insert(0, addInPoint);
                });
                IsMapClick = false;
            }
        }