Dartit=map->phi1(d1);do{it=map->phi1(it);i++;}while(it!=d1);it=map->phi1(d2);do{it=map->phi1(it);j++;}while(it!=d2);if(i==j){map->mergeVolumes(d1,d2);mh->notifyConnectivityModification();}elseQMessageBox::information(0,"Attention","Selected faces should have the same number of edges");

}voidSurface_Modelisation_Plugin::flipBackEdge(MapHandlerGen*mhg){MapHandler<PFP2>*mh=static_cast<MapHandler<PFP2>*>(mhg);PFP2::MAP*map=mh->getMap();constMapParameters&p=h_parameterSet[mhg];if(p.edgeSelector&&!p.edgeSelector->getSelectedCells().empty()){conststd::vector<Dart>&edge=p.edgeSelector->getSelectedCells();map->flipBackEdge(edge[0]);mh->notifyConnectivityModification();}}/* ------------------- operations with faces ----------------------------*/voidSurface_Modelisation_Plugin::splitFace(MapHandlerGen*mhg){MapHandler<PFP2>*mh=static_cast<MapHandler<PFP2>*>(mhg);PFP2::MAP*map=mh->getMap();constMapParameters&p=h_parameterSet[mhg];if(p.vertexSelector&&!p.vertexSelector->getSelectedCells().empty()&&(p.vertexSelector->getSelectedCells().size()==2)){conststd::vector<Dart>&selectedDarts=p.vertexSelector->getSelectedCells();boolsameFace=false;Dartd=selectedDarts[0];Dartit=d;Dartit2;do{Darte=selectedDarts[1];it2=e;do{if(map->sameFace(it,it2)){sameFace=true;break;}it2=map->phi2(map->phi_1(it2));}while(it2!=e);if(sameFace)break;it=map->phi2(map->phi_1(it));}while(it!=d);if(sameFace){map->splitFace(it,it2);mh->notifyConnectivityModification();}elseQMessageBox::information(0,"Attention","Selected points don't belong to the same face");}elseQMessageBox::information(0,"Attention","To split a face select 2 points of the same face");}voidSurface_Modelisation_Plugin::mergeFaces(MapHandlerGen*mhg){MapHandler<PFP2>*mh=static_cast<MapHandler<PFP2>*>(mhg);PFP2::MAP*map=mh->getMap();constMapParameters&p=h_parameterSet[mhg];if(p.edgeSelector&&!p.edgeSelector->getSelectedCells().empty()){conststd::vector<Dart>&edge=p.edgeSelector->getSelectedCells();map->mergeFaces(edge[0]);mh->notifyConnectivityModification();}}

voidSurface_Modelisation_Plugin::sewFaces(MapHandlerGen*mhg){MapHandler<PFP2>*mh=static_cast<MapHandler<PFP2>*>(mhg);PFP2::MAP*map=mh->getMap();constMapParameters&p=h_parameterSet[mhg];if(p.edgeSelector&&!p.edgeSelector->getSelectedCells().empty()&&(p.edgeSelector->getSelectedCells().size()==2)){conststd::vector<Dart>&selectedDarts=p.edgeSelector->getSelectedCells();Dartd=selectedDarts[0];Darte=selectedDarts[1];if(map->isBoundaryEdge(d)&&map->isBoundaryEdge(e)){map->sewFaces(d,e);mh->notifyConnectivityModification();}elseQMessageBox::information(0,"Attention","One or two of selcted faces are already sewed with another face");}elseQMessageBox::information(0,"Attention","To sew faces select 2 edges which you want to connect");}voidSurface_Modelisation_Plugin::unsewFaces(MapHandlerGen*mhg){MapHandler<PFP2>*mh=static_cast<MapHandler<PFP2>*>(mhg);PFP2::MAP*map=mh->getMap();MapParameters&p=h_parameterSet[mhg];if(p.edgeSelector&&!p.edgeSelector->getSelectedCells().empty()){conststd::vector<Dart>&dart=p.edgeSelector->getSelectedCells();if(!map->isBoundaryEdge(dart[0])){Dartd=dart[0];PFP2::VEC3pos1=p.positionAttribute[d];PFP2::VEC3pos2=p.positionAttribute[map->phi1(d)];Darte=map->phi2(d);map->unsewFaces(dart[0]);p.positionAttribute[d]=pos1;p.positionAttribute[map->phi1(d)]=pos2;p.positionAttribute[e]=pos2;p.positionAttribute[map->phi1(e)]=pos1;mh->notifyConnectivityModification();mh->notifyAttributeModification(p.positionAttribute);}elseQMessageBox::information(0,"Attention","One or two of selcted faces are already unsewed");}}voidSurface_Modelisation_Plugin::extrudeFace(MapHandlerGen*mhg){MapHandler<PFP2>*mh=static_cast<MapHandler<PFP2>*>(mhg);PFP2::MAP*map=mh->getMap();MapParameters&p=h_parameterSet[mhg];if(p.faceSelector&&!p.faceSelector->getSelectedCells().empty()){conststd::vector<Dart>&selectedDart=p.faceSelector->getSelectedCells();Dartd=selectedDart[0];PFP2::REALdist=0;intn=0;Dartit=d;do{dist=dist+(p.positionAttribute[it]-p.positionAttribute[map->phi1(it)]).norm();it=map->phi1(it);n++;}while(it!=d);dist=dist/n;Algo::Surface::Modelisation::extrudeFace<PFP2>(*map,p.positionAttribute,d,dist);mh->notifyConnectivityModification();mh->notifyAttributeModification(p.positionAttribute);mh->updateBB(p.positionAttribute);}}voidSurface_Modelisation_Plugin::pathExtrudeFace(MapHandlerGen*mhg){MapHandler<PFP2>*mh=static_cast<MapHandler<PFP2>*>(mhg);PFP2::MAP*map=mh->getMap();MapParameters&p=h_parameterSet[mhg];