Beispiel #1
0
        private void DisplayCanalResult(Point position)
        {
            if (CanalViewModel.CanalData != null)
            {
                CanalPointResult canalPointResult = CanalViewModel.CanalData.GetCanalPointResult((position.X - InitialCanalX) / ScaleX);

                if (canalPointResult != null)
                {
                    RemoveTemporaryCanvasElements();

                    //  Add cross
                    activeCanalLine        = GetClosestCanalLine(position.X);
                    activeCanalLine.Stroke = Brushes.Red;

                    Label displayResultLabel = new Label();
                    displayResultLabel.Content = "X= " + canalPointResult.X + Environment.NewLine + "Y= " + canalPointResult.WaterLevel + " m";
                    Canvas.SetLeft(displayResultLabel, activeCanalLine.X1);
                    Canvas.SetTop(displayResultLabel, activeCanalLine.Y2 - 50);

                    temporaryCanvasElements.Add(displayResultLabel);

                    canalCanvas.Children.Add(displayResultLabel);
                }
            }
        }
Beispiel #2
0
        public ICanalSection GetCanalSection(CanalPointResult canalPointResult)
        {
            var canalStretch = GetCanalStretch(canalPointResult);

            if (canalStretch != null)
            {
                return(canalStretch.CanalSection);
            }

            return(null);
        }
Beispiel #3
0
        public ICanalStretchModel GetCanalStretch(CanalPointResult canalPointResult)
        {
            int    canalIndex     = 0;
            double relativeCanalX = canalPointResult.X;

            while (canalIndex < Canal.CanalStretches.Count)
            {
                ICanalStretchModel canalStretch = Canal.CanalStretches[canalIndex];

                if (relativeCanalX <= canalStretch.Length)
                {
                    return(canalStretch);
                }
                else
                {
                    relativeCanalX -= canalStretch.Length;
                }
            }

            return(null);
        }