Exemple #1
0
        public void SetTextStr(string Value)
        {
            int vPos, I;

            text = Value;
            if (DXFConst.macroStrings != null)
            {
                for (I = 0; I < DXFConst.macroStrings.Count; I++)
                {
                    vPos = ((string)DXFConst.macroStrings[I]).IndexOf("=");
                    if (vPos == 0)
                    {
                        continue;
                    }
                    text.Replace((string)DXFConst.macroStrings[I],
                                 ((string)DXFConst.macroStrings[I]).Substring(vPos + 1, ((string)DXFConst.macroStrings[I]).Length));
                }
            }
            text = text.Replace("%%d", "°");
            text = text.Replace("%%p", "±");
            text = text.Replace("%%u", @"\L");
            text = text.Replace("%%127", "?");
            text = text.Replace("%%128", "ˆ");
            text = text.Replace("%%176", "°");
            text = text.Replace("%%179", "?");
            text = text.Replace("%%c", @"\U+2205");
            DXFConst.ReplaceNToDiameter(text);
        }
Exemple #2
0
        private void Row(int AStart, int AEnd, float X)
        {
            int     I;
            DXFText T;

            X = rectWidth - X;
            if (X < 0)
            {
                return;
            }
            if ((align == 2) || (align == 5) || (align == 8))
            {
                X = X / 2;
            }
            if (AStart < 0)            // added me
            {
                AStart = 0;
            }
            for (I = AStart; I < AEnd; I++)
            {
                T = (DXFText)FBlock.Entities[I];
                T.startPoint.X = T.startPoint.X + X;
                DXFConst.OffsetFRect(T.box, X, 0, 0);
            }
        }
Exemple #3
0
        private SFPoint RotPt(float Angle)
        {
            SFPoint Result;

            Angle    = (float)DXFConst.Radian(Angle);
            Result.X = this.Point1.X + (float)(radius * Math.Cos(Angle));
            Result.Y = this.Point1.Y + (float)(radius * Math.Sin(Angle));
            Result.Z = this.Point1.Z;
            return(Result);
        }
Exemple #4
0
        public override void Draw(System.Drawing.Graphics G)
        {
            SFPoint P1, P2;
            Color   RealColor = DXFConst.EntColor(this, Converter.FParams.Insert);

            P1 = Converter.GetPoint(Point1);
            P2 = Converter.GetPoint(Point2);
            if (FVisible)
            {
                G.DrawLine(new Pen(RealColor, 1), P1.X, P1.Y, P2.X, P2.Y);
            }
        }
Exemple #5
0
        public override void Draw(Graphics G)
        {
            SFPoint P1;
            Color   RealColor = DXFConst.EntColor(this, Converter.FParams.Insert);

            if (RealColor == DXFConst.clNone)
            {
                RealColor = Color.Black;
            }
            P1 = this.Converter.GetPoint(point);
            float h1 = height * Converter.FScale;

            P1.Y = P1.Y - h1;
            SolidBrush br1 = new SolidBrush(RealColor);
            Font       f1  = new Font("Times New Roman", h1);

            if (FVisible)
            {
                /*GraphicsContainer c1 = G.BeginContainer();
                 * if(rotation != 0)
                 * {
                 *      string str = string.Empty;
                 *      SizeF textSize = SizeF.Empty;
                 *      PointF textLocation = new PointF(P1.X, P1.Y); //PointF.Empty;
                 *      StringFormat strfmt = new StringFormat();
                 *      str = text;
                 *      //strfmt.FormatFlags = StringFormatFlags.DirectionVertical;
                 *      Size ClientSize = new Size((int) G.VisibleClipBounds.Width, (int) G.VisibleClipBounds.Height);
                 *      textSize = G.MeasureString(str, f1, ClientSize, strfmt);
                 *      textLocation = new Point(ClientSize.Width / 2, ClientSize.Height / 4);
                 *      RectangleF rectFSrc = new RectangleF(PointF.Empty, textSize);
                 *      RectangleF rectFDest = new RectangleF(new PointF(textLocation.X + textSize.Width, textLocation.Y + textSize.Height / 2), textSize);
                 *      GraphicsContainer container = G.BeginContainer(rectFDest, rectFSrc, GraphicsUnit.Pixel);
                 *      G.RotateTransform(rotation);
                 *      G.DrawString(str, f1, br1, PointF.Empty, strfmt);
                 *      strfmt.Dispose();
                 * } else G.DrawString(text, f1, br1, P1.X, P1.Y);
                 * G.EndContainer(c1); */
                if (rotation == 90)
                {
                    G.DrawString(text, new Font("Times New Roman", h1),
                                 br1, P1.X - h1, P1.Y - (text.Length * h1 / 1.6f),
                                 new StringFormat(StringFormatFlags.DirectionVertical));
                }
                else
                {
                    G.DrawString(text, new Font("Times New Roman", h1), br1, P1.X, P1.Y);
                }
            }
        }
Exemple #6
0
        public override void Draw(Graphics G)
        {
            SFPoint P1;
            float   rd1 = radius;

            P1   = Converter.GetPoint(Point1);
            rd1  = rd1 * Converter.FScale;
            P1.X = P1.X - rd1;
            P1.Y = P1.Y - rd1;
            Color RealColor = DXFConst.EntColor(this, Converter.FParams.Insert);

            if (FVisible)
            {
                G.DrawEllipse(new Pen(RealColor, 1), P1.X, P1.Y, rd1 * 2, rd1 * 2);
            }
        }
Exemple #7
0
        public override void Draw(Graphics G)
        {
            SFPoint P1;
            float   rd1, rd2;

            if (radPt.X == 0)
            {
                rd1 = Math.Abs(radius * ratio);
                rd2 = radius;
            }
            else
            {
                rd1 = radius;
                rd2 = Math.Abs(radius * ratio);
            }
            P1   = Converter.GetPoint(Point1);
            rd1  = rd1 * Converter.FScale;
            rd2  = rd2 * Converter.FScale;
            P1.X = P1.X - rd1;
            P1.Y = P1.Y - rd2;
            Color RealColor = DXFConst.EntColor(this, Converter.FParams.Insert);

            if (RealColor == DXFConst.clNone)
            {
                RealColor = Color.Black;
            }
            float sA = startAngle, eA = endAngle;

            //if(endAngle < startAngle) sA = Conversion_Angle(sA);
            eA -= sA;
            if (FVisible)
            {
                if (eA == 0)
                {
                    G.DrawEllipse(new Pen(RealColor, 1), P1.X, P1.Y, rd1 * 2, rd2 * 2);
                }
                else
                {
                    G.DrawArc(new Pen(RealColor, 1), P1.X, P1.Y, rd1 * 2, rd2 * 2, 0, 360);                     //sA, eA);
                }
            }
        }
Exemple #8
0
        public override void Draw(Graphics G)
        {
            SFPoint P1;
            float   rd1 = radius;

            P1   = Converter.GetPoint(Point1);
            rd1  = rd1 * Converter.FScale;
            P1.X = P1.X - rd1;
            P1.Y = P1.Y - rd1;
            Color RealColor = DXFConst.EntColor(this, Converter.FParams.Insert);
            float sA = -startAngle, eA = -endAngle;

            if (endAngle < startAngle)
            {
                sA = Conversion_Angle(sA);
            }
            eA -= sA;
            if (FVisible)
            {
                G.DrawArc(new Pen(RealColor, 1), P1.X, P1.Y, rd1 * 2, rd1 * 2, sA, eA);
            }
        }
Exemple #9
0
 public void SetAngle(double Value)
 {
     angle = (float)Value;
     sin   = Math.Sin(DXFConst.Radian(Value));
     cos   = Math.Cos(DXFConst.Radian(Value));
 }