Exemple #1
0
        internal DxfLayerRecord(string layerName, int colorNumber, LineTypeEnum lineTypeName, int lineWeight)
        {
            layerName.Trim();
            layerName.Replace(" ", "_");
            this.LayerName = layerName;

            this.lineTypeName = lineTypeName.ToString();

            if (colorNumber < 1)
            {
                colorNumber = 3;
            }
            if (colorNumber > 248)
            {
                colorNumber = 3;
            }
            this.colorNumber = colorNumber.ToString();

            if (lineWeight < 5)
            {
                lineWeight = 5;
            }
            if (lineWeight > 80)
            {
                lineWeight = 80;
            }
            this.lineWeight = lineWeight.ToString();
        }
        protected Tuple <LineTypeEnum, string> ReturnParse(
            LineTypeEnum lineType, string parsedString)
        {
            _logger.Info("Parsed as line type: " + lineType);
            _logger.Info("Returned content: '" + parsedString + "'");
            _logger.CloseSection(_location);

            return(new Tuple <LineTypeEnum, string>(lineType, parsedString));
        }
Exemple #3
0
        protected override Tuple <LineTypeEnum, string> ParseLine(string line, LineTypeEnum lastLineType = LineTypeEnum.Nothing)
        {
            _location = this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name;
            _logger.OpenSection(_location);

            _logger.Info("Parsing line '" + line + "'...");

            if (line.Length == 0)
            {
                return(ReturnParse(LineTypeEnum.Nothing, null));
            }

            var firstCharacter = line.Substring(0, 1);

            if (firstCharacter == "#")
            {
                return(ReturnParse(LineTypeEnum.Comment, null));
            }

            if (firstCharacter == ":")
            {
                var contentStart = line.IndexOf("=");
                if (contentStart > -1)
                {
                    var content = line.Substring(contentStart + 1);
                    if (line.IndexOf(":WordStyle=", StringComparison.InvariantCultureIgnoreCase) == 0)
                    {
                        return(ReturnParse(LineTypeEnum.Comment, content));
                    }
                }
            }

            if (line.Contains("【") && line.Contains("】"))
            {
                return(ReturnParse(LineTypeEnum.JwpceWord, line));
            }

            if (line.Contains("「") && line.Contains("」") && lastLineType != LineTypeEnum.Quote)
            {
                return(ReturnParse(LineTypeEnum.Quote, line));
            }

            if (lastLineType != LineTypeEnum.Source)
            {
                return(ReturnParse(LineTypeEnum.Source, line));
            }

            var ex = new Exception("Could not parse line: '" + line + "'");

            _logger.Error(ex);
            throw ex;
        }
Exemple #4
0
        internal DxfLinetypeRecord(LineTypeEnum dxfLineType)
        {
            switch (dxfLineType)
            {
            case LineTypeEnum.CONTINUOUS:
                InitContinuous();
                break;

            case LineTypeEnum.DASH:
                InitDash();
                break;
            }
        }
        protected override Tuple <LineTypeEnum, string> ParseLine(string line, LineTypeEnum lastLineType = LineTypeEnum.Nothing)
        {
            _location = this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name;
            _logger.OpenSection(_location);

            _logger.Info("Parsing line '" + line + "'...");

            if (line.Length == 0)
            {
                return(ReturnParse(LineTypeEnum.Nothing, null));
            }

            var firstCharacter = line.Substring(0, 1);

            if (firstCharacter == "#")
            {
                return(ReturnParse(LineTypeEnum.Comment, null));
            }

            if (firstCharacter == ":")
            {
                var contentStart = line.IndexOf("=");
                if (contentStart > -1)
                {
                    var content = line.Substring(contentStart + 1);

                    if (line.IndexOf(":src=", StringComparison.InvariantCultureIgnoreCase) == 0)
                    {
                        return(ReturnParse(LineTypeEnum.Source, content));
                    }

                    if (line.IndexOf(":WordStyle=", StringComparison.InvariantCultureIgnoreCase) == 0)
                    {
                        return(ReturnParse(LineTypeEnum.Comment, content));
                    }

                    if (line.IndexOf(":cat=", StringComparison.InvariantCultureIgnoreCase) == 0)
                    {
                        return(ReturnParse(LineTypeEnum.Comment, content));
                    }

                    if (line.IndexOf(":subcat=", StringComparison.InvariantCultureIgnoreCase) == 0)
                    {
                        return(ReturnParse(LineTypeEnum.Comment, content));
                    }
                }
            }

            if (line.Contains("「") && line.Contains("」"))
            {
                return(ReturnParse(LineTypeEnum.Quote, line));
            }

            if (lastLineType == LineTypeEnum.Quote || lastLineType == LineTypeEnum.Translation)
            {
                return(ReturnParse(LineTypeEnum.Kanji, line));
            }

            if (lastLineType == LineTypeEnum.Kanji)
            {
                if (LineContainsKana(line))
                {
                    return(ReturnParse(LineTypeEnum.Kana, line));
                }

                // for when a word isn't kanji-kana-romaji-translation, but only kana and translation
                // e.g. "うだうだ \r\n idle, long-winded and meaningless"
                if (LineContainsAlphabetLetters(line))
                {
                    return(ReturnParse(LineTypeEnum.Translation, line));
                }

                var exInner = new Exception("Could not parse line: '" + line + "'");
                _logger.Error(exInner);
                throw exInner;
            }



            if (lastLineType == LineTypeEnum.Kana)
            {
                return(ReturnParse(LineTypeEnum.Romaji, line));
            }

            if (lastLineType == LineTypeEnum.Romaji)
            {
                return(ReturnParse(LineTypeEnum.Translation, line));
            }

            var ex = new Exception("Could not parse line: '" + line + "'");

            _logger.Error(ex);
            throw ex;
        }
Exemple #6
0
 internal DxfLineType(LineTypeEnum typeEnum)
 {
     this.LineTypeEnum = typeEnum;
 }
Exemple #7
0
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();

            if (drawingObjectEnum.GetSize() == 1)
            {
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.GridLine)
                    {
                        Tekla.Structures.Drawing.GridLine grid = (Tekla.Structures.Drawing.GridLine)drawingObjectEnum.Current;
                        if (grid.Attributes.DrawOnlyTextLabelsNotGridLines)
                        {
                            drawOnlyTextLabelsNotGridLines = Bool.True;
                        }
                        else
                        {
                            drawOnlyTextLabelsNotGridLines = Bool.False;
                        }

                        if (grid.Attributes.DrawTextAtEndOfGridLine)
                        {
                            drawTextAtEndOfGridLine = Bool.True;
                        }
                        else
                        {
                            drawTextAtEndOfGridLine = Bool.False;
                        }

                        if (grid.Attributes.DrawTextAtStartOfGridLine)
                        {
                            drawTextAtStartOfGridLine = Bool.True;
                        }
                        else
                        {
                            drawTextAtStartOfGridLine = Bool.False;
                        }

                        if (grid.Attributes.Font.Bold)
                        {
                            fontBold = Bool.True;
                        }
                        else
                        {
                            fontBold = Bool.False;
                        }

                        fontColour = grid.Attributes.Font.Color;
                        fontHeight = grid.Attributes.Font.Height.ToString();

                        if (grid.Attributes.Font.Italic)
                        {
                            fontItalic = Bool.True;
                        }
                        else
                        {
                            fontItalic = Bool.False;
                        }

                        fontName    = grid.Attributes.Font.Name;
                        frameColour = grid.Attributes.Frame.Color;
                        if (grid.Attributes.Frame.Type == FrameTypes.Circle)
                        {
                            frameType = FrameTypeEnum.Circle;
                        }
                        else if (grid.Attributes.Frame.Type == FrameTypes.Diamond)
                        {
                            frameType = FrameTypeEnum.Diamond;
                        }
                        else if (grid.Attributes.Frame.Type == FrameTypes.Hexagon)
                        {
                            frameType = FrameTypeEnum.Hexagon;
                        }
                        else if (grid.Attributes.Frame.Type == FrameTypes.Line)
                        {
                            frameType = FrameTypeEnum.Line;
                        }
                        else if (grid.Attributes.Frame.Type == FrameTypes.None)
                        {
                            frameType = FrameTypeEnum.None;
                        }
                        else if (grid.Attributes.Frame.Type == FrameTypes.Rectangular)
                        {
                            frameType = FrameTypeEnum.Rectangular;
                        }
                        else if (grid.Attributes.Frame.Type == FrameTypes.Round)
                        {
                            frameType = FrameTypeEnum.Round;
                        }
                        else if (grid.Attributes.Frame.Type == FrameTypes.Sharpened)
                        {
                            frameType = FrameTypeEnum.Sharpened;
                        }
                        else if (grid.Attributes.Frame.Type == FrameTypes.Triangle)
                        {
                            frameType = FrameTypeEnum.Triangle;
                        }
                        lineColour = grid.Attributes.Line.Color;

                        if (grid.Attributes.Line.Type == LineTypes.DashDot)
                        {
                            lineType = LineTypeEnum.DashDot;
                        }
                        else if (grid.Attributes.Line.Type == LineTypes.DashDoubleDot)
                        {
                            lineType = LineTypeEnum.DashDoubleDot;
                        }
                        else if (grid.Attributes.Line.Type == LineTypes.DashedLine)
                        {
                            lineType = LineTypeEnum.DashedLine;
                        }
                        else if (grid.Attributes.Line.Type == LineTypes.DottedLine)
                        {
                            lineType = LineTypeEnum.DottedLine;
                        }
                        else if (grid.Attributes.Line.Type == LineTypes.SlashDash)
                        {
                            lineType = LineTypeEnum.SlashDash;
                        }
                        else if (grid.Attributes.Line.Type == LineTypes.SlashedLine)
                        {
                            lineType = LineTypeEnum.SlashedLine;
                        }
                        else if (grid.Attributes.Line.Type == LineTypes.SolidLine)
                        {
                            lineType = LineTypeEnum.SolidLine;
                        }
                        else if (grid.Attributes.Line.Type == LineTypes.UndefinedLine)
                        {
                            lineType = LineTypeEnum.UndefinedLine;
                        }

                        offsetAtEndOfLine   = grid.Attributes.OffsetAtEndOfLine.ToString();
                        offsetAtStartOfLine = grid.Attributes.OffsetAtStartOfLine.ToString();
                        gridLabelText       = grid.EndLabel.GridLabelText;
                    }
                }
            }
            if (drawingObjectEnum.GetSize() > 1)
            {
                drawOnlyTextLabelsNotGridLines = new Bool();
                drawTextAtEndOfGridLine        = new Bool();
                drawTextAtStartOfGridLine      = new Bool();
                fontColour          = new DrawingColors();
                fontHeight          = "";
                fontBold            = new Bool();
                fontItalic          = new Bool();
                fontName            = "";
                frameColour         = new DrawingColors();
                frameType           = new FrameTypeEnum();
                lineColour          = new DrawingColors();
                lineType            = new LineTypeEnum();
                offsetAtEndOfLine   = "";
                offsetAtStartOfLine = "";
                gridLabelText       = "";
            }
        }
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();
            if (drawingObjectEnum.GetSize() == 1)
            {
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.GridLine)
                    {
                        Tekla.Structures.Drawing.GridLine grid = (Tekla.Structures.Drawing.GridLine)drawingObjectEnum.Current;
                        if (grid.Attributes.DrawOnlyTextLabelsNotGridLines) drawOnlyTextLabelsNotGridLines = Bool.True;
                        else drawOnlyTextLabelsNotGridLines = Bool.False;

                        if (grid.Attributes.DrawTextAtEndOfGridLine) drawTextAtEndOfGridLine = Bool.True;
                        else drawTextAtEndOfGridLine = Bool.False;

                        if (grid.Attributes.DrawTextAtStartOfGridLine) drawTextAtStartOfGridLine = Bool.True;
                        else drawTextAtStartOfGridLine = Bool.False;

                        if (grid.Attributes.Font.Bold) fontBold = Bool.True; else fontBold = Bool.False;

                        fontColour = grid.Attributes.Font.Color;
                        fontHeight = grid.Attributes.Font.Height.ToString();

                        if (grid.Attributes.Font.Italic) fontItalic = Bool.True; else fontItalic = Bool.False;

                        fontName = grid.Attributes.Font.Name;
                        frameColour = grid.Attributes.Frame.Color;
                        if (grid.Attributes.Frame.Type == FrameTypes.Circle) frameType = FrameTypeEnum.Circle;
                        else if (grid.Attributes.Frame.Type == FrameTypes.Diamond) frameType = FrameTypeEnum.Diamond;
                        else if (grid.Attributes.Frame.Type == FrameTypes.Hexagon) frameType = FrameTypeEnum.Hexagon;
                        else if (grid.Attributes.Frame.Type == FrameTypes.Line) frameType = FrameTypeEnum.Line;
                        else if (grid.Attributes.Frame.Type == FrameTypes.None) frameType = FrameTypeEnum.None;
                        else if (grid.Attributes.Frame.Type == FrameTypes.Rectangular) frameType = FrameTypeEnum.Rectangular;
                        else if (grid.Attributes.Frame.Type == FrameTypes.Round) frameType = FrameTypeEnum.Round;
                        else if (grid.Attributes.Frame.Type == FrameTypes.Sharpened) frameType = FrameTypeEnum.Sharpened;
                        else if (grid.Attributes.Frame.Type == FrameTypes.Triangle) frameType = FrameTypeEnum.Triangle;
                        lineColour = grid.Attributes.Line.Color;

                        if (grid.Attributes.Line.Type == LineTypes.DashDot) lineType = LineTypeEnum.DashDot;
                        else if (grid.Attributes.Line.Type == LineTypes.DashDoubleDot) lineType = LineTypeEnum.DashDoubleDot;
                        else if (grid.Attributes.Line.Type == LineTypes.DashedLine) lineType = LineTypeEnum.DashedLine;
                        else if (grid.Attributes.Line.Type == LineTypes.DottedLine) lineType = LineTypeEnum.DottedLine;
                        else if (grid.Attributes.Line.Type == LineTypes.SlashDash) lineType = LineTypeEnum.SlashDash;
                        else if (grid.Attributes.Line.Type == LineTypes.SlashedLine) lineType = LineTypeEnum.SlashedLine;
                        else if (grid.Attributes.Line.Type == LineTypes.SolidLine) lineType = LineTypeEnum.SolidLine;
                        else if (grid.Attributes.Line.Type == LineTypes.UndefinedLine) lineType = LineTypeEnum.UndefinedLine;

                        offsetAtEndOfLine = grid.Attributes.OffsetAtEndOfLine.ToString();
                        offsetAtStartOfLine = grid.Attributes.OffsetAtStartOfLine.ToString();
                        gridLabelText = grid.EndLabel.GridLabelText;
                    }
                }
            }
            if (drawingObjectEnum.GetSize() > 1)
            {
                drawOnlyTextLabelsNotGridLines = new Bool();
                drawTextAtEndOfGridLine = new Bool();
                drawTextAtStartOfGridLine = new Bool();
                fontColour = new DrawingColors();
                fontHeight = "";
                fontBold = new Bool();
                fontItalic = new Bool();
                fontName = "";
                frameColour = new DrawingColors();
                frameType = new FrameTypeEnum();
                lineColour = new DrawingColors();
                lineType = new LineTypeEnum();
                offsetAtEndOfLine = "";
                offsetAtStartOfLine = "";
                gridLabelText = "";
            }
        }
Exemple #9
0
        /// <summary>
        /// default Constructor
        /// </summary>
        public AxisLine(LineTypeEnum lineType, DimensionEnum dimension, LineOrderEnum lineOrder,
                        Color lineColor, double strokeThickness, FrameworkElement testFrameworkElement)
        {
            LineType  = lineType;
            Dimension = dimension;
            LineOrder = lineOrder;
            this.testFrameworkElement = testFrameworkElement;
            testControl = (testFrameworkElement as Control) !;
            DependencyObject vparent  = VisualTreeHelper.GetParent(testFrameworkElement);
            DependencyObject vgparent = VisualTreeHelper.GetParent(vparent);

            hostGrid = (vgparent as Grid) !;
            if (hostGrid == null)
            {
                throw new NotSupportedException("TestFrameworkElement must be placed directly in a Grid.");
            }
            hostGridRow    = Grid.GetColumn(testFrameworkElement);
            hostGirdColumn = Grid.GetRow(testFrameworkElement);

            ThisLine = new Line {
                StrokeThickness = strokeThickness
            };
            if (dimension == DimensionEnum.width)
            {
                ThisLine.VerticalAlignment = VerticalAlignment.Stretch;
            }
            else /* height*/
            {
                ThisLine.HorizontalAlignment = HorizontalAlignment.Stretch;
            }
            GradientStopCollection gradientStopCollection = new GradientStopCollection(4);

            if (lineOrder == LineOrderEnum.first)
            {
                gradientStopCollection.Add(new GradientStop(lineColor, 0));
                gradientStopCollection.Add(new GradientStop(lineColor, 0.5));
                gradientStopCollection.Add(new GradientStop(Colors.Transparent, 0.5));
                gradientStopCollection.Add(new GradientStop(Colors.Transparent, 1));
            }
            else
            {
                gradientStopCollection.Add(new GradientStop(Colors.Transparent, 0));
                gradientStopCollection.Add(new GradientStop(Colors.Transparent, 0.5));
                gradientStopCollection.Add(new GradientStop(lineColor, 0.5));
                gradientStopCollection.Add(new GradientStop(lineColor, 1));
            }
            LinearGradientBrush brush;

            if (dimension == DimensionEnum.width)
            {
                brush = new LinearGradientBrush(gradientStopCollection, 0);
            }
            else
            {
                brush = new LinearGradientBrush(gradientStopCollection, 90);
            }
            brush.Opacity = 0.4;
            brush.Freeze();
            ThisLine.Stroke = brush;

            ThisLine.StrokeThickness = strokeThickness;
            int[] strokeDashes;
            if (testControl == null)
            {
                if (lineType != LineTypeEnum.margin)
                {
                    throw new Exception("lineType '' only support for FrameworkElements inheriting from Control.");
                }
                strokeDashes = singlelineStrokeDashes;
            }
            else
            {
                strokeDashes = multilineStrokeDashes[(int)lineType];
            }
            ThisLine.StrokeDashArray = new DoubleCollection();
            foreach (double strokeDash in strokeDashes)
            {
                ThisLine.StrokeDashArray.Add(strokeDash);
            }

            if (dimension == DimensionEnum.width)
            {
                ThisLine.Y2     = SystemParameters.VirtualScreenHeight;
                ThisLine.X1     = strokeThickness / 2;
                ThisLine.X2     = strokeThickness / 2;
                ThisLine.Cursor = Cursors.ScrollWE;
                if (lineOrder == LineOrderEnum.first)
                {
                    LineName = "Left";
                }
                else
                {
                    LineName = "Right";
                }
            }
            else
            {
                ThisLine.X2     = SystemParameters.VirtualScreenWidth;
                ThisLine.Y1     = strokeThickness / 2;
                ThisLine.Y2     = strokeThickness / 2;
                ThisLine.Cursor = Cursors.ScrollNS;
                if (lineOrder == LineOrderEnum.first)
                {
                    LineName = "Top";
                }
                else
                {
                    LineName = "Bottom";
                }
            }

            switch (LineType)
            {
            case LineTypeEnum.margin: changeThicknessProperty = FrameworkElement.MarginProperty; LineName += "Margin"; break;

            case LineTypeEnum.border: changeThicknessProperty = Control.BorderThicknessProperty; LineName += "Border"; break;

            case LineTypeEnum.padding: changeThicknessProperty = Control.PaddingProperty; LineName += "Padding"; break;

            default: throw new Exception("LineType '" + LineType + "' not supported");
            }

            hostGrid.Children.Add(ThisLine);
            Grid.SetRow(ThisLine, hostGridRow);
            Grid.SetColumn(ThisLine, hostGirdColumn);
            ThisLine.MouseDown += mouseDown;
            ThisLine.MouseMove += mouseMove;
            ThisLine.MouseUp   += mouseUp;
        }
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();

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

                        if (drawingPart.Attributes.DrawCenterLine)
                        {
                            drawCenterLine = Bool.True;
                        }
                        else
                        {
                            drawCenterLine = Bool.False;
                        }
                        if (drawingPart.Attributes.DrawChamfers)
                        {
                            drawChamfers = Bool.True;
                        }
                        else
                        {
                            drawChamfers = Bool.False;
                        }
                        //drawConnectingSideMarks = drawingPart.Attributes.DrawConnectingSideMarks;
                        if (drawingPart.Attributes.DrawHiddenLines)
                        {
                            drawHiddenLines = Bool.True;
                        }
                        else
                        {
                            drawHiddenLines = Bool.False;
                        }
                        if (drawingPart.Attributes.DrawOrientationMark)
                        {
                            drawOrientationMark = Bool.True;
                        }
                        else
                        {
                            drawOrientationMark = Bool.False;
                        }
                        if (drawingPart.Attributes.DrawOwnHiddenLines)
                        {
                            drawOwnHiddenLines = Bool.True;
                        }
                        else
                        {
                            drawOwnHiddenLines = Bool.False;
                        }
                        if (drawingPart.Attributes.DrawPopMarks)
                        {
                            drawPopMarks = Bool.True;
                        }
                        else
                        {
                            drawPopMarks = Bool.False;
                        }
                        if (drawingPart.Attributes.DrawReferenceLine)
                        {
                            drawReferenceLine = Bool.True;
                        }
                        else
                        {
                            drawReferenceLine = Bool.False;
                        }
                        visibleLinesColour = drawingPart.Attributes.VisibleLines.Color;
                        if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashDot)
                        {
                            visibleLinesType = LineTypeEnum.DashDot;
                        }
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashDoubleDot)
                        {
                            visibleLinesType = LineTypeEnum.DashDoubleDot;
                        }
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashedLine)
                        {
                            visibleLinesType = LineTypeEnum.DashedLine;
                        }
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DottedLine)
                        {
                            visibleLinesType = LineTypeEnum.DottedLine;
                        }
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.SlashDash)
                        {
                            visibleLinesType = LineTypeEnum.SlashDash;
                        }
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.SlashedLine)
                        {
                            visibleLinesType = LineTypeEnum.SlashedLine;
                        }
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.SolidLine)
                        {
                            visibleLinesType = LineTypeEnum.SolidLine;
                        }
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.UndefinedLine)
                        {
                            visibleLinesType = LineTypeEnum.UndefinedLine;
                        }
                        hiddenLinesColour = drawingPart.Attributes.HiddenLines.Color;
                        if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DashDot)
                        {
                            hiddenLinesType = LineTypeEnum.DashDot;
                        }
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DashDoubleDot)
                        {
                            hiddenLinesType = LineTypeEnum.DashDoubleDot;
                        }
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DashedLine)
                        {
                            hiddenLinesType = LineTypeEnum.DashedLine;
                        }
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DottedLine)
                        {
                            hiddenLinesType = LineTypeEnum.DottedLine;
                        }
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.SlashDash)
                        {
                            hiddenLinesType = LineTypeEnum.SlashDash;
                        }
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.SlashedLine)
                        {
                            hiddenLinesType = LineTypeEnum.SlashedLine;
                        }
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.SolidLine)
                        {
                            hiddenLinesType = LineTypeEnum.SolidLine;
                        }
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.UndefinedLine)
                        {
                            hiddenLinesType = LineTypeEnum.UndefinedLine;
                        }
                        referenceLinesColour = drawingPart.Attributes.ReferenceLine.Color;
                        if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashDot)
                        {
                            visibleLinesType = LineTypeEnum.DashDot;
                        }
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.DashDoubleDot)
                        {
                            referenceLinesType = LineTypeEnum.DashDoubleDot;
                        }
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.DashedLine)
                        {
                            referenceLinesType = LineTypeEnum.DashedLine;
                        }
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.DottedLine)
                        {
                            referenceLinesType = LineTypeEnum.DottedLine;
                        }
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.SlashDash)
                        {
                            referenceLinesType = LineTypeEnum.SlashDash;
                        }
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.SlashedLine)
                        {
                            referenceLinesType = LineTypeEnum.SlashedLine;
                        }
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.SolidLine)
                        {
                            referenceLinesType = LineTypeEnum.SolidLine;
                        }
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.UndefinedLine)
                        {
                            referenceLinesType = LineTypeEnum.UndefinedLine;
                        }
                    }
                }
            }
            else if (drawingObjectEnum.GetSize() > 1)
            {
                drawCenterLine       = new Bool();
                drawChamfers         = new Bool();
                drawHiddenLines      = new Bool();
                drawOrientationMark  = new Bool();
                drawOwnHiddenLines   = new Bool();
                DrawPopMarks         = new Bool();
                drawReferenceLine    = new Bool();
                visibleLinesColour   = new DrawingColors();
                visibleLinesType     = new LineTypeEnum();
                hiddenLinesColour    = new DrawingColors();
                hiddenLinesType      = new LineTypeEnum();
                referenceLinesColour = new DrawingColors();
                referenceLinesType   = new LineTypeEnum();
            }
        }
        public void GetProperties()
        {
            DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected();
            if (drawingObjectEnum.GetSize() == 1)
            {
                while (drawingObjectEnum.MoveNext())
                {
                    if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Part)
                    {
                        Tekla.Structures.Drawing.Part drawingPart = (Tekla.Structures.Drawing.Part)drawingObjectEnum.Current;

                        if (drawingPart.Attributes.DrawCenterLine) drawCenterLine = Bool.True; else drawCenterLine = Bool.False;
                        if (drawingPart.Attributes.DrawChamfers) drawChamfers = Bool.True; else drawChamfers = Bool.False;
                        //drawConnectingSideMarks = drawingPart.Attributes.DrawConnectingSideMarks;
                        if (drawingPart.Attributes.DrawHiddenLines) drawHiddenLines = Bool.True; else drawHiddenLines = Bool.False;
                        if (drawingPart.Attributes.DrawOrientationMark) drawOrientationMark = Bool.True; else drawOrientationMark = Bool.False;
                        if (drawingPart.Attributes.DrawOwnHiddenLines) drawOwnHiddenLines = Bool.True; else drawOwnHiddenLines = Bool.False;
                        if (drawingPart.Attributes.DrawPopMarks) drawPopMarks = Bool.True; else drawPopMarks = Bool.False;
                        if (drawingPart.Attributes.DrawReferenceLine) drawReferenceLine = Bool.True; else drawReferenceLine = Bool.False;
                        visibleLinesColour = drawingPart.Attributes.VisibleLines.Color;
                        if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashDot) visibleLinesType = LineTypeEnum.DashDot;
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashDoubleDot) visibleLinesType = LineTypeEnum.DashDoubleDot;
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashedLine) visibleLinesType = LineTypeEnum.DashedLine;
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DottedLine) visibleLinesType = LineTypeEnum.DottedLine;
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.SlashDash) visibleLinesType = LineTypeEnum.SlashDash;
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.SlashedLine) visibleLinesType = LineTypeEnum.SlashedLine;
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.SolidLine) visibleLinesType = LineTypeEnum.SolidLine;
                        else if (drawingPart.Attributes.VisibleLines.Type == LineTypes.UndefinedLine) visibleLinesType = LineTypeEnum.UndefinedLine;
                        hiddenLinesColour = drawingPart.Attributes.HiddenLines.Color;
                        if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DashDot) hiddenLinesType = LineTypeEnum.DashDot;
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DashDoubleDot) hiddenLinesType = LineTypeEnum.DashDoubleDot;
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DashedLine) hiddenLinesType = LineTypeEnum.DashedLine;
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.DottedLine) hiddenLinesType = LineTypeEnum.DottedLine;
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.SlashDash) hiddenLinesType = LineTypeEnum.SlashDash;
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.SlashedLine) hiddenLinesType = LineTypeEnum.SlashedLine;
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.SolidLine) hiddenLinesType = LineTypeEnum.SolidLine;
                        else if (drawingPart.Attributes.HiddenLines.Type == LineTypes.UndefinedLine) hiddenLinesType = LineTypeEnum.UndefinedLine;
                        referenceLinesColour = drawingPart.Attributes.ReferenceLine.Color;
                        if (drawingPart.Attributes.VisibleLines.Type == LineTypes.DashDot) visibleLinesType = LineTypeEnum.DashDot;
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.DashDoubleDot) referenceLinesType = LineTypeEnum.DashDoubleDot;
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.DashedLine) referenceLinesType = LineTypeEnum.DashedLine;
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.DottedLine) referenceLinesType = LineTypeEnum.DottedLine;
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.SlashDash) referenceLinesType = LineTypeEnum.SlashDash;
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.SlashedLine) referenceLinesType = LineTypeEnum.SlashedLine;
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.SolidLine) referenceLinesType = LineTypeEnum.SolidLine;
                        else if (drawingPart.Attributes.ReferenceLine.Type == LineTypes.UndefinedLine) referenceLinesType = LineTypeEnum.UndefinedLine;
                    }
                }
            }
            else if (drawingObjectEnum.GetSize() > 1)
            {
                drawCenterLine = new Bool();
                drawChamfers = new Bool();
                drawHiddenLines = new Bool();
                drawOrientationMark = new Bool();
                drawOwnHiddenLines = new Bool();
                DrawPopMarks = new Bool();
                drawReferenceLine = new Bool();
                visibleLinesColour = new DrawingColors();
                visibleLinesType = new LineTypeEnum();
                hiddenLinesColour = new DrawingColors();
                hiddenLinesType = new LineTypeEnum();
                referenceLinesColour = new DrawingColors();
                referenceLinesType = new LineTypeEnum();
            }
        }
Exemple #12
0
 public void GIVEN_aLine_WHEN_parsed_THEN_itShouldBeIdentifiedAsTheCorrectType(string inputLine, LineTypeEnum expectedType)
 {
     CentralinoLine.Parse(inputLine).ShouldBeRight(line =>
     {
         Assert.Equal(expectedType, line.LineType);
     });
 }
 protected abstract Tuple <LineTypeEnum, string> ParseLine(string line, LineTypeEnum lastLineType = LineTypeEnum.Nothing);