| 903 | } |
| 904 | |
| 905 | void Doc_plugin_interface::addLines(std::vector<QPointF> const& points, bool closed) |
| 906 | { |
| 907 | if (doc) { |
| 908 | RS_LineData data; |
| 909 | |
| 910 | LC_UndoSection undo(doc); |
| 911 | data.endpoint=RS_Vector(points.front().x(), points.front().y()); |
| 912 | |
| 913 | for(size_t i=1; i<points.size(); ++i){ |
| 914 | data.startpoint=data.endpoint; |
| 915 | data.endpoint=RS_Vector(points[i].x(), points[i].y()); |
| 916 | RS_Line* line=new RS_Line(doc, data); |
| 917 | doc->addEntity(line); |
| 918 | undo.addUndoable(line); |
| 919 | } |
| 920 | if(closed){ |
| 921 | data.startpoint=data.endpoint; |
| 922 | data.endpoint=RS_Vector(points.front().x(), points.front().y()); |
| 923 | RS_Line* line=new RS_Line(doc, data); |
| 924 | doc->addEntity(line); |
| 925 | undo.addUndoable(line); |
| 926 | } |
| 927 | } else |
| 928 | RS_DEBUG->print("%s: currentContainer is nullptr", __func__); |
| 929 | } |
| 930 | |
| 931 | void Doc_plugin_interface::addPolyline(std::vector<Plug_VertexData> const& points, bool closed) |
| 932 | { |