Add "LyingOnGeom" filter.
FT_BelongToGeom,
FT_BelongToPlane,
FT_BelongToCylinder,
+ FT_LyingOnGeom,
FT_RangeOfIds,
FT_LessThan,
FT_MoreThan,
void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
};
+ /*!
+ * Logical functor (predicate) "Lying On Geometry".
+ * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
+ */
+ interface LyingOnGeom: Predicate
+ {
+ void SetGeom( in GEOM::GEOM_Object theGeom );
+ void SetElementType( in ElementType theType );
+
+ void SetShapeName( in string theName );
+ string GetShapeName();
+ };
+
/*!
* Logical functor (predicate) "Free borders".
* Verify whether 1D mesh element is free ( i.e. connected to one face only )
BelongToPlane CreateBelongToPlane();
BelongToCylinder CreateBelongToCylinder();
+ LyingOnGeom CreateLyingOnGeom();
+
FreeBorders CreateFreeBorders();
FreeEdges CreateFreeEdges();
if ( aCriterion == FT_RangeOfIds ||
aCriterion == FT_BelongToGeom ||
aCriterion == FT_BelongToPlane ||
- aCriterion == FT_BelongToCylinder )
+ aCriterion == FT_BelongToCylinder ||
+ aCriterion == FT_LyingOnGeom)
{
if ( aTable->text( i, 2 ).isEmpty() )
{
if ( aCriterionType != FT_RangeOfIds &&
aCriterionType != FT_BelongToGeom &&
aCriterionType != FT_BelongToPlane &&
- aCriterionType != FT_BelongToCylinder )
+ aCriterionType != FT_BelongToCylinder &&
+ aCriterionType != FT_LyingOnGeom)
{
theCriterion.Compare = ( (ComboItem*)aTable->item( theRow, 1 ) )->GetValue();
theCriterion.Threshold = aTable->item( theRow, 2 )->text().toDouble();
if ( theCriterion.Type != FT_RangeOfIds &&
theCriterion.Type != FT_BelongToGeom &&
theCriterion.Type != FT_BelongToPlane &&
- theCriterion.Type != FT_BelongToCylinder )
+ theCriterion.Type != FT_BelongToCylinder &&
+ theCriterion.Type != FT_LyingOnGeom)
aTable->setText( theRow, 2, QString( "%1" ).arg( theCriterion.Threshold, 0, 'g', 15 ) );
else
aTable->setText( theRow, 2, QString( theCriterion.ThresholdStr ) );
ComboItem* anItem = ( (ComboItem*)aTable->item( aRow, 0 ) );
bool toEnable = ( (ComboItem*)aTable->item( aRow, 1 ) )->GetValue() == FT_EqualTo &&
GetCriterionType( aRow ) != FT_BelongToGeom &&
+ GetCriterionType( aRow ) != FT_LyingOnGeom &&
GetCriterionType( aRow ) != FT_RangeOfIds &&
GetCriterionType( aRow ) != FT_FreeEdges;
if ( !myAddWidgets.contains( anItem ) )
else if ( aCriterionType == SMESH::FT_RangeOfIds ||
aCriterionType == SMESH::FT_BelongToGeom ||
aCriterionType == SMESH::FT_BelongToPlane ||
- aCriterionType == SMESH::FT_BelongToCylinder )
+ aCriterionType == SMESH::FT_BelongToCylinder ||
+ aCriterionType == SMESH::FT_LyingOnGeom)
{
QMap<int, QString> aMap;
aMap[ FT_EqualTo ] = tr( "EQUAL_TO" );
aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" );
aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+ aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
}
return aCriteria;
}
aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" );
aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+ aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
}
return aCriteria;
}
aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" );
aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+ aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
aCriteria[ SMESH::FT_Length2D ] = tr( "LENGTH2D" );
aCriteria[ SMESH::FT_MultiConnection2D] = tr( "MULTI2D_BORDERS" );
}
aCriteria[ SMESH::FT_AspectRatio3D] = tr( "ASPECT_RATIO_3D" );
aCriteria[ SMESH::FT_RangeOfIds ] = tr( "RANGE_OF_IDS" );
aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
+ aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
}
return aCriteria;
}
int aType = myTable->GetCriterionType( i );
if ( aType == FT_BelongToGeom ||
aType == FT_BelongToPlane ||
- aType == FT_BelongToCylinder )
+ aType == FT_BelongToCylinder ||
+ aType == FT_LyingOnGeom)
{
QString aName;
myTable->GetThreshold( i, aName );
!myTable->CurrentCell( aRow, aCol ) ||
myTable->GetCriterionType( aRow ) != FT_BelongToGeom &&
myTable->GetCriterionType( aRow ) != FT_BelongToPlane &&
- myTable->GetCriterionType( aRow ) != FT_BelongToCylinder)
+ myTable->GetCriterionType( aRow ) != FT_BelongToCylinder &&
+ myTable->GetCriterionType( aRow ) != FT_LyingOnGeom )
return;
Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject() ;
if ( myTable->CurrentCell( aRow, aCol ) &&
( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ||
myTable->GetCriterionType( aRow ) == FT_BelongToPlane ||
- myTable->GetCriterionType( aRow ) == FT_BelongToCylinder ) )
+ myTable->GetCriterionType( aRow ) == FT_BelongToCylinder ||
+ myTable->GetCriterionType( aRow ) == FT_LyingOnGeom) )
{
- if ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom )
+ if ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom || myTable->GetCriterionType( aRow ) == FT_LyingOnGeom )
mySelection->AddFilter( new SALOME_TypeFilter( "GEOM" ) );
else if ( myTable->GetCriterionType( aRow ) == FT_BelongToPlane )
mySelection->AddFilter( new GEOM_FaceFilter( StdSelect_Plane ) );
msgid "SMESHGUI_FilterTable::BELONG_TO_CYLINDER"
msgstr "Belong to Cylinder"
+msgid "SMESHGUI_FilterTable::LYING_ON_GEOM"
+msgstr "Lying on Geom"
+
# -------------- SMESHGUI_FilterDlg --------------
msgid "SMESHGUI_FilterDlg::TLT"
msgstr "Selection filter"
TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE )
{
TopExp_Explorer anExp( theShape,theFindShapeEnum,theAvoidShapeEnum );
-
+
while( anExp.More() )
{
const TopoDS_Shape& aShape = anExp.Current();
return myMeshDS;
}
+/*
+ Class : LyingOnGeom
+ Description : Predicate for verifying whether entiy lying or partially lying on
+ specified geometrical support
+*/
+
+Controls::LyingOnGeom::LyingOnGeom()
+: myMeshDS(NULL),
+ myType(SMDSAbs_All)
+{}
+
+void Controls::LyingOnGeom::SetMesh( SMDS_Mesh* theMesh )
+{
+ myMeshDS = dynamic_cast<SMESHDS_Mesh*>(theMesh);
+}
+
+void Controls::LyingOnGeom::SetGeom( const TopoDS_Shape& theShape )
+{
+ myShape = theShape;
+}
+
+bool Controls::LyingOnGeom::IsSatisfy( long theId )
+{
+ if ( myMeshDS == 0 || myShape.IsNull() )
+ return false;
+
+ if( myType == SMDSAbs_Node )
+ {
+ if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) )
+ {
+ const SMDS_PositionPtr& aPosition = aNode->GetPosition();
+ SMDS_TypeOfPosition aTypeOfPosition = aPosition->GetTypeOfPosition();
+ switch( aTypeOfPosition )
+ {
+ case SMDS_TOP_VERTEX : return IsContains( myMeshDS,myShape,aNode,TopAbs_VERTEX );
+ case SMDS_TOP_EDGE : return IsContains( myMeshDS,myShape,aNode,TopAbs_EDGE );
+ case SMDS_TOP_FACE : return IsContains( myMeshDS,myShape,aNode,TopAbs_FACE );
+ case SMDS_TOP_3DSPACE: return IsContains( myMeshDS,myShape,aNode,TopAbs_SHELL );
+ }
+ }
+ }
+ else
+ {
+ if( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ) )
+ {
+ if( myType == SMDSAbs_All )
+ {
+ return Contains( myMeshDS,myShape,anElem,TopAbs_EDGE ) ||
+ Contains( myMeshDS,myShape,anElem,TopAbs_FACE ) ||
+ Contains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
+ Contains( myMeshDS,myShape,anElem,TopAbs_SOLID );
+ }
+ else if( myType == anElem->GetType() )
+ {
+ switch( myType )
+ {
+ case SMDSAbs_Edge : return Contains( myMeshDS,myShape,anElem,TopAbs_EDGE );
+ case SMDSAbs_Face : return Contains( myMeshDS,myShape,anElem,TopAbs_FACE );
+ case SMDSAbs_Volume: return Contains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
+ Contains( myMeshDS,myShape,anElem,TopAbs_SOLID );
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+void Controls::LyingOnGeom::SetType( SMDSAbs_ElementType theType )
+{
+ myType = theType;
+}
+
+SMDSAbs_ElementType Controls::LyingOnGeom::GetType() const
+{
+ return myType;
+}
+
+TopoDS_Shape Controls::LyingOnGeom::GetShape()
+{
+ return myShape;
+}
+
+SMESHDS_Mesh* Controls::LyingOnGeom::GetMeshDS()
+{
+ return myMeshDS;
+}
+
+bool Controls::LyingOnGeom::Contains( SMESHDS_Mesh* theMeshDS,
+ const TopoDS_Shape& theShape,
+ const SMDS_MeshElement* theElem,
+ TopAbs_ShapeEnum theFindShapeEnum,
+ TopAbs_ShapeEnum theAvoidShapeEnum )
+{
+ if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum))
+ return true;
+
+ if ( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( theShape ) )
+ {
+ SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes();
+ while ( aNodeIt->more() )
+ {
+ const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(aNodeIt->next());
+ SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
+ while ( anElemIt->more() )
+ {
+ const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
+ if (anElement == theElem)
+ return true;
+ }
+ }
+ }
+
+ TopExp_Explorer anExp( theShape,TopAbs_VERTEX,theAvoidShapeEnum );
+
+ while( anExp.More() )
+ {
+ const TopoDS_Shape& aShape = anExp.Current();
+ if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){
+ SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes();
+ while ( aNodeIt->more() )
+ {
+ const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(aNodeIt->next());
+ SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
+ while ( anElemIt->more() )
+ {
+ const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
+ if (anElement == theElem)
+ return true;
+ }
+ }
+ }
+ anExp.Next();
+ }
+ return false;
+}
+
/*
AUXILIARY METHODS
return FT_BelongToCylinder;
}
+/*
+ Class : LyingOnGeom_i
+ Description : Predicate for selection on geometrical support
+*/
+LyingOnGeom_i::LyingOnGeom_i()
+{
+ myLyingOnGeomPtr.reset( new Controls::LyingOnGeom() );
+ myFunctorPtr = myPredicatePtr = myLyingOnGeomPtr;
+ myShapeName = 0;
+}
+LyingOnGeom_i::~LyingOnGeom_i()
+{
+ delete myShapeName;
+}
+
+void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
+{
+ if ( theGeom->_is_nil() )
+ return;
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ GEOM::GEOM_Gen_var aGEOMGen = SMESH_Gen_i::GetGeomEngine();
+ TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
+ myLyingOnGeomPtr->SetGeom( aLocShape );
+}
+
+void LyingOnGeom_i::SetGeom( const TopoDS_Shape& theShape )
+{
+ myLyingOnGeomPtr->SetGeom( theShape );
+}
+
+void LyingOnGeom_i::SetElementType(ElementType theType){
+ myLyingOnGeomPtr->SetType(SMDSAbs_ElementType(theType));
+}
+
+FunctorType LyingOnGeom_i::GetFunctorType()
+{
+ return SMESH::FT_LyingOnGeom;
+}
+
+void LyingOnGeom_i::SetShapeName( const char* theName )
+{
+ delete myShapeName;
+ myShapeName = strdup( theName );
+ myLyingOnGeomPtr->SetGeom( getShapeByName( myShapeName ) );
+}
+
+char* LyingOnGeom_i::GetShapeName()
+{
+ return CORBA::string_dup( myShapeName );
+}
/*
Class : FreeBorders_i
return anObj._retn();
}
+LyingOnGeom_ptr FilterManager_i::CreateLyingOnGeom()
+{
+ SMESH::LyingOnGeom_i* aServant = new SMESH::LyingOnGeom_i();
+ SMESH::LyingOnGeom_var anObj = aServant->_this();
+ return anObj._retn();
+}
+
FreeBorders_ptr FilterManager_i::CreateFreeBorders()
{
SMESH::FreeBorders_i* aServant = new SMESH::FreeBorders_i();
theCriteria[ i ].TypeOfElement = aPred->GetElementType();
theCriteria[ i ].Tolerance = aPred->GetTolerance();
+ return true;
+ }
+ case FT_LyingOnGeom:
+ {
+ LyingOnGeom_i* aPred = dynamic_cast<LyingOnGeom_i*>( thePred );
+
+ CORBA::ULong i = theCriteria->length();
+ theCriteria->length( i + 1 );
+
+ theCriteria[ i ] = createCriterion();
+
+ theCriteria[ i ].Type = FT_LyingOnGeom;
+ theCriteria[ i ].ThresholdStr = aPred->GetShapeName();
+ theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+
return true;
}
case FT_RangeOfIds:
aPredicate = tmpPred;
}
break;
+ case SMESH::FT_LyingOnGeom:
+ {
+ SMESH::LyingOnGeom_ptr tmpPred = aFilterMgr->CreateLyingOnGeom();
+ tmpPred->SetElementType( aTypeOfElem );
+ tmpPred->SetShapeName( aThresholdStr );
+ aPredicate = tmpPred;
+ }
+ break;
case SMESH::FT_RangeOfIds:
{
SMESH::RangeOfIds_ptr tmpPred = aFilterMgr->CreateRangeOfIds();
case FT_BelongToGeom : return "Belong to Geom";
case FT_BelongToPlane : return "Belong to Plane";
case FT_BelongToCylinder: return "Belong to Cylinder";
+ case FT_LyingOnGeom : return "Lying on Geom";
case FT_RangeOfIds : return "Range of IDs";
case FT_FreeBorders : return "Free borders";
case FT_FreeEdges : return "Free edges";
else if ( theStr.equals( "Belong to Geom" ) ) return FT_BelongToGeom;
else if ( theStr.equals( "Belong to Plane" ) ) return FT_BelongToPlane;
else if ( theStr.equals( "Belong to Cylinder" ) ) return FT_BelongToCylinder;
+ else if ( theStr.equals( "Lying on Geom" ) ) return FT_LyingOnGeom;
else if ( theStr.equals( "Free borders" ) ) return FT_FreeBorders;
else if ( theStr.equals( "Free edges" ) ) return FT_FreeEdges;
else if ( theStr.equals( "Borders at multi-connections" ) ) return FT_MultiConnection;
return aResArray._retn();
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
SMDSAbs_ElementType myType;
};
typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
+
+/*
+ Class : LyingOnGeom
+ Description : Predicate for verifying whether entiy lying or partially lying on
+ specified geometrical support
+*/
+class LyingOnGeom: public virtual Predicate
+{
+public:
+ LyingOnGeom();
+
+ virtual void SetMesh( SMDS_Mesh* theMesh );
+ virtual void SetGeom( const TopoDS_Shape& theShape );
+
+ virtual bool IsSatisfy( long theElementId );
+
+ virtual void SetType( SMDSAbs_ElementType theType );
+ virtual SMDSAbs_ElementType GetType() const;
+
+ TopoDS_Shape GetShape();
+ SMESHDS_Mesh* GetMeshDS();
+
+ virtual bool Contains( SMESHDS_Mesh* theMeshDS,
+ const TopoDS_Shape& theShape,
+ const SMDS_MeshElement* theElem,
+ TopAbs_ShapeEnum theFindShapeEnum,
+ TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE );
+private:
+ TopoDS_Shape myShape;
+ SMESHDS_Mesh* myMeshDS;
+ SMDSAbs_ElementType myType;
+};
+typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
}
/*
FunctorType GetFunctorType();
};
+/*
+ Class : LyingOnGeom_i
+ Description : Predicate for selection on geometrical support(lying or partially lying)
+*/
+class LyingOnGeom_i: public virtual POA_SMESH::LyingOnGeom,
+ public virtual Predicate_i
+{
+public:
+ LyingOnGeom_i();
+ virtual ~LyingOnGeom_i();
+
+ void SetGeom( GEOM::GEOM_Object_ptr theGeom );
+ void SetElementType( ElementType theType );
+ FunctorType GetFunctorType();
+
+ void SetGeom( const TopoDS_Shape& theShape );
+
+ void SetShapeName( const char* theName );
+ char* GetShapeName();
+
+protected:
+ Controls::LyingOnGeomPtr myLyingOnGeomPtr;
+ char* myShapeName;
+};
/*
Class : FreeBorders_i
BelongToPlane_ptr CreateBelongToPlane();
BelongToCylinder_ptr CreateBelongToCylinder();
+ LyingOnGeom_ptr CreateLyingOnGeom();
+
FreeBorders_ptr CreateFreeBorders();
FreeEdges_ptr CreateFreeEdges();