Esempio n. 1
0
        public static bool Split(ICanvas canvas, ILine line, ILine currentLine, IPoint point, IDiagramCreator creator, bool snap)
        {
            var    pin  = Insert.Pin(canvas, point, creator, snap);
            double x    = pin.GetX();
            double y    = pin.GetY();
            var    temp = Connect(canvas, pin, currentLine, x, y, creator);

            canvas.Remove(line);

            var connections = ModelEditor.RemoveWireConnections(canvas, line);

            if (connections != null && connections.Count == 2)
            {
                Reconnect(canvas, line, pin, x, y, connections, temp, creator);
            }
            else
            {
                throw new InvalidOperationException("LineEx should have only two connections: Start and End.");
            }

            return(true);
        }