Beispiel #1
0
 public IFCTreeData(IfcEngine engine, IntPtr model, IFCItem item, TreeView treeviewControl)
 {
     IFCEngine   = engine;
     IfcModel    = model;
     IfcRoot     = item;
     treeControl = treeviewControl;
 }
Beispiel #2
0
        private IFCItem FindIFCItem(IFCItem ifcParent, IFCTreeItem ifcTreeItem)
        {
            if (ifcParent == null)
            {
                return(null);
            }

            IFCItem ifcIterator = ifcParent;

            while (ifcIterator != null)
            {
                if (ifcIterator.ifcID == ifcTreeItem.instance)
                {
                    return(ifcIterator);
                }

                IFCItem ifcItem = FindIFCItem(ifcIterator.child, ifcTreeItem);
                if (ifcItem != null)
                {
                    return(ifcItem);
                }

                ifcIterator = ifcIterator.next;
            }

            return(FindIFCItem(ifcParent.child, ifcTreeItem));
        }
Beispiel #3
0
        private void FindNonReferencedIFCItems(IFCItem ifcParent, TreeViewItem tnNotReferenced)
        {
            if (ifcParent == null)
            {
                return;
            }

            IFCItem ifcIterator = ifcParent;

            while (ifcIterator != null)
            {
                if ((ifcIterator.ifcTreeItem == null) && (ifcIterator.ifcID != IntPtr.Zero))
                {
                    string strItemText = "'" + (string.IsNullOrEmpty(ifcIterator.name) ? "<name>" : ifcIterator.name) +
                                         "' = '" + (string.IsNullOrEmpty(ifcIterator.description) ? "<description>" : ifcIterator.description) +
                                         "' (" + (string.IsNullOrEmpty(ifcIterator.ifcType) ? ifcIterator.globalID : ifcIterator.ifcType) + ")";

                    IFCTreeItem ifcTreeItem = new IFCTreeItem();
                    ifcTreeItem.instance = ifcIterator.ifcID;
                    ifcTreeItem.treeNode = new TreeViewItem()
                    {
                        Header = strItemText
                    };
                    tnNotReferenced.Items.Add(ifcTreeItem.treeNode);
                    ifcTreeItem.ifcItem      = FindIFCItem(IfcRoot, ifcTreeItem);
                    ifcIterator.ifcTreeItem  = ifcTreeItem;
                    ifcTreeItem.treeNode.Tag = ifcTreeItem;

                    if (ifcTreeItem.ifcItem != null)
                    {
                        ifcTreeItem.ifcItem.ifcTreeItem = ifcTreeItem;
                    }
                }

                FindNonReferencedIFCItems(ifcIterator.child, tnNotReferenced);

                ifcIterator = ifcIterator.next;
            }

            FindNonReferencedIFCItems(ifcParent.child, tnNotReferenced);
        }
Beispiel #4
0
        public void CreateItem(IFCItem parent, IntPtr ifcID, string ifcType, string globalID, string name, string desc)
        {
            this.parent      = parent;
            this.next        = null;
            this.child       = null;
            this.globalID    = globalID;
            this.ifcID       = ifcID;
            this.ifcType     = ifcType;
            this.description = desc;
            this.name        = name;

            if (parent != null)
            {
                if (parent.child == null)
                {
                    parent.child = this;
                }
                else
                {
                    IFCItem NextChild = parent;

                    while (true)
                    {
                        if (NextChild.next == null)
                        {
                            NextChild.next = this;
                            break;
                        }
                        else
                        {
                            NextChild = NextChild.next;
                        }
                    }
                }
            }
        }