FT_FreeBorders,
FT_FreeEdges,
FT_FreeNodes,
+ FT_FreeFaces,
FT_MultiConnection,
FT_MultiConnection2D,
FT_Length,
FT_LyingOnGeom,
FT_RangeOfIds,
FT_BadOrientedVolume,
+ FT_LinearOrQuadratic,
+ FT_GroupColor,
+ FT_ElemGeomType,
FT_LessThan,
FT_MoreThan,
FT_EqualTo,
typedef sequence<Value> Values;
Values GetValues();
};
-
+
/*!
* Predicates are intended for verification of criteria,
* must return bool value by mesh id
*/
interface FreeNodes: Predicate{};
+ /*!
+ * Logical functor (predicate) "Free faces".
+ * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
+ */
+ interface FreeFaces: Predicate{};
+
/*!
* Abstract logical functor (predicate) "RangeOfIds".
* Verify whether an Entity Id belongs to defined sequence of id's
interface LogicalAND: LogicalBinary{};
interface LogicalOR : LogicalBinary{};
+ /*!
+ * Logical functor (predicate) "Is element Linear or Quadratic".
+ * Verify whether a mesh element is linear
+ */
+ interface LinearOrQuadratic: Predicate {
+ void SetElementType( in ElementType theType );
+ };
+
+ /*!
+ * Functor "Group Color"
+ * Returns color of group to which mesh element belongs to
+ */
+ interface GroupColor : Predicate{
+ void SetElementType( in ElementType theType );
+ void SetColorStr( in string theColor );
+ string GetColorStr();
+ };
+
+ /*!
+ * Functor "Element geometry type"
+ * Returns is element has indicated geometry type
+ */
+ interface ElemGeomType : Predicate{
+ void SetElementType ( in ElementType theType );
+ void SetGeometryType( in GeometryType theType );
+ };
+
/*!
* Filter
*/
* ThresholdStr - Threshold value defined as string. Used for:
* 1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"
* 2. BelongToGeom predicate for storing name of shape
+ * 3. GroupColor predicate for storing group color "0.2;0;0.5"
* ThresholdID - One more threshold value defined as string. Used for:
* 1. BelongToGeom predicate for storing id of shape
* Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
FreeBorders CreateFreeBorders();
FreeEdges CreateFreeEdges();
FreeNodes CreateFreeNodes();
+ FreeFaces CreateFreeFaces();
RangeOfIds CreateRangeOfIds();
BadOrientedVolume CreateBadOrientedVolume();
+ LinearOrQuadratic CreateLinearOrQuadratic();
+
+ GroupColor CreateGroupColor();
+ ElemGeomType CreateElemGeomType();
/*!
* Create comparators ( predicates )
FACE,
VOLUME
};
+
+ /*!
+ * Enumeration for element geometry type, like in SMDS
+ */
+ enum GeometryType
+ {
+ Geom_POINT,
+ Geom_EDGE,
+ Geom_TRIANGLE,
+ Geom_QUADRANGLE,
+ Geom_POLYGON,
+ Geom_TETRA,
+ Geom_PYRAMID,
+ Geom_HEXA,
+ Geom_PENTA,
+ Geom_POLYHEDRA
+ };
/*!
* ElementOrder points out entities of what order are requested
mesh_node_to_point.png \
mesh_tree_mesh_partial.png \
mesh_extractGroup.png \
- mesh_precompute.png
+ mesh_precompute.png \
+ mesh_free_faces.png
# VSR: little trick to avoid putting if SMESHCatalog.xml to the distribution archive
nodist_salomeres_SCRIPTS = SMESHCatalog.xml
$(CAS_CPPFLAGS) \
$(BOOST_CPPFLAGS) \
$(KERNEL_CXXFLAGS) \
- -I$(srcdir)/../SMDS
+ -I$(srcdir)/../SMDS \
+ -I$(srcdir)/../SMESHDS
libSMESHControls_la_LDFLAGS = \
../SMDS/libSMDS.la \
+ ../SMESHDS/libSMESHDS.la \
$(CAS_LDPATH) -lTKernel -lTKBRep -lTKG3d
SMESHControls_CPPFLAGS = \
SMESHControls_LDADD = \
../SMDS/libSMDS.la \
+ ../SMESHDS/libSMESHDS.la \
libSMESHControls.la \
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics \
$(GEOM_LDFLAGS) -lGEOMAlgo \
#include "SMDS_QuadraticFaceOfNodes.hxx"
#include "SMDS_QuadraticEdge.hxx"
+#include "SMESHDS_Mesh.hxx"
+#include "SMESHDS_GroupBase.hxx"
+
/*
AUXILIARY METHODS
*/
}
+/*
+ Class : FreeFaces
+ Description : Predicate for free faces
+*/
+
+FreeFaces::FreeFaces()
+{
+ myMesh = 0;
+}
+
+void FreeFaces::SetMesh( const SMDS_Mesh* theMesh )
+{
+ myMesh = theMesh;
+}
+
+bool FreeFaces::IsSatisfy( long theId )
+{
+ if (!myMesh) return false;
+ // check that faces nodes refers to less than two common volumes
+ const SMDS_MeshElement* aFace = myMesh->FindElement( theId );
+ if ( !aFace || aFace->GetType() != SMDSAbs_Face )
+ return false;
+
+ int nbNode = aFace->NbNodes();
+
+ // collect volumes check that number of volumss with count equal nbNode not less than 2
+ typedef map< SMDS_MeshElement*, int > TMapOfVolume; // map of volume counters
+ typedef map< SMDS_MeshElement*, int >::iterator TItrMapOfVolume; // iterator
+ TMapOfVolume mapOfVol;
+
+ SMDS_ElemIteratorPtr nodeItr = aFace->nodesIterator();
+ while ( nodeItr->more() ) {
+ const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(nodeItr->next());
+ if ( !aNode ) continue;
+ SMDS_ElemIteratorPtr volItr = aNode->GetInverseElementIterator(SMDSAbs_Volume);
+ while ( volItr->more() ) {
+ SMDS_MeshElement* aVol = (SMDS_MeshElement*)volItr->next();
+ TItrMapOfVolume itr = mapOfVol.insert(make_pair(aVol, 0)).first;
+ (*itr).second++;
+ }
+ }
+ int nbVol = 0;
+ TItrMapOfVolume volItr = mapOfVol.begin();
+ TItrMapOfVolume volEnd = mapOfVol.end();
+ for ( ; volItr != volEnd; ++volItr )
+ if ( (*volItr).second >= nbNode )
+ nbVol++;
+ // face is not free if number of volumes constructed on thier nodes more than one
+ return (nbVol < 2);
+}
+
+SMDSAbs_ElementType FreeFaces::GetType() const
+{
+ return SMDSAbs_Face;
+}
+
+/*
+ Class : LinearOrQuadratic
+ Description : Predicate to verify whether a mesh element is linear
+*/
+
+LinearOrQuadratic::LinearOrQuadratic()
+{
+ myMesh = 0;
+}
+
+void LinearOrQuadratic::SetMesh( const SMDS_Mesh* theMesh )
+{
+ myMesh = theMesh;
+}
+
+bool LinearOrQuadratic::IsSatisfy( long theId )
+{
+ if (!myMesh) return false;
+ const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
+ if ( !anElem || (myType != SMDSAbs_All && anElem->GetType() != myType) )
+ return false;
+ return (!anElem->IsQuadratic());
+}
+
+void LinearOrQuadratic::SetType( SMDSAbs_ElementType theType )
+{
+ myType = theType;
+}
+
+SMDSAbs_ElementType LinearOrQuadratic::GetType() const
+{
+ return myType;
+}
+
+/*
+ Class : GroupColor
+ Description : Functor for check color of group to whic mesh element belongs to
+*/
+
+GroupColor::GroupColor()
+{
+}
+
+bool GroupColor::IsSatisfy( long theId )
+{
+ return (myIDs.find( theId ) != myIDs.end());
+}
+
+void GroupColor::SetType( SMDSAbs_ElementType theType )
+{
+ myType = theType;
+}
+
+SMDSAbs_ElementType GroupColor::GetType() const
+{
+ return myType;
+}
+
+static bool isEqual( const Quantity_Color& theColor1,
+ const Quantity_Color& theColor2 )
+{
+ // tolerance to compare colors
+ const double tol = 5*1e-3;
+ return ( fabs( theColor1.Red() - theColor2.Red() ) < tol &&
+ fabs( theColor1.Green() - theColor2.Green() ) < tol &&
+ fabs( theColor1.Blue() - theColor2.Blue() ) < tol );
+}
+
+
+void GroupColor::SetMesh( const SMDS_Mesh* theMesh )
+{
+ myIDs.clear();
+
+ const SMESHDS_Mesh* aMesh = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
+ if ( !aMesh )
+ return;
+
+ int nbGrp = aMesh->GetNbGroups();
+ if ( !nbGrp )
+ return;
+
+ // iterates on groups and find necessary elements ids
+ const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups();
+ set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin();
+ for (; GrIt != aGroups.end(); GrIt++) {
+ SMESHDS_GroupBase* aGrp = (*GrIt);
+ if ( !aGrp )
+ continue;
+ // check type and color of group
+ if ( !isEqual( myColor, aGrp->GetColor() ) )
+ continue;
+ if ( myType != SMDSAbs_All && myType != (SMDSAbs_ElementType)aGrp->GetType() )
+ continue;
+
+ // add elements IDS into control
+ int aSize = aGrp->Extent();
+ for (int i = 0; i < aSize; i++)
+ myIDs.insert( aGrp->GetID(i+1) );
+ }
+}
+
+void GroupColor::SetColorStr( const TCollection_AsciiString& theStr )
+{
+ TCollection_AsciiString aStr = theStr;
+ aStr.RemoveAll( ' ' );
+ aStr.RemoveAll( '\t' );
+ for ( int aPos = aStr.Search( ";;" ); aPos != -1; aPos = aStr.Search( ";;" ) )
+ aStr.Remove( aPos, 2 );
+ Standard_Real clr[3];
+ clr[0] = clr[1] = clr[2] = 0.;
+ for ( int i = 0; i < 3; i++ ) {
+ TCollection_AsciiString tmpStr = aStr.Token( ";", i+1 );
+ if ( !tmpStr.IsEmpty() && tmpStr.IsRealValue() )
+ clr[i] = tmpStr.RealValue();
+ }
+ myColor = Quantity_Color( clr[0], clr[1], clr[2], Quantity_TOC_RGB );
+}
+
+//=======================================================================
+// name : GetRangeStr
+// Purpose : Get range as a string.
+// Example: "1,2,3,50-60,63,67,70-"
+//=======================================================================
+void GroupColor::GetColorStr( TCollection_AsciiString& theResStr ) const
+{
+ theResStr.Clear();
+ theResStr += TCollection_AsciiString( myColor.Red() );
+ theResStr += TCollection_AsciiString( ";" ) + TCollection_AsciiString( myColor.Green() );
+ theResStr += TCollection_AsciiString( ";" ) + TCollection_AsciiString( myColor.Blue() );
+}
+
+/*
+ Class : ElemGeomType
+ Description : Predicate to check element geometry type
+*/
+
+ElemGeomType::ElemGeomType()
+{
+ myMesh = 0;
+ myType = SMDSAbs_All;
+ myGeomType = SMDSGeom_TRIANGLE;
+}
+
+void ElemGeomType::SetMesh( const SMDS_Mesh* theMesh )
+{
+ myMesh = theMesh;
+}
+
+bool ElemGeomType::IsSatisfy( long theId )
+{
+ if (!myMesh) return false;
+ const SMDS_MeshElement* anElem = myMesh->FindElement( theId );
+ const SMDSAbs_ElementType anElemType = anElem->GetType();
+ if ( !anElem || (myType != SMDSAbs_All && anElemType != myType) )
+ return false;
+ const int aNbNode = anElem->NbNodes();
+ bool isOk = false;
+ switch( anElemType )
+ {
+ case SMDSAbs_Node:
+ isOk = (myGeomType == SMDSGeom_POINT);
+ break;
+
+ case SMDSAbs_Edge:
+ isOk = (myGeomType == SMDSGeom_EDGE);
+ break;
+
+ case SMDSAbs_Face:
+ if ( myGeomType == SMDSGeom_TRIANGLE )
+ isOk = (!anElem->IsPoly() && aNbNode == 3);
+ else if ( myGeomType == SMDSGeom_QUADRANGLE )
+ isOk = (!anElem->IsPoly() && aNbNode == 4);
+ else if ( myGeomType == SMDSGeom_POLYGON )
+ isOk = anElem->IsPoly();
+ break;
+
+ case SMDSAbs_Volume:
+ if ( myGeomType == SMDSGeom_TETRA )
+ isOk = (!anElem->IsPoly() && aNbNode == 4);
+ else if ( myGeomType == SMDSGeom_PYRAMID )
+ isOk = (!anElem->IsPoly() && aNbNode == 5);
+ else if ( myGeomType == SMDSGeom_PENTA )
+ isOk = (!anElem->IsPoly() && aNbNode == 6);
+ else if ( myGeomType == SMDSGeom_HEXA )
+ isOk = (!anElem->IsPoly() && aNbNode == 8);
+ else if ( myGeomType == SMDSGeom_POLYHEDRA )
+ isOk = anElem->IsPoly();
+ break;
+ default: break;
+ }
+ return isOk;
+}
+
+void ElemGeomType::SetType( SMDSAbs_ElementType theType )
+{
+ myType = theType;
+}
+
+SMDSAbs_ElementType ElemGeomType::GetType() const
+{
+ return myType;
+}
+
+void ElemGeomType::SetGeomType( SMDSAbs_GeometryType theType )
+{
+ myGeomType = theType;
+}
+
+SMDSAbs_GeometryType ElemGeomType::GetGeomType() const
+{
+ return myGeomType;
+}
+
/*
Class : RangeOfIds
Description : Predicate for Range of Ids.
#include <TopoDS_Face.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
+#include <Quantity_Color.hxx>
#include "SMDSAbs_ElementType.hxx"
#include "SMDS_MeshNode.hxx"
typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
+ /*
+ 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;
+
+ private:
+ typedef std::set< long > TIDs;
+
+ Quantity_Color myColor;
+ SMDSAbs_ElementType myType;
+ TIDs myIDs;
+ };
+ typedef boost::shared_ptr<GroupColor> GroupColorPtr;
+
+ /*
+ Class : ElemGeomType
+ Description : Predicate to check element geometry type
+ */
+ class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
+ public:
+ ElemGeomType();
+ virtual void SetMesh( const SMDS_Mesh* theMesh );
+ virtual bool IsSatisfy( long theElementId );
+ void SetType( SMDSAbs_ElementType theType );
+ virtual SMDSAbs_ElementType GetType() const;
+ void SetGeomType( SMDSAbs_GeometryType theType );
+ virtual SMDSAbs_GeometryType GetGeomType() const;
+
+ private:
+ const SMDS_Mesh* myMesh;
+ SMDSAbs_ElementType myType;
+ SMDSAbs_GeometryType myGeomType;
+ };
+ typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
+
/*
FILTER
*/
aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
+ my2DExtProp = vtkProperty::New();
+ my2DExtProp->DeepCopy(mySurfaceProp);
+ SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
+ anRGB[0] = 1 - anRGB[0];
+ anRGB[1] = 1 - anRGB[1];
+ anRGB[2] = 1 - anRGB[2];
+ my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+ my2DExtActor = SMESH_DeviceActor::New();
+ my2DExtActor->SetUserMatrix(aMatrix);
+ my2DExtActor->PickableOff();
+ my2DExtActor->SetProperty(my2DExtProp);
+ my2DExtActor->SetBackfaceProperty(my2DExtProp);
+ my2DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
+ aFilter = my2DExtActor->GetExtractUnstructuredGrid();
+ aFilter->RegisterCellsWithType(VTK_TRIANGLE);
+ aFilter->RegisterCellsWithType(VTK_POLYGON);
+ aFilter->RegisterCellsWithType(VTK_QUAD);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
+
my3DActor = SMESH_DeviceActor::New();
my3DActor->SetUserMatrix(aMatrix);
my3DActor->PickableOff();
my1DExtActor->Delete();
my2DActor->Delete();
+ my2DExtProp->Delete();
+ my2DExtActor->Delete();
my3DActor->Delete();
myNodeActor->Delete();
aFunctor.reset(new SMESH::Controls::FreeNodes());
myControlActor = myNodeActor;
break;
+ case eFreeFaces:
+ aFunctor.reset(new SMESH::Controls::FreeFaces());
+ myControlActor = my2DActor;
+ break;
case eMultiConnection:
aFunctor.reset(new SMESH::Controls::MultiConnection());
myControlActor = my1DActor;
case eFreeBorders:
my1DExtActor->SetExtControlMode(aFunctor);
break;
+ case eFreeFaces:
+ my2DExtActor->SetExtControlMode(aFunctor);
+ break;
case eLength2D:
case eMultiConnection2D:
my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
switch(myControlMode){
case eLength2D:
case eFreeEdges:
+ case eFreeFaces:
case eMultiConnection2D:
//SetEntityMode(eEdges);
SetEntityMode(eFaces);
my3DActor->AddToRender(theRenderer);
my2DActor->AddToRender(theRenderer);
+ my2DExtActor->AddToRender(theRenderer);
theRenderer->AddActor(my1DActor);
theRenderer->AddActor(my1DExtActor);
theRenderer->RemoveActor(my1DExtActor);
my2DActor->RemoveFromRender(theRenderer);
+ my2DExtActor->RemoveFromRender(theRenderer);
my3DActor->RemoveFromRender(theRenderer);
theRenderer->RemoveActor(myScalarBarActor);
my1DExtActor->Init(myVisualObj,myImplicitBoolean);
my2DActor->Init(myVisualObj,myImplicitBoolean);
+ my2DExtActor->Init(myVisualObj,myImplicitBoolean);
my3DActor->Init(myVisualObj,myImplicitBoolean);
my1DActor->GetMapper()->SetLookupTable(myLookupTable);
my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
my2DActor->GetMapper()->SetLookupTable(myLookupTable);
+ my2DExtActor->GetMapper()->SetLookupTable(myLookupTable);
my3DActor->GetMapper()->SetLookupTable(myLookupTable);
vtkFloatingPointType aFactor, aUnits;
my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
+ my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5);
SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
if( !mgr )
my1DExtActor->SetTransform(theTransform);
my2DActor->SetTransform(theTransform);
+ my2DExtActor->SetTransform(theTransform);
my3DActor->SetTransform(theTransform);
Modified();
my1DExtActor->SetShrinkFactor(theValue);
my2DActor->SetShrinkFactor(theValue);
+ my2DExtActor->SetShrinkFactor(theValue);
my3DActor->SetShrinkFactor(theValue);
Modified();
my1DExtActor->SetShrink();
my2DActor->SetShrink();
+ my2DExtActor->SetShrink();
my3DActor->SetShrink();
myIsShrunk = true;
my1DExtActor->UnShrink();
my2DActor->UnShrink();
+ my2DExtActor->UnShrink();
my3DActor->UnShrink();
myIsShrunk = false;
my1DExtActor->VisibilityOff();
my2DActor->VisibilityOff();
+ my2DExtActor->VisibilityOff();
my3DActor->VisibilityOff();
myScalarBarActor->VisibilityOff();
case eFreeBorders:
my1DExtActor->VisibilityOn();
break;
+ case eFreeFaces:
+ my2DExtActor->VisibilityOn();
+ break;
case eLength2D:
case eMultiConnection2D:
my1DExtActor->VisibilityOn();
my2DActor->SetProperty(aProp);
my2DActor->SetBackfaceProperty(aBackProp);
my2DActor->SetRepresentation(aReperesent);
+
+ my2DExtActor->SetRepresentation(aReperesent);
my3DActor->SetProperty(aProp);
my3DActor->SetBackfaceProperty(aBackProp);
my3DActor->SetRepresentation(aReperesent);
my1DExtActor->SetVisibility(false);
+ my2DExtActor->SetVisibility(false);
switch(myControlMode){
case eLength:
void SMESH_ActorDef::GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
::GetColor(mySurfaceProp,r,g,b);
+ my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
}
void SMESH_ActorDef::SetBackSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
+ my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
}
virtual bool GetFacesOriented() = 0;
enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes,
- eMultiConnection, eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping,
- eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D};
+ eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio,
+ eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D};
virtual void SetControlMode(eControl theMode) = 0;
virtual eControl GetControlMode() = 0;
SMESH_DeviceActor* myHighlitableActor;
eControl myControlMode;
+ vtkProperty* my2DExtProp;
SMESH_DeviceActor* my2DActor;
+ SMESH_DeviceActor* my2DExtActor;
SMESH_DeviceActor* my3DActor;
SMESH_DeviceActor* myControlActor;
myVisualObj->UpdateFunctor(theFunctor);
using namespace SMESH::Controls;
- if(FreeBorders* aFreeBorders = dynamic_cast<FreeBorders*>(theFunctor.get())){
+ if ( dynamic_cast<FreeBorders*>(theFunctor.get()) ||
+ dynamic_cast<FreeFaces*>(theFunctor.get()) ) {
+ Predicate* aFreePredicate = dynamic_cast<Predicate*>(theFunctor.get());
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells();
for( vtkIdType i = 0; i < aNbCells; i++ ){
vtkIdType anObjId = myVisualObj->GetElemObjId(i);
- if(aFreeBorders->IsSatisfy(anObjId))
+ if(aFreePredicate->IsSatisfy(anObjId))
myExtractUnstructuredGrid->RegisterCell(i);
}
if(!myExtractUnstructuredGrid->IsCellsRegistered())
SetUnstructuredGrid(aDataSet);
aDataSet->Delete();
- }
- else if(FreeNodes* aFreeNodes = dynamic_cast<FreeNodes*>(theFunctor.get())){
+ }else if(FreeNodes* aFreeNodes = dynamic_cast<FreeNodes*>(theFunctor.get())){
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells();
SMDSAbs_NbElementTypes
};
+/*! enumeration for element geometry type */
+enum SMDSAbs_GeometryType
+{
+ // 0D element
+ SMDSGeom_POINT,
+ // 1D element
+ SMDSGeom_EDGE,
+ // 2D element
+ SMDSGeom_TRIANGLE,
+ SMDSGeom_QUADRANGLE,
+ SMDSGeom_POLYGON,
+ // 3D element
+ SMDSGeom_TETRA,
+ SMDSGeom_PYRAMID,
+ SMDSGeom_PENTA,
+ SMDSGeom_HEXA,
+ SMDSGeom_POLYHEDRA,
+};
+
+
enum SMDSAbs_ElementOrder {
ORDER_ANY, /*! entities of any order */
ORDER_LINEAR, /*! entities of 1st order */
aTitle = QObject::tr( "SMESH_VOLUME" );
aControl = SMESH_Actor::eVolume3D;
break;
+ case 6021:
+ aTitle = QObject::tr( "FREE_FACES" );
+ aControl = SMESH_Actor::eFreeFaces;
+ break;
}
anActor->SetControlMode(aControl);
anActor->GetScalarBarActor()->SetTitle(aTitle.toLatin1().data());
case 6004:
case 6005:
case 6009:
+ case 6021:
if ( vtkwnd ) {
LightApp_SelectionMgr* mgr = selectionMgr();
createSMESHAction( 903, "WHAT_IS", "ICON_WHAT_IS" );
createSMESHAction( 6001, "LENGTH", "ICON_LENGTH", 0, true );
createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE", 0, true );
+ createSMESHAction( 6021, "FREE_FACES", "ICON_FREE_FACES", 0, true );
createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D", 0, true );
createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION", 0, true );
createSMESHAction( 6005, "FREE_NODE", "ICON_FREE_NODE", 0, true );
createMenu( separator(), ctrlId, -1 );
createMenu( 6017, ctrlId, -1 );
createMenu( 6009, ctrlId, -1 );
+ createMenu( 6021, ctrlId, -1 );
createMenu( separator(), ctrlId, -1 );
createMenu( 400, addId, -1 );
createTool( separator(), ctrlTb );
createTool( 6017, ctrlTb );
createTool( 6009, ctrlTb );
+ createTool( 6021, ctrlTb );
createTool( separator(), ctrlTb );
createTool( 400, addRemTb );
popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", QtxPopupMgr::ToggleRule );
+ popupMgr()->insert( action( 6021 ), anId, -1 ); // FREE_FACE
+ popupMgr()->setRule( action( 6021 ), aMeshInVtkHasFaces /*aMeshInVtkHasVolumes*/,
+ QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( 6021 ), "controlMode = 'eFreeFaces'", QtxPopupMgr::ToggleRule );
+
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myFilterDlg( 0 )
{
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
QPixmap edgeImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
ElementsLineEdit = new QLineEdit(GroupArguments);
ElementsLineEdit->setValidator(myIdValidator);
+ QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+ connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Controls for the whole mesh selection
MeshCheck = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
GroupArgumentsLayout->addWidget(ElementsLab, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
GroupArgumentsLayout->addWidget(ElementsLineEdit, 0, 2);
- GroupArgumentsLayout->addWidget(MeshCheck, 1, 0, 1, 3);
- GroupArgumentsLayout->addWidget(PathGrp, 2, 0, 1, 3);
- GroupArgumentsLayout->addWidget(BasePointGrp, 3, 0, 1, 3);
- GroupArgumentsLayout->addWidget(AnglesGrp, 4, 0, 1, 3);
- GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0, 1, 3);
+ GroupArgumentsLayout->addWidget(filterBtn, 0, 3);
+ GroupArgumentsLayout->addWidget(MeshCheck, 1, 0, 1, 4);
+ GroupArgumentsLayout->addWidget(PathGrp, 2, 0, 1, 4);
+ GroupArgumentsLayout->addWidget(BasePointGrp, 3, 0, 1, 4);
+ GroupArgumentsLayout->addWidget(AnglesGrp, 4, 0, 1, 4);
+ GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0, 1, 4);
/***************************************************************/
// common buttons group box
SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg()
{
// no need to delete child widgets, Qt does it all for us
+ if ( myFilterDlg != 0 ) {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ }
}
//=================================================================================
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
- SMESH::SetPickable(); // ???
- SMESH::SetPointRepresentation(false);
+ if (SMESH::GetCurrentVtkView()) {
+ SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+ SMESH::SetPointRepresentation(false);
+ SMESH::SetPickable();
+ }
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
ClickOnHelp();
}
}
+
+//=================================================================================
+// function : setFilters()
+// purpose : SLOT. Called when "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_ExtrusionAlongPathDlg::setFilters()
+{
+ if ( !myFilterDlg )
+ {
+ QList<int> types;
+ types.append( SMESH::EDGE );
+ types.append( SMESH::FACE );
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
+ }
+ myFilterDlg->Init( Elements1dRB->isChecked() ? SMESH::EDGE : SMESH::FACE );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( ElementsLineEdit );
+
+ myFilterDlg->show();
+}
class SMESH_Actor;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
+class SMESHGUI_FilterDlg;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SUIT_SelectionFilter;
QString myHelpFileName;
+ SMESHGUI_FilterDlg* myFilterDlg;
+
protected slots:
void reject();
void onSelectMesh();
void OnAngleAdded();
void OnAngleRemoved();
+ void setFilters();
};
#endif // SMESHGUI_EXTRUSIONALONGPATHDLG_H
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myFilterDlg( 0 )
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(myIdValidator);
+ QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+ connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
- GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 6);
+ GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 5);
+ GroupArgumentsLayout->addWidget(filterBtn, 0, 7);
GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 8);
GroupArgumentsLayout->addWidget(TextLabelDistance, 2, 0);
GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
//=================================================================================
SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
{
+ if ( myFilterDlg != 0 ) {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ }
}
//=================================================================================
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
- SMESH::SetPickable(); // ???
- SMESH::SetPointRepresentation(false);
+ if (SMESH::GetCurrentVtkView()) {
+ SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+ SMESH::SetPointRepresentation(false);
+ SMESH::SetPickable();
+ }
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
ClickOnHelp();
}
}
+
+//=================================================================================
+// function : setFilters()
+// purpose : SLOT. Called when "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_ExtrusionDlg::setFilters()
+{
+ if ( !myFilterDlg )
+ {
+ QList<int> types;
+ types.append( SMESH::EDGE );
+ types.append( SMESH::FACE );
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
+ }
+ myFilterDlg->Init( GetConstructorId() ? SMESH::FACE : SMESH::EDGE );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( LineEditElements );
+
+ myFilterDlg->show();
+}
class SMESH_Actor;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
+class SMESHGUI_FilterDlg;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SUIT_SelectionFilter;
QString myHelpFileName;
+ SMESHGUI_FilterDlg* myFilterDlg;
+
private slots:
void ConstructorsClicked( int );
void CheckIsEnable();
void ActivateThisDialog();
void onTextChange( const QString& );
void onSelectMesh( bool );
+ void setFilters();
};
#endif // SMESHGUI_EXTRUSIONDLG_H
return false;
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
- SMESH::ElementType anElemType = myPred->GetElementType();
- int aMeshId = anElemType == SMESH::NODE ? anActor->GetNodeObjId( theCellId )
- : anActor->GetElemObjId( theCellId );
+ SMDSAbs_ElementType anElemType = (SMDSAbs_ElementType)myPred->GetElementType();
+ int aMeshId = anElemType == SMDSAbs_Node ? anActor->GetNodeObjId( theCellId )
+ : anActor->GetElemObjId( theCellId );
// if type of element != type of predicate return true because
// this predicate is not intended for filtering sush elements
- const SMDS_MeshElement* anElem = anElemType == SMESH::NODE ? aMesh->FindNode( aMeshId )
- : aMesh->FindElement( aMeshId );
- if ( anElem != 0 && anElem->GetType() != (SMDSAbs_ElementType)myPred->GetElementType() )
- return true;
-
+ const SMDS_MeshElement* anElem = anElemType == SMDSAbs_Node ? aMesh->FindNode( aMeshId )
+ : aMesh->FindElement( aMeshId );
+ // here we guess that predicate element type can not be All in case of node selection
+ if ( !anElem || (anElemType != SMDSAbs_All && anElem->GetType() != anElemType) )
+ return false;
+
return myPred->IsSatisfy( aMeshId );
}
return false;
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
- SMESH::ElementType anElemType = myPred->GetElementType();
+ SMDSAbs_ElementType anElemType = (SMDSAbs_ElementType)myPred->GetElementType();
// if type of element != type of predicate return true because
// this predicate is not intended for filtering sush elements
- const SMDS_MeshElement* anElem = anElemType == SMESH::NODE ? aMesh->FindNode( theObjId )
- : aMesh->FindElement( theObjId );
- if ( anElem != 0 && anElem->GetType() != (SMDSAbs_ElementType)myPred->GetElementType() )
- return true;
+ const SMDS_MeshElement* anElem = anElemType == SMDSAbs_Node ? aMesh->FindNode( theObjId )
+ : aMesh->FindElement( theObjId );
+ // here we guess that predicate element type can not be All in case of node selection
+ if ( !anElem || (anElemType != SMDSAbs_All && anElem->GetType() != anElemType) )
+ return false;
return myPred->IsSatisfy( theObjId );
}
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
+#include <QtxComboBox.h>
+#include <QtxColorButton.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
if (myTables.isEmpty())
{
- int aType = theTypes.first();
-
// create main layout
QVBoxLayout* aMainLay = new QVBoxLayout(this);
aMainLay->setMargin( 0 );
mySwitchTableGrpLayout->setMargin(0);
mySwitchTableGrpLayout->setSpacing(0);
- myTables[ aType ] = createTable(mySwitchTableGrp, aType);
- mySwitchTableGrpLayout->addWidget(myTables[ aType ]);
+ QList<int>::const_iterator typeIt = theTypes.begin();
+ for ( ; typeIt != theTypes.end(); ++typeIt ) {
+ Table* aTable = createTable(mySwitchTableGrp, *typeIt);
+ myTables[ *typeIt ] = aTable;
+ mySwitchTableGrpLayout->addWidget(aTable);
+ if ( typeIt != theTypes.begin() )
+ aTable->hide();
+ }
// create buttons
myAddBtn = new QPushButton(tr("ADD"), myTableGrp);
for (int i = 0, n = aTable->rowCount(); i < n; i++)
{
int aCriterion = GetCriterionType(i, aType);
-
- if (aCriterion == SMESH::FT_RangeOfIds ||
+ QString errMsg;
+ if (aCriterion == SMESH::FT_GroupColor ) {
+ QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(i, 2));
+ if (clrBtn && !clrBtn->color().isValid())
+ errMsg = tr( "GROUPCOLOR_ERROR" );
+ } else if (aCriterion == SMESH::FT_ElemGeomType ) {
+ QtxComboBox* typeBox = qobject_cast<QtxComboBox*>(aTable->cellWidget(i, 2));
+ if (typeBox && typeBox->currentId() == -1)
+ errMsg = tr( "ERROR" );
+ } else if (aCriterion == SMESH::FT_RangeOfIds ||
aCriterion == SMESH::FT_BelongToGeom ||
aCriterion == SMESH::FT_BelongToPlane ||
aCriterion == SMESH::FT_BelongToCylinder ||
aCriterion == SMESH::FT_BelongToGenSurface ||
aCriterion == SMESH::FT_LyingOnGeom) {
- if (aTable->text(i, 2).isEmpty()) {
- if (theMess)
- SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("ERROR"));
- return false;
- }
- } else {
+ if (aTable->text(i, 2).isEmpty());
+ errMsg = tr( "ERROR" );
+ }
+ else {
bool aRes = false;
bool isSignalsBlocked = aTable->signalsBlocked();
aTable->blockSignals(true);
double aThreshold = (int)aTable->text(i, 2).toDouble(&aRes);
aTable->blockSignals(isSignalsBlocked);
- if (!aRes && aTable->isEditable(i, 2)) {
- if (theMess)
- SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("ERROR"));
- return false;
- }
+ if (!aRes && aTable->isEditable(i, 2))
+ errMsg = tr( "ERROR" );
else if (aType == SMESH::EDGE &&
GetCriterionType(i, aType) == SMESH::FT_MultiConnection &&
aThreshold == 1)
- {
- if (theMess)
- SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("MULTIEDGES_ERROR"));
- return false;
- }
+ errMsg = tr( "MULTIEDGES_ERROR" );
+ }
+
+ if (!errMsg.isEmpty()) {
+ if (theMess)
+ SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), errMsg );
+ return false;
}
QTableWidgetItem* anItem = aTable->item(i, 0);
int aCriterionType = GetCriterionType(theRow, aType);
- if ( aCriterionType != SMESH::FT_RangeOfIds &&
- aCriterionType != SMESH::FT_BelongToGeom &&
- aCriterionType != SMESH::FT_BelongToPlane &&
- aCriterionType != SMESH::FT_BelongToCylinder &&
- aCriterionType != SMESH::FT_BelongToGenSurface &&
- aCriterionType != SMESH::FT_LyingOnGeom)
+ if ( aCriterionType == SMESH::FT_GroupColor )
+ {
+ QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(theRow, 2));
+ if ( clrBtn )
+ {
+ const QColor qClr = clrBtn->color();
+ QString clrStr = QString( "%1;%2;%3" ).
+ arg( qClr.red()/256. ).arg( qClr.green()/256. ).arg( qClr.blue()/256. );
+ theCriterion.ThresholdStr = clrStr.toLatin1().constData();
+ }
+ }
+ else if ( aCriterionType == SMESH::FT_ElemGeomType ) {
+ QtxComboBox* typeBox = qobject_cast<QtxComboBox*>(aTable->cellWidget(theRow, 2));
+ if ( typeBox )
+ theCriterion.Threshold = (double)typeBox->currentId();
+ }
+ else if ( aCriterionType != SMESH::FT_RangeOfIds &&
+ aCriterionType != SMESH::FT_BelongToGeom &&
+ aCriterionType != SMESH::FT_BelongToPlane &&
+ aCriterionType != SMESH::FT_BelongToCylinder &&
+ aCriterionType != SMESH::FT_BelongToGenSurface &&
+ aCriterionType != SMESH::FT_LyingOnGeom)
{
theCriterion.Compare = ((ComboItem*)aTable->item(theRow, 1))->value();
theCriterion.Threshold = aTable->item(theRow, 2)->text().toDouble();
else
aTable->setEditable(false, theRow, 4);
- if (theCriterion.Type != SMESH::FT_RangeOfIds &&
+ if (theCriterion.Type == SMESH::FT_GroupColor )
+ {
+ QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(theRow, 2));
+ if ( clrBtn )
+ {
+ QColor qClr;
+ QString clrStr( theCriterion.ThresholdStr );
+ QStringList clrVals = clrStr.split( ";" );
+ if ( clrVals.count() > 2 )
+ qClr.setRgb( (int)256*clrVals[0].toDouble(),
+ (int)256*clrVals[1].toDouble(),
+ (int)256*clrVals[2].toDouble() );
+ clrBtn->setColor( qClr );
+ }
+ }
+ else if (theCriterion.Type == SMESH::FT_ElemGeomType )
+ {
+ QtxComboBox* typeBox = qobject_cast<QtxComboBox*>(aTable->cellWidget(theRow, 2));
+ if ( typeBox )
+ typeBox->setCurrentId( (int)(theCriterion.Threshold + 0.5) );
+ }
+ else if (theCriterion.Type != SMESH::FT_RangeOfIds &&
theCriterion.Type != SMESH::FT_BelongToGeom &&
theCriterion.Type != SMESH::FT_BelongToPlane &&
theCriterion.Type != SMESH::FT_BelongToCylinder &&
theCriterion.Type != SMESH::FT_FreeBorders &&
theCriterion.Type != SMESH::FT_FreeEdges &&
theCriterion.Type != SMESH::FT_FreeNodes &&
- theCriterion.Type != SMESH::FT_BadOrientedVolume)
+ theCriterion.Type != SMESH::FT_FreeFaces &&
+ theCriterion.Type != SMESH::FT_BadOrientedVolume &&
+ theCriterion.Type != SMESH::FT_LinearOrQuadratic)
aTable->item( theRow, 2 )->setText(QString("%1").arg(theCriterion.Threshold, 0, 'g', 15));
else
{
}
ComboItem* anItem = ((ComboItem*)aTable->item(aRow, 0));
+ int aCriterion = GetCriterionType(aRow);
bool toEnable = ((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo &&
- GetCriterionType(aRow) != SMESH::FT_BelongToGeom &&
- GetCriterionType(aRow) != SMESH::FT_LyingOnGeom &&
- GetCriterionType(aRow) != SMESH::FT_RangeOfIds &&
- GetCriterionType(aRow) != SMESH::FT_FreeEdges &&
- GetCriterionType(aRow) != SMESH::FT_BadOrientedVolume;
+ aCriterion != SMESH::FT_BelongToGeom &&
+ aCriterion != SMESH::FT_LyingOnGeom &&
+ aCriterion != SMESH::FT_RangeOfIds &&
+ aCriterion != SMESH::FT_FreeEdges &&
+ aCriterion != SMESH::FT_FreeFaces &&
+ aCriterion != SMESH::FT_BadOrientedVolume;
+
if (!myAddWidgets.contains(anItem))
{
myAddWidgets[ anItem ] = new AdditionalWidget(myWgStack);
emit CurrentChanged(theRow, theCol);
}
+//=======================================================================
+// name : geomTypes
+// Purpose : returns available geometry types of elements
+//=======================================================================
+static QList<int> geomTypes( const int theType )
+{
+ QList<int> typeIds;
+ if ( theType == SMESH::NODE )
+ typeIds.append( SMESH::Geom_POINT );
+ if ( theType == SMESH::ALL || theType == SMESH::EDGE )
+ typeIds.append( SMESH::Geom_EDGE );
+ if ( theType == SMESH::ALL || theType == SMESH::FACE )
+ {
+ typeIds.append( SMESH::Geom_TRIANGLE );
+ typeIds.append( SMESH::Geom_QUADRANGLE );
+ typeIds.append( SMESH::Geom_POLYGON );
+ }
+ if ( theType == SMESH::ALL || theType == SMESH::VOLUME )
+ {
+ typeIds.append( SMESH::Geom_TETRA );
+ typeIds.append( SMESH::Geom_PYRAMID );
+ typeIds.append( SMESH::Geom_HEXA );
+ typeIds.append( SMESH::Geom_PENTA );
+ typeIds.append( SMESH::Geom_POLYHEDRA );
+ }
+ return typeIds;
+}
+
//=======================================================================
// name : SMESHGUI_FilterTable::onCriterionChanged()
// Purpose : Provides reaction on change of criterion
ComboItem* aCompareItem = (ComboItem*)aTable->item(row, 1);
int aCriterionType = GetCriterionType(row);
+ QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(row, 2));
+ QtxComboBox* typeBox = qobject_cast<QtxComboBox*>(aTable->cellWidget(row, 2));
+
+ if ( (aCriterionType == SMESH::FT_GroupColor && !clrBtn) ||
+ (aCriterionType == SMESH::FT_ElemGeomType && !typeBox) )
+ {
+ bool isSignalsBlocked = aTable->signalsBlocked();
+ aTable->blockSignals( true );
+ if ( aCriterionType == SMESH::FT_GroupColor )
+ aTable->setCellWidget( row, 2, new QtxColorButton( aTable ) );
+ else {
+ QtxComboBox* typeBox = new QtxComboBox( aTable );
+ aTable->setCellWidget( row, 2, typeBox );
+ QList<int> typeIds = geomTypes( aType );
+ QList<int>::const_iterator anIter = typeIds.begin();
+ for ( int i = 0; anIter != typeIds.end(); ++anIter, ++i) {
+ QString typeKey = QString( "GEOM_TYPE_%1" ).arg( *anIter );
+ typeBox->addItem( tr( typeKey.toLatin1().data() ) );
+ typeBox->setId( i, *anIter );
+ }
+ }
+ aTable->blockSignals( isSignalsBlocked );
+ }
+ else if ( (aCriterionType != SMESH::FT_GroupColor && clrBtn) ||
+ (aCriterionType != SMESH::FT_ElemGeomType && typeBox) )
+ {
+ bool isSignalsBlocked = aTable->signalsBlocked();
+ aTable->blockSignals( true );
+ aTable->setCellWidget( row, 2, 0 );
+ aTable->setItem( row, 2, new QTableWidgetItem() );
+ aTable->blockSignals( isSignalsBlocked );
+ }
- if ( aType == SMESH::NODE && aCriterionType == SMESH::FT_FreeNodes ||
- aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ||
- aType == SMESH::FACE && aCriterionType == SMESH::FT_FreeEdges ||
- aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume)
+ if (aType == SMESH::NODE && aCriterionType == SMESH::FT_FreeNodes ||
+ aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ||
+ aType == SMESH::FACE && (aCriterionType == SMESH::FT_FreeEdges ||
+ aCriterionType == SMESH::FT_FreeFaces) ||
+ aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume ||
+ aCriterionType == SMESH::FT_LinearOrQuadratic ||
+ aCriterionType == SMESH::FT_GroupColor ||
+ aCriterionType == SMESH::FT_ElemGeomType)
{
bool isSignalsBlocked = aTable->signalsBlocked();
aTable->blockSignals( true );
if (aCompareItem->count() > 0)
aCompareItem->clear();
aTable->setEditable(false, row, 1);
- aTable->setEditable(false, row, 2);
-
+ aTable->setEditable(aCriterionType == SMESH::FT_GroupColor ||
+ aCriterionType == SMESH::FT_ElemGeomType, row, 2);
aTable->blockSignals( isSignalsBlocked );
}
else if (aCriterionType == SMESH::FT_RangeOfIds ||
if (!aTable->isEditable(row, 2))
aTable->setEditable(true, row, 2);
}
+ else if (aCriterionType == SMESH::FT_GroupColor ||
+ aCriterionType == SMESH::FT_ElemGeomType)
+ {
+ if (!aTable->isEditable(row, 2))
+ aTable->setEditable(true, row, 2);
+ }
else
{
if (aCompareItem->count() != 3)
aTypes[ SMESH::EDGE ] = tr("EDGES");
aTypes[ SMESH::FACE ] = tr("FACES");
aTypes[ SMESH::VOLUME ] = tr("VOLUMES");
+ aTypes[ SMESH::ALL ] = tr("ELEMENTS");
}
return aTypes;
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_FreeNodes ] = tr("FREE_NODES");
+ aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
}
return aCriteria;
}
aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
+ aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
+ aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
+ aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
}
return aCriteria;
}
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_Length2D ] = tr("LENGTH2D");
aCriteria[ SMESH::FT_MultiConnection2D ] = tr("MULTI2D_BORDERS");
+ aCriteria[ SMESH::FT_FreeFaces ] = tr("FREE_FACES");
+ aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
+ aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
+ aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
}
return aCriteria;
}
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_BadOrientedVolume ] = tr("BAD_ORIENTED_VOLUME");
aCriteria[ SMESH::FT_Volume3D ] = tr("VOLUME_3D");
+ aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
+ aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
+ aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
}
return aCriteria;
}
- else
+ else // SMESH::ALL
{
static QMap<int, QString> aCriteria;
+ if (aCriteria.isEmpty())
+ {
+ aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS");
+ aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM");
+ aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
+ aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
+ aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
+ aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
+ }
+
return aCriteria;
}
}
QRadioButton* aMeshBtn = new QRadioButton(tr("MESH"), aBox);
QRadioButton* aSelBtn = new QRadioButton(tr("SELECTION"), aBox);
- QRadioButton* aGrpBtn = new QRadioButton(tr("CURRENT_GROUP"), aBox);
+ QRadioButton* aDlgBtn = new QRadioButton(tr("CURRENT_DIALOG"),aBox);
aLay->addWidget(aMeshBtn);
aLay->addWidget(aSelBtn);
- aLay->addWidget(aGrpBtn);
+ aLay->addWidget(aDlgBtn);
mySourceGrp->addButton(aMeshBtn, Mesh);
mySourceGrp->addButton(aSelBtn, Selection);
- mySourceGrp->addButton(aGrpBtn, Dialog);
+ mySourceGrp->addButton(aDlgBtn, Dialog);
aSelBtn->setChecked(true);
case SMESH::EDGE : return EdgeSelection;
case SMESH::FACE : return FaceSelection;
case SMESH::VOLUME : return VolumeSelection;
+ case SMESH::ALL : return CellSelection;
default : return ActorSelection;
}
void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_var theMesh)
{
myMesh = theMesh;
- if ( myMesh->_is_nil() ) {
- myButtons[BTN_OK]->setEnabled(false);
- myButtons[BTN_Apply]->setEnabled(false);
- }
+ const bool isEnable = !(myMesh->_is_nil());
+ myButtons[BTN_OK]->setEnabled(isEnable);
+ myButtons[BTN_Apply]->setEnabled(isEnable);
}
//=======================================================================
}
}
+ int aCriterionType = myTable->GetCriterionType(aRow);
if (aList.Extent() != 1 ||
!myTable->CurrentCell(aRow, aCol) ||
- myTable->GetCriterionType(aRow) != SMESH::FT_BelongToGeom &&
- myTable->GetCriterionType(aRow) != SMESH::FT_BelongToPlane &&
- myTable->GetCriterionType(aRow) != SMESH::FT_BelongToCylinder &&
- myTable->GetCriterionType(aRow) != SMESH::FT_BelongToGenSurface &&
- myTable->GetCriterionType(aRow) != SMESH::FT_LyingOnGeom)
+ aCriterionType != SMESH::FT_BelongToGeom &&
+ aCriterionType != SMESH::FT_BelongToPlane &&
+ aCriterionType != SMESH::FT_BelongToCylinder &&
+ aCriterionType != SMESH::FT_BelongToGenSurface &&
+ aCriterionType != SMESH::FT_LyingOnGeom)
return;
Handle(SALOME_InteractiveObject) anIO = aList.First();
int aRow, aCol;
+ int aCriterionType = myTable->GetCriterionType(aRow);
if (myTable->CurrentCell(aRow, aCol) &&
- (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGeom ||
- myTable->GetCriterionType(aRow) == SMESH::FT_BelongToPlane ||
- myTable->GetCriterionType(aRow) == SMESH::FT_BelongToCylinder ||
- myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGenSurface ||
- myTable->GetCriterionType(aRow) == SMESH::FT_LyingOnGeom)) {
+ (aCriterionType == SMESH::FT_BelongToGeom ||
+ aCriterionType == SMESH::FT_BelongToPlane ||
+ aCriterionType == SMESH::FT_BelongToCylinder ||
+ aCriterionType == SMESH::FT_BelongToGenSurface ||
+ aCriterionType == SMESH::FT_LyingOnGeom)) {
- if (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGeom ||
- myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGenSurface ||
- myTable->GetCriterionType(aRow) == SMESH::FT_LyingOnGeom) {
+ if (aCriterionType == SMESH::FT_BelongToGeom ||
+ aCriterionType == SMESH::FT_BelongToGenSurface ||
+ aCriterionType == SMESH::FT_LyingOnGeom) {
mySelectionMgr->installFilter(new GEOM_SelectionFilter( aStudy, true ));
- } else if (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToPlane) {
+ } else if (aCriterionType == SMESH::FT_BelongToPlane) {
mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Plane ) );
- } else if (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToCylinder) {
+ } else if (aCriterionType == SMESH::FT_BelongToCylinder) {
mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Cylinder ) );
}
myIsSelectionChanged = true;
myName->setText( "Group On " + aShapeName);
myName->blockSignals(false);
}
+ updateButtons();
}
//=================================================================================
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMDS_Mesh.hxx>
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule),
- myBusy(false)
+ myBusy(false),
+ myFilterDlg(0)
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
SelectButtonC1A1->setIcon(image1);
LineEditC1A1 = new QLineEdit(GroupC1);
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this));
+ QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 );
+ connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
GroupC1Layout->addWidget(TextLabelC1A1);
GroupC1Layout->addWidget(SelectButtonC1A1);
GroupC1Layout->addWidget(LineEditC1A1);
+ GroupC1Layout->addWidget(filterBtn );
/***************************************************************/
GroupButtons = new QGroupBox(this);
//=================================================================================
SMESHGUI_RemoveElementsDlg::~SMESHGUI_RemoveElementsDlg()
{
+ if ( myFilterDlg ) {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ myFilterDlg = 0;
+ }
}
//=================================================================================
//=================================================================================
void SMESHGUI_RemoveElementsDlg::ClickOnCancel()
{
+ if (SMESH::GetCurrentVtkView())
+ SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
//mySelectionMgr->clearSelected();
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
+ mySelectionMgr->clearFilters();
mySMESHGUI->ResetState();
reject();
}
ClickOnHelp();
}
}
+
+//=================================================================================
+// function : setFilters()
+// purpose : SLOT. Called when "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_RemoveElementsDlg::setFilters()
+{
+ if ( !myFilterDlg )
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( LineEditC1A1 );
+
+ myFilterDlg->show();
+}
class QRadioButton;
class SMESHGUI;
+class SMESHGUI_FilterDlg;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
QString myHelpFileName;
+ SMESHGUI_FilterDlg* myFilterDlg;
+
private slots:
void ClickOnOk();
void ClickOnCancel();
void DeactivateActiveDialog();
void ActivateThisDialog();
void onTextChange( const QString& );
+ void setFilters();
};
#endif // SMESHGUI_REMOVEELEMENTSDLG_H
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMDS_Mesh.hxx>
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
mySMESHGUI(theModule),
- myBusy(false)
+ myBusy(false),
+ myFilterDlg(0)
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
SelectButtonC1A1->setIcon(image1);
LineEditC1A1 = new QLineEdit(GroupC1);
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this));
+ QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupC1 );
+ connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
GroupC1Layout->addWidget(TextLabelC1A1);
GroupC1Layout->addWidget(SelectButtonC1A1);
GroupC1Layout->addWidget(LineEditC1A1);
+ GroupC1Layout->addWidget(filterBtn );
/***************************************************************/
GroupButtons = new QGroupBox(this);
//=================================================================================
SMESHGUI_RemoveNodesDlg::~SMESHGUI_RemoveNodesDlg()
{
+ if ( myFilterDlg ) {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ myFilterDlg = 0;
+ }
}
//=================================================================================
void SMESHGUI_RemoveNodesDlg::ClickOnCancel()
{
//mySelectionMgr->clearSelected();
- SMESH::SetPointRepresentation(false);
+ if (SMESH::GetCurrentVtkView()) {
+ SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+ SMESH::SetPointRepresentation(false);
+ }
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
+ mySelectionMgr->clearFilters();
mySMESHGUI->ResetState();
reject();
}
ClickOnHelp();
}
}
+
+//=================================================================================
+// function : setFilters()
+// purpose : SLOT. Called when "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_RemoveNodesDlg::setFilters()
+{
+ if ( !myFilterDlg )
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::NODE );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( LineEditC1A1 );
+
+ myFilterDlg->show();
+}
class QRadioButton;
class SMESHGUI;
+class SMESHGUI_FilterDlg;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
QLineEdit* LineEditC1A1;
QString myHelpFileName;
+
+ SMESHGUI_FilterDlg* myFilterDlg;
private slots:
void ClickOnOk();
void DeactivateActiveDialog();
void ActivateThisDialog();
void onTextChange( const QString& );
+ void setFilters();
};
#endif // SMESHGUI_REMOVENODESDLG_H
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_MeshEditPreview.h"
+#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myVectorDefinition(NONE_SELECT)
+ myVectorDefinition(NONE_SELECT),
+ myFilterDlg( 0 )
{
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(myIdValidator);
+ QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+ connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
- GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 3);
- GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 3);
- GroupArgumentsLayout->addWidget(GroupAngleBox, 3, 0, 1, 3);
+ GroupArgumentsLayout->addWidget(filterBtn, 0, 3);
+ GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4);
+ GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 4);
+ GroupArgumentsLayout->addWidget(GroupAngleBox, 3, 0, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelTolerance, 4, 0, 1, 2);
- GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 4, 2);
- GroupArgumentsLayout->addWidget(CheckBoxPreview, 5, 0, 1, 3);
- GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 3);
+ GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 4, 2, 1, 2);
+ GroupArgumentsLayout->addWidget(CheckBoxPreview, 5, 0, 1, 4);
+ GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 4);
/***************************************************************/
GroupButtons = new QGroupBox(this);
SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
{
delete mySimulation;
+ if ( myFilterDlg ) {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ myFilterDlg = 0;
+ }
}
//=================================================================================
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
- SMESH::SetPointRepresentation(false);
+ if (SMESH::GetCurrentVtkView()) {
+ SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+ SMESH::SetPointRepresentation(false);
+ }
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
SelectionIntoArgument();
}
+
+//=================================================================================
+// function : setFilters()
+// purpose : SLOT. Called when "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_RevolutionDlg::setFilters()
+{
+ if ( !myFilterDlg )
+ {
+ QList<int> types;
+ types.append( SMESH::EDGE );
+ types.append( SMESH::FACE );
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
+ }
+ myFilterDlg->Init( GetConstructorId() ? SMESH::FACE : SMESH::EDGE );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( LineEditElements );
+
+ myFilterDlg->show();
+}
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
class SMESHGUI;
+class SMESHGUI_FilterDlg;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
QString myHelpFileName;
+ SMESHGUI_FilterDlg* myFilterDlg;
+
private slots:
void ConstructorsClicked( int );
void ClickOnOk();
void onDisplaySimulation( bool );
void onSelectVectorMenu( QAction* );
void onSelectVectorButton();
+ void setFilters();
};
#endif // SMESHGUI_REVOLUTIONDLG_H
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myFilterDlg(0)
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MESH_ROTATION")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
SelectElementsButton->setIcon(image1);
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(myIdValidator);
+ QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+ connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
- GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 2);
+ GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 1);
+ GroupArgumentsLayout->addWidget(filterBtn, 0, 3);
GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4);
GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelAngle, 3, 0, 1, 2);
//=================================================================================
SMESHGUI_RotationDlg::~SMESHGUI_RotationDlg()
{
+ if ( myFilterDlg ) {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ myFilterDlg = 0;
+ }
}
//=================================================================================
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
- SMESH::SetPointRepresentation(false);
+ if (SMESH::GetCurrentVtkView()) {
+ SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+ SMESH::SetPointRepresentation(false);
+ }
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
ClickOnHelp();
}
}
+
+//=================================================================================
+// function : setFilters()
+// purpose : SLOT. Called when "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_RotationDlg::setFilters()
+{
+ if ( !myFilterDlg )
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( LineEditElements );
+
+ myFilterDlg->show();
+}
class SMESH_Actor;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
+class SMESHGUI_FilterDlg;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SMESH_LogicalFilter;
QString myHelpFileName;
+ SMESHGUI_FilterDlg* myFilterDlg;
+
private slots:
void ClickOnOk();
void ClickOnCancel();
void onSelectMesh( bool );
void onVectorChanged();
void onActionClicked( int );
+ void setFilters();
};
#endif // SMESHGUI_ROTATIONDLG_H
case SMESH_Actor::eLength2D: return "eLength2D";
case SMESH_Actor::eFreeEdges: return "eFreeEdges";
case SMESH_Actor::eFreeBorders: return "eFreeBorders";
+ case SMESH_Actor::eFreeFaces: return "eFreeFaces";
case SMESH_Actor::eMultiConnection: return "eMultiConnection";
case SMESH_Actor::eMultiConnection2D: return "eMultiConnection2D";
case SMESH_Actor::eArea: return "eArea";
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myFilterDlg(0)
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(myIdValidator);
+ QPushButton* filterElemBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+ connect(filterElemBtn, SIGNAL(clicked()), this, SLOT(setElemFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
LineEditNodes = new QLineEdit(GroupArguments);
LineEditNodes->setValidator(myIdValidator);
+ QPushButton* filterNodeBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+ connect(filterNodeBtn, SIGNAL(clicked()), this, SLOT(setNodeFilters()));
// Controls for method selection
TextLabelMethod = new QLabel(tr("METHOD"), GroupArguments);
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
- GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 3);
+ GroupArgumentsLayout->addWidget(filterElemBtn, 0, 3);
+ GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelNodes, 2, 0);
GroupArgumentsLayout->addWidget(SelectNodesButton, 2, 1);
GroupArgumentsLayout->addWidget(LineEditNodes, 2, 2);
+ GroupArgumentsLayout->addWidget(filterNodeBtn, 2, 3);
GroupArgumentsLayout->addWidget(TextLabelMethod, 3, 0);
- GroupArgumentsLayout->addWidget(ComboBoxMethod, 3, 2);
+ GroupArgumentsLayout->addWidget(ComboBoxMethod, 3, 2, 1, 2);
GroupArgumentsLayout->addWidget(TextLabelLimit, 4, 0);
- GroupArgumentsLayout->addWidget(SpinBox_IterationLimit, 4, 2);
+ GroupArgumentsLayout->addWidget(SpinBox_IterationLimit, 4, 2, 1, 2);
GroupArgumentsLayout->addWidget(TextLabelAspectRatio, 5, 0);
- GroupArgumentsLayout->addWidget(SpinBox_AspectRatio, 5, 2);
- GroupArgumentsLayout->addWidget(CheckBoxParametric, 6, 0, 1, 3);
+ GroupArgumentsLayout->addWidget(SpinBox_AspectRatio, 5, 2, 1, 2);
+ GroupArgumentsLayout->addWidget(CheckBoxParametric, 6, 0, 1, 4);
/***************************************************************/
GroupButtons = new QGroupBox(this);
SMESHGUI_SmoothingDlg::~SMESHGUI_SmoothingDlg()
{
// no need to delete child widgets, Qt does it all for us
+ if ( myFilterDlg != 0 ) {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ }
}
//=================================================================================
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
- SMESH::SetPickable(); // ???
- SMESH::SetPointRepresentation(false);
+ if (SMESH::GetCurrentVtkView()) {
+ SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+ SMESH::SetPointRepresentation(false);
+ SMESH::SetPickable();
+ }
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
QString aString = "";
myBusy = true;
- if (myEditCurrentArgument == (QWidget*)LineEditElements) {
- LineEditElements->setText(aString);
- myNbOkElements = 0;
+ if (myEditCurrentArgument == LineEditElements ||
+ myEditCurrentArgument == LineEditNodes) {
+ myEditCurrentArgument->setText(aString);
+ if (myEditCurrentArgument == LineEditElements)
+ myNbOkElements = 0;
+ else
+ myNbOkNodes = 0;
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
myActor = 0;
return;
myBusy = true;
- LineEditElements->setEnabled(true);
- LineEditElements->setText(aString);
- LineEditElements->repaint();
- LineEditElements->setEnabled(false);
+ myEditCurrentArgument->setEnabled(true);
+ myEditCurrentArgument->setText(aString);
+ myEditCurrentArgument->repaint();
+ myEditCurrentArgument->setEnabled(false);
myBusy = false;
// OK
if (myEditCurrentArgument == LineEditElements)
- myNbOkElements = true;
+ myNbOkElements = aNbUnits;
else if (myEditCurrentArgument == LineEditNodes)
- myNbOkNodes = true;
+ myNbOkNodes = aNbUnits;
if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
buttonOk->setEnabled(true);
else
TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
- if (myEditCurrentArgument != LineEditElements) {
+ if (myEditCurrentArgument != LineEditElements &&
+ myEditCurrentArgument != LineEditNodes) {
LineEditElements->clear();
+ LineEditNodes->clear();
return;
}
aViewWindow->SetSelectionMode(ActorSelection);
// mySelectionMgr->setSelectionModes(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
- LineEditElements->setReadOnly(true);
- LineEditElements->setValidator(0);
+ myEditCurrentArgument->setReadOnly(true);
+ myEditCurrentArgument->setValidator(0);
} else {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- LineEditElements->setReadOnly(false);
+ aViewWindow->SetSelectionMode(myEditCurrentArgument == LineEditElements ? FaceSelection
+ : NodeSelection );
+ myEditCurrentArgument->setReadOnly(false);
LineEditElements->setValidator(myIdValidator);
- onTextChange(LineEditElements->text());
+ onTextChange(myEditCurrentArgument->text());
}
SelectionIntoArgument();
ClickOnHelp();
}
}
+
+//=================================================================================
+// function : setFilters()
+// purpose : activate filter dialog
+//=================================================================================
+void SMESHGUI_SmoothingDlg::setFilters( const bool theIsElem )
+{
+ if ( !myFilterDlg )
+ {
+ QList<int> types;
+ types.append( SMESH::NODE );
+ types.append( SMESH::ALL );
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
+ }
+ myFilterDlg->Init( theIsElem ? SMESH::ALL : SMESH::NODE );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( theIsElem ? LineEditElements : LineEditNodes );
+
+ myFilterDlg->show();
+}
+
+//=================================================================================
+// function : setElemFilters()
+// purpose : SLOT. Called when element "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_SmoothingDlg::setElemFilters()
+{
+ setFilters( true );
+}
+
+//=================================================================================
+// function : setNodeFilters()
+// purpose : SLOT. Called when node "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_SmoothingDlg::setNodeFilters()
+{
+ setFilters( false );
+}
class QComboBox;
class QCheckBox;
class QSpinBox;
+class SMESHGUI;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
-class SMESHGUI;
+class SMESHGUI_FilterDlg;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
void enterEvent( QEvent* ); /* mouse enter the QWidget */
void hideEvent( QHideEvent* ); /* ESC key */
void keyPressEvent( QKeyEvent* );
+ void setFilters( const bool theIsElem );
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
SMESHGUI_IdValidator* myIdValidator;
QString myHelpFileName;
+ SMESHGUI_FilterDlg* myFilterDlg;
+
private slots:
void ClickOnOk();
void ClickOnCancel();
void ActivateThisDialog();
void onTextChange( const QString& );
void onSelectMesh( bool );
+ void setElemFilters();
+ void setNodeFilters();
};
#endif // SMESHGUI_SMOOTHINGDLG_H
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myFilterDlg(0)
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_POINT")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS")));
SelectElementsButton->setIcon(image3);
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(myIdValidator);
+ QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+ connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
// layout
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
- GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 2);
+ GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 1);
+ GroupArgumentsLayout->addWidget(filterBtn, 0, 3);
GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4);
GroupArgumentsLayout->addWidget(GroupMirror, 2, 0, 1, 4);
GroupArgumentsLayout->addWidget(ActionBox, 3, 0, 3, 3);
//=================================================================================
SMESHGUI_SymmetryDlg::~SMESHGUI_SymmetryDlg()
{
+ if ( myFilterDlg != 0 ) {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ }
}
//=================================================================================
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
- SMESH::SetPointRepresentation(false);
+ if (SMESH::GetCurrentVtkView()) {
+ SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+ SMESH::SetPointRepresentation(false);
+ }
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
ClickOnHelp();
}
}
+
+//=================================================================================
+// function : setFilters()
+// purpose : SLOT. Called when "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_SymmetryDlg::setFilters()
+{
+ if ( !myFilterDlg )
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( LineEditElements );
+
+ myFilterDlg->show();
+}
class QPushButton;
class QRadioButton;
class QCheckBox;
+class SMESHGUI;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
-class SMESHGUI;
+class SMESHGUI_FilterDlg;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
QString myHelpFileName;
+ SMESHGUI_FilterDlg* myFilterDlg;
+
private slots:
void ConstructorsClicked( int );
void ClickOnOk();
void onSelectMesh( bool );
void onVectorChanged();
void onActionClicked( int );
+ void setFilters();
};
#endif // SMESHGUI_SYMMETRYDLG_H
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_FilterDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myFilterDlg(0)
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
SelectElementsButton->setIcon(image2);
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(myIdValidator);
+ QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+ connect(filterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
// layout
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
- GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 6);
+ GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 5);
+ GroupArgumentsLayout->addWidget(filterBtn, 0, 7);
GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 8);
GroupArgumentsLayout->addWidget(TextLabel1, 2, 0);
GroupArgumentsLayout->addWidget(SelectButton1, 2, 1);
//=================================================================================
SMESHGUI_TranslationDlg::~SMESHGUI_TranslationDlg()
{
+ if ( myFilterDlg ) {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ myFilterDlg = 0;
+ }
}
//=================================================================================
disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearFilters();
//mySelectionMgr->clearSelected();
- SMESH::SetPointRepresentation(false);
+ if (SMESH::GetCurrentVtkView()) {
+ SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+ SMESH::SetPointRepresentation(false);
+ }
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( ActorSelection );
mySMESHGUI->ResetState();
ClickOnHelp();
}
}
+
+//=================================================================================
+// function : setFilters()
+// purpose : SLOT. Called when "Filter" button pressed.
+//=================================================================================
+void SMESHGUI_TranslationDlg::setFilters()
+{
+ if ( !myFilterDlg )
+ myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
+
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( LineEditElements );
+
+ myFilterDlg->show();
+}
class SMESHGUI;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
+class SMESHGUI_FilterDlg;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
QLineEdit* LineEditNewMesh;
QString myHelpFileName;
+
+ SMESHGUI_FilterDlg* myFilterDlg;
private slots:
void ConstructorsClicked( int );
void onTextChange( const QString& );
void onSelectMesh( bool );
void onActionClicked( int );
+ void setFilters();
};
#endif // SMESHGUI_TRANSLATIONDLG_H
<source>ICON_FREE_NODE</source>
<translation>mesh_free_nodes.png</translation>
</message>
+ <message>
+ <source>ICON_FREE_FACES</source>
+ <translation>mesh_free_faces.png</translation>
+ </message>
<message>
<source>ICON_HYPO</source>
<translation>mesh_hypo_length.png</translation>
<source>MEN_FREE_NODE</source>
<translation>Free Nodes</translation>
</message>
+ <message>
+ <source>MEN_FREE_FACES</source>
+ <translation>Free Faces</translation>
+ </message>
<message>
<source>MEN_GLOBAL_HYPO</source>
<translation>Global Hypothesis</translation>
</message>
+ <message>
+ <source>STB_FREE_FACES</source>
+ <translation>Free Faces</translation>
+ </message>
<message>
<source>STB_GLOBAL_HYPO</source>
<translation>Global Hypothesis</translation>
</message>
+ <message>
+ <source>TOP_FREE_FACES</source>
+ <translation>Free Faces</translation>
+ </message>
<message>
<source>TOP_GLOBAL_HYPO</source>
<translation>Global Hypothesis</translation>
Please select valid object and try again</translation>
</message>
<message>
- <source>CURRENT_GROUP</source>
- <translation>Current Group</translation>
+ <source>CURRENT_DIALOG</source>
+ <translation>Current Dialog</translation>
</message>
<message>
<source>EDGES_TLT</source>
</message>
+ <message>
+ <source>FREE_FACES</source>
+ <translation>Free faces</translation>
+ </message>
<message>
<source>ID</source>
<translation>ID</translation>
<source>LENGTH</source>
<translation>Length</translation>
</message>
+ <message>
+ <source>LENGTH2D</source>
+ <translation>Length 2D</translation>
+ </message>
<message>
<source>LESS_THAN</source>
<translation>Less than</translation>
<message>
<source>MULTIEDGES_ERROR</source>
<translation>Threshold value of borders at multi-connections can not be equal 1
+Please enter correct value and try again</translation>
+ </message>
+ <message>
+ <source>GROUPCOLOR_ERROR</source>
+ <translation>Color of group can not be undefied
Please enter correct value and try again</translation>
</message>
<message>
<source>WARPING</source>
<translation>Warping</translation>
</message>
+ <message>
+ <source>LINEAR</source>
+ <translation>Linear</translation>
+ </message>
+ <message>
+ <source>GROUP_COLOR</source>
+ <translation>Color of Group</translation>
+ </message>
+ <message>
+ <source>ELEMENTS</source>
+ <translation>Elements</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE</source>
+ <translation>Geomtry type</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_0</source>
+ <translation></translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_0</source>
+ <translation>Point</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_1</source>
+ <translation>Edge</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_2</source>
+ <translation>Triangle</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_3</source>
+ <translation>Quadrangle</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_4</source>
+ <translation>Polygon</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_5</source>
+ <translation>Tetrahedron</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_6</source>
+ <translation>Pyramid</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_7</source>
+ <translation>Hexahedron</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_8</source>
+ <translation>Pentahedron</translation>
+ </message>
+ <message>
+ <source>GEOM_TYPE_9</source>
+ <translation>Polyhedra</translation>
+ </message>
</context>
<context>
<name>SMESHGUI_GroupOpDlg</name>
return SMESH::FT_FreeEdges;
}
+/*
+ Class : FreeFaces_i
+ Description : Predicate for free faces
+*/
+FreeFaces_i::FreeFaces_i()
+{
+ myPredicatePtr.reset(new Controls::FreeFaces());
+ myFunctorPtr = myPredicatePtr;
+}
+
+FunctorType FreeFaces_i::GetFunctorType()
+{
+ return SMESH::FT_FreeFaces;
+}
+
/*
Class : FreeNodes_i
Description : Predicate for free nodes
return SMESH::FT_RangeOfIds;
}
+/*
+ Class : LinearOrQuadratic_i
+ Description : Predicate to verify whether a mesh element is linear
+*/
+LinearOrQuadratic_i::LinearOrQuadratic_i()
+{
+ myLinearOrQuadraticPtr.reset(new Controls::LinearOrQuadratic());
+ myFunctorPtr = myPredicatePtr = myLinearOrQuadraticPtr;
+}
+
+void LinearOrQuadratic_i::SetElementType(ElementType theType)
+{
+ myLinearOrQuadraticPtr->SetType(SMDSAbs_ElementType(theType));
+ TPythonDump()<<this<<".SetElementType("<<theType<<")";
+}
+
+FunctorType LinearOrQuadratic_i::GetFunctorType()
+{
+ return SMESH::FT_LinearOrQuadratic;
+}
+
+/*
+ Class : GroupColor_i
+ Description : Functor for check color of group to whic mesh element belongs to
+*/
+GroupColor_i::GroupColor_i()
+{
+ myGroupColorPtr.reset(new Controls::GroupColor());
+ myFunctorPtr = myPredicatePtr = myGroupColorPtr;
+}
+
+FunctorType GroupColor_i::GetFunctorType()
+{
+ return SMESH::FT_GroupColor;
+}
+
+void GroupColor_i::SetColorStr( const char* theColor )
+{
+ myGroupColorPtr->SetColorStr(
+ TCollection_AsciiString( (Standard_CString)theColor ) );
+ TPythonDump()<<this<<".SetColorStr('"<<theColor<<"')";
+}
+
+char* GroupColor_i::GetColorStr()
+{
+ TCollection_AsciiString aStr;
+ myGroupColorPtr->GetColorStr( aStr );
+ return CORBA::string_dup( aStr.ToCString() );
+}
+
+void GroupColor_i::SetElementType(ElementType theType)
+{
+ myGroupColorPtr->SetType(SMDSAbs_ElementType(theType));
+ TPythonDump()<<this<<".SetElementType("<<theType<<")";
+}
+
+/*
+ Class : ElemGeomType_i
+ Description : Predicate check is element has indicated geometry type
+*/
+ElemGeomType_i::ElemGeomType_i()
+{
+ myElemGeomTypePtr.reset(new Controls::ElemGeomType());
+ myFunctorPtr = myPredicatePtr = myElemGeomTypePtr;
+}
+
+void ElemGeomType_i::SetElementType(ElementType theType)
+{
+ myElemGeomTypePtr->SetType(SMDSAbs_ElementType(theType));
+ TPythonDump()<<this<<".SetElementType("<<theType<<")";
+}
+
+void ElemGeomType_i::SetGeometryType(GeometryType theType)
+{
+ myElemGeomTypePtr->SetGeomType(SMDSAbs_GeometryType(theType));
+ TPythonDump()<<this<<".SetGeometryType("<<theType<<")";
+}
+
+GeometryType ElemGeomType_i::GetGeometryType() const
+{
+ return (GeometryType)myElemGeomTypePtr->GetGeomType();;
+}
+
+FunctorType ElemGeomType_i::GetFunctorType()
+{
+ return SMESH::FT_ElemGeomType;
+}
+
/*
Class : Comparator_i
Description : Base class for comparators
return anObj._retn();
}
+FreeFaces_ptr FilterManager_i::CreateFreeFaces()
+{
+ SMESH::FreeFaces_i* aServant = new SMESH::FreeFaces_i();
+ SMESH::FreeFaces_var anObj = aServant->_this();
+ TPythonDump()<<aServant<<" = "<<this<<".CreateFreeFaces()";
+ return anObj._retn();
+}
+
FreeNodes_ptr FilterManager_i::CreateFreeNodes()
{
SMESH::FreeNodes_i* aServant = new SMESH::FreeNodes_i();
return anObj._retn();
}
-
MoreThan_ptr FilterManager_i::CreateMoreThan()
{
SMESH::MoreThan_i* aServant = new SMESH::MoreThan_i();
return anObj._retn();
}
-
LogicalNOT_ptr FilterManager_i::CreateLogicalNOT()
{
SMESH::LogicalNOT_i* aServant = new SMESH::LogicalNOT_i();
return anObj._retn();
}
-
LogicalAND_ptr FilterManager_i::CreateLogicalAND()
{
SMESH::LogicalAND_i* aServant = new SMESH::LogicalAND_i();
return anObj._retn();
}
-
LogicalOR_ptr FilterManager_i::CreateLogicalOR()
{
SMESH::LogicalOR_i* aServant = new SMESH::LogicalOR_i();
return anObj._retn();
}
+LinearOrQuadratic_ptr FilterManager_i::CreateLinearOrQuadratic()
+{
+ SMESH::LinearOrQuadratic_i* aServant = new SMESH::LinearOrQuadratic_i();
+ SMESH::LinearOrQuadratic_var anObj = aServant->_this();
+ TPythonDump()<<aServant<<" = "<<this<<".CreateLinearOrQuadratic()";
+ return anObj._retn();
+}
+
+GroupColor_ptr FilterManager_i::CreateGroupColor()
+{
+ SMESH::GroupColor_i* aServant = new SMESH::GroupColor_i();
+ SMESH::GroupColor_var anObj = aServant->_this();
+ TPythonDump()<<aServant<<" = "<<this<<".CreateGroupColor()";
+ return anObj._retn();
+}
+
+ElemGeomType_ptr FilterManager_i::CreateElemGeomType()
+{
+ SMESH::ElemGeomType_i* aServant = new SMESH::ElemGeomType_i();
+ SMESH::ElemGeomType_var anObj = aServant->_this();
+ TPythonDump()<<aServant<<" = "<<this<<".CreateElemGeomType()";
+ return anObj._retn();
+}
+
Filter_ptr FilterManager_i::CreateFilter()
{
SMESH::Filter_i* aServant = new SMESH::Filter_i();
{
case FT_FreeBorders:
case FT_FreeEdges:
+ case FT_FreeFaces:
+ case FT_LinearOrQuadratic:
case FT_FreeNodes:
{
CORBA::ULong i = theCriteria->length();
theCriteria[ theCriteria->length() - 1 ].BinaryOp = aFType;
return getCriteria( aPred2, theCriteria );
}
+ case FT_GroupColor:
+ {
+ CORBA::ULong i = theCriteria->length();
+ theCriteria->length( i + 1 );
+
+ theCriteria[ i ] = createCriterion();
+
+ GroupColor_i* aPred = dynamic_cast<GroupColor_i*>( thePred );
+ theCriteria[ i ].Type = aFType;
+ theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+ theCriteria[ i ].ThresholdStr = aPred->GetColorStr();
+
+ return true;
+ }
+ case FT_ElemGeomType:
+ {
+ CORBA::ULong i = theCriteria->length();
+ theCriteria->length( i + 1 );
+
+ theCriteria[ i ] = createCriterion();
+
+ ElemGeomType_i* aPred = dynamic_cast<ElemGeomType_i*>( thePred );
+ theCriteria[ i ].Type = aFType;
+ theCriteria[ i ].TypeOfElement = aPred->GetElementType();
+ theCriteria[ i ].Threshold = (double)aPred->GetGeometryType();
+ return true;
+ }
case FT_Undefined:
return false;
case SMESH::FT_FreeEdges:
aPredicate = aFilterMgr->CreateFreeEdges();
break;
+ case SMESH::FT_FreeFaces:
+ aPredicate = aFilterMgr->CreateFreeFaces();
+ break;
case SMESH::FT_FreeNodes:
aPredicate = aFilterMgr->CreateFreeNodes();
break;
aPredicate = aFilterMgr->CreateBadOrientedVolume();
}
break;
+ case SMESH::FT_LinearOrQuadratic:
+ {
+ SMESH::LinearOrQuadratic_ptr tmpPred = aFilterMgr->CreateLinearOrQuadratic();
+ tmpPred->SetElementType( aTypeOfElem );
+ aPredicate = tmpPred;
+ break;
+ }
+ case SMESH::FT_GroupColor:
+ {
+ SMESH::GroupColor_ptr tmpPred = aFilterMgr->CreateGroupColor();
+ tmpPred->SetElementType( aTypeOfElem );
+ tmpPred->SetColorStr( aThresholdStr );
+ aPredicate = tmpPred;
+ break;
+ }
+ case SMESH::FT_ElemGeomType:
+ {
+ SMESH::ElemGeomType_ptr tmpPred = aFilterMgr->CreateElemGeomType();
+ tmpPred->SetElementType( aTypeOfElem );
+ tmpPred->SetGeometryType( (GeometryType)(aThreshold + 0.5) );
+ aPredicate = tmpPred;
+ break;
+ }
default:
continue;
case FT_RangeOfIds : return "Range of IDs";
case FT_FreeBorders : return "Free borders";
case FT_FreeEdges : return "Free edges";
+ case FT_FreeFaces : return "Free faces";
case FT_FreeNodes : return "Free nodes";
case FT_MultiConnection : return "Borders at multi-connections";
case FT_MultiConnection2D: return "Borders at multi-connections 2D";
case FT_Length : return "Length";
- case FT_Length2D : return "Length2D";
+ case FT_Length2D : return "Length 2D";
case FT_LessThan : return "Less than";
case FT_MoreThan : return "More than";
case FT_EqualTo : return "Equal to";
case FT_LogicalNOT : return "Not";
case FT_LogicalAND : return "And";
case FT_LogicalOR : return "Or";
+ case FT_GroupColor : return "Color of Group";
+ case FT_LinearOrQuadratic : return "Linear or Quadratic";
+ case FT_ElemGeomType : return "Element geomtry type";
case FT_Undefined : return "";
default : return "";
}
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( "Free faces" ) ) return FT_FreeFaces;
else if ( theStr.equals( "Free nodes" ) ) return FT_FreeNodes;
else if ( theStr.equals( "Borders at multi-connections" ) ) return FT_MultiConnection;
// else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D;
else if ( theStr.equals( "Not" ) ) return FT_LogicalNOT;
else if ( theStr.equals( "And" ) ) return FT_LogicalAND;
else if ( theStr.equals( "Or" ) ) return FT_LogicalOR;
+ else if ( theStr.equals( "Color of Group" ) ) return FT_GroupColor;
+ else if ( theStr.equals( "Linear or Quadratic" ) ) return FT_LinearOrQuadratic;
+ else if ( theStr.equals( "Element geomtry type" ) ) return FT_ElemGeomType;
else if ( theStr.equals( "" ) ) return FT_Undefined;
else return FT_Undefined;
}
}
else
aCriterion.ThresholdStr = str.GetString();
-
+
aCriteria.push_back( aCriterion );
}
};
+ /*
+ Class : FreeFaces_i
+ Description : Predicate for free faces
+ */
+ class SMESH_I_EXPORT FreeFaces_i: public virtual POA_SMESH::FreeFaces,
+ public virtual Predicate_i
+ {
+ public:
+ FreeFaces_i();
+ FunctorType GetFunctorType();
+ };
+
+
/*
Class : FreeNodes_i
Description : Predicate for free nodes
protected:
Controls::RangeOfIdsPtr myRangeOfIdsPtr;
};
+
+ /*
+ Class : LinearOrQuadratic_i
+ Description : Verify whether a mesh element is linear
+ */
+ class SMESH_I_EXPORT LinearOrQuadratic_i: public virtual POA_SMESH::LinearOrQuadratic,
+ public virtual Predicate_i
+ {
+ public:
+ LinearOrQuadratic_i();
+ FunctorType GetFunctorType();
+ void SetElementType( ElementType theType );
+
+ private:
+ Controls::LinearOrQuadraticPtr myLinearOrQuadraticPtr;
+ };
+
+ /*
+ Class : GroupColor_i
+ Description : Functor for check color of group to whic mesh element belongs to
+ */
+ class SMESH_I_EXPORT GroupColor_i: public virtual POA_SMESH::GroupColor,
+ public virtual Predicate_i
+ {
+ public:
+ GroupColor_i();
+ FunctorType GetFunctorType();
+
+ void SetElementType( ElementType theType );
+ void SetColorStr( const char* theColor );
+ char* GetColorStr();
+
+ private:
+ Controls::GroupColorPtr myGroupColorPtr;
+ };
+
+ /*
+ Class : ElemGeomType_i
+ Description : Functor for check element geometry type
+ */
+ class SMESH_I_EXPORT ElemGeomType_i: public virtual POA_SMESH::ElemGeomType,
+ public virtual Predicate_i
+ {
+ public:
+ ElemGeomType_i();
+ FunctorType GetFunctorType();
+
+ void SetElementType ( ElementType theType );
+ void SetGeometryType( GeometryType theType );
+ GeometryType GetGeometryType() const;
+
+ private:
+ Controls::ElemGeomTypePtr myElemGeomTypePtr;
+ };
/*
Class : Comparator_i
FreeBorders_ptr CreateFreeBorders();
FreeEdges_ptr CreateFreeEdges();
FreeNodes_ptr CreateFreeNodes();
+ FreeFaces_ptr CreateFreeFaces();
RangeOfIds_ptr CreateRangeOfIds();
BadOrientedVolume_ptr CreateBadOrientedVolume();
+ LinearOrQuadratic_ptr CreateLinearOrQuadratic();
+ GroupColor_ptr CreateGroupColor();
+
+ ElemGeomType_ptr CreateElemGeomType();
+
LessThan_ptr CreateLessThan();
MoreThan_ptr CreateMoreThan();
EqualTo_ptr CreateEqualTo();
else:
print "Error: The treshold should be a string."
return None
- elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume, FT_FreeNodes]:
+ elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume, FT_FreeNodes,
+ FT_FreeFaces, FT_ElemGeomType, FT_GroupColor]:
# At this point the treshold is unnecessary
if aTreshold == FT_LogicalNOT:
aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)