Ejemplo n.º 1
0
        public string LineTypeToDxfLayer(PicGraphics.LT lType)
        { 
            switch (lType)
            {
                case PicGraphics.LT.LT_CUT:             return "L5-113";
                case PicGraphics.LT.LT_PERFOCREASING:   return "L6-133";
                case PicGraphics.LT.LT_CONSTRUCTION:    return "LCN-27";
                case PicGraphics.LT.LT_PERFO:           return "EC1-193";
                case PicGraphics.LT.LT_HALFCUT:         return "LI5-103";
                case PicGraphics.LT.LT_CREASING:        return "L8-123";
                case PicGraphics.LT.LT_AXIS:            return "L2-106";
                case PicGraphics.LT.LT_COTATION:        return "LDM-4";
                case PicGraphics.LT.LT_GRID:            return "L2-106";
                default:    return "";
            }

            // **
            // "Cut", "L5-113"
            // "Perfo-Crease", "L6-133"
            // "Construction", "LCN-27"
            // "Perfo", "EC1-193"
            // "Half-Cut", "LI5-103"
            // "Crease", "L8-123"
            // "Axis", "L2-106"
            // "Dimension", "LDM-4"
            // **
        }
Ejemplo n.º 2
0
			protected PicTypedDrawable(uint id, PicGraphics.LT lType)
				: base(id)
			{
                _lineType = lType;
                _group = 1;
                _layer = 1;
			}
Ejemplo n.º 3
0
 public static PicSegment CreateNewSegment(uint id, PicGraphics.LT lType, Vector2D pt0, Vector2D pt1)
 {
     PicSegment segment = new PicSegment(id, lType);
     segment._pt0 = pt0;
     segment._pt1 = pt1;
     return segment;
 }
Ejemplo n.º 4
0
            /// <summary>
            /// Drawing method used to draw factory content
            /// </summary>
            /// <param name="graphics">Graphic environment parameters</param>
            public void Draw(PicGraphics graphics, PicFilter filter)
            {
                graphics.Initialize();

                // bounding box
                if (!graphics.DrawingBox.IsValid)
                {
                    // compute bounding box
                    using (PicVisitorBoundingBox visitor = new PicVisitorBoundingBox())
                    {
                        ProcessVisitor(visitor);
                        Box2D box = visitor.Box;
                        box.AddMarginRatio(0.01);
                        // set as drawing box
                        graphics.DrawingBox = box;
                    }
                }

                // first, draw cotation
                foreach (PicEntity entity in _entities)
                {
                    try
                    {
                        // cotation
                        PicCotation cotation = entity as PicCotation;
                        if (cotation != null && !cotation.Deleted && filter.Accept(entity))
                        {
                            cotation.Draw(graphics);
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex.Message);
                    }
                }
                // then other entities
                foreach (Object o in _entities)
                {
                    try
                    {
                        // drawable entities
                        PicDrawable drawable = o as PicDrawable;
                        if (drawable != null && !drawable.Deleted && !(drawable is PicCotation) && filter.Accept(drawable))
                        {
                            drawable.Draw(graphics);
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex.Message);
                    }
                }
                // cardboard format
                if (null != _cardboardFormat)
                {
                    _cardboardFormat.Draw(graphics);
                }

                graphics.Finish();
            }
Ejemplo n.º 5
0
 public static PicArc CreateNewArc(uint id, PicGraphics.LT lType, Vector2D center, double radius, double angleBeg, double angleEnd)
 {
     PicArc arc = new PicArc(id, lType);
     arc._center = center;
     arc._radius = radius;
     arc._angleBeg = angleBeg;
     arc._angleEnd = angleEnd;
     return arc;
 }
Ejemplo n.º 6
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
     foreach (var entity in _entities)
     {
         if (entity is PicDrawable drawable && !(drawable is PicCotation))
         {
             drawable.Draw(graphics);
         }
     }
 }
Ejemplo n.º 7
0
 protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
 {
     foreach (var entity in Block)
     {
         if (entity is PicDrawable drawable && !(drawable is PicCotation))
         {
             drawable.Draw(graphics, transform * BlockTransformation);
         }
     }
 }
Ejemplo n.º 8
0
        public override void DrawArc(PicGraphics.LT lineType, Vector2D ptCenter, double radius, double angle0, double angle1)
		{
            if (radius > 0.0)
            _gdiGraphics.DrawArc(ToPen(lineType)
                , X(ptCenter.X) - DX(radius)
                , Y(ptCenter.Y) - DY(radius)
                , (float)(2.0*DX(radius))	    // width
                , (float)(2.0*DY(radius))	    // height
                , -(float)angle0			    // start angle
                , -(float)(angle1-angle0));	    // sweep angle
		}
Ejemplo n.º 9
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
     foreach (PicEntity entity in _entities)
     {
         PicDrawable drawable = entity as PicDrawable;
         if (null != drawable && !(drawable is PicCotation))
         {
             drawable.Draw(graphics);
         }
     }
 }
Ejemplo n.º 10
0
 protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
 {
     foreach (PicEntity entity in _block)
     {
         PicDrawable drawable = entity as PicDrawable;
         if (null != drawable && !(drawable is PicCotation))
         {
             drawable.Draw(graphics, transform * BlockTransformation);
         }
     }
 }
Ejemplo n.º 11
0
 ExpPen.ToolAttribute LineTypeToExpPen(PicGraphics.LT lineType)
 {
     ExpPen.ToolAttribute toolAttribute;
     switch (lineType)
     {
         case PicGraphics.LT.LT_CUT: toolAttribute = ExpPen.ToolAttribute.LT_CUT; break;
         case PicGraphics.LT.LT_CREASING: toolAttribute = ExpPen.ToolAttribute.LT_CREASING; break;
         case PicGraphics.LT.LT_PERFOCREASING: toolAttribute = ExpPen.ToolAttribute.LT_PERFOCREASING; break;
         case PicGraphics.LT.LT_HALFCUT: toolAttribute = ExpPen.ToolAttribute.LT_HALFCUT; break;
         case PicGraphics.LT.LT_COTATION: toolAttribute = ExpPen.ToolAttribute.LT_COTATION; break;
         case PicGraphics.LT.LT_CONSTRUCTION: toolAttribute = ExpPen.ToolAttribute.LT_CONSTRUCTION; break;
         default: toolAttribute = ExpPen.ToolAttribute.LT_CONSTRUCTION; break;
     }
     return toolAttribute;        
 }
Ejemplo n.º 12
0
 public byte LineTypeToDesPen(PicGraphics.LT lType)
 {
     switch (lType)
     {
         case PicGraphics.LT.LT_CUT:             return 1;
         case PicGraphics.LT.LT_PERFOCREASING:   return 2;
         case PicGraphics.LT.LT_CONSTRUCTION:    return 3;
         case PicGraphics.LT.LT_PERFO:           return 4;
         case PicGraphics.LT.LT_HALFCUT:         return 5;
         case PicGraphics.LT.LT_CREASING:        return 6;
         case PicGraphics.LT.LT_AXIS:            return 7;
         case PicGraphics.LT.LT_COTATION:        return 8;
         default:
             throw new Exception("LineType export not implemented!");
     }
 }
Ejemplo n.º 13
0
            protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
            {
                Vector2D vecCenterTransformed = Vector2D.Zero;
                double   angleBeg = 0.0, angleEnd = 0.0;

                TransformData(transform, _radius, _center, _angleBeg, _angleEnd
                              , ref vecCenterTransformed, ref angleBeg, ref angleEnd);

                graphics.DrawArc(
                    LineType
                    , vecCenterTransformed
                    , _radius
                    , angleBeg
                    , angleEnd
                    );
            }
Ejemplo n.º 14
0
            protected override void DrawArrowLine(PicGraphics graphics, Vector2D pt2, Vector2D pt3, double textWidth, double textHeight, out Vector2D ptText, out bool middle)
            {
                double length = (pt3 - pt2).GetLength();
                middle = length > textHeight * _globalCotationProperties._lengthCoef;

                double textX = (TextDirection == 270.0f) ? textHeight : textWidth;
                double textY = (TextDirection == 270.0f) ? textWidth : textHeight;

                if (middle)
                {
                    ptText = 0.5 * (pt2 + pt3);
                    graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * 0.5 * (length - textY) / length);
                    graphics.DrawLine(LineType, pt2 + (pt3 - pt2) * 0.5 * (length + textY) / length, pt3);
                }
                else
                {
                    // text is on top
                    graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * _globalCotationProperties._lengthCoef);
                    ptText = pt2 + (pt3 - pt2) * ((_globalCotationProperties._lengthCoef * length + 0.5 * textX) / length);
                }
            }
Ejemplo n.º 15
0
            protected override void DrawArrowLine(PicGraphics graphics, Vector2D pt2, Vector2D pt3, double textWidth, double textHeight, out Vector2D ptText, out bool middle)
            {
                double length = (pt3 - pt2).GetLength();
                middle = length > textWidth * _globalCotationProperties._lengthCoef;

                if (middle)
                {
                    ptText = 0.5 * (pt2 + pt3);
                    graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * 0.5 * (length - textWidth) / length);
                    graphics.DrawLine(LineType, pt2 + (pt3 - pt2) * 0.5 * (length + textWidth) / length, pt3);
                }
                else
                { 
                    // text is on the right
                    Vector2D ptLeft = new Vector2D(pt2.X < pt3.X ? pt2 : pt3);
                    Vector2D ptRight = new Vector2D(pt2.X < pt3.X ? pt3 : pt2);

                    graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * _globalCotationProperties._lengthCoef);
                    ptText =  pt2 + (pt3 - pt2) * ((_globalCotationProperties._lengthCoef*length + 0.5*textWidth) / length);
                }
            }
Ejemplo n.º 16
0
            protected override void DrawArrowLine(PicGraphics graphics, Vector2D pt2, Vector2D pt3, double textWidth, double textHeight, out Vector2D ptText, out bool middle)
            {
                double length = (pt3 - pt2).GetLength();

                double textX = (TextDirection == 270.0f) ? textHeight : textWidth;
                double textY = (TextDirection == 270.0f) ? textWidth : textHeight;

                middle = length > textY * GlobalCotationProperties.LengthCoef;

                if (middle)
                {
                    ptText = 0.5 * (pt2 + pt3);
                    graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * 0.5 * (length - textY) / length);
                    graphics.DrawLine(LineType, pt2 + (pt3 - pt2) * 0.5 * (length + textY) / length, pt3);
                }
                else
                {
                    // text is on top
                    graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * GlobalCotationProperties.LengthCoef);
                    ptText = pt2 + (pt3 - pt2) * ((GlobalCotationProperties.LengthCoef * length + 0.5 * textX) / length);
                }
            }
Ejemplo n.º 17
0
            protected override void DrawArrowLine(PicGraphics graphics, Vector2D pt2, Vector2D pt3, double textWidth, double textHeight, out Vector2D ptText, out bool middle)
            {
                double length = (pt3 - pt2).GetLength();

                middle = length > textWidth * _globalCotationProperties._lengthCoef;

                if (middle)
                {
                    ptText = 0.5 * (pt2 + pt3);
                    graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * 0.5 * (length - textWidth) / length);
                    graphics.DrawLine(LineType, pt2 + (pt3 - pt2) * 0.5 * (length + textWidth) / length, pt3);
                }
                else
                {
                    // text is on the right
                    Vector2D ptLeft  = new Vector2D(pt2.X < pt3.X ? pt2 : pt3);
                    Vector2D ptRight = new Vector2D(pt2.X < pt3.X ? pt3 : pt2);

                    graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * _globalCotationProperties._lengthCoef);
                    ptText = pt2 + (pt3 - pt2) * ((_globalCotationProperties._lengthCoef * length + 0.5 * textWidth) / length);
                }
            }
Ejemplo n.º 18
0
            protected override void DrawSpecific(PicGraphics graphics)
            {
                // get text size
                graphics.GetTextSize(Text, PicGraphics.TextType.FT_COTATION, GlobalCotationProperties.FontSize, out double textWidth, out double textHeight);
                // offset points
                GetOffsetPoints(out Vector2D pt2, out Vector2D pt3);
                // find out if is middle quotation
                bool middle = IsMiddleQuotation(pt2, pt3, textWidth, textHeight);

                if (!middle && (!GlobalCotationProperties._showDeportedCotations || Auto))
                {
                    return;
                }

                // draw extremity segments
                if (UseShortLines || 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
                DrawArrowLine(graphics, pt2, pt3, textWidth, textHeight, out Vector2D ptText, out middle);
                // draw text
                graphics.DrawText(Text, PicGraphics.TextType.FT_COTATION, GlobalCotationProperties.FontSize, 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));
            }
Ejemplo n.º 19
0
 protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
 {
     graphics.DrawLine(
         LineType
         , transform.transform(new Vector2D(0.0,0.0))
         , transform.transform(new Vector2D(_dimensions.X, 0.0))
         );
     graphics.DrawLine(
         LineType
         , transform.transform(new Vector2D(_dimensions.X, 0.0))
         , transform.transform(new Vector2D(_dimensions.X, _dimensions.Y))
         );
     graphics.DrawLine(
         LineType
         , transform.transform(new Vector2D(_dimensions.X, _dimensions.Y))
         , transform.transform(new Vector2D(0.0, _dimensions.Y))
         );
     graphics.DrawLine(
         LineType
         , transform.transform(new Vector2D(0.0, _dimensions.Y))
         , transform.transform(new Vector2D(0.0, 0.0))
         );
 }
Ejemplo n.º 20
0
 protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
 {
     graphics.DrawLine(
         LineType
         , transform.transform(new Vector2D(0.0, 0.0))
         , transform.transform(new Vector2D(Dimensions.X, 0.0))
         );
     graphics.DrawLine(
         LineType
         , transform.transform(new Vector2D(Dimensions.X, 0.0))
         , transform.transform(new Vector2D(Dimensions.X, Dimensions.Y))
         );
     graphics.DrawLine(
         LineType
         , transform.transform(new Vector2D(Dimensions.X, Dimensions.Y))
         , transform.transform(new Vector2D(0.0, Dimensions.Y))
         );
     graphics.DrawLine(
         LineType
         , transform.transform(new Vector2D(0.0, Dimensions.Y))
         , transform.transform(new Vector2D(0.0, 0.0))
         );
 }
Ejemplo n.º 21
0
 protected PicPoint(uint id, PicGraphics.LT lType)
     : base(id, lType)
 {
 }
Ejemplo n.º 22
0
 protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
 {
     graphics.DrawLine(LineType, transform.transform(_pt0), transform.transform(_pt1));
 }
Ejemplo n.º 23
0
            protected virtual void DrawArrowLine(PicGraphics graphics, Vector2D pt2, Vector2D pt3, double textWidth, double textHeight, out Vector2D ptText, out bool middle)
            {
                double length = (pt3 - pt2).GetLength();
                if (Math.Abs( pt3.Y - pt2.Y ) < (textHeight / textWidth) * Math.Abs(pt3.X - pt2.X))
                    middle = Math.Abs((pt3-pt2).X) > textWidth * _globalCotationProperties._lengthCoef;
                else
                    middle = Math.Abs((pt3-pt2).Y) > textHeight * _globalCotationProperties._lengthCoef;

                if (middle)
                {
                    ptText = 0.5 * (pt2 + pt3);
                    if (Math.Abs((pt3 - pt2).X) > 0)
                    {
                        Vector2D pt2_ = pt2.X < pt3.X ? pt2 : pt3;
                        Vector2D pt3_ = pt2.X < pt3.X ? pt3 : pt2;

                        if (Math.Abs((pt3.Y - pt2.Y) / (pt3.X - pt2.X)) < textHeight / textWidth)
                        {
                            graphics.DrawLine(LineType, pt2_, pt2_ + (pt3_ - pt2_) * 0.5 * (pt3_.X - pt2_.X - textWidth) / length);
                            graphics.DrawLine(LineType, pt2_ + (pt3_ - pt2_) * 0.5 * (pt3_.X - pt2_.X + textWidth) / length, pt3_);
                        }
                        else
                        {
                            graphics.DrawLine(LineType, pt2_, pt2_ + (pt3_ - pt2_) * 0.5 * (pt3_.Y - pt2_.Y - textHeight) / length);
                            graphics.DrawLine(LineType, pt2_ + (pt3_ - pt2_) * 0.5 * (pt3_.Y - pt2_.Y + textHeight) / length, pt3_);
                        }
                    }
                    else
                    {
                        ptText = 0.5 * (pt2 + pt3);
                        graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * 0.5 * (length - textHeight) / length);
                        graphics.DrawLine(LineType, pt2 + (pt3 - pt2) * 0.5 * (length + textHeight) / length, pt3);
                    }
                }
                else
                {
                    if (Math.Abs((pt3 - pt2).X) > 0)
                    {
                        Vector2D pt2_ = pt2.X < pt3.X ? pt2 : pt3;
                        Vector2D pt3_ = pt2.X < pt3.X ? pt3 : pt2;
                        graphics.DrawLine(LineType, pt2_, pt2_ + (pt3_ - pt2_) * _globalCotationProperties._lengthCoef);
                        if (Math.Abs((pt3.Y - pt2.Y) / (pt3.X - pt2.X)) < textHeight / textWidth)
                            ptText = pt2_ + (pt3_ - pt2_) * ((_globalCotationProperties._lengthCoef * (pt3_-pt2_).X + 0.5 * textWidth) / length);
                        else
                            ptText = pt2_ + (pt3_ - pt2_) * ((_globalCotationProperties._lengthCoef * (pt3_ - pt2_).Y + 0.5 * textHeight) / length);
                    }
                    else
                    {
                        // text is on top
                        graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * _globalCotationProperties._lengthCoef);
                        ptText = pt2 + (pt3 - pt2) * ((_globalCotationProperties._lengthCoef * length + 0.5 * textHeight) / length);
                    }
                }
            }
Ejemplo n.º 24
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
     graphics.DrawPoint(LineType, Pt);
 }
Ejemplo n.º 25
0
 public void Draw(PicGraphics graphics, Transform2D transform)
 {
     DrawSpecific(graphics, transform);
 }
Ejemplo n.º 26
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
     DrawSpecific(graphics, Transform2D.Identity);
 }
Ejemplo n.º 27
0
            protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
			{
				graphics.DrawPoint(LineType, transform.transform(_pt));
			}
Ejemplo n.º 28
0
 public void Draw(PicGraphics graphics, Transform2D transform)
 {
     DrawSpecific(graphics, transform);
 }
Ejemplo n.º 29
0
			public void Draw(PicGraphics graphics)
			{
				Compute();
				DrawSpecific(graphics);
			}
Ejemplo n.º 30
0
 private PdfSharp.Drawing.XBrush LineTypeToPdfBrush(PicGraphics.LT lType)
 {
     switch (lType)
     {
         case PicGraphics.LT.LT_CUT: return PdfSharp.Drawing.XBrushes.Red;
         case PicGraphics.LT.LT_PERFOCREASING: return PdfSharp.Drawing.XBrushes.Blue;
         case PicGraphics.LT.LT_CONSTRUCTION: return PdfSharp.Drawing.XBrushes.Black;
         case PicGraphics.LT.LT_PERFO: return PdfSharp.Drawing.XBrushes.Red;
         case PicGraphics.LT.LT_HALFCUT: return PdfSharp.Drawing.XBrushes.LightBlue;
         case PicGraphics.LT.LT_CREASING: return PdfSharp.Drawing.XBrushes.Blue;
         case PicGraphics.LT.LT_AXIS: return PdfSharp.Drawing.XBrushes.Pink;
         case PicGraphics.LT.LT_COTATION: return PdfSharp.Drawing.XBrushes.Green;
         default: return PdfSharp.Drawing.XBrushes.White;
     }
 }
Ejemplo n.º 31
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
     graphics.DrawArc(LineType, Center, Radius, AngleBeg, AngleEnd);
 }
Ejemplo n.º 32
0
 private Font ToFont(PicGraphics.TextType tType)
 {
     switch (tType)
     {
         case TextType.FT_COTATION:
             {
                 BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                 return new Font(bf, FontSize(tType), Font.NORMAL, BaseColor.GREEN);
             }
         default: throw new Exception("Unknown text type");
     
     }
 }
Ejemplo n.º 33
0
            protected virtual void DrawArrowLine(PicGraphics graphics, Vector2D pt2, Vector2D pt3, double textWidth, double textHeight, out Vector2D ptText, out bool middle)
            {
                double length = (pt3 - pt2).GetLength();

                if (Math.Abs(pt3.Y - pt2.Y) < (textHeight / textWidth) * Math.Abs(pt3.X - pt2.X))
                {
                    middle = Math.Abs((pt3 - pt2).X) > textWidth * _globalCotationProperties._lengthCoef;
                }
                else
                {
                    middle = Math.Abs((pt3 - pt2).Y) > textHeight * _globalCotationProperties._lengthCoef;
                }

                if (middle)
                {
                    ptText = 0.5 * (pt2 + pt3);
                    if (Math.Abs((pt3 - pt2).X) > 0)
                    {
                        Vector2D pt2_ = pt2.X < pt3.X ? pt2 : pt3;
                        Vector2D pt3_ = pt2.X < pt3.X ? pt3 : pt2;

                        if (Math.Abs((pt3.Y - pt2.Y) / (pt3.X - pt2.X)) < textHeight / textWidth)
                        {
                            graphics.DrawLine(LineType, pt2_, pt2_ + (pt3_ - pt2_) * 0.5 * (pt3_.X - pt2_.X - textWidth) / length);
                            graphics.DrawLine(LineType, pt2_ + (pt3_ - pt2_) * 0.5 * (pt3_.X - pt2_.X + textWidth) / length, pt3_);
                        }
                        else
                        {
                            graphics.DrawLine(LineType, pt2_, pt2_ + (pt3_ - pt2_) * 0.5 * (pt3_.Y - pt2_.Y - textHeight) / length);
                            graphics.DrawLine(LineType, pt2_ + (pt3_ - pt2_) * 0.5 * (pt3_.Y - pt2_.Y + textHeight) / length, pt3_);
                        }
                    }
                    else
                    {
                        ptText = 0.5 * (pt2 + pt3);
                        graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * 0.5 * (length - textHeight) / length);
                        graphics.DrawLine(LineType, pt2 + (pt3 - pt2) * 0.5 * (length + textHeight) / length, pt3);
                    }
                }
                else
                {
                    if (Math.Abs((pt3 - pt2).X) > 0)
                    {
                        Vector2D pt2_ = pt2.X < pt3.X ? pt2 : pt3;
                        Vector2D pt3_ = pt2.X < pt3.X ? pt3 : pt2;
                        graphics.DrawLine(LineType, pt2_, pt2_ + (pt3_ - pt2_) * _globalCotationProperties._lengthCoef);
                        if (Math.Abs((pt3.Y - pt2.Y) / (pt3.X - pt2.X)) < textHeight / textWidth)
                        {
                            ptText = pt2_ + (pt3_ - pt2_) * ((_globalCotationProperties._lengthCoef * (pt3_ - pt2_).X + 0.5 * textWidth) / length);
                        }
                        else
                        {
                            ptText = pt2_ + (pt3_ - pt2_) * ((_globalCotationProperties._lengthCoef * (pt3_ - pt2_).Y + 0.5 * textHeight) / length);
                        }
                    }
                    else
                    {
                        // text is on top
                        graphics.DrawLine(LineType, pt2, pt2 + (pt3 - pt2) * _globalCotationProperties._lengthCoef);
                        ptText = pt2 + (pt3 - pt2) * ((_globalCotationProperties._lengthCoef * length + 0.5 * textHeight) / length);
                    }
                }
            }
Ejemplo n.º 34
0
 protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
 {
     graphics.DrawPoint(LineType, transform.transform(Pt));
 }
Ejemplo n.º 35
0
 public static PicPoint CreateNewPoint(uint id, PicGraphics.LT lType, Vector2D pt)
 {
     PicPoint point = new PicPoint(id, lType);
     return point;
 }
Ejemplo n.º 36
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
     graphics.DrawPoint(LineType, _pt);
 }
Ejemplo n.º 37
0
 protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
 {
 }
Ejemplo n.º 38
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
     DrawSpecific(graphics, Transform2D.Identity);
 }
Ejemplo n.º 39
0
 private BaseColor LineTypeToBaseColor(PicGraphics.LT lType)
 {
     switch (lType)
     {
         case PicGraphics.LT.LT_CUT: return BaseColor.RED;
         case PicGraphics.LT.LT_FOLD: return BaseColor.BLUE;
         case PicGraphics.LT.LT_COTATION: return BaseColor.GREEN;
         default: return BaseColor.WHITE;
     }           
 }
Ejemplo n.º 40
0
 protected abstract void DrawSpecific(PicGraphics graphics);
Ejemplo n.º 41
0
 private BaseFont ToBaseFont(PicGraphics.TextType tType)
 {
     switch (tType)
     {
         case TextType.FT_COTATION:
             {
                 BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                 _cb.SetFontAndSize(bf, FontSize(tType));
                 _cb.SetColorFill( BaseColor.GREEN );
                 return bf;
             }
         default: throw new Exception("Unknown text type");
     }
 }
Ejemplo n.º 42
0
        protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
        {
            float fontSize = (Math.Abs(FontSize) < 0.1f) ? PicCotation.GlobalCotationProperties.FontSize : graphics.FontSizePt(FontSize);

            graphics.DrawText(Text, PicGraphics.TextType.FT_COTATION, fontSize, Point + graphics.OffsetFont(FontSize, VAlignment), HAlignment, VAlignment, TextDirection);
        }
Ejemplo n.º 43
0
 private XFont ToFont(PicGraphics.TextType tType)
 {
     double fontHeight = pdfDocument.Pages[0].Height / 50.0;
     switch (tType)
     {
         case TextType.FT_COTATION: return new XFont("Arial", fontHeight);
         default: throw new Exception("Unknown text type");
     }
 }
Ejemplo n.º 44
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
     graphics.DrawArc(LineType, _center, _radius, _angleBeg, _angleEnd);
 }
Ejemplo n.º 45
0
            /// <summary>
            /// Drawing method used to draw factory content
            /// </summary>
            /// <param name="graphics">Graphic environment parameters</param>
            public void Draw(PicGraphics graphics, PicFilter filter)
            {
                graphics.Initialize();

                // bounding box
                if (!graphics.DrawingBox.IsValid)
                {
                    try
                    {
                        // compute bounding box
                        graphics.DrawingBox = Tools.BoundingBox(this, filter, 0.025);
                    }
                    catch (Exception /*ex*/)
                    {
                        return;
                    }
                }

                // first, draw cotation
                foreach (PicEntity entity in _entities)
                {
                    try
                    {
                        // cotation
                        if (entity is PicCotation cotation && !cotation.Deleted && filter.Accept(entity))
                        {
                            cotation.Draw(graphics);
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex.Message);
                    }
                }
                // then other entities
                foreach (object o in _entities)
                {
                    try
                    {
                        // drawable entities
                        if (o is PicDrawable drawable &&
                            !drawable.Deleted &&
                            !(drawable is PicCotation) &&
                            filter.Accept(drawable))
                        {
                            drawable.Draw(graphics);
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex.Message);
                    }
                }
                // cardboard format
                if (null != _cardboardFormat)
                {
                    _cardboardFormat.Draw(graphics);
                }

                graphics.Finish();
            }
Ejemplo n.º 46
0
 protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
 {
 }
Ejemplo n.º 47
0
 private float FontSize(PicGraphics.TextType tType)
 {
     switch (tType)
     {
         case TextType.FT_COTATION: return _pdfDocument.PageSize.Height / 25.0f;
         default: throw new Exception("Unknown text type");
     }
 }
Ejemplo n.º 48
0
 public static PicNurb CreateNewNurb(uint id, PicGraphics.LT lType)
 {
     PicNurb nurb = new PicNurb(id, lType);
     return nurb;
 }
Ejemplo n.º 49
0
 public void Draw(PicGraphics graphics)
 {
     Compute();
     DrawSpecific(graphics);
 }
Ejemplo n.º 50
0
 /// <summary>
 /// Drawing method used to draw factory content
 /// </summary>
 /// <param name="graphics">Graphics environment parameters</param>
 public void Draw(PicGraphics graphics)
 {
     Draw(graphics, new PicFilter());
 }
Ejemplo n.º 51
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
     graphics.DrawLine(LineType, _pt0, _pt1);
 }
Ejemplo n.º 52
0
 protected PicNurb(uint id, PicGraphics.LT lType)
     :base(id, lType)
 {
 }
Ejemplo n.º 53
0
 protected abstract void DrawSpecific(PicGraphics graphics, Transform2D transform);
Ejemplo n.º 54
0
		protected override void DrawSpecific(PicGraphics graphics)
		{
		}
Ejemplo n.º 55
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
 }
Ejemplo n.º 56
0
 protected abstract void DrawSpecific(PicGraphics graphics);
Ejemplo n.º 57
0
 protected abstract void DrawSpecific(PicGraphics graphics, Transform2D transform);