23179: EDF 11603 - Problem with extrusion when path is not well oriented

IPAL52909: TC7.7.0: edges selection provides incorrect nodes IDs
IPAL52895: TC7.7.0: Incorrect behaviour of the "Move Node" dialog.
IPAL52910: TC7.7.0: mesh is not updated at Apply click in Smoothing dialog
This commit is contained in:
eap 2015-10-07 18:06:26 +03:00
parent 67909c435c
commit a0880e7c36
9 changed files with 290 additions and 194 deletions

View File

@ -539,7 +539,7 @@ void SMESH_VisualObjDef::buildElemPrs()
//================================================================================= //=================================================================================
// function : GetEdgeNodes // function : GetEdgeNodes
// purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 ) // purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 0 )
//================================================================================= //=================================================================================
bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId, bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
const int theEdgeNum, const int theEdgeNum,
@ -556,11 +556,13 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
int nbNodes = anElem->NbCornerNodes(); int nbNodes = anElem->NbCornerNodes();
if ( theEdgeNum < 0 || theEdgeNum > 3 || (nbNodes != 3 && nbNodes != 4) || theEdgeNum > nbNodes ) if (( theEdgeNum < 0 || theEdgeNum > 3 ) ||
( nbNodes != 3 && nbNodes != 4 ) ||
( theEdgeNum >= nbNodes ))
return false; return false;
theNodeId1 = anElem->GetNode( theEdgeNum - 1 )->GetID(); theNodeId1 = anElem->GetNode( theEdgeNum )->GetID();
theNodeId2 = anElem->GetNode( theEdgeNum % nbNodes )->GetID(); theNodeId2 = anElem->GetNode(( theEdgeNum + 1 ) % nbNodes )->GetID();
return true; return true;
} }
@ -584,10 +586,9 @@ vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
//================================================================================= //=================================================================================
bool SMESH_VisualObjDef::IsValid() const bool SMESH_VisualObjDef::IsValid() const
{ {
//MESSAGE("SMESH_VisualObjDef::IsValid"); return ( GetNbEntities(SMDSAbs_0DElement) > 0 ||
return ( GetNbEntities(SMDSAbs_0DElement) > 0 || GetNbEntities(SMDSAbs_Ball ) > 0 ||
GetNbEntities(SMDSAbs_Ball ) > 0 || GetNbEntities(SMDSAbs_Edge ) > 0 ||
GetNbEntities(SMDSAbs_Edge ) > 0 ||
GetNbEntities(SMDSAbs_Face ) > 0 || GetNbEntities(SMDSAbs_Face ) > 0 ||
GetNbEntities(SMDSAbs_Volume ) > 0 || GetNbEntities(SMDSAbs_Volume ) > 0 ||
GetNbEntities(SMDSAbs_Node ) > 0 ); GetNbEntities(SMDSAbs_Node ) > 0 );
@ -597,59 +598,67 @@ bool SMESH_VisualObjDef::IsValid() const
// function : updateEntitiesFlags // function : updateEntitiesFlags
// purpose : Update entities flags // purpose : Update entities flags
//================================================================================= //=================================================================================
void SMESH_VisualObjDef::updateEntitiesFlags() { void SMESH_VisualObjDef::updateEntitiesFlags()
{
unsigned int tmp = myEntitiesState;
ClearEntitiesFlags();
unsigned int tmp = myEntitiesState; map<SMDSAbs_ElementType,int> entities = SMESH::GetEntitiesFromObject(this);
ClearEntitiesFlags();
map<SMDSAbs_ElementType,int> entities = SMESH::GetEntitiesFromObject(this);
if( myEntitiesCache[SMDSAbs_0DElement] != 0 || myEntitiesCache[SMDSAbs_0DElement] >= entities[SMDSAbs_0DElement] ) if( myEntitiesCache[SMDSAbs_0DElement] != 0 ||
myEntitiesState &= ~SMESH_Actor::e0DElements; myEntitiesCache[SMDSAbs_0DElement] >= entities[SMDSAbs_0DElement] )
myEntitiesState &= ~SMESH_Actor::e0DElements;
if( myEntitiesCache[SMDSAbs_Ball] != 0 || myEntitiesCache[SMDSAbs_Ball] >= entities[SMDSAbs_Ball] ) if( myEntitiesCache[SMDSAbs_Ball] != 0 ||
myEntitiesState &= ~SMESH_Actor::eBallElem; myEntitiesCache[SMDSAbs_Ball] >= entities[SMDSAbs_Ball] )
myEntitiesState &= ~SMESH_Actor::eBallElem;
if( myEntitiesCache[SMDSAbs_Edge] != 0 || myEntitiesCache[SMDSAbs_Edge] >= entities[SMDSAbs_Edge] ) if( myEntitiesCache[SMDSAbs_Edge] != 0 ||
myEntitiesState &= ~SMESH_Actor::eEdges; myEntitiesCache[SMDSAbs_Edge] >= entities[SMDSAbs_Edge] )
myEntitiesState &= ~SMESH_Actor::eEdges;
if( myEntitiesCache[SMDSAbs_Face] != 0 || myEntitiesCache[SMDSAbs_Face] >= entities[SMDSAbs_Face] ) if( myEntitiesCache[SMDSAbs_Face] != 0 ||
myEntitiesState &= ~SMESH_Actor::eFaces; myEntitiesCache[SMDSAbs_Face] >= entities[SMDSAbs_Face] )
myEntitiesState &= ~SMESH_Actor::eFaces;
if( myEntitiesCache[SMDSAbs_Volume] != 0 || myEntitiesCache[SMDSAbs_Volume] >= entities[SMDSAbs_Volume] ) if( myEntitiesCache[SMDSAbs_Volume] != 0 ||
myEntitiesState &= ~SMESH_Actor::eVolumes; myEntitiesCache[SMDSAbs_Volume] >= entities[SMDSAbs_Volume] )
myEntitiesState &= ~SMESH_Actor::eVolumes;
if( tmp != myEntitiesState ) { if( tmp != myEntitiesState ) {
myEntitiesFlag = true; myEntitiesFlag = true;
} }
myEntitiesCache = entities; myEntitiesCache = entities;
} }
//================================================================================= //=================================================================================
// function : ClearEntitiesFlags // function : ClearEntitiesFlags
// purpose : Clear the entities flags // purpose : Clear the entities flags
//================================================================================= //=================================================================================
void SMESH_VisualObjDef::ClearEntitiesFlags() { void SMESH_VisualObjDef::ClearEntitiesFlags()
myEntitiesState = SMESH_Actor::eAllEntity; {
myEntitiesFlag = false; myEntitiesState = SMESH_Actor::eAllEntity;
myEntitiesFlag = false;
} }
//================================================================================= //=================================================================================
// function : GetEntitiesFlag // function : GetEntitiesFlag
// purpose : Return the entities flag // purpose : Return the entities flag
//================================================================================= //=================================================================================
bool SMESH_VisualObjDef::GetEntitiesFlag() { bool SMESH_VisualObjDef::GetEntitiesFlag()
return myEntitiesFlag; {
return myEntitiesFlag;
} }
//================================================================================= //=================================================================================
// function : GetEntitiesState // function : GetEntitiesState
// purpose : Return the entities state // purpose : Return the entities state
//================================================================================= //=================================================================================
unsigned int SMESH_VisualObjDef::GetEntitiesState() { unsigned int SMESH_VisualObjDef::GetEntitiesState()
return myEntitiesState; {
return myEntitiesState;
} }
/* /*
@ -699,20 +708,20 @@ bool SMESH_MeshObj::Update( int theIsClear )
bool SMESH_MeshObj::NulData() bool SMESH_MeshObj::NulData()
{ {
MESSAGE ("SMESH_MeshObj::NulData() =================================================================================="); MESSAGE ("SMESH_MeshObj::NulData() ==================================================================================");
if (!myEmptyGrid) if (!myEmptyGrid)
{ {
myEmptyGrid = SMDS_UnstructuredGrid::New(); myEmptyGrid = SMDS_UnstructuredGrid::New();
myEmptyGrid->Initialize(); myEmptyGrid->Initialize();
myEmptyGrid->Allocate(); myEmptyGrid->Allocate();
vtkPoints* points = vtkPoints::New(); vtkPoints* points = vtkPoints::New();
points->SetNumberOfPoints(0); points->SetNumberOfPoints(0);
myEmptyGrid->SetPoints( points ); myEmptyGrid->SetPoints( points );
points->Delete(); points->Delete();
myEmptyGrid->BuildLinks(); myEmptyGrid->BuildLinks();
} }
myGrid->ShallowCopy(myEmptyGrid); myGrid->ShallowCopy(myEmptyGrid);
return true; return true;
} }
//================================================================================= //=================================================================================
// function : GetElemDimension // function : GetElemDimension

View File

@ -6389,7 +6389,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet theElements[2],
SMESH_MeshEditor_PathPoint PP2 = currList.front(); SMESH_MeshEditor_PathPoint PP2 = currList.front();
gp_Dir D1 = PP1.Tangent(); gp_Dir D1 = PP1.Tangent();
gp_Dir D2 = PP2.Tangent(); gp_Dir D2 = PP2.Tangent();
gp_Dir Dnew( ( D1.XYZ() + D2.XYZ() ) / 2 ); gp_Dir Dnew( D1.XYZ() + D2.XYZ() );
PP1.SetTangent(Dnew); PP1.SetTangent(Dnew);
fullList.push_back(PP1); fullList.push_back(PP1);
fullList.splice( fullList.end(), currList, ++currList.begin(), currList.end() ); fullList.splice( fullList.end(), currList, ++currList.begin(), currList.end() );
@ -6454,7 +6454,7 @@ SMESH_MeshEditor::MakeEdgePathPoints(std::list<double>& aPrms,
aL2 = aVec.SquareMagnitude(); aL2 = aVec.SquareMagnitude();
if ( aL2 < aTolVec2 ) if ( aL2 < aTolVec2 )
return EXTR_CANT_GET_TANGENT; return EXTR_CANT_GET_TANGENT;
gp_Dir aTgt( aVec ); gp_Dir aTgt( FirstIsStart ? aVec : -aVec );
aPP.SetPnt( aP3D ); aPP.SetPnt( aP3D );
aPP.SetTangent( aTgt ); aPP.SetTangent( aTgt );
aPP.SetParameter( aT ); aPP.SetParameter( aT );
@ -6479,9 +6479,11 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet theElemSets
const bool theMakeGroups) const bool theMakeGroups)
{ {
const int aNbTP = fullList.size(); const int aNbTP = fullList.size();
// Angles // Angles
if( theHasAngles && !theAngles.empty() && theLinearVariation ) if( theHasAngles && !theAngles.empty() && theLinearVariation )
LinearAngleVariation(aNbTP-1, theAngles); LinearAngleVariation(aNbTP-1, theAngles);
// fill vector of path points with angles // fill vector of path points with angles
vector<SMESH_MeshEditor_PathPoint> aPPs; vector<SMESH_MeshEditor_PathPoint> aPPs;
list<SMESH_MeshEditor_PathPoint>::iterator itPP = fullList.begin(); list<SMESH_MeshEditor_PathPoint>::iterator itPP = fullList.begin();
@ -6511,10 +6513,10 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet theElemSets
{ {
TIDSortedElemSet& theElements = theElemSets[ is2ndSet ]; TIDSortedElemSet& theElements = theElemSets[ is2ndSet ];
itElem = theElements.begin(); itElem = theElements.begin();
for ( ; itElem != theElements.end(); itElem++ ) { for ( ; itElem != theElements.end(); itElem++ )
{
const SMDS_MeshElement* elem = *itElem; const SMDS_MeshElement* elem = *itElem;
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
while ( itN->more() ) { while ( itN->more() ) {
const SMDS_MeshElement* node = itN->next(); const SMDS_MeshElement* node = itN->next();
if ( newNodes.insert( node ).second ) if ( newNodes.insert( node ).second )
@ -6528,19 +6530,15 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet theElemSets
// 4. Processing the elements // 4. Processing the elements
SMESHDS_Mesh* aMesh = GetMeshDS(); SMESHDS_Mesh* aMesh = GetMeshDS();
list<const SMDS_MeshNode*> emptyList;
setElemsFirst( theElemSets ); setElemsFirst( theElemSets );
for ( int is2ndSet = 0; is2ndSet < 2; ++is2ndSet ) for ( int is2ndSet = 0; is2ndSet < 2; ++is2ndSet )
{ {
TIDSortedElemSet& theElements = theElemSets[ is2ndSet ]; TIDSortedElemSet& theElements = theElemSets[ is2ndSet ];
for ( itElem = theElements.begin(); itElem != theElements.end(); itElem++ ) { for ( itElem = theElements.begin(); itElem != theElements.end(); itElem++ )
// check element type {
const SMDS_MeshElement* elem = *itElem; const SMDS_MeshElement* elem = *itElem;
if ( !elem )
continue;
// SMDSAbs_ElementType aTypeE = elem->GetType();
// if ( aTypeE != SMDSAbs_Face && aTypeE != SMDSAbs_Edge )
// continue;
vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ]; vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
newNodesItVec.reserve( elem->NbNodes() ); newNodesItVec.reserve( elem->NbNodes() );
@ -6552,13 +6550,11 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet theElemSets
{ {
++nodeIndex; ++nodeIndex;
// check if a node has been already processed // check if a node has been already processed
const SMDS_MeshNode* node = const SMDS_MeshNode* node = cast2Node( itN->next() );
static_cast<const SMDS_MeshNode*>( itN->next() ); TNodeOfNodeListMap::iterator nIt = mapNewNodes.insert( make_pair( node, emptyList )).first;
TNodeOfNodeListMap::iterator nIt = mapNewNodes.find( node ); list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
if ( nIt == mapNewNodes.end() ) { if ( listNewNodes.empty() )
nIt = mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first; {
list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
// make new nodes // make new nodes
Standard_Real aAngle1x, aAngleT1T0, aTolAng; Standard_Real aAngle1x, aAngleT1T0, aTolAng;
gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x; gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x;
@ -6573,7 +6569,6 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet theElemSets
const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0]; const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0];
aP0x = aPP0.Pnt(); aP0x = aPP0.Pnt();
aDT0x= aPP0.Tangent(); aDT0x= aPP0.Tangent();
//cout<<"j = 0 PP: Pnt("<<aP0x.X()<<","<<aP0x.Y()<<","<<aP0x.Z()<<")"<<endl;
for ( int j = 1; j < aNbTP; ++j ) { for ( int j = 1; j < aNbTP; ++j ) {
const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j]; const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j];
@ -6592,7 +6587,8 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet theElemSets
// rotation 1 [ T1,T0 ] // rotation 1 [ T1,T0 ]
aAngleT1T0=-aDT1x.Angle( aDT0x ); aAngleT1T0=-aDT1x.Angle( aDT0x );
if (fabs(aAngleT1T0) > aTolAng) { if (fabs(aAngleT1T0) > aTolAng)
{
aDT1T0=aDT1x^aDT0x; aDT1T0=aDT1x^aDT0x;
anAxT1T0.SetLocation( aV1x ); anAxT1T0.SetLocation( aV1x );
anAxT1T0.SetDirection( aDT1T0 ); anAxT1T0.SetDirection( aDT1T0 );
@ -6611,13 +6607,11 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet theElemSets
} }
// make new node // make new node
//MESSAGE("elem->IsQuadratic " << elem->IsQuadratic() << " " << elem->IsMediumNode(node)); if ( elem->IsQuadratic() && !elem->IsMediumNode(node) )
if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) { {
// create additional node // create additional node
double x = ( aPN1.X() + aPN0.X() )/2.; gp_XYZ midP = 0.5 * ( aPN1.XYZ() + aPN0.XYZ() );
double y = ( aPN1.Y() + aPN0.Y() )/2.; const SMDS_MeshNode* newNode = aMesh->AddNode( midP.X(), midP.Y(), midP.Z() );
double z = ( aPN1.Z() + aPN0.Z() )/2.;
const SMDS_MeshNode* newNode = aMesh->AddNode(x,y,z);
myLastCreatedNodes.Append(newNode); myLastCreatedNodes.Append(newNode);
srcNodes.Append( node ); srcNodes.Append( node );
listNewNodes.push_back( newNode ); listNewNodes.push_back( newNode );
@ -6633,42 +6627,40 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet theElemSets
aDT0x = aDT1x; aDT0x = aDT1x;
} }
} }
else if( elem->IsQuadratic() && !elem->IsMediumNode(node) )
else { {
// if current elem is quadratic and current node is not medium // if current elem is quadratic and current node is not medium
// we have to check - may be it is needed to insert additional nodes // we have to check - may be it is needed to insert additional nodes
if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) { list< const SMDS_MeshNode* > & listNewNodes = nIt->second;
list< const SMDS_MeshNode* > & listNewNodes = nIt->second; if ( listNewNodes.size() == aNbTP-1 )
if(listNewNodes.size()==aNbTP-1) { {
vector<const SMDS_MeshNode*> aNodes(2*(aNbTP-1)); vector<const SMDS_MeshNode*> aNodes(2*(aNbTP-1));
gp_XYZ P(node->X(), node->Y(), node->Z()); gp_XYZ P(node->X(), node->Y(), node->Z());
list< const SMDS_MeshNode* >::iterator it = listNewNodes.begin(); list< const SMDS_MeshNode* >::iterator it = listNewNodes.begin();
int i; int i;
for(i=0; i<aNbTP-1; i++) { for(i=0; i<aNbTP-1; i++) {
const SMDS_MeshNode* N = *it; const SMDS_MeshNode* N = *it;
double x = ( N->X() + P.X() )/2.; double x = ( N->X() + P.X() )/2.;
double y = ( N->Y() + P.Y() )/2.; double y = ( N->Y() + P.Y() )/2.;
double z = ( N->Z() + P.Z() )/2.; double z = ( N->Z() + P.Z() )/2.;
const SMDS_MeshNode* newN = aMesh->AddNode(x,y,z); const SMDS_MeshNode* newN = aMesh->AddNode(x,y,z);
srcNodes.Append( node ); srcNodes.Append( node );
myLastCreatedNodes.Append(newN); myLastCreatedNodes.Append(newN);
aNodes[2*i] = newN; aNodes[2*i] = newN;
aNodes[2*i+1] = N; aNodes[2*i+1] = N;
P = gp_XYZ(N->X(),N->Y(),N->Z()); P = gp_XYZ(N->X(),N->Y(),N->Z());
} }
listNewNodes.clear(); listNewNodes.clear();
for(i=0; i<2*(aNbTP-1); i++) { for(i=0; i<2*(aNbTP-1); i++) {
listNewNodes.push_back(aNodes[i]); listNewNodes.push_back(aNodes[i]);
}
} }
} }
} }
newNodesItVec.push_back( nIt ); newNodesItVec.push_back( nIt );
} }
// make new elements // make new elements
//sweepElement( aMesh, elem, newNodesItVec, newElemsMap[elem],
// newNodesItVec[0]->second.size(), myLastCreatedElems );
sweepElement( elem, newNodesItVec, newElemsMap[elem], aNbTP-1, srcElems ); sweepElement( elem, newNodesItVec, newElemsMap[elem], aNbTP-1, srcElems );
} }
} }

View File

@ -826,7 +826,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QPushButton* button
if (!myPath->_is_nil()) { if (!myPath->_is_nil()) {
SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPath); SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPath);
if (aPathActor) { if (aPathActor) {
SMESH::SetPointRepresentation(true); aPathActor->SetPointRepresentation( true );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection); aViewWindow->SetSelectionMode(NodeSelection);
SMESH::SetPickable(aPathActor); SMESH::SetPickable(aPathActor);

View File

@ -1827,6 +1827,8 @@ void SMESHGUI_GroupDlg::onAdd()
if (aNbSel == 0 || myActorsList.count() == 0 || myMesh->_is_nil()) return; if (aNbSel == 0 || myActorsList.count() == 0 || myMesh->_is_nil()) return;
SUIT_OverrideCursor wc;
myIsBusy = true; myIsBusy = true;
int sizeBefore = myElements->count(); int sizeBefore = myElements->count();

View File

@ -326,7 +326,8 @@ void SMESHGUI_MakeNodeAtPointDlg::ConstructorsClicked (int constructorId)
myDestDX->hide(); myDestDX->hide();
myDestDY->hide(); myDestDY->hide();
myDestDZ->hide(); myDestDZ->hide();
if (myNodeToMoveGrp->isVisible()) {myNodeToMoveGrp->hide();} if (myNodeToMoveGrp->isVisible()) myNodeToMoveGrp->hide();
myDestBtn->setChecked( true );
break; break;
} }
} }
@ -356,14 +357,15 @@ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp()
myDestCoordChanged = true; myDestCoordChanged = true;
// connect signals and slots // connect signals and slots
connect(myDlg->myDestinationX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); connect(myDlg->myDestinationX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myDlg->myDestinationY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); connect(myDlg->myDestinationY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myDlg->myDestinationZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); connect(myDlg->myDestinationZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
connect(myDlg->myDestDX, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); connect(myDlg->myDestDX, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
connect(myDlg->myDestDY, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); connect(myDlg->myDestDY, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
connect(myDlg->myDestDZ, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged())); connect(myDlg->myDestDZ, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview())); connect(myDlg->myId, SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview()));
connect(myDlg->myPreviewChkBox, SIGNAL (toggled(bool)),SLOT(redisplayPreview())); connect(myDlg->myPreviewChkBox, SIGNAL (toggled(bool)), SLOT(redisplayPreview()));
connect(myDlg->myButtonGroup, SIGNAL (buttonClicked(int)), SLOT(redisplayPreview()));
// IPAL22913: TC6.5.0: selected in "Move node" dialog box node is not highlighted // IPAL22913: TC6.5.0: selected in "Move node" dialog box node is not highlighted
// note: this slot seems to be lost together with removed obsolete SMESHGUI_MoveNodesDlg class // note: this slot seems to be lost together with removed obsolete SMESHGUI_MoveNodesDlg class
@ -440,13 +442,6 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation()
myDlg->show(); myDlg->show();
onSelectionDone(); // init myMeshActor onSelectionDone(); // init myMeshActor
if ( myMeshActor ) {
// myMeshActor->SetRepresentation( VTK_WIREFRAME );
myMeshActor->SetPointRepresentation(true);
SMESH::RepaintCurrentView();
redisplayPreview();
}
} }
//================================================================================= //=================================================================================
@ -604,6 +599,8 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
{ {
if ( !myDlg->isVisible() || !myDlg->isEnabled() ) if ( !myDlg->isVisible() || !myDlg->isEnabled() )
return; return;
myNoPreview = true;
try { try {
SALOME_ListIO aList; SALOME_ListIO aList;
selectionMgr()->selectedObjects(aList, SVTK_Viewer::Type()); selectionMgr()->selectedObjects(aList, SVTK_Viewer::Type());
@ -612,6 +609,10 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
Handle(SALOME_InteractiveObject) anIO = aList.First(); Handle(SALOME_InteractiveObject) anIO = aList.First();
SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry()); SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
if (( myDlg->myIdBtn->isChecked() && myDlg->myIdBtn->isEnabled() ) ||
( !myDlg->myNodeToMoveGrp->isVisible() ))
myMeshActor = aMeshActor;
if (!aMeshActor) { // coord by geom if (!aMeshActor) { // coord by geom
if ( myDlg->myDestBtn->isChecked() ) { if ( myDlg->myDestBtn->isChecked() ) {
GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO); GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
@ -620,63 +621,56 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone()
if ( GEOMBase::GetShape(geom, aShape) && if ( GEOMBase::GetShape(geom, aShape) &&
aShape.ShapeType() == TopAbs_VERTEX ) { aShape.ShapeType() == TopAbs_VERTEX ) {
gp_Pnt P = BRep_Tool::Pnt(aShape); gp_Pnt P = BRep_Tool::Pnt(aShape);
myNoPreview = true;
myDlg->myDestinationX->SetValue(P.X()); myDlg->myDestinationX->SetValue(P.X());
myDlg->myDestinationY->SetValue(P.Y()); myDlg->myDestinationY->SetValue(P.Y());
myDlg->myDestinationZ->SetValue(P.Z()); myDlg->myDestinationZ->SetValue(P.Z());
myNoPreview = false;
redisplayPreview();
} }
} }
myNoPreview = false;
redisplayPreview();
return; return;
} }
} }
if ( !myMeshActor )
myMeshActor = aMeshActor;
QString aString; QString aString;
int nbElems = SMESH::GetNameOfSelectedElements(selector(),anIO, aString); int nbElems = SMESH::GetNameOfSelectedElements(selector(),anIO, aString);
if (nbElems == 1) { if (nbElems == 1) {
if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) { if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) {
if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) { if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) {
myNoPreview = true;
if ( myDlg->myDestBtn->isChecked() ) { // set coord if ( myDlg->myDestBtn->isChecked() ) { // set coord
myDlg->myDestinationX->SetValue(aNode->X()); myDlg->myDestinationX->SetValue(aNode->X());
myDlg->myDestinationY->SetValue(aNode->Y()); myDlg->myDestinationY->SetValue(aNode->Y());
myDlg->myDestinationZ->SetValue(aNode->Z()); myDlg->myDestinationZ->SetValue(aNode->Z());
myNoPreview = false;
redisplayPreview();
} }
else if ( myDlg->myIdBtn->isChecked() && else if ( myDlg->myIdBtn->isChecked() &&
myDlg->myIdBtn->isEnabled() ) { // set node to move myDlg->myIdBtn->isEnabled() ) { // set node to move
myDlg->myId->setText(aString); myDlg->myId->setText(aString);
myNoPreview = false; myDlg->myCurrentX->SetValue( aNode->X() );
myDlg->myCurrentY->SetValue( aNode->Y() );
myDlg->myCurrentZ->SetValue( aNode->Z() );
redisplayPreview(); redisplayPreview();
} }
if (const SMDS_MeshNode* aCurrentNode = aMesh->FindNode(myDlg->myId->text().toInt())) { double x = myDlg->myCurrentX->GetValue();
double x = aCurrentNode->X(); double y = myDlg->myCurrentY->GetValue();
double y = aCurrentNode->Y(); double z = myDlg->myCurrentZ->GetValue();
double z = aCurrentNode->Z(); double dx = myDlg->myDestinationX->GetValue() - x;
double dx = myDlg->myDestinationX->GetValue() - x; double dy = myDlg->myDestinationY->GetValue() - y;
double dy = myDlg->myDestinationY->GetValue() - y; double dz = myDlg->myDestinationZ->GetValue() - z;
double dz = myDlg->myDestinationZ->GetValue() - z; myDlg->myDestDX->SetValue(dx);
myDlg->myCurrentX->SetValue(x); myDlg->myDestDY->SetValue(dy);
myDlg->myCurrentY->SetValue(y); myDlg->myDestDZ->SetValue(dz);
myDlg->myCurrentZ->SetValue(z); myDlg->myDestDX->setReadOnly(false);
myDlg->myDestDX->SetValue(dx); myDlg->myDestDY->setReadOnly(false);
myDlg->myDestDY->SetValue(dy); myDlg->myDestDZ->setReadOnly(false);
myDlg->myDestDZ->SetValue(dz);
myDlg->myDestDX->setReadOnly(false);
myDlg->myDestDY->setReadOnly(false);
myDlg->myDestDZ->setReadOnly(false);
}
} }
} }
} }
} catch (...) { } catch (...) {
} }
myNoPreview = false;
redisplayPreview();
} }
//================================================================================ //================================================================================
@ -696,7 +690,7 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
bool moveShown = false; bool moveShown = false;
if ( myMeshActor) if ( myMeshActor)
{ {
const bool isPreview = myDlg->myPreviewChkBox->isChecked(); const bool isPreview = myDlg->myPreviewChkBox->isChecked();
const bool isMoveNode = myDlg->myRButMoveWithoutNode->isChecked(); const bool isMoveNode = myDlg->myRButMoveWithoutNode->isChecked();
QString msg; QString msg;
if ( isValid( msg ) ) if ( isValid( msg ) )
@ -725,22 +719,28 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
myDlg->myDestinationX->SetValue(x); myDlg->myDestinationX->SetValue(x);
myDlg->myDestinationY->SetValue(y); myDlg->myDestinationY->SetValue(y);
myDlg->myDestinationZ->SetValue(z); myDlg->myDestinationZ->SetValue(z);
}
if ( myDestCoordChanged ) {
dx = myDlg->myDestinationX->GetValue() - x;
dy = myDlg->myDestinationY->GetValue() - y;
dz = myDlg->myDestinationZ->GetValue() - z;
myDlg->myDestDX->SetValue(dx); myDlg->myDestDX->SetValue(dx);
myDlg->myDestDY->SetValue(dy); myDlg->myDestDY->SetValue(dy);
myDlg->myDestDZ->SetValue(dz); myDlg->myDestDZ->SetValue(dz);
} }
else { else
dx = myDlg->myDestDX->GetValue() + x; {
dy = myDlg->myDestDY->GetValue() + y; if ( myDestCoordChanged ) {
dz = myDlg->myDestDZ->GetValue() + z; dx = myDlg->myDestinationX->GetValue() - x;
myDlg->myDestinationX->SetValue(dx); dy = myDlg->myDestinationY->GetValue() - y;
myDlg->myDestinationY->SetValue(dy); dz = myDlg->myDestinationZ->GetValue() - z;
myDlg->myDestinationZ->SetValue(dz); myDlg->myDestDX->SetValue(dx);
myDlg->myDestDY->SetValue(dy);
myDlg->myDestDZ->SetValue(dz);
}
else {
dx = myDlg->myDestDX->GetValue() + x;
dy = myDlg->myDestDY->GetValue() + y;
dz = myDlg->myDestDZ->GetValue() + z;
myDlg->myDestinationX->SetValue(dx);
myDlg->myDestinationY->SetValue(dy);
myDlg->myDestinationZ->SetValue(dz);
}
} }
myDlg->myCurrentX->SetValue(x); myDlg->myCurrentX->SetValue(x);
myDlg->myCurrentY->SetValue(y); myDlg->myCurrentY->SetValue(y);
@ -878,7 +878,7 @@ void SMESHGUI_MakeNodeAtPointOp::onTextChange( const QString& theText )
void SMESHGUI_MakeNodeAtPointOp::activateSelection() void SMESHGUI_MakeNodeAtPointOp::activateSelection()
{ {
selectionMgr()->clearFilters(); selectionMgr()->clearFilters();
SMESH::SetPointRepresentation(false); SMESH::SetPointRepresentation( true );
selectionMgr()->installFilter( myFilter ); selectionMgr()->installFilter( myFilter );
setSelectionMode( NodeSelection ); setSelectionMode( NodeSelection );
} }

View File

@ -406,10 +406,11 @@ bool SMESHGUI_SmoothingDlg::ClickOnApply()
if (aResult) { if (aResult) {
SMESH::Update(myIO, SMESH::eDisplay); SMESH::Update(myIO, SMESH::eDisplay);
SMESH::RepaintCurrentView();
SMESHGUI::Modified(); SMESHGUI::Modified();
//Init(); //Init();
mySelectedObject = SMESH::SMESH_IDSource::_nil(); //mySelectedObject = SMESH::SMESH_IDSource::_nil();
} }
} }

View File

@ -390,7 +390,8 @@ namespace
BranchIterator(const std::vector<const TVDEdge*> & edges, int i ) BranchIterator(const std::vector<const TVDEdge*> & edges, int i )
:_i( i ), _size( edges.size() ), _edges( edges ) :_i( i ), _size( edges.size() ), _edges( edges )
{ {
_closed = ( edges[0]->vertex1() == edges.back()->vertex0() ); // closed branch _closed = ( edges[0]->vertex1() == edges.back()->vertex0() || // closed branch
edges[0]->vertex0() == edges.back()->vertex1() );
} }
const TVDEdge* operator++() { ++_i; return edge(); } const TVDEdge* operator++() { ++_i; return edge(); }
const TVDEdge* operator--() { --_i; return edge(); } const TVDEdge* operator--() { --_i; return edge(); }
@ -1031,14 +1032,16 @@ namespace
{ {
branchID = bndSegs[i]._prev->_branchID; // with sign branchID = bndSegs[i]._prev->_branchID; // with sign
} }
else if ( bndSegs[i]._edge && // 1st bndSeg of a WIRE else if ( bndSegs[i]._edge ) // 1st bndSeg of a WIRE
bndSegs[i]._inSeg->isConnected( bndSegs[i]._edge ))
{ {
branchEdges.resize(( branchID = branchEdges.size()) + 1 ); branchEdges.resize(( branchID = branchEdges.size()) + 1 );
if ( bndSegs[i]._inSeg->point0() == bndSegs[i]._edge->vertex1() ) if ( bndSegs[i]._inSeg->isConnected( bndSegs[i]._edge ))
endType.insert( make_pair( bndSegs[i]._edge->vertex1(), SMESH_MAT2d::BE_ON_VERTEX )); {
else if ( bndSegs[i]._inSeg->point0() == bndSegs[i]._edge->vertex1() )
endType.insert( make_pair( bndSegs[i]._edge->vertex0(), SMESH_MAT2d::BE_ON_VERTEX )); endType.insert( make_pair( bndSegs[i]._edge->vertex1(), SMESH_MAT2d::BE_ON_VERTEX ));
else
endType.insert( make_pair( bndSegs[i]._edge->vertex0(), SMESH_MAT2d::BE_ON_VERTEX ));
}
} }
bndSegs[i].setBranch( branchID, bndSegsPerEdge ); // set to i-th and to the opposite bndSeg bndSegs[i].setBranch( branchID, bndSegsPerEdge ); // set to i-th and to the opposite bndSeg
@ -1398,6 +1401,21 @@ bool SMESH_MAT2d::Boundary::getBranchPoint( const std::size_t iEdge,
return true; return true;
} }
//================================================================================
/*!
* \brief Returns a BranchPoint corresponding to a given BoundaryPoint on a geom EDGE
* \param [in] bp - the BoundaryPoint
* \param [out] p - the found BranchPoint
* \return bool - is OK
*/
//================================================================================
bool SMESH_MAT2d::Boundary::getBranchPoint( const BoundaryPoint& bp,
BranchPoint& p ) const
{
return getBranchPoint( bp._edgeIndex, bp._param, p );
}
//================================================================================ //================================================================================
/*! /*!
* \brief Check if a given boundary segment is a null-length segment on a concave * \brief Check if a given boundary segment is a null-length segment on a concave

View File

@ -82,7 +82,8 @@ namespace SMESH_MAT2d
std::size_t _iEdge; // MA edge index within the branch std::size_t _iEdge; // MA edge index within the branch
double _edgeParam; // normalized param within the MA edge double _edgeParam; // normalized param within the MA edge
BranchPoint(): _branch(0), _iEdge(0), _edgeParam(-1) {} BranchPoint( const Branch* b = 0, std::size_t e = 0, double u = -1 ):
_branch(b), _iEdge(e), _edgeParam(u) {}
}; };
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
/*! /*!
@ -180,6 +181,8 @@ namespace SMESH_MAT2d
bool getBranchPoint( const std::size_t iEdge, double u, BranchPoint& p ) const; bool getBranchPoint( const std::size_t iEdge, double u, BranchPoint& p ) const;
bool getBranchPoint( const BoundaryPoint& bp, BranchPoint& p ) const;
bool isConcaveSegment( std::size_t iEdge, std::size_t iSeg ) const; bool isConcaveSegment( std::size_t iEdge, std::size_t iSeg ) const;
bool moveToClosestEdgeEnd( BoundaryPoint& bp ) const; bool moveToClosestEdgeEnd( BoundaryPoint& bp ) const;

View File

@ -1031,6 +1031,9 @@ namespace
TMAPar2NPoints & thePointsOnE, TMAPar2NPoints & thePointsOnE,
SinuousFace& theSinuFace) SinuousFace& theSinuFace)
{ {
if ( theDivPoints.empty() )
return true;
SMESHDS_Mesh* meshDS = theHelper.GetMeshDS(); SMESHDS_Mesh* meshDS = theHelper.GetMeshDS();
const vector< TopoDS_Edge >& theSinuEdges = theSinuFace._sinuEdges; const vector< TopoDS_Edge >& theSinuEdges = theSinuFace._sinuEdges;
const vector< Handle(Geom_Curve) >& theCurves = theSinuFace._sinuCurves; const vector< Handle(Geom_Curve) >& theCurves = theSinuFace._sinuCurves;
@ -1059,12 +1062,28 @@ namespace
findVertexAndNode( np1, theSinuEdges, meshDS ); findVertexAndNode( np1, theSinuEdges, meshDS );
thePointsOnE.insert( make_pair( 1.1, make_pair( np0, np1))); thePointsOnE.insert( make_pair( 1.1, make_pair( np0, np1)));
} }
else
{
// project a VERTEX of outer sinuous side corresponding to branch(0.)
// which is not included into theDivPoints
if ( ! ( theDivPoints[0]._iEdge == 0 &&
theDivPoints[0]._edgeParam == 0. )) // recursive call
{
SMESH_MAT2d::BranchPoint brp( &branch, 0, 0 );
vector< SMESH_MAT2d::BranchPoint > divPoint( 1, brp );
vector< std::size_t > edgeIDs1(2), edgeIDs2(2);
edgeIDs1[0] = theEdgeIDs1.back();
edgeIDs1[1] = theEdgeIDs1[0];
edgeIDs2[0] = theEdgeIDs2.back();
edgeIDs2[1] = theEdgeIDs2[0];
projectVertices( theHelper, theMA, divPoint, edgeIDs1, edgeIDs2,
theIsEdgeComputed, thePointsOnE, theSinuFace );
}
}
// project theDivPoints // project theDivPoints
if ( theDivPoints.empty() ) TMAPar2NPoints::iterator u2NP;
return true;
for ( size_t i = 0; i < theDivPoints.size(); ++i ) for ( size_t i = 0; i < theDivPoints.size(); ++i )
{ {
if ( !branch.getParameter( theDivPoints[i], uMA )) if ( !branch.getParameter( theDivPoints[i], uMA ))
@ -1080,15 +1099,32 @@ namespace
findVertexAndNode( np[0], theSinuEdges, meshDS, theEdgeIDs1[i], theEdgeIDs1[i+1] ), findVertexAndNode( np[0], theSinuEdges, meshDS, theEdgeIDs1[i], theEdgeIDs1[i+1] ),
findVertexAndNode( np[1], theSinuEdges, meshDS, theEdgeIDs2[i], theEdgeIDs2[i+1] ) findVertexAndNode( np[1], theSinuEdges, meshDS, theEdgeIDs2[i], theEdgeIDs2[i+1] )
}; };
const size_t iVert = isVertex[0] ? 0 : 1; // side with a VERTEX
const size_t iNode = 1 - iVert; // opposite (meshed?) side
TMAPar2NPoints::iterator u2NP = if ( isVertex[0] != isVertex[1] ) // try to find an opposite VERTEX
thePointsOnE.insert( make_pair( uMA, make_pair( np[0], np[1])));//.first; {
theMA.getBoundary().moveToClosestEdgeEnd( bp[iNode] ); // EDGE -> VERTEX
SMESH_MAT2d::BranchPoint brp;
theMA.getBoundary().getBranchPoint( bp[iNode], brp ); // WIRE -> MA
SMESH_MAT2d::BoundaryPoint bp2[2];
branch.getBoundaryPoints( brp, bp2[0], bp2[1] ); // MA -> WIRE
NodePoint np2[2] = { NodePoint( bp2[0]), NodePoint( bp2[1]) };
findVertexAndNode( np2[0], theSinuEdges, meshDS );
findVertexAndNode( np2[1], theSinuEdges, meshDS );
if ( np2[ iVert ]._node == np[ iVert ]._node &&
np2[ iNode ]._node)
{
np[ iNode ] = np2[ iNode ];
isVertex[ iNode ] = true;
}
}
u2NP = thePointsOnE.insert( make_pair( uMA, make_pair( np[0], np[1])));
if ( !isVertex[0] && !isVertex[1] ) return false; // error if ( !isVertex[0] && !isVertex[1] ) return false; // error
if ( isVertex[0] && isVertex[1] ) if ( isVertex[0] && isVertex[1] )
continue; continue;
const size_t iVert = isVertex[0] ? 0 : 1;
const size_t iNode = 1 - iVert;
bool isOppComputed = theIsEdgeComputed[ np[ iNode ]._edgeInd ]; bool isOppComputed = theIsEdgeComputed[ np[ iNode ]._edgeInd ];
if ( !isOppComputed ) if ( !isOppComputed )
@ -1103,7 +1139,7 @@ namespace
// evaluate distance to neighbor projections // evaluate distance to neighbor projections
const double rShort = 0.2; const double rShort = 0.2;
bool isShortPrev[2], isShortNext[2]; bool isShortPrev[2], isShortNext[2], isPrevCloser[2];
TMAPar2NPoints::iterator u2NPPrev = u2NP, u2NPNext = u2NP; TMAPar2NPoints::iterator u2NPPrev = u2NP, u2NPNext = u2NP;
--u2NPPrev; ++u2NPNext; --u2NPPrev; ++u2NPNext;
// bool hasPrev = ( u2NP != thePointsOnE.begin() ); // bool hasPrev = ( u2NP != thePointsOnE.begin() );
@ -1121,8 +1157,9 @@ namespace
double distPrev = p.Distance( pPrev ); double distPrev = p.Distance( pPrev );
double distNext = p.Distance( pNext ); double distNext = p.Distance( pNext );
double r = distPrev / ( distPrev + distNext ); double r = distPrev / ( distPrev + distNext );
isShortPrev[iS] = ( r < rShort ); isShortPrev [iS] = ( r < rShort );
isShortNext[iS] = (( 1 - r ) > ( 1 - rShort )); isShortNext [iS] = (( 1 - r ) > ( 1 - rShort ));
isPrevCloser[iS] = (( r < 0.5 ) && ( u2NPPrev->first > 0 ));
} }
// if ( !hasPrev ) isShortPrev[0] = isShortPrev[1] = false; // if ( !hasPrev ) isShortPrev[0] = isShortPrev[1] = false;
// if ( !hasNext ) isShortNext[0] = isShortNext[1] = false; // if ( !hasNext ) isShortNext[0] = isShortNext[1] = false;
@ -1132,14 +1169,14 @@ namespace
if (( isShortPrev[0] && isShortPrev[1] ) || // option 2) -> remove a too close projection if (( isShortPrev[0] && isShortPrev[1] ) || // option 2) -> remove a too close projection
( isShortNext[0] && isShortNext[1] )) ( isShortNext[0] && isShortNext[1] ))
{ {
u2NPClose = isShortPrev[0] ? u2NPPrev : u2NPNext; u2NPClose = isPrevCloser[0] ? u2NPPrev : u2NPNext;
NodePoint& npProj = get( u2NP->second, iNode ); // NP of VERTEX projection NodePoint& npProj = get( u2NP->second, iNode ); // NP of VERTEX projection
NodePoint npCloseN = get( u2NPClose->second, iNode ); // NP close to npProj NodePoint npCloseN = get( u2NPClose->second, iNode ); // NP close to npProj
NodePoint npCloseV = get( u2NPClose->second, iVert ); // NP close to VERTEX NodePoint npCloseV = get( u2NPClose->second, iVert ); // NP close to VERTEX
if ( !npCloseV._node ) if ( !npCloseV._node )
{ {
npProj = npCloseN; npProj = npCloseN;
thePointsOnE.erase( isShortPrev[0] ? u2NPPrev : u2NPNext ); thePointsOnE.erase( isPrevCloser[0] ? u2NPPrev : u2NPNext );
continue; continue;
} }
else else
@ -1149,7 +1186,7 @@ namespace
} }
// else: option 1) - wide enough -> "duplicate" existing node // else: option 1) - wide enough -> "duplicate" existing node
{ {
u2NPClose = isShortPrev[ iNode ] ? u2NPPrev : u2NPNext; u2NPClose = isPrevCloser[ iNode ] ? u2NPPrev : u2NPNext;
NodePoint& npProj = get( u2NP->second, iNode ); // NP of VERTEX projection NodePoint& npProj = get( u2NP->second, iNode ); // NP of VERTEX projection
NodePoint& npCloseN = get( u2NPClose->second, iNode ); // NP close to npProj NodePoint& npCloseN = get( u2NPClose->second, iNode ); // NP close to npProj
npProj = npCloseN; npProj = npCloseN;
@ -1164,6 +1201,12 @@ namespace
//theNodes2Merge[ npCloseN._node ].push_back( npProj._node ); //theNodes2Merge[ npCloseN._node ].push_back( npProj._node );
} }
} }
// remove auxiliary NodePoint's of ends of theSinuEdges
for ( u2NP = thePointsOnE.begin(); u2NP->first < 0; )
thePointsOnE.erase( u2NP++ );
thePointsOnE.erase( 1.1 );
return true; return true;
} }
@ -1198,7 +1241,8 @@ namespace
void separateNodes( SMESH_MesherHelper& theHelper, void separateNodes( SMESH_MesherHelper& theHelper,
const SMESH_MAT2d::MedialAxis& theMA, const SMESH_MAT2d::MedialAxis& theMA,
TMAPar2NPoints & thePointsOnE, TMAPar2NPoints & thePointsOnE,
SinuousFace& theSinuFace ) SinuousFace& theSinuFace,
const vector< bool >& theIsComputedEdge)
{ {
if ( thePointsOnE.size() < 2 ) if ( thePointsOnE.size() < 2 )
return; return;
@ -1287,7 +1331,7 @@ namespace
} }
// distribute points and create nodes // distribute points and create nodes
double du = ( u1 - u0 ) / ( sameU2NP.size() + 1 ); double du = ( u1 - u0 ) / ( sameU2NP.size() + !existingNode );
double u = u0 + du; double u = u0 + du;
for ( size_t i = 0; i < sameU2NP.size(); ++i ) for ( size_t i = 0; i < sameU2NP.size(); ++i )
{ {
@ -1299,7 +1343,9 @@ namespace
gp_Pnt p = np->Point( curves ); gp_Pnt p = np->Point( curves );
np->_node = meshDS->AddNode( p.X(), p.Y(), p.Z() ); np->_node = meshDS->AddNode( p.X(), p.Y(), p.Z() );
meshDS->SetNodeOnEdge( np->_node, theSinuEdges[ *edgeID ], np->_u ); meshDS->SetNodeOnEdge( np->_node, theSinuEdges[ *edgeID ], np->_u );
//mergeNodes.push_back( np->_node );
if ( theIsComputedEdge[ *edgeID ])
mergeNodes.push_back( np->_node );
} }
} }
} }
@ -1410,9 +1456,33 @@ namespace
theFace._quad->side[ 0 ] = StdMeshers_FaceSide::New( uvsNew ); theFace._quad->side[ 0 ] = StdMeshers_FaceSide::New( uvsNew );
theFace._quad->side[ 2 ] = theFace._quad->side[ 0 ]; theFace._quad->side[ 2 ] = theFace._quad->side[ 0 ];
// rotate the IN side if opposite nodes of IN and OUT sides don't match if ( theFace._quad->side[ 1 ].GetUVPtStruct().empty() ||
if ( theFace._quad->side[ 1 ].GetUVPtStruct().empty() ) theFace._quad->side[ 3 ].GetUVPtStruct().empty() )
return false; return false;
// assure that the outer sinuous side starts at nOut
if ( theFace._sinuSide[0].size() > 1 )
{
const UVPtStructVec& uvsOut = theFace._quad->side[ 3 ].GetUVPtStruct(); // _sinuSide[0]
size_t i; // find UVPtStruct holding nOut
for ( i = 0; i < uvsOut.size(); ++i )
if ( nOut == uvsOut[i].node )
break;
if ( i == uvsOut.size() )
return false;
if ( i != 0 && i != uvsOut.size()-1 )
{
// create a new OUT quad side
uvsNew.clear();
uvsNew.reserve( uvsOut.size() );
uvsNew.insert( uvsNew.end(), uvsOut.begin() + i, uvsOut.end() );
uvsNew.insert( uvsNew.end(), uvsOut.begin() + 1, uvsOut.begin() + i + 1);
theFace._quad->side[ 3 ] = StdMeshers_FaceSide::New( uvsNew );
}
}
// rotate the IN side if opposite nodes of IN and OUT sides don't match
const SMDS_MeshNode * nIn0 = theFace._quad->side[ 1 ].First().node; const SMDS_MeshNode * nIn0 = theFace._quad->side[ 1 ].First().node;
if ( nIn0 != nIn ) if ( nIn0 != nIn )
{ {
@ -1431,12 +1501,13 @@ namespace
uvsNew.insert( uvsNew.end(), uvsIn.begin() + i, uvsIn.end() ); uvsNew.insert( uvsNew.end(), uvsIn.begin() + i, uvsIn.end() );
uvsNew.insert( uvsNew.end(), uvsIn.begin() + 1, uvsIn.begin() + i + 1); uvsNew.insert( uvsNew.end(), uvsIn.begin() + 1, uvsIn.begin() + i + 1);
theFace._quad->side[ 1 ] = StdMeshers_FaceSide::New( uvsNew ); theFace._quad->side[ 1 ] = StdMeshers_FaceSide::New( uvsNew );
if ( theFace._quad->side[ 1 ].NbPoints() !=
theFace._quad->side[ 3 ].NbPoints())
return false;
} }
} // if ( theShortEdges[0].empty() )
if ( theFace._quad->side[ 1 ].NbPoints() !=
theFace._quad->side[ 3 ].NbPoints())
return false;
} // if ( theFace.IsRing() )
return true; return true;
@ -1666,7 +1737,7 @@ namespace
isComputed, pointsOnE, theSinuFace )) isComputed, pointsOnE, theSinuFace ))
return false; return false;
separateNodes( theHelper, theMA, pointsOnE, theSinuFace ); separateNodes( theHelper, theMA, pointsOnE, theSinuFace, isComputed );
// create nodes // create nodes
TMAPar2NPoints::iterator u2np = pointsOnE.begin(); TMAPar2NPoints::iterator u2np = pointsOnE.begin();