Esempio n. 1
0
		private LinkCollection GetInLinks(IFactory factory)
		{
			LinkCollection links = new LinkCollection();

			ChartObjectCollection nodes = new ChartObjectCollection();
			nodes.Add(_node);

			// Collect all objects within that group
			if (_keepGroups)
			{
				int i = 0;
				while (i < nodes.Count)
				{
					Node node = nodes[i] as Node;
					i++;

					if (node.SubordinateGroup != null)
					{
						foreach (ChartObject sub in node.SubordinateGroup.AttachedObjects)
						{
							// Check if attached object is a node
							if (!(sub is Node))
								continue;

							// Add the node to the nodes of the group
							if (!nodes.Contains(sub))
								nodes.Add(sub);
						}
					}
				}
			}

			foreach (Node node in nodes)
			{
				foreach (Arrow a in node.IncomingArrows)
				{
					// Ignore non-layoutable objects
					if (a.IgnoreLayout)
						continue;
					if (a.Origin.Frozen)
						continue;
					if (!a.IsConnected)
						continue;

					// Add only if it comes from outside the group
					if (!nodes.Contains(a.Origin))
					{
						// Use the factory to create the adapter link.
						// That way, if the adapter for the arrow already
						// exists, it will be returned instead of creating a
						// new adapter.
						links.Add(factory.CreateLink(a,
							_keepGroups, _ignoreArrowDirection));
					}
				}

				if (node is Table)
				{
					Table t = node as Table;

					foreach (Table.Row r in t.Rows)
					{
						foreach (Arrow a in r.IncomingArrows)
						{
							// Ignore non-layoutable objects
							if (a.IgnoreLayout)
								continue;
							if (a.Origin.Frozen)
								continue;
							if (!a.IsConnected)
								continue;

							// Add only if it comes from outside the group
							if (!nodes.Contains(a.Origin))
							{
								// Use the factory to create the adapter link.
								// That way, if the adapter for the arrow already
								// exists, it will be returned instead of creating a
								// new adapter.
								links.Add(factory.CreateLink(a,
									_keepGroups, _ignoreArrowDirection));
							}
						}
					}
				}
			}

			return links;
		}
Esempio n. 2
0
        private LinkCollection GetInLinks(IFactory factory)
        {
            LinkCollection links = new LinkCollection();

            ChartObjectCollection nodes = new ChartObjectCollection();

            nodes.Add(_node);

            // Collect all objects within that group
            if (_keepGroups)
            {
                int i = 0;
                while (i < nodes.Count)
                {
                    Node node = nodes[i] as Node;
                    i++;

                    if (node.SubordinateGroup != null)
                    {
                        foreach (ChartObject sub in node.SubordinateGroup.AttachedObjects)
                        {
                            // Check if attached object is a node
                            if (!(sub is Node))
                            {
                                continue;
                            }

                            // Add the node to the nodes of the group
                            if (!nodes.Contains(sub))
                            {
                                nodes.Add(sub);
                            }
                        }
                    }
                }
            }

            foreach (Node node in nodes)
            {
                foreach (Arrow a in node.IncomingArrows)
                {
                    // Ignore non-layoutable objects
                    if (a.IgnoreLayout)
                    {
                        continue;
                    }
                    if (a.Origin.Frozen)
                    {
                        continue;
                    }
                    if (!a.IsConnected)
                    {
                        continue;
                    }

                    // Add only if it comes from outside the group
                    if (!nodes.Contains(a.Origin))
                    {
                        // Use the factory to create the adapter link.
                        // That way, if the adapter for the arrow already
                        // exists, it will be returned instead of creating a
                        // new adapter.
                        links.Add(factory.CreateLink(a,
                                                     _keepGroups, _ignoreArrowDirection));
                    }
                }

                if (node is Table)
                {
                    Table t = node as Table;

                    foreach (Table.Row r in t.Rows)
                    {
                        foreach (Arrow a in r.IncomingArrows)
                        {
                            // Ignore non-layoutable objects
                            if (a.IgnoreLayout)
                            {
                                continue;
                            }
                            if (a.Origin.Frozen)
                            {
                                continue;
                            }
                            if (!a.IsConnected)
                            {
                                continue;
                            }

                            // Add only if it comes from outside the group
                            if (!nodes.Contains(a.Origin))
                            {
                                // Use the factory to create the adapter link.
                                // That way, if the adapter for the arrow already
                                // exists, it will be returned instead of creating a
                                // new adapter.
                                links.Add(factory.CreateLink(a,
                                                             _keepGroups, _ignoreArrowDirection));
                            }
                        }
                    }
                }
            }

            return(links);
        }