Exemplo n.º 1
0
        void ProtocolStatesViewerMouseUp(object sender, Microsoft.Msagl.Drawing.MsaglMouseEventArgs e)
        {
//			  object obj = ProtocolStatesViewer.GetObjectAt(e.X, e.Y);
            //            Microsoft.Msagl.Drawing.Node node = null;
            //            Microsoft.Msagl.Drawing.Edge edge = null;
            //            Microsoft.Msagl.GraphViewerGdi.DNode dnode = obj as Microsoft.Msagl.GraphViewerGdi.DNode;
            //            Microsoft.Msagl.GraphViewerGdi.DEdge dedge = obj as Microsoft.Msagl.GraphViewerGdi.DEdge;
            //            Microsoft.Msagl.GraphViewerGdi.DLabel dl = obj as Microsoft.Msagl.GraphViewerGdi.DLabel;
            //            if (dnode!=null)
            //                node = dnode.DrawingNode;
            //            else if (dedge!=null)
            //                edge = dedge.DrawingEdge;
            //            else if (dl!=null) {
            //                if (dl.Parent is Microsoft.Msagl.GraphViewerGdi.DNode)
            //                    node = (dl.Parent as Microsoft.Msagl.GraphViewerGdi.DNode).DrawingNode;
            //                else if (dl.Parent is Microsoft.Msagl.GraphViewerGdi.DEdge)
            //                    edge = (dl.Parent as Microsoft.Msagl.GraphViewerGdi.DEdge).DrawingEdge;
            //            }
            //            if (node != null) {
            //                ShowEditorDelegate(node);
            //            } else if (edge != null) {
            //                ShowEditorDelegate(edge);
            //            } else {
            //                CloseEditorDelegate();
            //            }
        }
Exemplo n.º 2
0
        void ProtocolStatesViewerMouseDown(object sender, Microsoft.Msagl.Drawing.MsaglMouseEventArgs e)
        {
            if (e.RightButtonIsPressed && !e.Handled)
            {
                //Microsoft.Msagl.Point  m_MouseRightButtonDownPoint = (ProtocolStatesViewer as Microsoft.Msagl.Drawing.IViewer).ScreenToSource(e);

                if (UserControlProtocol == null || UserControlProtocol.Status == Protocol.Statuses.EndedSuccessfully ||
                    UserControlProtocol.Status == Protocol.Statuses.Stopped)
                {
                    ProtocolViewercontextMenuStrip.Show(this, new System.Drawing.Point(e.X, e.Y));
                }
            }
        }
        public void MouseMove(MsaglMouseEventArgs e) {
            if (currentPath == null) return;
            var point = scroller.GetWpfPosition(e);

            if (DistanceBetweenWpfPoints(point, pathEnd) < 3 * currentPath.StrokeThickness) return;

            pathEnd = point;

            pathSegmentCollection.Add(new LineSegment(point, true));
            var pathFigure = new PathFigure(pathStart, pathSegmentCollection, true);
            var pathFigureCollection = new PathFigureCollection { pathFigure };
            var pathGeometry = new PathGeometry(pathFigureCollection);
            currentPath.Data = pathGeometry;
        }
Exemplo n.º 4
0
        //private void SpreadGroupForMDS(MsaglMouseEventArgs args) {
        //    if ((viewer.ModifierKeys & Microsoft.Msagl.Drawing.ModifierKeys.Shift) == Microsoft.Msagl.Drawing.ModifierKeys.Shift) {
        //        Microsoft.Msagl.Splines.Rectangle rect =
        //            new Microsoft.Msagl.Splines.Rectangle(this.mouseDownSourcePoint, viewer.ScreenToSource(args));

        //        double radius = (rect.LeftTop - rect.RightBottom).Length / 2;
        //        Set<IViewerNode> iSet = new Set<IViewerNode>();
        //        Set<Microsoft.Msagl.Node> setToSpread = new Set<Microsoft.Msagl.Node>();

        //        GeometryGraph graph = null;
        //        foreach (IViewerNode node in Nodes()) {

        //            if (rect.Intersect(node.Node.BoundingBox)) {
        //                viewer.InvalidateBeforeTheChange(node);
        //                foreach (IViewerEdge edge in node.SelfEdges)
        //                    viewer.Invalidate(edge);
        //                iSet.Insert(node);
        //                setToSpread.Insert(node.Node.Attr.GeometryNode);
        //                graph = node.Node.Attr.GeometryNode.Parent as GeometryGraph;
        //            }
        //        }

        //        foreach (IViewerNode node in Nodes()) {
        //            viewer.Invalidate(node);
        //            foreach (IViewerEdge edge in node.OutEdges)
        //                viewer.Invalidate(edge);

        //            foreach (IViewerEdge edge in node.SelfEdges)
        //                viewer.Invalidate(edge);
        //        }

        //        if (graph != null) {
        //            System.Console.WriteLine("xxx");
        //            Microsoft.Msagl.Mds.MdsGraphLayout graphLayout = new Microsoft.Msagl.Mds.MdsGraphLayout();
        //            graphLayout.GroupSpread(graph, setToSpread);
        //        }

        //        foreach (IViewerNode node in Nodes()) {
        //            viewer.Invalidate(node);
        //            foreach (IViewerEdge edge in node.OutEdges)
        //                viewer.Invalidate(edge);

        //            foreach (IViewerEdge edge in node.SelfEdges)
        //                viewer.Invalidate(edge);

        //        }
        //        viewer.Invalidate(); //remove it later
        //        args.Handled = true;
        //    }
        //}

        private void SelectEntitiesForDraggingWithRectangle(MsaglMouseEventArgs args)
        {
            Microsoft.Msagl.Splines.Rectangle rect =
                new Microsoft.Msagl.Splines.Rectangle(this.mouseDownSourcePoint, viewer.ScreenToSource(args));

            foreach (IViewerNode node in Nodes())
            {
                if (rect.Intersect(node.Node.BoundingBox))
                {
                    SelectObjectForDragging(node);
                }
            }

            args.Handled = true;
        }
        private void OnMouseCursorChanged(object sender, MsaglMouseEventArgs e)
        {
            foreach (var en in _graphViewer.Entities)
            {
                var node = en as IViewerNode;

                if (node != null)
                {
                    //CLEAR
                    node.Node.Attr.FillColor = Color.Gray;

                    node.OutEdges.ToList().ForEach(x =>
                    {
                        node.Node.Attr.FillColor = Color.LightGreen;
                        x.Edge.SourceNode.Attr.FillColor = Color.LightGreen;
                        x.Edge.Attr.Color = Color.Black;
                    });
                    node.InEdges.ToList().ForEach(x =>
                    {
                        node.Node.Attr.FillColor = Color.LightGreen;
                        x.Edge.TargetNode.Attr.FillColor = Color.LightGreen;
                        x.Edge.Attr.Color = Color.Black;
                    });
                }
            }
            foreach (var en in _graphViewer.Entities)
            {
                var node = en as IViewerNode;

                if (en.MarkedForDragging && node != null)
                {
                    //MARK
                    node.Node.Attr.FillColor = Color.Yellow;

                    node.OutEdges.ToList().ForEach(x =>
                    {
                        x.Edge.TargetNode.Attr.FillColor = Color.PaleVioletRed;
                        x.Edge.Attr.Color = Color.Red;
                    });

                    node.InEdges.ToList().ForEach(x =>
                    {
                        x.Edge.SourceNode.Attr.FillColor = Color.LightBlue;
                        x.Edge.Attr.Color = Color.Blue;
                    });
                }
            }
        }
Exemplo n.º 6
0
        static MouseButtons GetPressedButtons(MsaglMouseEventArgs e)
        {
            MouseButtons ret = MouseButtons.None;

            if (e.LeftButtonIsPressed)
            {
                ret |= MouseButtons.Left;
            }
            if (e.MiddleButtonIsPressed)
            {
                ret |= MouseButtons.Middle;
            }
            if (e.RightButtonIsPressed)
            {
                ret |= MouseButtons.Right;
            }
            return(ret);
        }
Exemplo n.º 7
0
 void CheckIfDraggingPolylineVertex(MsaglMouseEventArgs e)
 {
     if (SelectedEdge != null)
     {
         Site site = this.SelectedEdge.Edge.Attr.GeometryEdge.UnderlyingPolyline.HeadSite;
         do
         {
             if (MouseScreenPointIsCloseEnoughToVertex(site.Point,
                                                       SelectedEdge.RadiusOfPolylineCorner + ((double)SelectedEdge.Edge.Attr.LineWidth) / 2.0))
             {
                 this.PolylineVertex = site;
                 e.Handled           = true;
                 break;
             }
             site = site.Next;
         }while (site != null);
     }
 }
Exemplo n.º 8
0
        void viewer_MouseMove(object sender, MsaglMouseEventArgs e)
        {
            if (viewer.LayoutIsEditable)
            {
                if (e.LeftButtonIsPressed && (ActiveDraggedObject != null || this.PolylineVertex != null))
                {
                    if (!Dragging)
                    {
                        if (this.MouseDownPointAndMouseUpPointsAreFarEnough(e))
                        {
                            Dragging = true;
                            //first time we are in Dragging mode
                            if (this.PolylineVertex != null)
                            {
                                geomGraphEditor.PrepareForEdgeCornerDragging(GetSetOfAffectedObjs(),
                                                                             SelectedEdge.DrawingObject.GeometryObject as Microsoft.Msagl.Edge, PolylineVertex);
                            }
                            else if (ActiveDraggedObject != null)
                            {
                                UnselectEdge();
                                if (!ActiveDraggedObject.MarkedForDragging)
                                {
                                    UnselectEverything();
                                }
                                SelectObjectForDragging(ActiveDraggedObject);
                                geomGraphEditor.PrepareForObjectDragging(GetSetOfAffectedObjs(), DraggedGeomObjects());
                            }
                        }
                    }

                    if (Dragging)
                    {
                        InvalidateAffectedObjsBeforeEdit();
                        geomGraphEditor.Drag(GetDelta(e));
                        InvalidateAffectedObjs();
                        e.Handled = true;
                    }
                }
                else if (MiddleMouseButtonWasPressed)
                {
                    viewer.DrawRubberLine(e);
                }
            }
        }
Exemplo n.º 9
0
 void viewer_MouseDown(object sender, MsaglMouseEventArgs e)
 {
     if (viewer.LayoutIsEditable)
     {
         PressedMouseButtons  = GetPressedButtons(e);
         mouseDownSourcePoint = viewer.ScreenToSource(e);
         mouseDownScreenPoint = new Point(e.X, e.Y);
         if (e.LeftButtonIsPressed)
         {
             LeftMouseButtonWasPressed = true;
             if (!(viewer.ObjectUnderMouseCursor is IViewerEdge))
             {
                 ActiveDraggedObject = viewer.ObjectUnderMouseCursor;
             }
             if (ActiveDraggedObject != null)
             {
                 e.Handled = true;
             }
             if (this.SelectedEdge != null)
             {
                 this.CheckIfDraggingPolylineVertex(e);
             }
         }
         else if (e.RightButtonIsPressed)
         {
             if (this.SelectedEdge != null)
             {
                 ProcessRightClickOnSelectedEdge(e);
             }
         }
         else if (e.MiddleButtonIsPressed && viewer.ObjectUnderMouseCursor is IViewerNode)
         {
             SourceOfInsertedEdge = viewer.ObjectUnderMouseCursor as IViewerNode;
             UnselectEverything();
             MiddleMouseButtonWasPressed = true;
             viewer.StartDrawingRubberLine(e);
         }
     }
 }
 void scroller_MouseUp(object sender, MsaglMouseEventArgs e) {
     MouseUp();
 }
 public void MouseDown(MsaglMouseEventArgs e) {
     StartNewPath(scroller.GetWpfPosition(e));
 }
Exemplo n.º 12
0
 Point GetDelta(MsaglMouseEventArgs e)
 {
     return(viewer.ScreenToSource(e) - mouseDownSourcePoint);
 }
Exemplo n.º 13
0
 void Form1_MouseUp(object sender, MsaglMouseEventArgs e) {
     object obj = gViewer.GetObjectAt(e.X, e.Y);
     DrawingNode node = null;
     Edge edge = null;
     var dnode = obj as DNode;
     var dedge = obj as DEdge;
     var dl = obj as DLabel;
     if (dnode != null)
         node = dnode.DrawingNode;
     else if (dedge != null)
         edge = dedge.DrawingEdge;
     else if (dl != null) {
         if (dl.Parent is DNode)
             node = (dl.Parent as DNode).DrawingNode;
         else if (dl.Parent is DEdge)
             edge = (dl.Parent as DEdge).DrawingEdge;
     }
     if (node != null) {
         ShowEditorDelegate(node);
     } else if (edge != null) {
         ShowEditorDelegate(edge);
     } else {
         CloseEditorDelegate();
     }
 }
Exemplo n.º 14
0
        void GraphViewerMouseDown(object sender, MsaglMouseEventArgs e) {
//            if (e.RightButtonIsPressed) {
//                PopupMenus(CreatePopupMenu());
//                e.Handled = true;
//            }
        }
Exemplo n.º 15
0
 public Point ScreenToSource(MsaglMouseEventArgs e)
 {
     return new Point(e.X, e.Y);
 }
Exemplo n.º 16
0
 void HandleMouseMoveWhenInsertingEdgeAndNotPressingLeftButton(MsaglMouseEventArgs e) {
     IViewerNode oldNode = SourceOfInsertedEdge;
     if (TrySetNodePort(e, ref sourceOfInsertedEdge, ref sourcePort, out sourceLoosePolyline))
         viewer.SetSourcePortForEdgeRouting(sourcePort.Location);
     else if (oldNode != null)
         viewer.RemoveSourcePortEdgeRouting();
 }
 void scroller_MouseMove(object sender, MsaglMouseEventArgs e) {
     MouseMove(e);
 }
Exemplo n.º 18
0
 void ViewerMouseMove(object sender, MsaglMouseEventArgs e) {
     if (viewer.LayoutEditingEnabled) {                 
         if (e.LeftButtonIsPressed) {
             if (ActiveDraggedObject != null || PolylineVertex != null)
                 DragSomeObjects(e);
             else if (InsertingEdge)
                 MouseMoveWhenInsertingEdgeAndPressingLeftButton(e);
         } else if(InsertingEdge)
             HandleMouseMoveWhenInsertingEdgeAndNotPressingLeftButton(e);
     }            
 }
Exemplo n.º 19
0
        void ViewerMouseDown(object sender, MsaglMouseEventArgs e) {
            if (!viewer.LayoutEditingEnabled || viewer.Graph == null) return;

            PressedMouseButtons = GetPressedButtons(e);
            mouseDownGraphPoint = viewer.ScreenToSource(e);
            MouseDownScreenPoint = new Point(e.X, e.Y);
            if (e.LeftButtonIsPressed) {
                LeftMouseButtonWasPressed = true;
                if (!InsertingEdge) {
                    if (!(viewer.ObjectUnderMouseCursor is IViewerEdge))
                        ActiveDraggedObject = viewer.ObjectUnderMouseCursor;
                    if (ActiveDraggedObject != null)
                        e.Handled = true;
                    if (SelectedEdge != null)
                        CheckIfDraggingPolylineVertex(e);
                } else if (SourceOfInsertedEdge != null && SourcePort != null && DraggingStraightLine())
                    viewer.StartDrawingRubberLine(sourcePort.Location);
            } else if (e.RightButtonIsPressed)
                if (SelectedEdge != null)
                    ProcessRightClickOnSelectedEdge(e);
        }
Exemplo n.º 20
0
 bool MouseDownPointAndMouseUpPointsAreFarEnoughOnScreen(MsaglMouseEventArgs e) {
     int x = e.X;
     int y = e.Y;
     double dx = (MouseDownScreenPoint.X - x)/viewer.DpiX;
     double dy = (MouseDownScreenPoint.Y - y)/viewer.DpiY;
     return Math.Sqrt(dx*dx + dy*dy) > MouseMoveThreshold/3;
 }
Exemplo n.º 21
0
 void DrawEdgeInteractivelyToLocation(MsaglMouseEventArgs e) {
     DrawEdgeInteractivelyToLocation(viewer.ScreenToSource(e));
 }
Exemplo n.º 22
0
 void MouseMoveWhenInsertingEdgeAndPressingLeftButton(MsaglMouseEventArgs e) {
     if(SourcePort != null) {
         SetDraggingFlag(e);
         if(Dragging) {
             Polyline loosePolyline;
             if(TrySetNodePort(e,ref targetOfInsertedEdge,ref targetPort,out loosePolyline)) {
                 viewer.SetTargetPortForEdgeRouting(targetPort.Location);
                 if(DraggingStraightLine())
                     viewer.DrawRubberLine(TargetPort.Location);
                 else
                     DrawEdgeInteractivelyToPort(TargetPort,loosePolyline);
             } else {
                 viewer.RemoveTargetPortEdgeRouting();
                 if(DraggingStraightLine())
                     viewer.DrawRubberLine(e);
                 else
                     DrawEdgeInteractivelyToLocation(e);
             }                   
         }
         e.Handled = true;
     }
 }
 void scroller_MouseDown(object sender, MsaglMouseEventArgs e) {
     MouseDown(e);
 }
Exemplo n.º 24
0
 void DGraph_MouseLeftButtonDoubleClick(object sender, MsaglMouseEventArgs e)
 {
     if (ObjectUnderMouseCursor != null)
         BeginContentEdit(ObjectUnderMouseCursor as DObject);
 }
Exemplo n.º 25
0
 void SetDraggingFlag(MsaglMouseEventArgs e) {
     if (!Dragging && MouseDownPointAndMouseUpPointsAreFarEnoughOnScreen(e))
         Dragging = true;
 }
 public Point ScreenToSource(MsaglMouseEventArgs e) {
     var p = new Point(e.X, e.Y);
     var m = Transform.Inverse;
     return m*p;
 }
Exemplo n.º 27
0
 public void DrawRubberLine(MsaglMouseEventArgs args)
 {
     DrawRubberLine(new MsaglPoint(args.X, args.Y));
 }
Exemplo n.º 28
0
        bool TrySetNodePort(MsaglMouseEventArgs e, ref IViewerNode node, ref Port port, out Polyline loosePolyline) {
            Debug.Assert(InsertingEdge);

            Point mousePosition = viewer.ScreenToSource(e);
            loosePolyline = null;
            if (Graph != null) {
                if (DraggingStraightLine()) {
                    node= SetPortWhenDraggingStraightLine(ref port, ref mousePosition);
                } else {
                    if (InteractiveEdgeRouter == null)
                        PrepareForEdgeDragging();
                    loosePolyline = InteractiveEdgeRouter.GetHitLoosePolyline(viewer.ScreenToSource(e));
                    if (loosePolyline != null)
                        SetPortUnderLoosePolyline(mousePosition, loosePolyline, ref node, ref port);
                    else {
                        node = null;
                        port = null;
                    }
                }
            }
            return port != null;
        }
 public void DrawRubberLine(MsaglMouseEventArgs args) {
     DrawRubberLine(ScreenToSource(args));
 }
Exemplo n.º 30
0
        void DragSomeObjects(MsaglMouseEventArgs e) {
            if (!Dragging) {
                if (MouseDownPointAndMouseUpPointsAreFarEnoughOnScreen(e)) {
                    Dragging = true;
                    //first time we are in Dragging mode
                    if (PolylineVertex != null)
                        geomGraphEditor.PrepareForEdgeCornerDragging(
                            SelectedEdge.DrawingObject.GeometryObject as Core.Layout.Edge, PolylineVertex);
                    else if (ActiveDraggedObject != null) {
                        UnselectEdge();
                        if (!ActiveDraggedObject.MarkedForDragging)
                            UnselectEverything();
                        SelectObjectForDragging(ActiveDraggedObject);
                        geomGraphEditor.PrepareForObjectDragging(DraggedGeomObjects(), GetDraggingMode());
                    }
                }
                _lastDragPoint = mouseDownGraphPoint;
            }

            if (!Dragging) return;
            var currentDragPoint = viewer.ScreenToSource(e);
            geomGraphEditor.Drag(currentDragPoint - _lastDragPoint, GetDraggingMode(), _lastDragPoint);
            foreach (var affectedObject in CurrentUndoAction.AffectedObjects) {
                viewer.Invalidate(affectedObject);
            }
            if (geomGraphEditor.GraphBoundingBoxGetsExtended)
                viewer.Invalidate();       
            e.Handled = true;
            _lastDragPoint = currentDragPoint;
        }
Exemplo n.º 31
0
 public void DrawRubberLine(MsaglMouseEventArgs args)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 32
0
 void ViewerMouseUp(object sender, MsaglMouseEventArgs args) {
     if (args.Handled) return;
     if (viewer.LayoutEditingEnabled)
         HandleMouseUpOnLayoutEnabled(args);
 }
Exemplo n.º 33
0
 void GraphViewerMouseMove(object sender, MsaglMouseEventArgs e) {
     SetStatusText();
 }
Exemplo n.º 34
0
        void HandleMouseUpOnLayoutEnabled(MsaglMouseEventArgs args) {
            bool click = !MouseDownPointAndMouseUpPointsAreFarEnoughOnScreen(args);
            if (click && LeftMouseButtonWasPressed) {
                if (viewer.ObjectUnderMouseCursor != null) {
                    AnalyzeLeftMouseButtonClick();
                    args.Handled = true;
                }
                else
                    UnselectEverything();
            }
            else if (Dragging) {
                if (!InsertingEdge) {
                    geomGraphEditor.OnDragEnd(viewer.ScreenToSource(args) - mouseDownGraphPoint);
                    InteractiveEdgeRouter = null;
                    looseObstaclesToTheirViewerNodes = null;
                }
                else
                    InsertEdgeOnMouseUp();
                args.Handled = true;
            }
            else if (LeftMouseButtonWasPressed) {
                if (ToggleEntityPredicate(viewer.ModifierKeys, PressedMouseButtons, true) &&
                    (viewer.ModifierKeys & ModifierKeys.Shift) != ModifierKeys.Shift)
                    SelectEntitiesForDraggingWithRectangle(args);
            }
            Dragging = false;
            geomGraphEditor.ForgetDragging();
            PolylineVertex = null;
            ActiveDraggedObject = null;
            LeftMouseButtonWasPressed = false;
            if (TargetPort != null)
                viewer.RemoveTargetPortEdgeRouting();
            if (SourcePort != null)
                viewer.RemoveSourcePortEdgeRouting();

            SourceOfInsertedEdge = TargetOfInsertedEdge = null;
            SourcePort = TargetPort = null;
        }
Exemplo n.º 35
0
        void GViewerKeyDown(object sender, MsaglMouseEventArgs e)
        {

            if (e.MiddleButtonIsPressed &&  !e.Handled)
            {
               
                if (gViewer.SelectedObject != null)
                {
                    var edge = gViewer.ObjectUnderMouseCursor as IViewerEdge;
                    gViewer.RemoveEdge(edge, true);
                    string Source = Graph.source.ToString().Substring(0, Graph.source.ToString().IndexOf(':'));
                    string Target = Graph.target.ToString().Substring(0, Graph.target.ToString().IndexOf(':'));
                    map.disconnect(Source,Target);
                    for (int j = 0; j < edges; j++) {
                        if (Edges[j, 0] == Graph.source.ToString() && Edges[j, 2] == Graph.target.ToString())
                        {
                            Edges[j, 0] = "null";
                            Edges[j, 1] = "null";
                            Edges[j, 2] = "null";
                        }
                    }
                }
            }
         }
Exemplo n.º 36
0
        void SelectEntitiesForDraggingWithRectangle(MsaglMouseEventArgs args) {
            var rect =
                new Rectangle(mouseDownGraphPoint, viewer.ScreenToSource(args));

            foreach (IViewerNode node in ViewerNodes())
                if (rect.Intersects(node.Node.BoundingBox))
                    SelectObjectForDragging(node);

            args.Handled = true;
        }
Exemplo n.º 37
0
        void Form1_MouseDown(object sender, MsaglMouseEventArgs e) {
            /*if (e.RightButtonIsPressed && this.gViewer.DrawingLayoutEditor.SelectedEdge != null && this.gViewer.ObjectUnderMouseCursor == this.gViewer.DrawingLayoutEditor.SelectedEdge)
                ProcessRightClickOnSelectedEdge(e);
            else*/
            if (e.RightButtonIsPressed && !e.Handled) {
                m_MouseRightButtonDownPoint = (gViewer).ScreenToSource(e);

                ContextMenu cm = BuildContextMenu(m_MouseRightButtonDownPoint);

                cm.Show(this, new System.Drawing.Point(e.X, e.Y));
            }
        }
Exemplo n.º 38
0
        void ProcessRightClickOnSelectedEdge(MsaglMouseEventArgs e) {
            mouseRightButtonDownPoint = viewer.ScreenToSource(e);

            cornerInfo = AnalyzeInsertOrDeletePolylineCorner(mouseRightButtonDownPoint,
                                                             SelectedEdge.RadiusOfPolylineCorner);

            if (cornerInfo == null)
                return;

            e.Handled = true;

            var edgeRemoveCouple = new Tuple<string, VoidDelegate>("Remove edge",
                                                                    () => viewer.RemoveEdge(SelectedEdge, true));

            if (cornerInfo.Item2 == PolylineCornerType.PreviousCornerForInsertion)
                viewer.PopupMenus(
                    new Tuple<string, VoidDelegate>("Insert polyline corner", InsertPolylineCorner),
                    edgeRemoveCouple);
            else if (cornerInfo.Item2 == PolylineCornerType.CornerToDelete)
                viewer.PopupMenus(
                    new Tuple<string, VoidDelegate>("Delete polyline corner",
                                                              DeleteCorner), edgeRemoveCouple);
        }