src/toolsets/algorithmtoolset.cpp

changeset 1323
05b3e173c900
parent 1320
bdb4804bc09c
child 1324
563a9b65777b
equal deleted inserted replaced
1322:d8935cdb24c0 1323:05b3e173c900
165 Vertex v = mo->position(); 165 Vertex v = mo->position();
166 Matrix t = mo->transformationMatrix(); 166 Matrix t = mo->transformationMatrix();
167 167
168 v.apply ([&](Axis, double& a) 168 v.apply ([&](Axis, double& a)
169 { 169 {
170 roundToDecimals (a, m_config->roundPositionPrecision()); 170 roundToDecimals (a, config::roundPositionPrecision());
171 }); 171 });
172 172
173 applyToMatrix (t, [&](int, double& a) 173 applyToMatrix (t, [&](int, double& a)
174 { 174 {
175 roundToDecimals (a, m_config->roundMatrixPrecision()); 175 roundToDecimals (a, config::roundMatrixPrecision());
176 }); 176 });
177 177
178 mo->setPosition (v); 178 mo->setPosition (v);
179 mo->setTransformationMatrix (t); 179 mo->setTransformationMatrix (t);
180 num += 12; 180 num += 12;
184 for (int i = 0; i < obj->numVertices(); ++i) 184 for (int i = 0; i < obj->numVertices(); ++i)
185 { 185 {
186 Vertex v = obj->vertex (i); 186 Vertex v = obj->vertex (i);
187 v.apply ([&](Axis, double& a) 187 v.apply ([&](Axis, double& a)
188 { 188 {
189 roundToDecimals (a, m_config->roundPositionPrecision()); 189 roundToDecimals (a, config::roundPositionPrecision());
190 }); 190 });
191 obj->setVertex (i, v); 191 obj->setVertex (i, v);
192 num += 3; 192 num += 3;
193 } 193 }
194 } 194 }
438 438
439 void AlgorithmToolset::splitLines() 439 void AlgorithmToolset::splitLines()
440 { 440 {
441 bool ok; 441 bool ok;
442 int numSegments = QInputDialog::getInt (m_window, APPNAME, "Amount of segments:", 442 int numSegments = QInputDialog::getInt (m_window, APPNAME, "Amount of segments:",
443 m_config->splitLinesSegments(), 0, std::numeric_limits<int>::max(), 1, &ok); 443 config::splitLinesSegments(), 0, std::numeric_limits<int>::max(), 1, &ok);
444 444
445 if (not ok) 445 if (not ok)
446 return; 446 return;
447 447
448 m_config->setSplitLinesSegments (numSegments); 448 config::setSplitLinesSegments (numSegments);
449 449
450 for (LDObject* obj : selectedObjects()) 450 for (LDObject* obj : selectedObjects())
451 { 451 {
452 if (not isOneOf (obj->type(), LDObjectType::EdgeLine, LDObjectType::ConditionalEdge)) 452 if (not isOneOf (obj->type(), LDObjectType::EdgeLine, LDObjectType::ConditionalEdge))
453 continue; 453 continue;
559 LDDocument* subfile = m_window->newDocument(); 559 LDDocument* subfile = m_window->newDocument();
560 subfile->setFullPath(fullSubfileName); 560 subfile->setFullPath(fullSubfileName);
561 subfile->header.description = subfileTitle; 561 subfile->header.description = subfileTitle;
562 subfile->header.type = LDHeader::Subpart; 562 subfile->header.type = LDHeader::Subpart;
563 subfile->header.name = LDDocument::shortenName(fullSubfileName); 563 subfile->header.name = LDDocument::shortenName(fullSubfileName);
564 subfile->header.author = format("%1 [%2]", m_config->defaultName(), m_config->defaultUser()); 564 subfile->header.author = format("%1 [%2]", config::defaultName(), config::defaultUser());
565 565
566 if (::config->useCaLicense()) 566 if (config::useCaLicense())
567 subfile->header.license = LDHeader::CaLicense; 567 subfile->header.license = LDHeader::CaLicense;
568 568
569 subfile->setWinding(currentDocument()->winding()); 569 subfile->setWinding(currentDocument()->winding());
570 570
571 // Copy the body over to the new document 571 // Copy the body over to the new document

mercurial