Esempio n. 1
0
        private static DxfHandle AssignHandles(IDxfItemInternal item, DxfHandle nextHandle, DxfHandle ownerHandle, HashSet <IDxfItemInternal> visitedItems)
        {
            if (item == null || !visitedItems.Add(item))
            {
                return(nextHandle);
            }

            Debug.Assert(item.Handle.Value == 0);
            item.Handle = new DxfHandle(nextHandle.Value);
            nextHandle  = new DxfHandle(nextHandle.Value + 1);
            if (item.OwnerHandle.Value == 0 && ownerHandle.Value != 0)
            {
                item.OwnerHandle = ownerHandle;
            }

            foreach (var child in item.GetPointers().Where(c => c.Item != null))
            {
                var childItem    = (IDxfItemInternal)child.Item;
                var parentHandle = GetParentHandle(item, childItem);
                nextHandle            = AssignHandles(childItem, nextHandle, parentHandle, visitedItems);
                child.Handle          = childItem.Handle;
                childItem.OwnerHandle = parentHandle;
            }

            return(nextHandle);
        }
Esempio n. 2
0
        public static DxfHandle AssignHandles(DxfFile file)
        {
            var visitedItems = new HashSet <IDxfItemInternal>();

            foreach (var item in file.GetFileItems())
            {
                ClearPointers(item, visitedItems);
            }

            visitedItems.Clear();

            var nextPointer = new DxfHandle(1);

            foreach (var item in file.GetFileItems().Where(i => i != null))
            {
                nextPointer = AssignHandles(item, nextPointer, default(DxfHandle), visitedItems);
                foreach (var child in item.GetChildItems().Where(c => c != null))
                {
                    var parentHandle = GetParentHandle(item, child);
                    nextPointer = AssignHandles(child, nextPointer, parentHandle, visitedItems);
                    SetOwner(child, item, isWriting: true);
                }
            }

            return(nextPointer);
        }
Esempio n. 3
0
 public static string HandleString(DxfHandle handle)
 {
     return(handle.ToString());
 }
Esempio n. 4
0
 public static DxfHandle HandleString(string s)
 {
     DxfHandle.TryParse(s, out var result);
     return(result);
 }
Esempio n. 5
0
 private static string HandleString(DxfHandle handle)
 {
     return(DxfCommonConverters.HandleString(handle));
 }
Esempio n. 6
0
 protected static string HandleString(DxfHandle handle)
 {
     return(DxfCommonConverters.HandleString(handle));
 }
Esempio n. 7
0
 public DxfPointer(DxfHandle handle, IDxfItem item)
 {
     Handle = handle;
     Item   = item;
 }
Esempio n. 8
0
 public DxfPointer(DxfHandle handle)
     : this(handle, null)
 {
 }