Commit 3abbc5b4 authored by Jan Möbius's avatar Jan Möbius
Browse files

Use ranges for Object Iteration to simplify code

parent 91b2031a
......@@ -114,7 +114,7 @@ initializePlugin()
void MeshRepairPlugin::slotRemoveSelectedVal3Vertices() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH )) )
removeSelectedVal3Vertices(o_it->id());
emit updateView();
......@@ -124,7 +124,7 @@ void MeshRepairPlugin::slotRemoveSelectedVal3Vertices() {
void MeshRepairPlugin::slotRemoveSelectedEdges(){
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH )) )
removeSelectedEdges(o_it->id());
emit updateView();
......@@ -134,7 +134,7 @@ void MeshRepairPlugin::slotRemoveSelectedEdges(){
void MeshRepairPlugin::slotDetectSkinnyTriangleByAngle()
{
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
detectSkinnyTriangleByAngle( o_it->id(), tool_->capAngleSpinbox->value(), false );
emit updateView();
......@@ -145,7 +145,7 @@ void MeshRepairPlugin::slotDetectSkinnyTriangleByAngle()
void MeshRepairPlugin::slotRemoveSkinnyTriangleByAngle()
{
//rewrite!!!
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
detectSkinnyTriangleByAngle( o_it->id(), tool_->capAngleSpinbox->value(), true );
emit updateView();
......@@ -155,7 +155,7 @@ void MeshRepairPlugin::slotRemoveSkinnyTriangleByAngle()
void MeshRepairPlugin::slotDetectFoldover() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
detectFoldover(o_it->id(), tool_->detectFoldoverSpinbox->value());
emit updateView();
......@@ -165,7 +165,7 @@ void MeshRepairPlugin::slotDetectFoldover() {
void MeshRepairPlugin::slotDetectTriangleAspect() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
detectTriangleAspect(o_it->id(), tool_->triangleAspectSpinbox->value());
emit updateView();
......@@ -175,7 +175,7 @@ void MeshRepairPlugin::slotDetectTriangleAspect() {
void MeshRepairPlugin::slotFlipOrientation(){
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
flipOrientation(o_it->id());
emit updateView();
......@@ -186,7 +186,7 @@ void MeshRepairPlugin::slotFlipOrientation(){
void MeshRepairPlugin::slotFixMesh() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH )) )
fixMesh(o_it->id() , tool_->fixMeshBox->value() );
emit updateView();
......@@ -196,7 +196,7 @@ void MeshRepairPlugin::slotFixMesh() {
//-----------------------------------------------------------------------------
void MeshRepairPlugin::slotUpdateVertexNormals() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
updateVertexNormals(o_it->id());
emit updateView();
......@@ -205,7 +205,7 @@ void MeshRepairPlugin::slotUpdateVertexNormals() {
//-----------------------------------------------------------------------------
void MeshRepairPlugin::slotUpdateFaceNormals() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
updateFaceNormals(o_it->id());
emit updateView();
......@@ -214,7 +214,7 @@ void MeshRepairPlugin::slotUpdateFaceNormals() {
//-----------------------------------------------------------------------------
void MeshRepairPlugin::slotUpdateHalfedgeNormals() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
updateHalfedgeNormals(o_it->id());
emit updateView();
......@@ -223,7 +223,7 @@ void MeshRepairPlugin::slotUpdateHalfedgeNormals() {
//-----------------------------------------------------------------------------
void MeshRepairPlugin::slotUpdateNormals(){
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
updateNormals(o_it->id());
emit updateView();
......@@ -234,7 +234,7 @@ void MeshRepairPlugin::slotUpdateNormals(){
void MeshRepairPlugin::slotDetectEdgesShorter(){
double length = tool_->edgeSpin->value();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
selectEdgesShorterThan(o_it->id(),length);
emit updateView();
......@@ -245,7 +245,7 @@ void MeshRepairPlugin::slotDetectEdgesShorter(){
void MeshRepairPlugin::slotDetectEdgesLonger(){
double length = tool_->edgeSpin->value();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
selectEdgesLongerThan(o_it->id(),length);
emit updateView();
......@@ -256,7 +256,7 @@ void MeshRepairPlugin::slotDetectEdgesLonger(){
void MeshRepairPlugin::slotDetectFlatValence3Vertices() {
double angle = tool_->valenceThreeSpinbox->value();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
detectFlatValence3Vertices(o_it->id(), angle);
emit updateView();
......@@ -267,7 +267,7 @@ void MeshRepairPlugin::slotDetectFlatValence3Vertices() {
void MeshRepairPlugin::slotSnapBoundary()
{
double eps = tool_->snapBoundarySpinBox->value();
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
snapBoundary(o_it->id(), eps);
emit updateView();
}
......@@ -276,7 +276,7 @@ void MeshRepairPlugin::slotSnapBoundary()
void MeshRepairPlugin::slotFixNonManifoldVertices()
{
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
for (auto* o_it : PluginFunctions::objects(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH)) )
fixNonManifoldVertices(o_it->id());
emit updateView();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment