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); }
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); }
public static string HandleString(DxfHandle handle) { return(handle.ToString()); }
public static DxfHandle HandleString(string s) { DxfHandle.TryParse(s, out var result); return(result); }
private static string HandleString(DxfHandle handle) { return(DxfCommonConverters.HandleString(handle)); }
protected static string HandleString(DxfHandle handle) { return(DxfCommonConverters.HandleString(handle)); }
public DxfPointer(DxfHandle handle, IDxfItem item) { Handle = handle; Item = item; }
public DxfPointer(DxfHandle handle) : this(handle, null) { }