コード例 #1
0
ファイル: DrawPath.cs プロジェクト: kallotec/Bonsai
        public static DrawPath Create(SvgPath svp)
        {
            DrawPath dp;

            try
            {
                string s = svp.PathData.Trim();
                s = s.Replace("\r", "");
                s = s.Replace("\n", " ");
                s = s.Trim();
                string[] arr = s.Split(' ');

                dp = new DrawPath(arr)
                {
                    Name = svp.ShapeName
                };
                dp.SetStyleFromSvg(svp);
            }
            catch (Exception ex)
            {
                ErrH.Log("DrawPath", "Create", ex.ToString(), ErrH._LogPriority.Info);
                dp = null;
            }

            return(dp);
        }
コード例 #2
0
ファイル: DrawPath.cs プロジェクト: kallotec/Bonsai
        public override object Clone()
        {
            DrawPath newDrawPath = new DrawPath();

            foreach (PathCommands pc in _pointArray)
            {
                newDrawPath._pointArray.Add(new PathCommands(pc.P, pc.Pc));
            }
            newDrawPath.Stroke      = Stroke;
            newDrawPath.StrokeWidth = StrokeWidth;
            newDrawPath.Fill        = Fill;
            return(newDrawPath);
        }
コード例 #3
0
        DrawObject CreateDrawObject(SvgElement svge)
        {
            DrawObject o = null;

            switch (svge.getElementType())
            {
            case SvgElement._SvgElementType.typeLine:
                o = DrawLine.Create((SvgLine )svge);
                break;

            case SvgElement._SvgElementType.typeRect:
                o = DrawRectangle.Create((SvgRect )svge);
                break;

            case SvgElement._SvgElementType.typeEllipse:
                o = DrawEllipse.Create((SvgEllipse )svge);
                break;

            case SvgElement._SvgElementType.typePolyline:
                o = DrawPolygon.Create((SvgPolyline )svge);
                break;

            case SvgElement._SvgElementType.typeImage:
                o = DrawImage.Create((SvgImage )svge);
                break;

            case SvgElement._SvgElementType.typeText:
                o = DrawText.Create((SvgText )svge);
                break;

            case SvgElement._SvgElementType.typeGroup:
                o = CreateGroup((SvgGroup )svge);
                break;

            case SvgElement._SvgElementType.typePath:
                o = DrawPath.Create((SvgPath)svge);
                break;

            case SvgElement._SvgElementType.typeDesc:
                Description = ((SvgDesc)svge).Value;
                break;

            default:
                break;
            }
            return(o);
        }