/// <summary>
        /// Стандартный конструктор. Инициализирует панель рассчёта дистанций
        /// </summary>
        /// <param name="w">Ссылка на главное окно с отображаемой картой</param>
        public DistanceMeasureControl(MapWindow w)
        {
            InitializeComponent();

            mapWindow = w;


            // Создаём делегаты
            mouseLMBHandler = new MouseButtonEventHandler(MouseLMBDown);
            mouseRMBHandler = new MouseButtonEventHandler(MouseRMBDown);

            // Подписываем их на соответствующие события в главном окне
            mapWindow.MainPanel.MouseLeftButtonDown  += mouseLMBHandler;
            mapWindow.MainPanel.MouseRightButtonDown += mouseRMBHandler;

            // Инициализируем DistanceLine, добавляем её на главную панель
            distanceViewer = new DistanceLine(mapWindow.MapPanel, FIRST_MARKER_BRUSH, SECOND_MARKER_BRUSH);
            distanceViewer.Hide();

            // Инициализируем PointMarker-ы, добавляем их на главную панель
            firstPointMarker = new PointMarker(mapWindow.MapPanel, 0, 0);
            firstPointMarker.SetStrokeColor(FIRST_MARKER_BRUSH);
            firstPointMarker.Hide();

            secondPointMarker = new PointMarker(mapWindow.MapPanel, 0, 0);
            secondPointMarker.SetStrokeColor(SECOND_MARKER_BRUSH);
            secondPointMarker.Hide();

            rmbMenu = this.FindResource("rmbMenu") as ContextMenu;
            rmbMenu.PlacementTarget = mapWindow.MainPanel;

            mapWindow.SetStatus("Включён режим: \"Измерение расстояний\"");
        }
        private void ClearPoints(object sender, RoutedEventArgs e)
        {
            markerFirstPoint.X  = double.MaxValue;
            markerFirstPoint.Y  = double.MaxValue;
            markerSecondPoint.X = double.MaxValue;
            markerSecondPoint.Y = double.MaxValue;
            firstPointMarker.Hide();
            secondPointMarker.Hide();
            distanceViewer.Hide();

            FirstPointXCordView.Text  = "X: -";
            FirstPointYCordView.Text  = "Y: -";
            SecondPointXCordView.Text = "X: -";
            SecondPointYCordView.Text = "Y: -";
            DistanceView.Text         = "Расстояние: ";

            mapWindow.SetStatus("Точки очищены");
        }
예제 #3
0
        /// <summary>
        /// Очиащет все введённые точки
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ClearPoints(object sender, RoutedEventArgs e)
        {
            APointWaiting = false;
            APoint        = new Point(double.MaxValue, double.MaxValue);
            if (APointMarker.IsVisible)
            {
                APointMarker.Hide();
            }

            BPointWaiting = false;
            BPoint        = new Point(double.MaxValue, double.MaxValue);
            if (BPointMarker.IsVisible)
            {
                BPointMarker.Hide();
            }

            CPointWaiting = false;
            CPoint        = new Point(double.MaxValue, double.MaxValue);
            if (CPointMarker.IsVisible)
            {
                CPointMarker.Hide();
            }

            ABDistanceLine.Hide();
            BCDistanceLine.Hide();
            CADistanceLine.Hide();

            PointAXCord.Text = "X: -";
            PointAYCord.Text = "Y: -";
            PointBXCord.Text = "X: -";
            PointBYCord.Text = "Y: -";
            PointCXCord.Text = "X: -";
            PointCYCord.Text = "Y: -";

            HaveStudentCalculationsTB.Text       = "Введите точки на карте";
            HaveStudentCalculationsTB.Foreground = Brushes.Red;
            StartStudentInput.IsEnabled          = false;

            mapWindow.SetStatus("Точки очищены");
        }
예제 #4
0
        public DirectGeodTaskControl(MapWindow w)
        {
            InitializeComponent();

            mapWindow = w;

            // Создаём делегаты
            mouseLMBHandler = new MouseButtonEventHandler(MouseLMBDown);
            mouseRMBHandler = new MouseButtonEventHandler(MouseRMBDown);

            // Подписываем их на соответствующие события в главном окне
            mapWindow.MainPanel.MouseLeftButtonDown  += mouseLMBHandler;
            mapWindow.MainPanel.MouseRightButtonDown += mouseRMBHandler;

            // Инициализируем PointMarker-ы, добавляем их на главную панель
            APointMarker = new PointMarker(mapWindow.MapPanel, 0, 0);
            APointMarker.SetStrokeColor(A_POINT_MARKER_BRUSH);
            APointMarker.Hide();

            BPointMarker = new PointMarker(mapWindow.MapPanel, 0, 0);
            BPointMarker.SetStrokeColor(B_POINT_MARKER_BRUSH);
            BPointMarker.Hide();

            CPointMarker = new PointMarker(mapWindow.MapPanel, 0, 0);
            CPointMarker.SetStrokeColor(C_POINT_COLOR_BRUSH);
            CPointMarker.Hide();

            //studAPointMarker = new PointMarker(mapWindow.MapPanel, 0, 0);
            //studAPointMarker.SetStrokeColor(STUD_A_POINT_MARKER_BRUSH);
            //studAPointMarker.Hide();

            //studBPointMarker = new PointMarker(mapWindow.MapPanel, 0, 0);
            //studBPointMarker.SetStrokeColor(STUD_B_POINT_MARKER_BRUSH);
            //studBPointMarker.Hide();

            //studCPointMarker = new PointMarker(mapWindow.MapPanel, 0, 0);
            //studCPointMarker.SetStrokeColor(STUD_C_POINT_MARKER_BRUSH);
            //studCPointMarker.Hide();

            // Выставим соответствующий цвет шрифтов, чтобы маркеры на карте можно было отличить друг от друга
            APointHint.Foreground = A_POINT_MARKER_BRUSH;
            BPointHint.Foreground = B_POINT_MARKER_BRUSH;
            CPointHint.Foreground = C_POINT_COLOR_BRUSH;

            // Инициализируем DistanceLine-ы, добавим их на панель
            ABDistanceLine = new DistanceLine(mapWindow.MapPanel, A_POINT_MARKER_BRUSH, B_POINT_MARKER_BRUSH);
            ABDistanceLine.Hide();
            BCDistanceLine = new DistanceLine(mapWindow.MapPanel, B_POINT_MARKER_BRUSH, C_POINT_COLOR_BRUSH);
            BCDistanceLine.Hide();
            CADistanceLine = new DistanceLine(mapWindow.MapPanel, C_POINT_COLOR_BRUSH, A_POINT_MARKER_BRUSH);
            CADistanceLine.Hide();

            //studABDistanceLine = new DistanceLine(mapWindow.MapPanel, STUD_A_POINT_MARKER_BRUSH, STUD_B_POINT_MARKER_BRUSH);
            //studABDistanceLine.Hide();
            //studBCDistanceLine = new DistanceLine(mapWindow.MapPanel, STUD_B_POINT_MARKER_BRUSH, STUD_C_POINT_MARKER_BRUSH);
            //studBCDistanceLine.Hide();
            //studCADistanceLine = new DistanceLine(mapWindow.MapPanel, STUD_C_POINT_MARKER_BRUSH, STUD_A_POINT_MARKER_BRUSH);
            //studCADistanceLine.Hide();

            rmbMenu = this.FindResource("rmbMenu") as ContextMenu;
            rmbMenu.PlacementTarget = mapWindow.MainPanel;

            mapWindow.SetStatus("Включён режим: \"Прямая геодезическая задача\"");
        }