Salome HOME
Bug PAL7334 - DEVELOPMENT : Control Improvement
authorenk <enk@opencascade.com>
Wed, 29 Dec 2004 14:32:59 +0000 (14:32 +0000)
committerenk <enk@opencascade.com>
Wed, 29 Dec 2004 14:32:59 +0000 (14:32 +0000)
Bug PAL7613: Needless submenu in the 3D Viewer popup for meshes groups

13 files changed:
idl/SMESH_Filter.idl
resources/SMESH_en.xml
src/Controls/SMESHControls.cxx
src/Controls/SMESH_Controls.cxx
src/Controls/SMESH_ControlsDef.hxx
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_DeviceActor.cxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_FilterDlg.cxx
src/SMESHGUI/SMESH_msg_en.po
src/SMESH_I/SMESH_Filter_i.cxx
src/SMESH_I/SMESH_Filter_i.hxx

index d6cfc5ed86e515fcc23459038e1b7eecbb2808ad..367e53da21369d1df58cecf1facb95c18ff06f2c 100644 (file)
@@ -54,6 +54,7 @@ module SMESH
     FT_FreeBorders,
     FT_FreeEdges,
     FT_MultiConnection,
+    FT_MultiConnection2D,
     FT_Length,
     FT_Length2D,
     FT_BelongToGeom,
@@ -108,13 +109,23 @@ module SMESH
     struct Value
     {
       double myLength;
-      long myElemId;
       long myPnt1, myPnt2;
     };
     typedef sequence<Value> Values;
     Values GetValues();
   };
-  interface MultiConnection : NumericalFunctor{};
+  interface MultiConnection   : NumericalFunctor{};
+  interface MultiConnection2D : NumericalFunctor
+  {
+    struct Value
+    {
+      long myNbConnects;
+      long myPnt1, myPnt2;
+    };
+    
+    typedef sequence<Value> Values;
+    Values GetValues();
+  };
 
   /*!
   * Predicates are intended for verification of criteria,
@@ -342,6 +353,7 @@ module SMESH
     Length            CreateLength();
     Length2D          CreateLength2D();
     MultiConnection   CreateMultiConnection();
+    MultiConnection2D CreateMultiConnection2D();
 
     /*!
     *  Create logical functors ( predicates )
index 0ebb0d48a38ebf2e16a24cb8ff91e1c2b6a1fd86..91fc253623b30b92757ce3841fa0c9fe70fffed0 100644 (file)
@@ -79,6 +79,7 @@
         <separator pos-id=""/>
        <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <separator pos-id=""/>
        <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <separator pos-id=""/>
        <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <separator pos-id=""/>
        <popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+        <popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
        <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
         <separatorTB/>
        <toolbutton-item item-id="6002" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="Free edges" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6018" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="Length2D" accel-id="" toggle-id="" execute-action=""/>
+        <toolbutton-item item-id="6019" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="Multiconnection 2D" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6011" label-id="Area" icon-id="mesh_area.png" tooltip-id="Area" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6012" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="Taper" accel-id="" toggle-id="" execute-action=""/>
        <toolbutton-item item-id="6013" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="Aspect Ratio" accel-id="" toggle-id="" execute-action=""/>
index 0490f9ff1760b2b5bd3db6cf654add400b66b266..0c8d145a366e5fd29eaae0fe8e2209349d03deff 100644 (file)
@@ -29,7 +29,9 @@ int main(int argc, char** argv)
   new Skew();
   new Area();
   new Length();
+  //  new Length2D();
   new MultiConnection();
+  //  new MultiConnection2D();
   new FreeBorders();
   new LessThan();
   new MoreThan();
index 5d38ccc00553c8266d162878e3e97a0f2887201a..d0ee98ef4faee7dbe55d7e687e8bb30b4eed38d4 100644 (file)
@@ -1020,6 +1020,148 @@ SMDSAbs_ElementType MultiConnection::GetType() const
   return SMDSAbs_Edge;
 }
 
+/*
+  Class       : MultiConnection2D
+  Description : Functor for calculating number of faces conneted to the edge
+*/
+double MultiConnection2D::GetValue( const TSequenceOfXYZ& P )
+{
+  return 0;
+}
+
+double MultiConnection2D::GetValue( long theElementId )
+{
+  TSequenceOfXYZ P;
+  int aResult = 0;
+  
+  if (GetPoints(theElementId,P)){
+    double  aVal;
+    const SMDS_MeshElement* anFaceElem = myMesh->FindElement( theElementId );
+    SMDSAbs_ElementType aType = anFaceElem->GetType();
+    
+    int len = P.size();
+    
+    TColStd_MapOfInteger aMap;
+    int aResult = 0;
+    
+    switch (aType){
+    case SMDSAbs_All:
+    case SMDSAbs_Node: 
+    case SMDSAbs_Edge:
+    case SMDSAbs_Face:
+      if (len == 3){ // triangles
+       int Nb[3] = {0,0,0};
+
+       int i=0;
+       SMDS_ElemIteratorPtr anIter = anFaceElem->nodesIterator();
+       if ( anIter != 0 ) {
+         while( anIter->more() ) {
+           const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+           if ( aNode == 0 ){
+             break;
+           }
+           SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
+           while( anElemIter->more() ) {
+             const SMDS_MeshElement* anElem = anElemIter->next();
+             if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
+               int anId = anElem->GetID();
+
+               if ( anIter->more() )              // i.e. first node
+                 aMap.Add( anId );
+               else if ( aMap.Contains( anId ) ){
+                 Nb[i]++;
+               }
+             }
+             else if ( anElem != 0 && anElem->GetType() == SMDSAbs_Edge ) i++;
+           }
+         }
+       }
+       
+       aResult = Max(Max(Nb[0],Nb[1]),Nb[2]);
+      }
+      break;
+    case SMDSAbs_Volume:
+    default: aResult=0;
+    }
+    
+  }
+  return aResult;//getNbMultiConnection( myMesh, theId );
+}
+
+double MultiConnection2D::GetBadRate( double Value, int /*nbNodes*/ ) const
+{
+  return Value;
+}
+
+SMDSAbs_ElementType MultiConnection2D::GetType() const
+{
+  return SMDSAbs_Face;
+}
+
+MultiConnection2D::Value::Value(long thePntId1, long thePntId2)
+{
+  myPntId[0] = thePntId1;  myPntId[1] = thePntId2;
+  if(thePntId1 > thePntId2){
+    myPntId[1] = thePntId1;  myPntId[0] = thePntId2;
+  }
+}
+
+bool MultiConnection2D::Value::operator<(const MultiConnection2D::Value& x) const{
+  if(myPntId[0] < x.myPntId[0]) return true;
+  if(myPntId[0] == x.myPntId[0])
+    if(myPntId[1] < x.myPntId[1]) return true;
+  return false;
+}
+
+void MultiConnection2D::GetValues(MValues& theValues){
+  SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
+  for(; anIter->more(); ){
+    const SMDS_MeshFace* anElem = anIter->next();
+    long anElemId = anElem->GetID();
+    SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
+    long aNodeId[3];
+
+    //int aNbConnects=0;
+    const SMDS_MeshNode* aNode0;
+    const SMDS_MeshNode* aNode1;
+    const SMDS_MeshNode* aNode2;
+    if(aNodesIter->more()){
+      aNode0 = (SMDS_MeshNode*) aNodesIter->next();
+      aNode1 = aNode0;
+      const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode1;
+      aNodeId[0] = aNodeId[1] = aNodes->GetID();
+    }
+    for(; aNodesIter->more(); ){
+      aNode2 = (SMDS_MeshNode*) aNodesIter->next();
+      long anId = aNode2->GetID();
+      aNodeId[2] = anId;
+      
+      Value aValue(aNodeId[1],aNodeId[2]);
+      MValues::iterator aItr = theValues.find(aValue);
+      if (aItr != theValues.end()){
+       aItr->second += 1;
+       //aNbConnects = nb;
+      } else {
+       theValues[aValue] = 1;
+       //aNbConnects = 1;
+      }
+      //cout << "NodeIds: "<<aNodeId[1]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
+      aNodeId[1] = aNodeId[2];
+      aNode1 = aNode2;
+    }
+    Value aValue(aNodeId[0],aNodeId[2]);
+    MValues::iterator aItr = theValues.find(aValue);
+    if (aItr != theValues.end()){
+      aItr->second += 1;
+      //aNbConnects = nb;
+    } else {
+      theValues[aValue] = 1;
+      //aNbConnects = 1;
+    }
+    //cout << "NodeIds: "<<aNodeId[0]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
+  }
+
+}
 
 /*
                             PREDICATES
index bb15c96357fea6e7dba549ba96d3efd347b746a6..4244c0b0d03c9538c910276044fa95d1ce8c1eb1 100644 (file)
@@ -253,6 +253,26 @@ namespace SMESH{
       virtual SMDSAbs_ElementType GetType() const;
     };
     
+    /*
+      Class       : MultiConnection2D
+      Description : Functor for calculating number of faces conneted to the edge
+    */
+    class MultiConnection2D: public virtual NumericalFunctor{
+    public:
+      virtual double GetValue( long theElementId );
+      virtual double GetValue( const TSequenceOfXYZ& thePoints );
+      virtual double GetBadRate( double Value, int nbNodes ) const;
+      virtual SMDSAbs_ElementType GetType() const;
+      struct Value{
+       long myPntId[2];
+       Value(long thePntId1, long thePntId2);
+       bool operator<(const Value& x) const;
+      };
+      typedef std::map<Value,int> MValues;
+
+      void GetValues(MValues& theValues);
+    };
+    typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
     /*
       PREDICATES
     */
index 9bd62817c4d684c5fd196928425cb029f0b8b4fe..1b9000893ebc6a88eae2e15f1b50118ab65ddc22 100644 (file)
@@ -660,6 +660,10 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){
       aFunctor.reset(new SMESH::Controls::MultiConnection());
       myControlActor = my1DActor;
       break;
+    case eMultiConnection2D:
+      aFunctor.reset(new SMESH::Controls::MultiConnection2D());
+      myControlActor = my2DActor;
+      break;
     case eArea:
     {
       SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
@@ -732,6 +736,9 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){
       case eLength2D:
        my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
        break;
+      case eMultiConnection2D:
+       my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
+       break;
       default:
        myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
       }
@@ -1032,6 +1039,8 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
        break;
       case eLength2D:
        my1DExtActor->VisibilityOn();
+      case eMultiConnection2D:
+       my1DExtActor->VisibilityOn();
       default:
        if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
          myScalarBarActor->VisibilityOn();
index cb49219174ec4a39cc80b0a1a544d6d6a5b8dd81..ad041c275d339ef0fa794d1bcbb336bcfd6bb256 100644 (file)
@@ -95,7 +95,7 @@ class SMESH_Actor: public SALOME_Actor
 
   enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eMultiConnection, 
                eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew,
-               eAspectRatio3D};
+               eAspectRatio3D, eMultiConnection2D};
   virtual void SetControlMode(eControl theMode) = 0;
   virtual eControl GetControlMode() = 0;
 
index c46bbe2240de523e405fe4fe5c9eb2673fe25867..fb77446a95d2247eabf4202cdf61b6fd769f7fa0 100644 (file)
@@ -24,7 +24,7 @@
 //  File   : SMESH_Actor.cxx
 //  Author : Nicolas REJNERI
 //  Module : SMESH
-//  $Header$Header$
+//  $Header$Header: /home/server/cvs/SMESH/SMESH_SRC/src/OBJECT/SMESH_DeviceActor.cxx,v 1.5.2.4 2004/12/27 12:49:55 apo Exp $
 
 
 #include "SMESH_DeviceActor.h"
@@ -332,6 +332,69 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
       theLookupTable->SetRange(aScalars->GetRange());
       theLookupTable->Build();
       
+      myMergeFilter->SetScalars(aDataSet);
+      aDataSet->Delete();
+    }
+    else if (MultiConnection2D* aMultiConnection2D = dynamic_cast<MultiConnection2D*>(theFunctor.get())){
+      SMESH::Controls::MultiConnection2D::MValues aValues;
+
+      myVisualObj->UpdateFunctor(theFunctor);
+
+      aMultiConnection2D->GetValues(aValues);
+      vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
+      vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
+      aDataSet->SetPoints(aGrid->GetPoints());
+      
+      vtkIdType aNbCells = aValues.size();
+      vtkDoubleArray *aScalars = vtkDoubleArray::New();
+      aScalars->SetNumberOfComponents(1);
+      aScalars->SetNumberOfTuples(aNbCells);
+
+      vtkIdType aCellsSize = 3*aNbCells;
+      vtkCellArray* aConnectivity = vtkCellArray::New();
+      aConnectivity->Allocate( aCellsSize, 0 );
+      
+      vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+      aCellTypesArray->SetNumberOfComponents( 1 );
+      aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
+      
+      vtkIdList *anIdList = vtkIdList::New();
+      anIdList->SetNumberOfIds(2);
+      
+      MultiConnection2D::MValues::const_iterator anIter = aValues.begin();
+      int i = 0;
+      for(vtkIdType aVtkId; anIter != aValues.end(); anIter++,i++){
+       const MultiConnection2D::Value& aValue = (*anIter).first;
+       int aNode[2] = {
+         myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
+         myVisualObj->GetNodeVTKId(aValue.myPntId[1])
+       };
+       if(aNode[0] >= 0 && aNode[1] >= 0){
+         anIdList->SetId( 0, aNode[0] );
+         anIdList->SetId( 1, aNode[1] );
+         aConnectivity->InsertNextCell( anIdList );
+         aCellTypesArray->InsertNextValue( VTK_LINE );
+         aScalars->SetValue(i,(*anIter).second);
+       }
+      }
+      
+      vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+      aCellLocationsArray->SetNumberOfComponents( 1 );
+      aCellLocationsArray->SetNumberOfTuples( aNbCells );
+      
+      aConnectivity->InitTraversal();
+      for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+       aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+      
+      aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+      SetUnstructuredGrid(aDataSet);
+
+      aDataSet->GetCellData()->SetScalars(aScalars);
+      aScalars->Delete();
+      
+      theLookupTable->SetRange(aScalars->GetRange());
+      theLookupTable->Build();
+      
       myMergeFilter->SetScalars(aDataSet);
       aDataSet->Delete();
     }
index 0c6049cab375ce75647971f490d7e51ca5b20c26..339b56a39462b50302f3386742788ec5d5c4bbf6 100644 (file)
@@ -563,6 +563,10 @@ namespace{
            aTitle = QObject::tr( "MULTI_BORDERS" );
            aControl = SMESH_Actor::eMultiConnection;
            break;
+         case 6019:
+           aTitle = QObject::tr( "MULTI2D_BORDERS" );
+           aControl = SMESH_Actor::eMultiConnection2D;
+           break;
          case 6011:
            aTitle = QObject::tr( "AREA_ELEMENTS" );
            aControl = SMESH_Actor::eArea;
@@ -2081,6 +2085,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
   case 6011:
   case 6001:
   case 6018:
+  case 6019:
   case 6002:
   case 6003:
   case 6004:    
@@ -2428,30 +2433,40 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
 
            // Display Entity
            mi = popup->findItem( 1135 );
-           if ( mi && mi->popup() ) {
+           int aIsSomething=0;
+           if (aNbVolumes>0) aIsSomething++;
+           if (aNbFaces>0) aIsSomething++;
+           if (aNbEdges>0) aIsSomething++;
+           if ( mi && (aIsSomething <= 1)){
+             popup->removeItem(1135);
+           }else if ( mi && mi->popup() ) {
              QPopupMenu* aPopup = mi->popup();
              unsigned int aMode = anActor->GetEntityMode();
-
+             
+             bool aIsVolumesMode = aMode & SMESH_Actor::eVolumes;
+             bool aIsFacesMode   = aMode & SMESH_Actor::eFaces;
+             bool aIsEdgesMode   = aMode & SMESH_Actor::eEdges;
+             
              if(aNbVolumes == 0)
                aPopup->removeItem( 219 );
              else
-               aPopup->setItemChecked( 219, aMode & SMESH_Actor::eVolumes );
+               aPopup->setItemChecked( 219, aIsVolumesMode );
 
              if(aNbFaces == 0)
                aPopup->removeItem( 218 );
              else
-               aPopup->setItemChecked( 218, aMode & SMESH_Actor::eFaces );
+               aPopup->setItemChecked( 218, aIsFacesMode );
 
 
              if(aNbEdges == 0)
                aPopup->removeItem( 217 );
              else
-               aPopup->setItemChecked( 217, aMode & SMESH_Actor::eEdges );
+               aPopup->setItemChecked( 217, aIsEdgesMode );
 
 
-             bool aIsRemove = (aNbVolumes == 0 || aMode & SMESH_Actor::eVolumes);
-             aIsRemove &= (aNbFaces == 0 || aMode & SMESH_Actor::eFaces);
-             aIsRemove &= (aNbEdges == 0 || aMode & SMESH_Actor::eEdges);
+             bool aIsRemove = (aNbVolumes == 0 || aIsVolumesMode);
+             aIsRemove &= (aNbFaces == 0 || aIsFacesMode);
+             aIsRemove &= (aNbEdges == 0 || aIsEdgesMode);
 
              if(aIsRemove)
                aPopup->removeItem( 220 );
@@ -2476,6 +2491,8 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
                break;
              case SMESH_Actor::eMultiConnection:
                mi->popup()->setItemChecked( 6004, true ); break;
+             case SMESH_Actor::eMultiConnection2D:
+               mi->popup()->setItemChecked( 6019, true ); break;
              case SMESH_Actor::eArea:
                mi->popup()->setItemChecked( 6011, true ); break;
              case SMESH_Actor::eTaper:
@@ -2511,6 +2528,7 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
                mi->popup()->removeItem( 6014 );
                mi->popup()->removeItem( 6015 );
                mi->popup()->removeItem( 6016 );
+               mi->popup()->removeItem( 6019 );
              }
              if(aNbVolumes == 0){
                mi->popup()->removeItem( 6017 );
index fff798a30ce0c5b4ad66094ef62586937a76db4a..66bc89083da4ce13fd25c3c4f3175f159cfa9b57 100755 (executable)
@@ -1278,6 +1278,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
       aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
       aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
       aCriteria[ SMESH::FT_Length2D         ] = tr( "LENGTH2D" );
+      aCriteria[ SMESH::FT_MultiConnection2D] = tr( "MULTI2D_BORDERS" );
     }
     return aCriteria;
   }
index a84e68a07a2ef4db21b79f7a844a8d1e888352c7..78bcd46fd3c9eda50f276ab82a00be17f913adbe 100644 (file)
@@ -961,9 +961,15 @@ msgstr "Free borders"
 msgid "SMESHGUI_FilterTable::MULTI_BORDERS"
 msgstr "Borders at multi-connections"
 
+#msgid "SMESHGUI_FilterTable::MULTI2D_BORDERS"
+#msgstr "Borders at multi-connections 2D"
+
 msgid "SMESHGUI_FilterTable::LENGTH"
 msgstr "Length"
 
+#msgid "SMESHGUI_FilterTable::LENGTH2D"
+#msgstr "Length2D"
+
 msgid "SMESHGUI_FilterTable::ASPECT_RATIO"
 msgstr "Aspect ratio"
 
@@ -1096,13 +1102,16 @@ msgid "LENGTH_EDGES"
 msgstr "Length"
 
 msgid "LENGTH2D_EDGES"
-msgstr "Length2D"
+msgstr "Length 2D"
 
 msgid "FREE_BORDERS"
-msgstr "Free borders"
+msgstr "Free Borders"
 
 msgid "MULTI_BORDERS"
-msgstr "Borders at multi-connections"
+msgstr "Borders at Multi-Connections"
+
+msgid "MULTI2D_BORDERS"
+msgstr "Borders at Multi-Connections 2D"
 
 msgid "AREA_ELEMENTS"
 msgstr "Area"
index 6b12b6ad12f142abb7b43b5a56315ec2403e6640..4d98d80c38e15c2632a38ecf58e8625d7b750d6a 100644 (file)
@@ -483,6 +483,46 @@ FunctorType MultiConnection_i::GetFunctorType()
   return SMESH::FT_MultiConnection;
 }
 
+/*
+  Class       : MultiConnection2D_i
+  Description : Functor for calculating number of faces conneted to the edge
+*/
+MultiConnection2D_i::MultiConnection2D_i()
+{
+  myNumericalFunctorPtr.reset( new Controls::MultiConnection2D() );
+  myFunctorPtr = myNumericalFunctorPtr;
+}
+
+FunctorType MultiConnection2D_i::GetFunctorType()
+{
+  return SMESH::FT_MultiConnection2D;
+}
+
+SMESH::MultiConnection2D::Values* MultiConnection2D_i::GetValues()
+{
+  INFOS("MultiConnection2D_i::GetValues");
+  SMESH::Controls::MultiConnection2D::MValues aValues;
+  myMulticonnection2DPtr->GetValues( aValues );
+  
+  long i = 0, iEnd = aValues.size();
+
+  SMESH::MultiConnection2D::Values_var aResult = new SMESH::MultiConnection2D::Values(iEnd);
+
+  SMESH::Controls::MultiConnection2D::MValues::const_iterator anIter;
+  for ( anIter = aValues.begin() ; anIter != aValues.end(); anIter++, i++ )
+  {
+    const SMESH::Controls::MultiConnection2D::Value&  aVal = (*anIter).first;
+    SMESH::MultiConnection2D::Value &aValue = aResult[ i ];
+    
+    aValue.myPnt1 = aVal.myPntId[ 0 ];
+    aValue.myPnt2 = aVal.myPntId[ 1 ];
+    aValue.myNbConnects = (*anIter).second;
+   
+  }
+
+  INFOS("Multiconnection2D_i::GetValuess~");
+  return aResult._retn();
+}
 
 /*
                             PREDICATES
@@ -1092,6 +1132,12 @@ MultiConnection_ptr FilterManager_i::CreateMultiConnection()
   return anObj._retn();
 }
 
+MultiConnection2D_ptr FilterManager_i::CreateMultiConnection2D()
+{
+  SMESH::MultiConnection2D_i* aServant = new SMESH::MultiConnection2D_i();
+  SMESH::MultiConnection2D_var anObj = aServant->_this();
+  return anObj._retn();
+}
 
 BelongToGeom_ptr FilterManager_i::CreateBelongToGeom()
 {
@@ -1470,6 +1516,9 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
       case SMESH::FT_MultiConnection:
         aFunctor = aFilterMgr->CreateMultiConnection();
         break;
+      case SMESH::FT_MultiConnection2D:
+       aFunctor = aFilterMgr->CreateMultiConnection2D();
+       break;
       case SMESH::FT_Length:
         aFunctor = aFilterMgr->CreateLength();
         break;
@@ -1741,6 +1790,7 @@ static inline LDOMString toString( const long theType )
     case FT_FreeBorders     : return "Free borders";
     case FT_FreeEdges       : return "Free edges";
     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_LessThan        : return "Less than";
@@ -1772,7 +1822,9 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
   else if ( theStr.equals( "Free borders"                 ) ) return FT_FreeBorders;
   else if ( theStr.equals( "Free edges"                   ) ) return FT_FreeEdges;
   else if ( theStr.equals( "Borders at multi-connections" ) ) return FT_MultiConnection;
+  //  else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D;
   else if ( theStr.equals( "Length"                       ) ) return FT_Length;
+  //  else if ( theStr.equals( "Length2D"                     ) ) return FT_Length2D;
   else if ( theStr.equals( "Range of IDs"                 ) ) return FT_RangeOfIds;
   else if ( theStr.equals( "Less than"                    ) ) return FT_LessThan;
   else if ( theStr.equals( "More than"                    ) ) return FT_MoreThan;
index 95e7b58e9a437df12acbc9090ed5560e06464583..4e884a416fb80c916fba7da55c961cb7b2cebc44 100644 (file)
@@ -247,6 +247,22 @@ public:
   FunctorType                     GetFunctorType();
 };
 
+/*
+  Class       : MultiConnection2D_i
+  Description : Functor for calculating number of faces conneted to the edge
+*/
+class MultiConnection2D_i: public virtual POA_SMESH::MultiConnection2D,
+                          public virtual NumericalFunctor_i
+{
+public:
+                                     MultiConnection2D_i();
+  SMESH::MultiConnection2D::Values*  GetValues();
+  FunctorType                        GetFunctorType();
+
+protected:
+  Controls::MultiConnection2DPtr     myMulticonnection2DPtr;
+};
+
 
 /*
                             PREDICATES
@@ -620,6 +636,7 @@ public:
   Length_ptr                CreateLength();
   Length2D_ptr              CreateLength2D();
   MultiConnection_ptr       CreateMultiConnection();
+  MultiConnection2D_ptr     CreateMultiConnection2D();
   
   BelongToGeom_ptr          CreateBelongToGeom();
   BelongToPlane_ptr         CreateBelongToPlane();