Ejemplo n.º 1
0
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();

            if (drawingObjectEnum.GetSize() == 1)
            {
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Text)
                    {
                        Tekla.Structures.Drawing.Text text = (Tekla.Structures.Drawing.Text)drawingObjectEnum.Current;

                        Text.TextAttributes textAttributes = text.Attributes;
                        if (textAttributes.PreferredPlacing.ToString() == "Tekla.Structures.Drawing.PointPlacingType")
                        {
                            preferredPlacingType = PreferredPlacingEnum.PointPlacingType;
                        }
                        else if (textAttributes.PreferredPlacing.ToString() == "Tekla.Structures.Drawing.LeaderLinePlacingType")
                        {
                            preferredPlacingType = PreferredPlacingEnum.LeaderLinePlacingType;
                        }

                        textString = text.TextString.Replace("\n", "¬");

                        fontColour = text.Attributes.Font.Color;
                        fontHeight = text.Attributes.Font.Height.ToString();
                        fontName   = text.Attributes.Font.Name;
                        if (text.Attributes.Font.Bold)
                        {
                            fontBold = Bool.True;
                        }
                        else
                        {
                            fontBold = Bool.False;
                        }
                        if (text.Attributes.Font.Italic)
                        {
                            fontItalic = Bool.True;
                        }
                        else
                        {
                            fontItalic = Bool.False;
                        }
                        textAngle = text.Attributes.Angle.ToString();

                        if (text.Attributes.Alignment == Tekla.Structures.Drawing.TextAlignment.Center)
                        {
                            textAlignment = TextAlignmentEnum.Center;
                        }
                        else if (text.Attributes.Alignment == Tekla.Structures.Drawing.TextAlignment.Left)
                        {
                            textAlignment = TextAlignmentEnum.Left;
                        }
                        else if (text.Attributes.Alignment == Tekla.Structures.Drawing.TextAlignment.Right)
                        {
                            textAlignment = TextAlignmentEnum.Right;
                        }

                        if (text.Attributes.Frame.Type == FrameTypes.Circle)
                        {
                            frameType = FrameTypeEnum.Circle;
                        }
                        else if (text.Attributes.Frame.Type == FrameTypes.Diamond)
                        {
                            frameType = FrameTypeEnum.Diamond;
                        }
                        else if (text.Attributes.Frame.Type == FrameTypes.Hexagon)
                        {
                            frameType = FrameTypeEnum.Hexagon;
                        }
                        else if (text.Attributes.Frame.Type == FrameTypes.Line)
                        {
                            frameType = FrameTypeEnum.Line;
                        }
                        else if (text.Attributes.Frame.Type == FrameTypes.None)
                        {
                            frameType = FrameTypeEnum.None;
                        }
                        else if (text.Attributes.Frame.Type == FrameTypes.Rectangular)
                        {
                            frameType = FrameTypeEnum.Rectangular;
                        }
                        else if (text.Attributes.Frame.Type == FrameTypes.Round)
                        {
                            frameType = FrameTypeEnum.Round;
                        }
                        else if (text.Attributes.Frame.Type == FrameTypes.Sharpened)
                        {
                            frameType = FrameTypeEnum.Sharpened;
                        }
                        else if (text.Attributes.Frame.Type == FrameTypes.Triangle)
                        {
                            frameType = FrameTypeEnum.Triangle;
                        }

                        frameColour = text.Attributes.Frame.Color;

                        if (text.Attributes.ArrowHead.Head == ArrowheadTypes.CircleArrow)
                        {
                            arrowheadType = ArrowheadTypeEnum.CircleArrow;
                        }
                        else if (text.Attributes.ArrowHead.Head == ArrowheadTypes.FilledArrow)
                        {
                            arrowheadType = ArrowheadTypeEnum.FilledArrow;
                        }
                        else if (text.Attributes.ArrowHead.Head == ArrowheadTypes.FilledCircleArrow)
                        {
                            arrowheadType = ArrowheadTypeEnum.FilledCircleArrow;
                        }
                        else if (text.Attributes.ArrowHead.Head == ArrowheadTypes.LineArrow)
                        {
                            arrowheadType = ArrowheadTypeEnum.LineArrow;
                        }

                        if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.Both)
                        {
                            arrowheadPosition = ArrowheadPositionEnum.Both;
                        }
                        else if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.End)
                        {
                            arrowheadPosition = ArrowheadPositionEnum.End;
                        }
                        else if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.None)
                        {
                            arrowheadPosition = ArrowheadPositionEnum.None;
                        }
                        else if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.Start)
                        {
                            arrowheadPosition = ArrowheadPositionEnum.Start;
                        }

                        arrowheadWidth  = text.Attributes.ArrowHead.Width.ToString();
                        arrowheadHeight = text.Attributes.ArrowHead.Height.ToString();
                    }
                }
            }
            else if (drawingObjectEnum.GetSize() > 1)
            {
                preferredPlacingType = new PreferredPlacingEnum();
                textString           = "";
                FontColour           = new DrawingColors();
                fontHeight           = "";
                fontName             = "";
                fontBold             = new Bool();
                fontItalic           = new Bool();
                textAngle            = "";
                textAlignment        = new TextAlignmentEnum();
                frameType            = new FrameTypeEnum();
                FrameColour          = new DrawingColors();
                arrowheadType        = new ArrowheadTypeEnum();
                arrowheadPosition    = new ArrowheadPositionEnum();
                arrowheadWidth       = "";
                arrowheadHeight      = "";
            }
        }
Ejemplo n.º 2
0
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();
            if (drawingObjectEnum.GetSize() == 1)
            {
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Text)
                    {
                        Tekla.Structures.Drawing.Text text = (Tekla.Structures.Drawing.Text)drawingObjectEnum.Current;

                        Text.TextAttributes textAttributes = text.Attributes;
                        if (textAttributes.PreferredPlacing.ToString() == "Tekla.Structures.Drawing.PointPlacingType")
                            preferredPlacingType = PreferredPlacingEnum.PointPlacingType;
                        else if (textAttributes.PreferredPlacing.ToString() == "Tekla.Structures.Drawing.LeaderLinePlacingType")
                            preferredPlacingType = PreferredPlacingEnum.LeaderLinePlacingType;

                        textString = text.TextString.Replace("\n", "¬");

                        fontColour = text.Attributes.Font.Color;
                        fontHeight = text.Attributes.Font.Height.ToString();
                        fontName = text.Attributes.Font.Name;
                        if (text.Attributes.Font.Bold) fontBold = Bool.True; else fontBold = Bool.False;
                        if (text.Attributes.Font.Italic) fontItalic = Bool.True; else fontItalic = Bool.False;
                        textAngle = text.Attributes.Angle.ToString();

                        if (text.Attributes.Alignment == Tekla.Structures.Drawing.TextAlignment.Center) textAlignment = TextAlignmentEnum.Center;
                        else if (text.Attributes.Alignment == Tekla.Structures.Drawing.TextAlignment.Left) textAlignment = TextAlignmentEnum.Left;
                        else if (text.Attributes.Alignment == Tekla.Structures.Drawing.TextAlignment.Right) textAlignment = TextAlignmentEnum.Right;

                        if (text.Attributes.Frame.Type == FrameTypes.Circle) frameType = FrameTypeEnum.Circle;
                        else if (text.Attributes.Frame.Type == FrameTypes.Diamond) frameType = FrameTypeEnum.Diamond;
                        else if (text.Attributes.Frame.Type == FrameTypes.Hexagon) frameType = FrameTypeEnum.Hexagon;
                        else if (text.Attributes.Frame.Type == FrameTypes.Line) frameType = FrameTypeEnum.Line;
                        else if (text.Attributes.Frame.Type == FrameTypes.None) frameType = FrameTypeEnum.None;
                        else if (text.Attributes.Frame.Type == FrameTypes.Rectangular) frameType = FrameTypeEnum.Rectangular;
                        else if (text.Attributes.Frame.Type == FrameTypes.Round) frameType = FrameTypeEnum.Round;
                        else if (text.Attributes.Frame.Type == FrameTypes.Sharpened) frameType = FrameTypeEnum.Sharpened;
                        else if (text.Attributes.Frame.Type == FrameTypes.Triangle) frameType = FrameTypeEnum.Triangle;

                        frameColour = text.Attributes.Frame.Color;

                        if (text.Attributes.ArrowHead.Head == ArrowheadTypes.CircleArrow) arrowheadType = ArrowheadTypeEnum.CircleArrow;
                        else if (text.Attributes.ArrowHead.Head == ArrowheadTypes.FilledArrow) arrowheadType = ArrowheadTypeEnum.FilledArrow;
                        else if (text.Attributes.ArrowHead.Head == ArrowheadTypes.FilledCircleArrow) arrowheadType = ArrowheadTypeEnum.FilledCircleArrow;
                        else if (text.Attributes.ArrowHead.Head == ArrowheadTypes.LineArrow) arrowheadType = ArrowheadTypeEnum.LineArrow;

                        if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.Both) arrowheadPosition = ArrowheadPositionEnum.Both;
                        else if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.End) arrowheadPosition = ArrowheadPositionEnum.End;
                        else if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.None) arrowheadPosition = ArrowheadPositionEnum.None;
                        else if (text.Attributes.ArrowHead.ArrowPosition == ArrowheadPositions.Start) arrowheadPosition = ArrowheadPositionEnum.Start;

                        arrowheadWidth = text.Attributes.ArrowHead.Width.ToString();
                        arrowheadHeight = text.Attributes.ArrowHead.Height.ToString();
                    }
                }
            }
            else if (drawingObjectEnum.GetSize() > 1)
            {
                preferredPlacingType = new PreferredPlacingEnum();
                textString = "";
                FontColour = new DrawingColors();
                fontHeight = "";
                fontName = "";
                fontBold = new Bool();
                fontItalic = new Bool();
                textAngle = "";
                textAlignment = new TextAlignmentEnum();
                frameType = new FrameTypeEnum();
                FrameColour = new DrawingColors();
                arrowheadType = new ArrowheadTypeEnum();
                arrowheadPosition = new ArrowheadPositionEnum();
                arrowheadWidth = "";
                arrowheadHeight = "";
            }
        }