Mesh: change MeshSegmentAlgorithm::FindSegments to accept shared instead of raw pointers

This commit is contained in:
wmayer
2020-03-03 12:20:42 +01:00
committed by Bernd Hahnebach
parent 4b77f9f3ac
commit a031816de2
8 changed files with 34 additions and 23 deletions

View File

@@ -83,23 +83,23 @@ void Segmentation::accept()
MeshCore::MeshCurvature meshCurv(kernel);
meshCurv.ComputePerVertex();
std::vector<MeshCore::MeshSurfaceSegment*> segm;
std::vector<MeshCore::MeshSurfaceSegmentPtr> segm;
if (ui->groupBoxFree->isChecked()) {
segm.push_back(new MeshCore::MeshCurvatureFreeformSegment
segm.emplace_back(new MeshCore::MeshCurvatureFreeformSegment
(meshCurv.GetCurvature(), ui->numFree->value(),
ui->tol1Free->value(), ui->tol2Free->value(),
ui->crv1Free->value(), ui->crv2Free->value()));
}
if (ui->groupBoxCyl->isChecked()) {
segm.push_back(new MeshCore::MeshCurvatureCylindricalSegment
segm.emplace_back(new MeshCore::MeshCurvatureCylindricalSegment
(meshCurv.GetCurvature(), ui->numCyl->value(), ui->tol1Cyl->value(), ui->tol2Cyl->value(), ui->crvCyl->value()));
}
if (ui->groupBoxSph->isChecked()) {
segm.push_back(new MeshCore::MeshCurvatureSphericalSegment
segm.emplace_back(new MeshCore::MeshCurvatureSphericalSegment
(meshCurv.GetCurvature(), ui->numSph->value(), ui->tolSph->value(), ui->crvSph->value()));
}
if (ui->groupBoxPln->isChecked()) {
segm.push_back(new MeshCore::MeshCurvaturePlanarSegment
segm.emplace_back(new MeshCore::MeshCurvaturePlanarSegment
(meshCurv.GetCurvature(), ui->numPln->value(), ui->tolPln->value()));
}
finder.FindSegments(segm);
@@ -114,7 +114,7 @@ void Segmentation::accept()
std::string labelname = "Segments ";
labelname += myMesh->Label.getValue();
group->Label.setValue(labelname);
for (std::vector<MeshCore::MeshSurfaceSegment*>::iterator it = segm.begin(); it != segm.end(); ++it) {
for (std::vector<MeshCore::MeshSurfaceSegmentPtr>::iterator it = segm.begin(); it != segm.end(); ++it) {
const std::vector<MeshCore::MeshSegment>& data = (*it)->GetSegments();
for (std::vector<MeshCore::MeshSegment>::const_iterator jt = data.begin(); jt != data.end(); ++jt) {
Mesh::MeshObject* segment = mesh->meshFromSegment(*jt);
@@ -128,7 +128,6 @@ void Segmentation::accept()
label << feaSegm->Label.getValue() << " (" << (*it)->GetType() << ")";
feaSegm->Label.setValue(label.str());
}
delete (*it);
}
document->commitTransaction();
}