Exemplo n.º 1
0
        private void GetPointsTest()
        {
            CadFigure fig = Controller.CurrentFigure;

            if (fig == null)
            {
                return;
            }

            VertexList vl = fig.GetPoints(4);

            int a = vl.Count;

            CadFigurePolyLines tmpFig = (CadFigurePolyLines)Controller.DB.NewFigure(CadFigure.Types.POLY_LINES);

            tmpFig.AddPoints(vl);

            Controller.CurrentLayer.AddFigure(tmpFig);

            Controller.UpdateObjectTree(true);
        }
Exemplo n.º 2
0
        public static XElement ToPath(CadFigurePolyLines fig, DrawContext dc, double width, double height, double lineW)
        {
            StringBuilder sb = new StringBuilder("");

            int state = 0;

            foreach (CadVertex v in fig.PointList)
            {
                Vector3d dv = dc.WorldPointToDevPoint(v.vector);
                if (state == 0)
                {
                    sb.Append("M ");
                    state = 1;
                }
                else
                {
                    sb.Append(" L ");
                }
                sb.Append($"{dv.X:F3} {dv.Y:F3}");
            }

            if (fig.IsLoop)
            {
                sb.Append(" z");
            }

            XElement ele = new XElement("path",
                                        new XAttribute("d", sb.ToString()),
                                        new XAttribute("fill", "none"),
                                        new XAttribute("stroke", "black"),
                                        new XAttribute("stroke-width", lineW)
                                        );

            //DOut.pl(ele.ToString());

            return(ele);
        }
Exemplo n.º 3
0
        public CadFigure CreatePolyLines()
        {
            CadFigurePolyLines fig = (CadFigurePolyLines)Controller.DB.NewFigure(CadFigure.Types.POLY_LINES);

            return(fig);
        }