+
+
+ /*
+ Class : ElementsOnShape
+ Description : Predicate elements that lying on indicated shape
+ (1D, 2D or 3D)
+ */
+ class SMESHCONTROLS_EXPORT ElementsOnShape : public virtual Predicate
+ {
+ public:
+ ElementsOnShape();
+ ~ElementsOnShape();
+
+ virtual void SetMesh (const SMDS_Mesh* theMesh);
+ virtual bool IsSatisfy (long theElementId);
+ virtual SMDSAbs_ElementType GetType() const;
+
+ void SetTolerance (const double theToler);
+ double GetTolerance() const;
+ void SetAllNodes (bool theAllNodes);
+ bool GetAllNodes() const { return myAllNodesFlag; }
+ void SetShape (const TopoDS_Shape& theShape,
+ const SMDSAbs_ElementType theType);
+
+ private:
+
+ struct TClassifier
+ {
+ TClassifier(const TopoDS_Shape& s, double tol) { Init(s,tol); }
+ void Init(const TopoDS_Shape& s, double tol);
+ bool IsOut(const gp_Pnt& p);
+ TopAbs_ShapeEnum ShapeType() const;
+ private:
+ bool isOutOfSolid (const gp_Pnt& p);
+ bool isOutOfBox (const gp_Pnt& p);
+ bool isOutOfFace (const gp_Pnt& p);
+ bool isOutOfEdge (const gp_Pnt& p);
+ bool isOutOfVertex(const gp_Pnt& p);
+ bool isBox (const TopoDS_Shape& s);
+
+ bool (TClassifier::* myIsOutFun)(const gp_Pnt& p);
+ BRepClass3d_SolidClassifier mySolidClfr;
+ Bnd_B3d myBox;
+ GeomAPI_ProjectPointOnSurf myProjFace;
+ GeomAPI_ProjectPointOnCurve myProjEdge;
+ gp_Pnt myVertexXYZ;
+ TopoDS_Shape myShape;
+ double myTol;
+ };
+ void clearClassifiers();
+ bool getNodeIsOut( const SMDS_MeshNode* n, bool& isOut );
+ void setNodeIsOut( const SMDS_MeshNode* n, bool isOut );
+
+ std::vector< TClassifier* > myClassifiers;
+ SMDSAbs_ElementType myType;
+ TopoDS_Shape myShape;
+ double myToler;
+ bool myAllNodesFlag;
+
+ TMeshModifTracer myMeshModifTracer;
+ std::vector<bool> myNodeIsChecked;
+ std::vector<bool> myNodeIsOut;
+ };
+
+ typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
+
+
+ /*
+ Class : BelongToGeom
+ Description : Predicate for verifying whether entiy belong to
+ specified geometrical support
+ */
+ class SMESHCONTROLS_EXPORT BelongToGeom: public virtual Predicate
+ {
+ public:
+ BelongToGeom();
+
+ virtual void SetMesh( const 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();
+ const SMESHDS_Mesh* GetMeshDS() const;
+
+ void SetTolerance( double );
+ double GetTolerance();
+
+ private:
+ virtual void init();
+
+ TopoDS_Shape myShape;
+ const SMESHDS_Mesh* myMeshDS;
+ SMDSAbs_ElementType myType;
+ bool myIsSubshape;
+ double myTolerance; // only if myIsSubshape == false
+ Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
+ };
+ typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
+
+ /*
+ Class : LyingOnGeom
+ Description : Predicate for verifying whether entiy lying or partially lying on
+ specified geometrical support
+ */
+ class SMESHCONTROLS_EXPORT LyingOnGeom: public virtual Predicate
+ {
+ public:
+ LyingOnGeom();
+
+ virtual void SetMesh( const 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();
+ const SMESHDS_Mesh* GetMeshDS() const;
+
+ void SetTolerance( double );
+ double GetTolerance();
+
+ virtual bool Contains( const SMESHDS_Mesh* theMeshDS,
+ const TopoDS_Shape& theShape,
+ const SMDS_MeshElement* theElem,
+ TopAbs_ShapeEnum theFindShapeEnum,
+ TopAbs_ShapeEnum theAvoidShapeEnum = TopAbs_SHAPE );
+ private:
+ virtual void init();
+
+ TopoDS_Shape myShape;
+ TColStd_MapOfInteger mySubShapesIDs;
+ const SMESHDS_Mesh* myMeshDS;
+ SMDSAbs_ElementType myType;
+ bool myIsSubshape;
+ double myTolerance; // only if myIsSubshape == false
+ Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
+ };
+ typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
+
+ /*
+ Class : FreeFaces
+ Description : Predicate for free faces
+ */
+ class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
+ public:
+ FreeFaces();
+ virtual void SetMesh( const SMDS_Mesh* theMesh );
+ virtual bool IsSatisfy( long theElementId );
+ virtual SMDSAbs_ElementType GetType() const;
+
+ private:
+ const SMDS_Mesh* myMesh;
+ };
+
+ /*
+ Class : LinearOrQuadratic
+ Description : Predicate for free faces
+ */
+ class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
+ public:
+ LinearOrQuadratic();
+ virtual void SetMesh( const SMDS_Mesh* theMesh );
+ virtual bool IsSatisfy( long theElementId );
+ void SetType( SMDSAbs_ElementType theType );
+ virtual SMDSAbs_ElementType GetType() const;
+
+ private:
+ const SMDS_Mesh* myMesh;
+ SMDSAbs_ElementType myType;
+ };
+ typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
+
+ /*
+ Class : GroupColor
+ Description : Functor for check color of group to whic mesh element belongs to
+ */
+ class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
+ public:
+ GroupColor();
+ virtual void SetMesh( const SMDS_Mesh* theMesh );
+ virtual bool IsSatisfy( long theElementId );
+ void SetType( SMDSAbs_ElementType theType );
+ virtual SMDSAbs_ElementType GetType() const;
+ void SetColorStr( const TCollection_AsciiString& );
+ void GetColorStr( TCollection_AsciiString& ) const;