示例#1
0
        private Connection AttachToConnection(Connection connection)
        {
            if (connection == null)
            {
                return(null);
            }

            Connector  t_from  = connection.From;
            Connector  t_to    = connection.To;
            Connection t_conn1 = null; //the new connection attached by connector
            Connection t_conn2 = null;

            if (LeftConnector.Location.Y <= t_to.Location.Y)
            {
                t_conn1 = new FlowChartConnection(Site);
                t_conn1.Insert(t_from, LeftConnector);

                t_conn2 = new FlowChartConnection(Site);
                t_conn2.Insert(LeftConnector, t_to);

                connection.Remove();
            }

            if (t_to.Location.Y < LeftConnector.Location.Y)
            {
                t_conn1 = new FlowChartConnection(LeftConnector.Site);
                t_conn1.Insert(t_to, LeftConnector);
            }

            //Horizontally move shape of connector to connection
            HorizonMoveTo(t_to.Location.X);
            return(t_conn1);
        }
示例#2
0
        private void AttachFromBelow(Connector connector)
        {
            Connection t_outConnection = null;

            foreach (Connection connection in connector.Connections)
            {
                if (connection.From == connector)
                {
                    t_outConnection = connection;
                    break;
                }
            }

            Connection t_conn1 = null;
            Connection t_conn2 = null;

            t_conn1 = new FlowChartConnection(Site);
            t_conn1.Insert(connector, LeftConnector);

            if (t_outConnection != null)
            {
                t_conn2 = new FlowChartConnection(Site);
                t_conn2.Insert(LeftConnector, t_outConnection.To);
                t_outConnection.Remove();
            }

            //Horizontally move shape of connector to connection
            HorizonMoveTo(connector.Location.X);
        }
示例#3
0
        private void AttachFromAbove(Connector connector)
        {
            Connection t_inConnection = null;

            foreach (Connection connection in connector.Connections)
            {
                if (connection.To == connector)
                {
                    t_inConnection = connection;
                    break;
                }
            }

            Connection t_conn1 = null; //the new connection attached by connector
            Connection t_conn2 = null;

            if (t_inConnection != null)
            {
                t_conn1 = new FlowChartConnection(Site);
                t_conn1.Insert(t_inConnection.From, LeftConnector);
                t_inConnection.Remove();
            }

            t_conn2 = new FlowChartConnection(Site);
            t_conn2.Insert(LeftConnector, connector);

            //Horizontally move shape of connector to connection
            HorizonMoveTo(connector.Location.X);
        }
示例#4
0
        private void DetachLeftSideConnections()
        {
            Connection t_inConnection  = null;
            Connection t_outConnection = null;

            foreach (Connection connection in LeftConnector.Connections)
            {
                if (connection.To == LeftConnector)
                {
                    t_inConnection = connection;
                    continue;
                }

                if (connection.From == LeftConnector)
                {
                    t_outConnection = connection;
                }
            }

            float t_stickX = 0;

            if (t_inConnection != null && t_outConnection != null)
            {
                t_stickX = t_outConnection.To.Location.X;
                Connection t_conn = new FlowChartConnection(Site);
                t_conn.Insert(t_inConnection.From, t_outConnection.To);
            }

            if (t_inConnection != null)
            {
                if (IsVerticalConnection(t_inConnection))
                {
                    t_stickX = t_inConnection.From.Location.X;
                }
                t_inConnection.Remove();
            }

            if (t_outConnection != null)
            {
                if (IsVerticalConnection(t_outConnection))
                {
                    t_stickX = t_outConnection.To.Location.X;
                }
                t_outConnection.Remove();
            }

            t_stickX = t_stickX < Rectangle.X ? t_stickX + m_autoShiftX + 1 : t_stickX - m_autoShiftX - 1;
            HorizonMoveTo(t_stickX);
        }
示例#5
0
        public virtual Connection CreateConnection(Connector connector)
        {
            FlowChartConnection connection = new FlowChartConnection();

            return(connection);
        }