mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-14 21:20:33 +05:00
22264: EDF 2648 GEOM: Propagate edges automatic orientation
Fix for sub-meshes
This commit is contained in:
parent
5c372c1659
commit
3026fe8712
@ -128,6 +128,17 @@ TopoDS_Shape SMESH_PreviewActorsCollection::GetShapeByIndex( int index )
|
|||||||
return IsValidIndex( index ) ? myMapOfShapes.FindKey( index ) : TopoDS_Shape();
|
return IsValidIndex( index ) ? myMapOfShapes.FindKey( index ) : TopoDS_Shape();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SMESH_PreviewActorsCollection::NbShapesOfType( TopAbs_ShapeEnum type )
|
||||||
|
{
|
||||||
|
if ( type == TopAbs_SHAPE ) return myMapOfShapes.Extent();
|
||||||
|
|
||||||
|
int nb = 0;
|
||||||
|
for ( int i = 1; i <= myMapOfShapes.Extent(); ++i )
|
||||||
|
nb += ( myMapOfShapes(i).ShapeType() == type );
|
||||||
|
|
||||||
|
return nb;
|
||||||
|
}
|
||||||
|
|
||||||
void SMESH_PreviewActorsCollection::SetIndices( const QList<int>& indices)
|
void SMESH_PreviewActorsCollection::SetIndices( const QList<int>& indices)
|
||||||
{
|
{
|
||||||
if ( myIndices != indices )
|
if ( myIndices != indices )
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
|
|
||||||
int GetIndexByShape( const TopoDS_Shape& );
|
int GetIndexByShape( const TopoDS_Shape& );
|
||||||
TopoDS_Shape GetShapeByIndex( int i );
|
TopoDS_Shape GetShapeByIndex( int i );
|
||||||
|
int NbShapesOfType( TopAbs_ShapeEnum type );
|
||||||
|
|
||||||
void SetIndices( const QList<int>& indices);
|
void SetIndices( const QList<int>& indices);
|
||||||
const QList<int>& GetIndices() const { return myIndices; }
|
const QList<int>& GetIndices() const { return myIndices; }
|
||||||
|
@ -174,15 +174,11 @@ void StdMeshersGUI_PropagationHelperWdg::onShowGeometry(bool toShow)
|
|||||||
BRep_Builder aBuilder;
|
BRep_Builder aBuilder;
|
||||||
aBuilder.MakeCompound( aCompound );
|
aBuilder.MakeCompound( aCompound );
|
||||||
|
|
||||||
SMESH_PreviewActorsCollection* previewActor = mySubSelectWdg->GetActorCollection();
|
TopTools_MapOfShape edgesMap;
|
||||||
if ( !previewActor ) return;
|
TopExp_Explorer edge( mainShape, TopAbs_EDGE );
|
||||||
const QList<int>& egdeIDs = previewActor->GetIndices();
|
for ( ; edge.More(); edge.Next() )
|
||||||
for ( QList<int>::const_iterator ieIt = egdeIDs.begin(); ieIt != egdeIDs.end(); ++ieIt )
|
if ( edgesMap.Add( edge.Current() ))
|
||||||
{
|
aBuilder.Add( aCompound, edge.Current() );
|
||||||
TopoDS_Shape E = previewActor->GetShapeByIndex( *ieIt );
|
|
||||||
if ( !E.IsNull() && E.ShapeType() == TopAbs_EDGE )
|
|
||||||
aBuilder.Add( aCompound, E );
|
|
||||||
}
|
|
||||||
|
|
||||||
myModelActor = GEOM_Actor::New();
|
myModelActor = GEOM_Actor::New();
|
||||||
myModelActor->SetShape( aCompound, 0, 0 );
|
myModelActor->SetShape( aCompound, 0, 0 );
|
||||||
@ -233,12 +229,13 @@ bool StdMeshersGUI_PropagationHelperWdg::buildChains()
|
|||||||
typedef std::vector< TEdgeInWire > TWiresOfEdge;// WIREs including an EDGE
|
typedef std::vector< TEdgeInWire > TWiresOfEdge;// WIREs including an EDGE
|
||||||
|
|
||||||
std::vector< TWire > quadWires;
|
std::vector< TWire > quadWires;
|
||||||
quadWires.reserve( egdeIDs.count() );
|
quadWires.reserve( previewActor->NbShapesOfType( TopAbs_FACE ));
|
||||||
NCollection_DataMap< TGeomID, TWiresOfEdge > wiresOfEdge( egdeIDs.count() );
|
NCollection_DataMap< TGeomID, TWiresOfEdge >
|
||||||
|
wiresOfEdge( previewActor->NbShapesOfType( TopAbs_EDGE ));
|
||||||
|
|
||||||
TopExp_Explorer wire;
|
TopExp_Explorer wire;
|
||||||
TopTools_MapOfShape faceMap;
|
TopTools_MapOfShape faceMap;
|
||||||
for ( TopExp_Explorer face( shape, TopAbs_FACE ); face.More(); face.Next() )
|
for ( TopExp_Explorer face( mainShape, TopAbs_FACE ); face.More(); face.Next() )
|
||||||
{
|
{
|
||||||
if ( !faceMap.Add( face.Current() )) continue;
|
if ( !faceMap.Add( face.Current() )) continue;
|
||||||
|
|
||||||
@ -278,6 +275,11 @@ bool StdMeshersGUI_PropagationHelperWdg::buildChains()
|
|||||||
|
|
||||||
TColStd_IndexedMapOfInteger chain, chainedEdges;
|
TColStd_IndexedMapOfInteger chain, chainedEdges;
|
||||||
|
|
||||||
|
TColStd_MapOfInteger shapeEdges;
|
||||||
|
if ( !shape.IsSame( mainShape ))
|
||||||
|
for ( QList<TGeomID>::const_iterator ieIt = egdeIDs.begin(); ieIt != egdeIDs.end(); ++ieIt )
|
||||||
|
shapeEdges.Add( *ieIt );
|
||||||
|
|
||||||
// loop on all EDGEs in mainShape
|
// loop on all EDGEs in mainShape
|
||||||
for ( QList<TGeomID>::const_iterator ieIt = egdeIDs.begin(); ieIt != egdeIDs.end(); ++ieIt )
|
for ( QList<TGeomID>::const_iterator ieIt = egdeIDs.begin(); ieIt != egdeIDs.end(); ++ieIt )
|
||||||
{
|
{
|
||||||
@ -319,9 +321,16 @@ bool StdMeshersGUI_PropagationHelperWdg::buildChains()
|
|||||||
myChains.push_back( std::vector< TGeomID >() );
|
myChains.push_back( std::vector< TGeomID >() );
|
||||||
std::vector< TGeomID > & ch = myChains.back();
|
std::vector< TGeomID > & ch = myChains.back();
|
||||||
for ( int iC = 1; iC <= chain.Extent(); ++iC )
|
for ( int iC = 1; iC <= chain.Extent(); ++iC )
|
||||||
ch.push_back( chain( iC ) );
|
{
|
||||||
|
TGeomID iE = chain( iC );
|
||||||
|
if ( shapeEdges.IsEmpty() || shapeEdges.Contains( Abs( iE )))
|
||||||
|
ch.push_back( iE );
|
||||||
|
}
|
||||||
|
if ( ch.size() < 2 )
|
||||||
|
myChains.pop_back();
|
||||||
}
|
}
|
||||||
}
|
} // loop on egdeIDs
|
||||||
|
|
||||||
return !myChains.empty();
|
return !myChains.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user