Пример #1
0
            protected void DrawArrowHead(Pic.Factory2D.PicGraphics graphics, Vector2D pt, Vector2D director)
            {
                director.Normalize();
                Vector2D normal = new Vector2D(-director.Y, director.X);

                double angleRad    = _globalCotationProperties._arrowHeadAngle * Math.PI / 180.0;
                double arrowLength = graphics.DX_inv(_globalCotationProperties._arrowLength);

                // lower part of arrow head
                graphics.DrawLine(LineType
                                  , pt - arrowLength * (Math.Cos(angleRad) * director + Math.Sin(angleRad) * normal)
                                  , pt);
                // upper part of arrow head
                graphics.DrawLine(LineType
                                  , pt - arrowLength * (Math.Cos(angleRad) * director - Math.Sin(angleRad) * normal)
                                  , pt);
            }
Пример #2
0
            protected override void DrawSpecific(Pic.Factory2D.PicGraphics graphics)
            {
                // get text size
                double textWidth = 0.0, textHeight = 0.0;

                graphics.GetTextSize(Text, PicGraphics.TextType.FT_COTATION, out textWidth, out textHeight);
                // offset points
                Vector2D pt2, pt3;

                GetOffsetPoints(out pt2, out pt3);
                // find out if is middle quotation
                bool middle = IsMiddleQuotation(pt2, pt3, textWidth, textHeight);

                if (!middle && !_globalCotationProperties._showDeportedCotations)
                {
                    return;
                }

                // draw extremity segments
                if (_shortLines || PicGlobalCotationProperties.ShowShortCotationLines)
                {
                    double arrowLength = graphics.DX_inv(_globalCotationProperties._arrowLength);

                    Vector2D vecI = _pt0 - pt2;
                    vecI.Normalize();
                    vecI *= arrowLength;
                    graphics.DrawLine(LineType, pt2 + vecI, pt2 - vecI);
                    graphics.DrawLine(LineType, pt3 + vecI, pt3 - vecI);
                }
                else
                {
                    graphics.DrawLine(LineType, _pt0, pt2);
                    graphics.DrawLine(LineType, _pt1, pt3);
                }
                // draw arrow line
                Vector2D ptText;

                DrawArrowLine(graphics, pt2, pt3, textWidth, textHeight, out ptText, out middle);
                // draw text
                graphics.DrawText(Text, PicGraphics.TextType.FT_COTATION, ptText, PicGraphics.HAlignment.HA_CENTER, PicGraphics.VAlignment.VA_MIDDLE, TextDirection);
                // draw arrows heads
                DrawArrowHead(graphics, pt2, (middle ? 1.0 : -1.0) * (pt2 - pt3));
                DrawArrowHead(graphics, pt3, (middle ? 1.0 : -1.0) * (pt3 - pt2));
            }