Skip to content

Commit

Permalink
MultiLeader as object
Browse files Browse the repository at this point in the history
  • Loading branch information
DomCR committed Jan 29, 2024
1 parent 7261930 commit f25125d
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 76 deletions.
9 changes: 0 additions & 9 deletions ACadSharp/AttachmentType.cs

This file was deleted.

8 changes: 8 additions & 0 deletions ACadSharp/Entities/AttachmentType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ACadSharp.Entities
{
public enum AttachmentType : short
{
CenterExtents = 0,
InsertionPoint = 1
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System;
using ACadSharp.Objects;

using ACadSharp.Entities;
using ACadSharp.Tables;

namespace ACadSharp {

namespace ACadSharp.Entities
{
[Flags]
public enum MultiLeaderPropertyOverrideFlags : int {

public enum MultiLeaderPropertyOverrideFlags : int
{
/// <summary>
/// No Flag: No property to be overridden
/// </summary>
Expand Down
7 changes: 0 additions & 7 deletions ACadSharp/FlowDirectionType.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private void writeObject(CadObject obj)
{
switch (obj)
{
case MultiLeaderStyle:
case SortEntitiesTable:
case XRecord:
this.notify($"Object type not implemented {obj.GetType().FullName}", NotificationType.NotImplemented);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using ACadSharp.Entities;
using ACadSharp.Objects;
using ACadSharp.Tables;
using System;
using System.Linq;

Expand Down
34 changes: 18 additions & 16 deletions ACadSharp/IO/Templates/CadMLeaderStyleTemplate.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
using ACadSharp.Tables;
using ACadSharp.Objects;
using ACadSharp.Tables;

namespace ACadSharp.IO.Templates {
internal class CadMLeaderStyleTemplate : CadTableEntryTemplate<MultiLeaderStyle>
{
namespace ACadSharp.IO.Templates
{
internal class CadMLeaderStyleTemplate : CadTemplate<MultiLeaderStyle>
{
public CadMLeaderStyleTemplate(MultiLeaderStyle entry) : base(entry) { }

public ulong LeaderLineTypeHandle { get; internal set; }

public ulong ArrowheadHandle { get; internal set; }

public ulong MTextStyleHandle { get; internal set; }

public ulong BlockContentHandle { get; internal set; }

public override void Build(CadDocumentBuilder builder) {

if (builder.TryGetCadObject<CadObject>(this.OwnerHandle, out CadObject cadObject))
{
public ulong MTextStyleHandle { get; internal set; }

}
public ulong BlockContentHandle { get; internal set; }

public override void Build(CadDocumentBuilder builder)
{
base.Build(builder);

if (builder.TryGetCadObject(this.LeaderLineTypeHandle, out LineType lineType)) {
if (builder.TryGetCadObject(this.LeaderLineTypeHandle, out LineType lineType))
{
this.CadObject.LeaderLineType = lineType;
}

//if (builder.TryGetCadObject(this.ArrowheadHandle, out Arr arrowhead)) {
// this.CadObject.Arrowhead = arrowhead;
//}
if (builder.TryGetCadObject(this.MTextStyleHandle, out TextStyle textStyle)) {
if (builder.TryGetCadObject(this.MTextStyleHandle, out TextStyle textStyle))
{
this.CadObject.TextStyle = textStyle;
}
if (builder.TryGetCadObject(this.BlockContentHandle, out BlockRecord blockContent)) {

if (builder.TryGetCadObject(this.BlockContentHandle, out BlockRecord blockContent))
{
this.CadObject.BlockContent = blockContent;
}
}
Expand Down
9 changes: 9 additions & 0 deletions ACadSharp/Objects/FlowDirectionType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace ACadSharp.Objects
{
public enum FlowDirectionType : short
{
Horizontal = 1,
Vertical = 3,
ByStyle = 6,
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace ACadSharp {

public enum LeaderContentType : short {

namespace ACadSharp.Objects
{
public enum LeaderContentType : short
{
/// <summary>
/// None
/// </summary>
Expand All @@ -20,6 +20,6 @@ public enum LeaderContentType : short {
/// <summary>
/// Leader content is provided by a TOLERANCE entity
/// </summary>
Tolerance = 3
Tolerance = 3
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
namespace ACadSharp.Tables {
namespace ACadSharp.Objects
{

/// <summary>
/// Specifies the draw order of a <see cref="Objects.MultiLeaderAnnotContext.LeaderRoot"/>
/// Specifies the draw order of a <see cref="MultiLeaderAnnotContext.LeaderRoot"/>
/// in a <see cref="Entities.MultiLeader"/> entity.
/// </summary>
public enum LeaderDrawOrderType {
public enum LeaderDrawOrderType
{

/// <summary>
/// 0 = draw leader head first
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
using System;

using ACadSharp.Entities;
using ACadSharp.Tables;

namespace ACadSharp {

namespace ACadSharp.Objects
{
[Flags]
public enum LeaderLinePropertOverrideFlags : Int32 {
public enum LeaderLinePropertOverrideFlags : int
{

/// <summary>
/// No property to be overridden
/// </summary>
None = 0,

/// <summary>
/// <see cref="P:MultiLeaderAnnotContext.LeaderLine.PathType" /> property
/// <see cref="MultiLeaderAnnotContext.LeaderLine.PathType" /> property
/// overrides settings from <see cref="MultiLeader"/> and <see cref="MultiLeaderStyle"/>.
/// </summary>
PathType = 1,

/// <summary>
/// <see cref="P:MultiLeaderAnnotContext.LeaderLine.LineColor" /> property
/// <see cref="MultiLeaderAnnotContext.LeaderLine.LineColor" /> property
/// overrides settings from <see cref="MultiLeader"/> and <see cref="MultiLeaderStyle"/>.
/// </summary>
LineColor = 2,

/// <summary>
/// <see cref="P:MultiLeaderAnnotContext.LeaderLine.LineType"/> property
/// <see cref="MultiLeaderAnnotContext.LeaderLine.LineType"/> property
/// overrides settings from <see cref="MultiLeader"/> and <see cref="MultiLeaderStyle"/>.
/// </summary>
LineType = 4,

/// <summary>
/// <see cref="P:MultiLeaderAnnotContext.LeaderLine.LineWeight" /> property
/// <see cref="MultiLeaderAnnotContext.LeaderLine.LineWeight" /> property
/// overrides settings from <see cref="MultiLeader"/> and <see cref="MultiLeaderStyle"/>.
/// </summary>
LineWeight = 8,

/// <summary>
/// <see cref="P:MultiLeaderAnnotContext.LeaderLine.ArrowSize" /> property
/// <see cref="MultiLeaderAnnotContext.LeaderLine.ArrowheadSize" /> property
/// overrides settings from <see cref="MultiLeader"/> and <see cref="MultiLeaderStyle"/>.
/// </summary>
ArrowheadSize = 16,

/// <summary>
/// <see cref="P:MultiLeaderAnnotContext.LeaderLine.ArrowSymbol" /> property
/// <see cref="MultiLeaderAnnotContext.Lines" /> property
/// overrides settings from <see cref="MultiLeader"/> and <see cref="MultiLeaderStyle"/>.
/// </summary>
Arrowhead = 32,
Expand Down
1 change: 1 addition & 0 deletions ACadSharp/Objects/MultiLeaderAnnotContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;

using ACadSharp.Attributes;
using ACadSharp.Entities;
using ACadSharp.Tables;

using CSMath;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace ACadSharp.Tables {

namespace ACadSharp.Objects
{
/// <summary>
/// Specifies the draw order of a <see cref="Entities.MultiLeader"/> entity.
/// </summary>
public enum MultiLeaderDrawOrderType {

public enum MultiLeaderDrawOrderType
{
/// <summary>
/// 0 = draw content first,
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using ACadSharp.Attributes;
using ACadSharp.Entities;

using ACadSharp.Tables;
using CSMath;


namespace ACadSharp.Tables
namespace ACadSharp.Objects
{
/// <summary>
/// Represents a <see cref="MultiLeaderStyle"/> table entry.
Expand All @@ -15,7 +14,7 @@ namespace ACadSharp.Tables
/// </remarks>
[DxfName(DxfFileToken.EntityMLeaderStyle)]
[DxfSubClass(DxfSubclassMarker.MLeaderStyle)]
public class MultiLeaderStyle : TableEntry
public class MultiLeaderStyle : CadObject
{
/// <inheritdoc/>
public override ObjectType ObjectType => ObjectType.UNLISTED;
Expand All @@ -26,6 +25,11 @@ public class MultiLeaderStyle : TableEntry
/// <inheritdoc/>
public override string SubclassMarker => DxfSubclassMarker.MLeaderStyle;

/// <summary>
/// Style name
/// </summary>
public string Name { get; set; }

/// <summary>
/// Content Type
/// </summary>
Expand Down Expand Up @@ -77,7 +81,7 @@ public class MultiLeaderStyle : TableEntry
/// <summary>
/// LeaderLineType ID
/// </summary>
[DxfCodeValue(340)]
[DxfCodeValue(DxfReferenceType.Handle, 340)]
public LineType LeaderLineType { get; set; }

/// <summary>
Expand Down Expand Up @@ -119,7 +123,7 @@ public class MultiLeaderStyle : TableEntry
/// <summary>
/// Arrowhead ID is Block?
/// </summary>
[DxfCodeValue(341)]
[DxfCodeValue(DxfReferenceType.Handle, 341)]
public BlockRecord Arrowhead { get; set; }

/// <summary>
Expand All @@ -137,7 +141,7 @@ public class MultiLeaderStyle : TableEntry
/// <summary>
/// mTextStyleId
/// </summary>
[DxfCodeValue(342)]
[DxfCodeValue(DxfReferenceType.Handle, 342)]
public TextStyle TextStyle { get; set; }

/// <summary>
Expand Down Expand Up @@ -197,7 +201,7 @@ public class MultiLeaderStyle : TableEntry
/// <summary>
/// Block Content ID
/// </summary>
[DxfCodeValue(343)]
[DxfCodeValue(DxfReferenceType.Handle, 343)]
public BlockRecord BlockContent { get; set; }

/// <summary>
Expand All @@ -210,7 +214,7 @@ public class MultiLeaderStyle : TableEntry
/// Block Content Scale
/// </summary>
[DxfCodeValue(47, 49, 140)]
public XYZ BlockContentScale { get; set; }
public XYZ BlockContentScale { get; set; } //TODO: Change to 3 doubles values to better support the Dxf reading

/// <summary>
/// Enable Block Content Scale
Expand Down Expand Up @@ -297,17 +301,16 @@ public class MultiLeaderStyle : TableEntry
/// <summary>
/// Default constructor
/// </summary>
public MultiLeaderStyle() : base() { }
public MultiLeaderStyle() : this(string.Empty) { }

public MultiLeaderStyle(string name) : this()
public MultiLeaderStyle(string name) : base()
{
Name = name;
this.Name = name;
}

public override CadObject Clone()
{
MultiLeaderStyle clone = (MultiLeaderStyle)base.Clone();

return clone;
}
}
Expand Down

0 comments on commit f25125d

Please sign in to comment.