private static MLeader CreateMLeader(
Point3d mLeaderArrowPoint,
Point3d mLeaderPosition,
ObjectId mLeaderTextStyleId,
Vector3d mLeaderTextDoglegDirection,
double mLeaderTextHeight,
LineWeight mLeaderLineWeight,
ObjectId mLeaderLayerId,
Color mLeaderColor,
LineWeight mLeaderTextLineWeight,
string mLeaderTextContent,
double mLeaderTextRotation,
bool useTextMask,
TextAlignmentType mLeaderTextAlignment,
Color mLeaderTextColor)
{
var leader = new MLeader();
leader.SetDatabaseDefaults();
var i = leader.AddLeader();
leader.AddLeaderLine(i);
leader.AddFirstVertex(i, mLeaderArrowPoint);
leader.AddLastVertex(i, mLeaderPosition);
leader.SetTextAttachmentType(
TextAttachmentType.AttachmentBottomOfTopLine,
LeaderDirectionType.LeftLeader);
leader.SetTextAttachmentType(
TextAttachmentType.AttachmentBottomOfTopLine,
LeaderDirectionType.RightLeader);
leader.ContentType = ContentType.MTextContent;
leader.TextStyleId = mLeaderTextStyleId;
leader.EnableDogleg = true;
leader.EnableLanding = true;
leader.SetDogleg(i, mLeaderTextDoglegDirection);
leader.DoglegLength = 0.05 * mLeaderTextHeight;
leader.LineWeight = mLeaderLineWeight;
leader.LayerId = mLeaderLayerId;
leader.Color = mLeaderColor;
using (var mText = new MText())
{
mText.TextStyleId = mLeaderTextStyleId;
mText.LineWeight = mLeaderTextLineWeight;
mText.Contents = mLeaderTextContent;
mText.TextHeight = mLeaderTextHeight;
mText.Rotation = mLeaderTextRotation;
mText.LineSpacingFactor = 0.9;
mText.Color = mLeaderTextColor;
if (useTextMask)
{
mText.BackgroundFill = true;
mText.BackgroundScaleFactor = 1.1;
mText.UseBackgroundColor = true;
}
else
{
mText.BackgroundFill = false;
}
leader.MText = mText;
}
// Выравнивание работает только
// после присваивания выноске текста
leader.TextAlignmentType = mLeaderTextAlignment;
leader.ArrowSymbolId = ObjectId.Null;
leader.SetArrowSize(i, 0.0);
leader.SetArrowSymbolId(i, ObjectId.Null);
return leader;
}