예제 #1
0
 private void BtnPolyLine_Checked(object sender, RoutedEventArgs e)
 {
     _tool            = ToolType.Polyline;
     _polyLine        = new PolyLine1();
     _polyLine.Points = new PointCollection();
     grid.Cursor      = Cursors.Cross;
     CanHit(false);
     _pan = false;
 }
예제 #2
0
        public void MouseDownPolyLine(Panel canvas, MouseButtonEventArgs e, Matrix screenToWorld, PolyLine1 ply)
        {
            Point p = e.GetPosition(canvas);

            p = screenToWorld.Transform(p);
            var point = new Point(p.X, p.Y);

            ply.Points.Add(point);

            _polyline = ply;
            PolyLine1 clonePy = new PolyLine1();

            clonePy.Points = new PointCollection();

            _line = new System.Windows.Shapes.Line();
            //_line = new Line();
            _line.Stroke = new SolidColorBrush(Colors.Black);
            _line.StrokeDashArray.Add(4);
            _line.X1 = p.X;
            _line.Y1 = p.Y;
            _line.X2 = p.X;
            _line.Y2 = p.Y;


            if (ply.Points.Count == 1)
            {
                // ply.Points.Add(point);//添加新的数据点
                canvas.Children.Add(ply);
                canvas.Children.Add(_line);
                lastIndex = canvas.Children.IndexOf(ply);
            }
            else
            {
                canvas.Children.RemoveAt(lastIndex);
                clonePy.Points = ply.Points.Clone();
                _polyline      = clonePy;
                canvas.Children.Insert(lastIndex, clonePy);//重新new  新节点否则不会onrender 执行
                canvas.Children.RemoveAt(lastIndex + 1);
                canvas.Children.Insert(lastIndex + 1, _line);
            }
        }
예제 #3
0
 public void MouseRightDown(Panel canvas, MouseButtonEventArgs e, Matrix screenToWorld, PolyLine1 ply)
 {
 }
예제 #4
0
 public void MouseDownPolyLine(Panel canvas, MouseButtonEventArgs e, Matrix screenToWorld, PolyLine1 ply)
 {
     return;
 }
예제 #5
0
        public void MouseRightDown(Panel canvas, MouseButtonEventArgs e, Matrix screenToWorld, PolyLine1 ply)
        {
            if (_polyline == null)
            {
                return;
            }

            _polyline.IsSelected = true;
            //_polyline.Points.Clear();
            // ply.Points.Clear();
            _line.X1 = _line.X2 = _line.Y1 = _line.Y2 = 0;
        }