Beispiel #1
0
        private void buildTree(Node node)
        {
            if (objects.Contains(node))
            {
                if (!strict)
                {
                    return;
                }
                throw new NotATreeException();
            }
            objects.Add(node);

            // get the appropriate arrows
            ArrowCollection arrows = new ArrowCollection();

            if (reversedDir)
            {
                node.getAllIncomingArrows(arrows);
            }
            else
            {
                node.getAllOutgoingArrows(arrows);
            }

            // build subtrees recursively
            foreach (Arrow a in arrows)
            {
                if (enumArrows)
                {
                    objects.Add(a);
                }
                buildTree(reversedDir ? a.Origin : a.Destination);
            }
        }
Beispiel #2
0
        internal Path(MindFusion.LayoutSystem.Path path)
        {
            _nodes = new ChartObjectCollection();
            _links = new ArrowCollection();
            _items = new ChartObjectCollection();

            foreach (FCNode node in path.Nodes)
            {
                _nodes.Add(node.Node);
            }
            foreach (FCLink link in path.Links)
            {
                _links.Add(link.Arrow);
            }
            foreach (object item in path.Items)
            {
                if (item is FCLink)
                {
                    _items.Add((item as FCLink).Arrow);
                }
                else
                {
                    _items.Add((item as FCNode).Node);
                }
            }
        }
Beispiel #3
0
 internal void updateObjCol()
 {
     attachedObjects.Clear();
     foreach (Attachment att in attachments)
     {
         attachedObjects.Add(att.node);
     }
 }
Beispiel #4
0
		public ChartObjectCollection Clone()
		{
			ChartObjectCollection oc = new ChartObjectCollection();
			foreach (ChartObject co in this)
				oc.Add(co);
			return oc;
		}
Beispiel #5
0
		internal Path(MindFusion.LayoutSystem.Path path)
		{
			_nodes = new ChartObjectCollection();
			_links = new ArrowCollection();
			_items = new ChartObjectCollection();

			foreach (FCNode node in path.Nodes)
				_nodes.Add(node.Node);
			foreach (FCLink link in path.Links)
				_links.Add(link.Arrow);
			foreach (object item in path.Items)
			{
				if (item is FCLink)
					_items.Add((item as FCLink).Arrow);
				else
					_items.Add((item as FCNode).Node);
			}
		}
Beispiel #6
0
        public ChartObjectCollection Clone()
        {
            ChartObjectCollection oc = new ChartObjectCollection();

            foreach (ChartObject co in this)
            {
                oc.Add(co);
            }
            return(oc);
        }
Beispiel #7
0
		internal void getIntersectingObjects(RectangleF rect,
			ChartObjectCollection objects, bool multiple, bool ifIntersect)
		{
			RectangleF rcSel = Utilities.normalizeRect(rect);

			if (ifIntersect)
			{
				foreach (ChartObject obj in zOrder)
				{
					RectangleF rcObjRect = obj.getRotatedBounds();
					if (!obj.notInteractive() && rcObjRect.IntersectsWith(rcSel))
					{
						objects.Add(obj);
						if (!multiple) return;
					}
				}
			}
			else
			{
				foreach (ChartObject obj in zOrder)
				{
					RectangleF rcObjRect = obj.getRotatedBounds();
					if (!obj.notInteractive() && rcSel.Contains(rcObjRect))
					{
						objects.Add(obj);
						if (!multiple) return;
					}
				}
			}
		}
Beispiel #8
0
		private ItemsAndGroups copySelection(
			FlowChart doc, bool unconnectedArrows, bool copyGroups)
		{
			if (doc.Selection.Objects.Count == 0)
				return null;

			// determine which items and groups to copy
			ChartObjectCollection items = new ChartObjectCollection();
			GroupCollection groups = new GroupCollection();
			Hashtable indexMap = new Hashtable();
			for (int i = 0; i < doc.Selection.Objects.Count; ++i)
			{
				ChartObject item = doc.Selection.Objects[i];

				// do not copy unconncted arrows if specified
				if (!unconnectedArrows && item is Arrow)
				{
					Arrow arrow = item as Arrow;
					if (!arrow.IsConnected) continue;
				}

				indexMap[item] = items.Count;
				items.Add(item);
				
				if (copyGroups && item.SubordinateGroup != null)
					groups.Add(item.SubordinateGroup);
			}

			// add subordinated group items
			foreach (Group group in groups)
			{
				foreach (ChartObject item in group.AttachedObjects)
				{
					if (!items.Contains(item))
					{
						indexMap[item] = items.Count;
						items.Add(item);
					}
				}
			}

			// copy nodes
			for (int i = 0; i < items.Count; ++i)
			{
				ChartObject item = items[i];

				if (item is Box) items[i] = new Box((Box)item);
				if (item is ControlHost) items[i] = new ControlHost((ControlHost)item);
				if (item is Table) items[i] = new Table((Table)item);
			}

			// copy arrows, linking them to node clones
			for (int i = 0; i <  items.Count; ++i)
			{
				if (items[i] is Arrow)
				{
					Arrow arrow = items[i] as Arrow;

					int srcIndex = indexMap.Contains(arrow.Origin) ?
						(int)indexMap[arrow.Origin] : -1;
					int dstIndex = indexMap.Contains(arrow.Destination) ?
						(int)indexMap[arrow.Destination] : -1;

					items[i] = new Arrow(arrow,
						srcIndex == -1 ? Dummy : items[srcIndex] as Node,
						dstIndex == -1 ? Dummy : items[dstIndex] as Node);
				}
			}

			// copy groups
			for (int i = 0; i < groups.Count; ++i)
			{
				Group group = new Group(groups[i]);
				groups[i] = group;
				group.setMainObject(items[(int)indexMap[group.MainObject]]);

				foreach (Attachment atc in group.Attachments)
				{
					atc.node = items[(int)indexMap[atc.node]] as Node;
					atc.node.putInGroup(group);
				}
				group.updateObjCol();
			}

			return new ItemsAndGroups(items, groups);
		}
Beispiel #9
0
		public bool CutToClipboard(bool copy)
		{
			if (Selection.Objects.Count == 0) return false;

			if (CopyToClipboard(copy))
			{
				// that returns the active composite if somebody has already created one
				CompositeCmd composite = UndoManager.StartComposite("_fcnet_");

				// delete selected items
				ChartObjectCollection temp = new ChartObjectCollection();
				foreach (ChartObject item in Selection.Objects)
					temp.Add(item);

				Selection.Clear();

				foreach (ChartObject item in temp)
					DeleteObject(item);

				if (composite != null && composite.Title == "_fcnet_")
				{
					// this is our own composite cmd
					composite.Title = "Cut";
					composite.Execute();
				}

				return true;
			}

			return false;
		}