Exemplo n.º 1
0
 private PointCollection TransPoints(gTopology.Line line)
 {
     return(new PointCollection(line.Points));
     //PointCollection ps = new PointCollection();
     //foreach (Point p in line.Points)
     //{
     //    ps.Add(GraphContainer.TranslatePoint(p, this.AssociatedObject));
     //}
     //return ps;
 }
Exemplo n.º 2
0
        public override void MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            gTopology.Graph graph = Graph;
            if (graph == null)
            {
                return;
            }

            Topology editor = new Topology(graph);
            Point    pos    = e.GetPosition(GraphContainer);

            gTopology.Line line = editor.LinHit(pos, Tolerance);
            if (line != null)
            {
                SelectLine = line;
            }
            base.MouseLeftButtonDown(sender, e);
        }
Exemplo n.º 3
0
        public override void MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            gTopology.Graph graph = Graph;
            if (graph == null)
            {
                return;
            }

            Path node = e.OriginalSource as Path;

            if (node != null && EditAdorner.IsNode(node))
            {
                return;
            }

            Topology editor = new Topology(graph);
            Point    pos    = e.GetPosition(GraphContainer);

            gTopology.Line line = editor.LinHit(pos, Tolerance);

            if (line != null)
            {
                if (SelectLine == line)
                {
                    SelectLine = editor.LinAddPoint(SelectLine, pos, Tolerance);
                    EditAdorner.Select(TransPoints(SelectLine));
                }
                else
                {
                    SelectLine = line;
                    EditAdorner.Select(TransPoints(SelectLine));
                }
            }
            else
            {
                SelectLine = null;
                EditAdorner.Select(null);
            }
            base.MouseLeftButtonDown(sender, e);
        }
Exemplo n.º 4
0
        public override void MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (UseErasePart)
            {
                gTopology.Graph graph = Graph;
                if (graph == null)
                {
                    return;
                }

                Topology       editor = new Topology(graph);
                Point          pos    = e.GetPosition(GraphContainer);
                gTopology.Line line   = editor.LinHit(pos, Tolerance);
                if (line != null)
                {
                    SelectLine = line;
                    this.TrackAdorner.ClearPoint();
                    Point np = editor.LinNearestPoint(line, pos);
                    TrackPoints.Add(np);
                    np = GraphContainer.TranslatePoint(np, this.AssociatedObject);
                    TrackAdorner.Track.Points.Add(np);
                    OldTrackStyle = TrackAdorner.Track.Style;
                    Style newstyle = new Style();
                    newstyle.Setters.Add(new Setter()
                    {
                        Property = Polyline.StrokeProperty, Value = new SolidColorBrush()
                        {
                            Color = Colors.LightBlue
                        }
                    });
                    newstyle.Setters.Add(new Setter()
                    {
                        Property = Polyline.StrokeThicknessProperty, Value = 3.0
                    });
                    TrackAdorner.Track.Style = newstyle;
                    return;
                }
            }
            base.MouseLeftButtonDown(sender, e);
        }