MCPcopy Create free account
hub / github.com/LibreCAD/LibreCAD / addLines

Method addLines

librecad/src/main/doc_plugin_interface.cpp:905–929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

903}
904
905void 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
931void Doc_plugin_interface::addPolyline(std::vector<Plug_VertexData> const& points, bool closed)
932{

Callers 1

execCommMethod · 0.80

Calls 5

RS_VectorClass · 0.50
sizeMethod · 0.45
addEntityMethod · 0.45
addUndoableMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected