Esempio n. 1
0
        private ObjFigu cnvCruveToFigu(ClsAtrXY atrxy0, ClsAtrXY atrxy1, ClsAtrXY atrxy2, ClsAtrXY atrxy3)
        {
            ObjFigu    objFigu;
            int        atr0, atr1, atr2;
            double     x0, y0, x1, y1, x2, y2, x3, y3;
            ClsBeze    bz;
            ClsPairRag pr;
            ClsPoint   pt;

            objFigu      = new ObjFigu();
            objFigu.kind = Constants.BEZEKIND;
            objFigu.x1   = atrxy1.x; objFigu.y1 = atrxy1.y;
            objFigu.x4   = atrxy2.x; objFigu.y4 = atrxy2.y;
            atr0         = atrxy0.atr;
            atr1         = atrxy1.atr;
            atr2         = atrxy2.atr;
            x0           = atrxy0.x; y0 = atrxy0.y;
            x1           = atrxy1.x; y1 = atrxy1.y;
            x2           = atrxy2.x; y2 = atrxy2.y;
            x3           = atrxy3.x; y3 = atrxy3.y;
            pr           = new ClsPairRag();
            pr.srag      = m_libCurve.getCurveStartRag(atr0, atr1, x0, y0, x1, y1, x2, y2);
            pr.erag      = m_libCurve.getCurveEndRag(atr1, atr2, x1, y1, x2, y2, x3, y3);
            pr           = m_libCurve.legalCurveRag(pr);
            pt           = m_libCurve.getBezeControlPoint(x1, y1, x2, y2, pr.srag);
            objFigu.x2   = pt.x; objFigu.y2 = pt.y;
            pt           = m_libCurve.getBezeControlPoint(x2, y2, x1, y1, pr.erag);
            objFigu.x3   = pt.x; objFigu.y3 = pt.y;
            return(objFigu);
        }
Esempio n. 2
0
        private ObjFigu cnvLineToFigu(ClsAtrXY atrxy1, ClsAtrXY atrxy2)
        {
            ObjFigu objFigu;

            objFigu      = new ObjFigu();
            objFigu.kind = Constants.LINEKIND;
            objFigu.x1   = atrxy1.x; objFigu.y1 = atrxy1.y;
            objFigu.x4   = atrxy2.x; objFigu.y4 = atrxy2.y;
            return(objFigu);
        }
Esempio n. 3
0
        private ObjFigu cnvBezeToFigu(ClsAtrXY atrxy1, ClsAtrXY atrxy2, ClsAtrXY atrxy3, ClsAtrXY atrxy4)
        {
            ObjFigu objFigu;

            objFigu      = new ObjFigu();
            objFigu.kind = Constants.BEZEKIND;
            objFigu.x1   = atrxy1.x; objFigu.y1 = atrxy1.y;
            objFigu.x2   = atrxy2.x; objFigu.y2 = atrxy2.y;
            objFigu.x3   = atrxy3.x; objFigu.y3 = atrxy3.y;
            objFigu.x4   = atrxy4.x; objFigu.y4 = atrxy4.y;
            return(objFigu);
        }
Esempio n. 4
0
        private ObjFigu cnvArcToFigu(ClsAtrXY atrxy1, ClsAtrXY atrxy2, ClsAtrXY atrxy3)
        {
            ObjFigu      objFigu;
            double       x1, y1, x2, y2, x3, y3;
            ClsArcCenter cntr;
            ClsArcSER    ser;
            ClsBeze      bz;
            double       rag;
            double       t1, t2;

            x1           = atrxy1.x;
            y1           = atrxy1.y;
            x2           = atrxy2.x;
            y2           = atrxy2.y;
            x3           = atrxy3.x;
            y3           = atrxy3.y;
            objFigu      = new ObjFigu();
            objFigu.kind = Constants.LINEKIND;
            objFigu.x1   = x1; objFigu.y1 = y1;
            objFigu.x4   = x3; objFigu.y4 = y3;
            cntr         = m_libCurve.getCurve3pCenter(x1, y1, x2, y2, x3, y3);
            if (cntr.stat == false)
            {
                return(objFigu);
            }
            ser = m_libCurve.getCurve3pRagR(x1, y1, x2, y2, x3, y3, cntr.x0, cntr.y0);
            if (ser.stat == false)
            {
                return(objFigu);
            }
            bz           = new ClsBeze();
            bz.x1        = x1; bz.y1 = y1;
            rag          = (ser.erag - ser.srag) / 3.0 + ser.srag;
            bz.x2        = Math.Cos(rag) * ser.dr + cntr.x0;
            bz.y2        = Math.Sin(rag) * ser.dr + cntr.y0;
            rag          = (ser.erag - ser.srag) / 3.0 * 2.0 + ser.srag;
            bz.x3        = Math.Cos(rag) * ser.dr + cntr.x0;
            bz.y3        = Math.Sin(rag) * ser.dr + cntr.y0;
            bz.x4        = x3; bz.y4 = y3;
            t1           = 1.0 / 3.0; t2 = 1.0 / 3.0 * 2.0;
            bz           = m_libCurve.cnvOnpointToCntrlpoint(bz, t1, t2);
            objFigu.kind = Constants.BEZEKIND;
            objFigu.x1   = bz.x1; objFigu.y1 = bz.y1;
            objFigu.x2   = bz.x2; objFigu.y2 = bz.y2;
            objFigu.x3   = bz.x3; objFigu.y3 = bz.y3;
            objFigu.x4   = bz.x4; objFigu.y4 = bz.y4;
            return(objFigu);
        }
Esempio n. 5
0
        public ObjVectList ConvMojiToVectList(string str, string sFontName)
        {
            string              sTTFontName;
            double              dFontSize;
            ObjVectList         objVectList;
            ObjVect             objVect;
            ObjFigu             objFigu;
            ClsFontPathGeometry clsFGP;
            PathGeometry        pg;
            int               psmax, psidx;
            PathSegment       ps;
            int               pfmax, pfidx;
            PathFigure        pf;
            BezierSegment     bz;
            PolyBezierSegment pbz;
            LineSegment       ln;
            PolyLineSegment   pln;
            int               ptmax, ptidx;
            string            stype;
            double            x1, y1;

            dFontSize   = 1024;
            sTTFontName = GetTTFontName(sFontName);
            clsFGP      = m_libCmn.GetFontPathGeometry(str, dFontSize, sFontName);
            pfmax       = clsFGP.pg.Figures.Count;
            objVectList = new ObjVectList();
            for (pfidx = 0; pfidx < pfmax; pfidx++)
            {
                objVect = new ObjVect();
                pf      = clsFGP.pg.Figures[pfidx];
                x1      = pf.StartPoint.X;
                y1      = pf.StartPoint.Y + clsFGP.dMoveY;
                psmax   = pf.Segments.Count;
                for (psidx = 0; psidx < psmax; psidx++)
                {
                    ps    = pf.Segments[psidx];
                    stype = ps.GetType().Name;
                    if (stype.Equals("PolyBezierSegment"))
                    {
                        pbz   = (PolyBezierSegment)ps;
                        ptmax = pbz.Points.Count;
                        for (ptidx = 0; ptidx < ptmax; ptidx = ptidx + 3)
                        {
                            objFigu      = new ObjFigu();
                            objFigu.x1   = x1;
                            objFigu.y1   = y1;
                            objFigu.x2   = pbz.Points[ptidx].X;
                            objFigu.y2   = pbz.Points[ptidx].Y + clsFGP.dMoveY;
                            objFigu.x3   = pbz.Points[ptidx + 1].X;
                            objFigu.y3   = pbz.Points[ptidx + 1].Y + clsFGP.dMoveY;
                            objFigu.x4   = pbz.Points[ptidx + 2].X;
                            objFigu.y4   = pbz.Points[ptidx + 2].Y + clsFGP.dMoveY;
                            objFigu.kind = Constants.BEZEKIND;
                            objVect.m_lstObjFigu.Add(objFigu);
                            x1 = objFigu.x4;
                            y1 = objFigu.y4;
                        }
                    }
                    else if (stype.Equals("PolyLineSegment"))
                    {
                        pln   = (PolyLineSegment)ps;
                        ptmax = pln.Points.Count;
                        for (ptidx = 0; ptidx < ptmax; ptidx++)
                        {
                            objFigu      = new ObjFigu();
                            objFigu.x1   = x1;
                            objFigu.y1   = y1;
                            objFigu.x4   = pln.Points[ptidx].X;
                            objFigu.y4   = pln.Points[ptidx].Y + clsFGP.dMoveY;
                            objFigu.kind = Constants.LINEKIND;
                            objVect.m_lstObjFigu.Add(objFigu);
                            x1 = objFigu.x4;
                            y1 = objFigu.y4;
                        }
                    }
                    else if (stype.Equals("BezierSegment"))
                    {
                        objFigu      = new ObjFigu();
                        bz           = (BezierSegment)ps;
                        objFigu.x1   = x1;
                        objFigu.y1   = y1;
                        objFigu.x2   = bz.Point1.X;
                        objFigu.y2   = bz.Point1.Y + clsFGP.dMoveY;
                        objFigu.x3   = bz.Point2.X;
                        objFigu.y3   = bz.Point2.Y + clsFGP.dMoveY;
                        objFigu.x4   = bz.Point3.X;
                        objFigu.y4   = bz.Point3.Y + clsFGP.dMoveY;
                        objFigu.kind = Constants.BEZEKIND;
                        objVect.m_lstObjFigu.Add(objFigu);
                        x1 = objFigu.x4;
                        y1 = objFigu.y4;
                    }
                    else if (stype.Equals("LineSegment"))
                    {
                        objFigu      = new ObjFigu();
                        ln           = (LineSegment)ps;
                        objFigu.x1   = x1;
                        objFigu.y1   = y1;
                        objFigu.x4   = ln.Point.X;
                        objFigu.y4   = ln.Point.Y + clsFGP.dMoveY;
                        objFigu.kind = Constants.LINEKIND;
                        objVect.m_lstObjFigu.Add(objFigu);
                        x1 = objFigu.x4;
                        y1 = objFigu.y4;
                    }
                }
                objVectList.AddVect(objVect);
            }
            return(objVectList);
        }