804:d8589e8e2973 | 805:d88c0354de97 |
---|---|
283 { | 283 { |
284 if (lines[i] == null) | 284 if (lines[i] == null) |
285 continue; | 285 continue; |
286 | 286 |
287 long idx = obj->lineNumber() + i + 1; | 287 long idx = obj->lineNumber() + i + 1; |
288 lines[i]->setColor (edgecolor()); | |
289 getCurrentDocument()->insertObj (idx, lines[i]); | 288 getCurrentDocument()->insertObj (idx, lines[i]); |
290 } | 289 } |
291 | 290 |
292 num += countof (lines); | 291 num += countof (lines); |
293 } | 292 } |
565 for (LDObjectPtr obj : selection()) | 564 for (LDObjectPtr obj : selection()) |
566 { | 565 { |
567 if (not obj->isColored()) | 566 if (not obj->isColored()) |
568 continue; | 567 continue; |
569 | 568 |
570 obj->setColor ((obj->type() == OBJ_Line || obj->type() == OBJ_CondLine) ? edgecolor() : maincolor()); | 569 obj->setColor (obj->defaultColor()); |
571 num++; | 570 num++; |
572 } | 571 } |
573 | 572 |
574 print (tr ("%1 objects uncolored"), num); | 573 print (tr ("%1 objects uncolored"), num); |
575 refresh(); | 574 refresh(); |
673 for (LDObjectPtr obj : sel) | 672 for (LDObjectPtr obj : sel) |
674 { | 673 { |
675 if (obj->type() != OBJ_CondLine) | 674 if (obj->type() != OBJ_CondLine) |
676 continue; | 675 continue; |
677 | 676 |
678 obj.staticCast<LDCondLine>()->demote(); | 677 obj.staticCast<LDCondLine>()->toEdgeLine(); |
679 ++num; | 678 ++num; |
680 } | 679 } |
681 | 680 |
682 print (tr ("Demoted %1 conditional lines"), num); | 681 print (tr ("Demoted %1 conditional lines"), num); |
683 refresh(); | 682 refresh(); |
801 QVector<LDObjectPtr> newsegs; | 800 QVector<LDObjectPtr> newsegs; |
802 | 801 |
803 for (int i = 0; i < segments; ++i) | 802 for (int i = 0; i < segments; ++i) |
804 { | 803 { |
805 LDObjectPtr segment; | 804 LDObjectPtr segment; |
806 | |
807 if (obj->type() == OBJ_Line) | |
808 segment = spawn<LDLine>(); | |
809 else | |
810 segment = spawn<LDCondLine>(); | |
811 | |
812 Vertex v0, v1; | 805 Vertex v0, v1; |
813 v0.apply ([&](Axis ax, double& a) { a = (obj->vertex (0)[ax] + (((obj->vertex (1)[ax] - obj->vertex (0)[ax]) * i) / segments)); }); | 806 v0.apply ([&](Axis ax, double& a) { a = (obj->vertex (0)[ax] + (((obj->vertex (1)[ax] - obj->vertex (0)[ax]) * i) / segments)); }); |
814 v1.apply ([&](Axis ax, double& a) { a = (obj->vertex (0)[ax] + (((obj->vertex (1)[ax] - obj->vertex (0)[ax]) * (i + 1)) / segments)); }); | 807 v1.apply ([&](Axis ax, double& a) { a = (obj->vertex (0)[ax] + (((obj->vertex (1)[ax] - obj->vertex (0)[ax]) * (i + 1)) / segments)); }); |
815 print ("%1, %2\n", v0.toString(true), v1.toString(true)); | 808 |
816 segment->setVertex (0, v0); | 809 if (obj->type() == OBJ_Line) |
817 segment->setVertex (0, v1); | 810 segment = spawn<LDLine> (v0, v1); |
818 segment->setVertex (2, obj->vertex (2)); | 811 else |
819 segment->setVertex (3, obj->vertex (3)); | 812 segment = spawn<LDCondLine> (v0, v1, obj->vertex (2), obj->vertex (3)); |
813 | |
820 newsegs << segment; | 814 newsegs << segment; |
821 } | 815 } |
822 | 816 |
823 int ln = obj->lineNumber(); | 817 int ln = obj->lineNumber(); |
824 | 818 |