示例#1
0
        public override List <Shadow> GetSourceTargets()
        {
            List <Shadow>  list     = new List <Shadow>();
            List <Connect> connects = GetShapeInputs();

            if (connects.Count == 0)
            {
                // no inbound connectors, find the partner and go from there
                OffPageRefShadow partnerShadow = GetPartnerOffPageRefShadow() as OffPageRefShadow;
                if (partnerShadow != null)
                {
                    List <Connect> partnerConnects = partnerShadow.GetShapeInputs();
                    if (partnerConnects.Count == 0)
                    {
                        if (GetShapeOutputs().Count == 0)
                        {
                            Common.ErrorMessage("No inputs for off-page connector " + shape.Text + " on page " + shape.ContainingPage.Name);
                        }
                        else
                        {
                            Common.ErrorMessage("No inputs for off-page connector " + partnerShadow.shape.Text + " on page " + partnerShadow.shape.ContainingPage.Name);
                        }
                        list.Add(this);
                    }
                    else
                    {
                        list.AddRange(partnerShadow.GetSourceTargets());
                    }
                }
                else
                {
                    list.Add(this);
                }
            }
            else
            {
                foreach (Connect c in connects)
                {
                    // always the from sheet = connector (fromsheet = 1D, tosheet = 2D)
                    Shape  sourceShape  = c.FromSheet;
                    Shadow sourceShadow = PathMaker.LookupShadowByShape(sourceShape);
                    if (sourceShadow != null)
                    {
                        list.AddRange(sourceShadow.GetSourceTargets());
                    }
                    else
                    {
                        list.Add(this);
                    }
                }
            }
            return(list);
        }
示例#2
0
        public override Shadow GetDestinationTarget()
        {
            List <Connect> list = GetShapeOutputs();

            System.Diagnostics.Debug.WriteLine("offpage - " + shape.Text + " page - " + shape.ContainingPage.Name);

            if (list.Count == 0 && GetShapeInputs().Count == 0)
            {
                // no in or outbound connectors
                return(this);
            }
            else if (list.Count > 0)
            {
                // find outbound link (should only be one)
                if (list.Count != 1)
                {
                    return(this);
                }

                // the FromSheet is the outgoing connector (always from = 1D, to = 2D)
                Shadow connectedToShadow = PathMaker.LookupShadowByShape(list[0].FromSheet);
                if (connectedToShadow != null)
                {
                    return(connectedToShadow.GetDestinationTarget());
                }
                else
                {
                    return(this);
                }
            }
            else
            {
                OffPageRefShadow partnerShadow = GetPartnerOffPageRefShadow() as OffPageRefShadow;

                if (partnerShadow != null && partnerShadow.GetShapeOutputs().Count > 0)
                {
                    return(partnerShadow.GetDestinationTarget());
                }
                else
                {
                    if (partnerShadow != null && partnerShadow.GetShapeInputs().Count > 0)
                    {
                        Common.ErrorMessage("Off page connector " + shape.Text + " on page " + shape.ContainingPage.Name + " and it's partner both have inputs");
                    }
                    return(this);
                }
            }
        }