Skip to content

Commit

Permalink
improve entity default handle references
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo committed Dec 4, 2022
1 parent bf9b8f6 commit 8102b6a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/IxMilia.Dwg/Objects/DwgEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public abstract class DwgEntity : DwgObject
internal DwgHandleReference LayerHandleReference { get; set; }
public DwgLineType LineType { get; set; }
internal DwgHandleReference LineTypeHandleReference { get; set; }
internal DwgHandleReference PreviousEntityHandle { get; set; } = new DwgHandleReference(DwgHandleReferenceCode.HandleMinus1, 0);
internal DwgHandleReference NextEntityHandle { get; set; } = new DwgHandleReference(DwgHandleReferenceCode.HandlePlus1, 0);
internal DwgHandleReference PreviousEntityHandle { get; set; } = new DwgHandleReference(DwgHandleReferenceCode.HardPointer, 0);
internal DwgHandleReference NextEntityHandle { get; set; } = new DwgHandleReference(DwgHandleReferenceCode.HardPointer, 0);

internal virtual void OnBeforeEntityWrite(DwgVersionId version)
{
Expand Down Expand Up @@ -74,7 +74,12 @@ internal override void ReadCommonDataEnd(BitReader reader)
LineTypeHandleReference = reader.Read_H();
}

if (!_noLinks)
if (_noLinks)
{
PreviousEntityHandle = new DwgHandleReference(DwgHandleReferenceCode.HandleMinus1, 0);
NextEntityHandle = new DwgHandleReference(DwgHandleReferenceCode.HandlePlus1, 0);
}
else
{
PreviousEntityHandle = reader.Read_H();
NextEntityHandle = reader.Read_H();
Expand Down Expand Up @@ -187,5 +192,13 @@ internal override void OnAfterObjectRead(BitReader reader, DwgObjectCache object

OnAfterEntityRead(reader, objectCache, version);
}

internal void AssignSubentityReference(DwgHandle ownerHandle)
{
if (_entityMode == 0)
{
_subentityRef = ownerHandle.MakeHandleReference(DwgHandleReferenceCode.HardPointer);
}
}
}
}

0 comments on commit 8102b6a

Please sign in to comment.