Esempio n. 1
0
        public override void MouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            gTopology.Graph graph = Graph;
            if (graph == null)
            {
                return;
            }

            if (SelectLine == null)
            {
                return;
            }

            Topology editer = new Topology(graph);

            Path node = e.OriginalSource as Path;

            if (node != null && EditAdorner.IsNode(node))
            {
                int id = EditAdorner.GetNodeID(node);
                if (EditAdorner.IsControl(id))
                {
                    SelectLine = editer.LinRemovePoint(SelectLine, id);
                    EditAdorner.Select(TransPoints(SelectLine));
                }
            }
            base.MouseRightButtonUp(sender, e);
        }
Esempio n. 2
0
        public override void MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            gTopology.Graph graph = Graph;
            if (graph == null)
            {
                return;
            }

            Topology editer = new Topology(graph);
            Point    pos    = e.GetPosition(GraphContainer);
            Face     face   = editer.FacHit(pos, Tolerance);

            if (face != null)
            {
                if (InvalidFace)
                {
                    editer.FacSetInvalid(face);
                }
                else
                {
                    editer.FacSetType(face, FaceType);
                }
            }

            base.MouseLeftButtonUp(sender, e);
        }
Esempio n. 3
0
        public override void MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (TrackPoints.Count == 0)
            {
                return;
            }

            if (UseErasePart && SelectLine != null)
            {
                Topology editor = new Topology(Graph);
                Point    pos    = e.GetPosition(GraphContainer);
                editor.LinEraseSubLine(SelectLine, TrackPoints, Tolerance);
                TrackAdorner.Track.Style = OldTrackStyle;
                SelectLine = null;
            }
            else
            {
                gTopology.Graph graph = Graph;
                if (graph == null)
                {
                    return;
                }
                Topology editor = new Topology(graph);
                editor.LinRemoveLine(TrackPoints);
            }
            base.MouseLeftButtonUp(sender, e);
        }
Esempio n. 4
0
        public override void MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            gTopology.Graph graph = Graph;
            if (graph == null)
            {
                return;
            }

            Topology editor = new Topology(graph);

            editor.LinAddLine(Start, End, Tolerance);

            base.MouseLeftButtonUp(sender, e);
        }
Esempio n. 5
0
        public override void MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            gTopology.Graph graph = Graph;
            if (graph == null)
            {
                return;
            }

            Topology editor = new Topology(graph);

            Type clickSourceType = e.OriginalSource.GetType();

            if (Start.X >= 0 && Start.Y >= 0 && End.X >= 0 && End.Y >= 0 && Start != End)
            {
                editor.LinAddLine(Start, End, Tolerance);
                if (clickSourceType.Equals(typeof(Path)))
                {
                    Path         path = (Path)e.OriginalSource;
                    Point        p    = PathToPoint(path);
                    WellLocation well = PathToWellLocation(path);

                    if (well != null)
                    {
                        SelectPath(path);
                        WellNumList.Add(well.WellNum);
                    }
                }
                else if (clickSourceType.Equals(typeof(System.Windows.Shapes.Line)))
                {
                    IEnumerable <Path> paths = FindChild.FindVisualChildren <Path>(TrackAdorner.AdornedElement);
                    foreach (Path path in paths)
                    {
                        WellLocation well = PathToWellLocation(path);
                        if (well != null)
                        {
                            if (well.X == End.X && well.Y == End.Y)
                            {
                                SelectPath(path);
                                WellNumList.Add(well.WellNum);
                            }
                        }
                    }
                }
            }
            base.MouseLeftButtonUp(sender, e);
        }
        public override void MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (TrackAdorner.Track.Points.Count == 0)
            {
                return;
            }

            gTopology.Graph graph = Graph;
            if (graph == null)
            {
                return;
            }

            Topology editor = new Topology(graph);

            editor.LinAddCurve(TrackPoints, Tolerance, true);
            this.TrackAdorner.ClearPoint();
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
        public override void MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            gTopology.Graph graph = Graph;
            if (graph == null)
            {
                return;
            }

            if (SelectLine == null)
            {
                return;
            }

            Topology editer = new Topology(graph);

            Path node = e.OriginalSource as Path;

            if (node != null && EditAdorner.IsNode(node))
            {
                int id = EditAdorner.GetNodeID(node);
                if (EditAdorner.IsControl(id))
                {
                    SelectLine = editer.LinMoveControlPoint(SelectLine, id, EditAdorner.GetNodePos(node));
                    EditAdorner.Select(TransPoints(SelectLine));
                }
                else
                {
                    if ((Keyboard.Modifiers & ModifierKeys.Control) != ModifierKeys.Control)
                    {
                        SelectLine = editer.LinMoveEarPoint(SelectLine, id, EditAdorner.GetNodePos(node), true);
                        EditAdorner.Select(TransPoints(SelectLine));
                    }
                    else
                    {
                        SelectLine = editer.LinMoveEarPoint(SelectLine, id, EditAdorner.GetNodePos(node), false);
                        EditAdorner.Select(TransPoints(SelectLine));
                    }
                }
            }

            base.MouseLeftButtonUp(sender, e);
        }
Esempio n. 9
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);
        }
Esempio n. 10
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);
        }