TColStd_MapOfInteger aMap;
aMap.Add(GEOM_SHELL);
aMap.Add(GEOM_FACE);
- globalSelection( aMap );
-
+ aMap.Add(GEOM_COMPOUNDFILTER);
+
+ QValueList<int> aSubShapes;
+ aSubShapes.append(GEOM_FACE);
+ globalSelection( aMap, aSubShapes );
+
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_SHELL);
aMap.Add(GEOM_FACE);
- globalSelection( aMap );
+ aMap.Add(GEOM_COMPOUNDFILTER);
+
+ QValueList<int> aSubShapes;
+ aSubShapes.append(GEOM_FACE);
+ globalSelection( aMap, aSubShapes );
+
myEditCurrentArgument = GroupShell->LineEdit1;
myEditCurrentArgument->setFocus();
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
+
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_SHELL);
aMap.Add(GEOM_FACE);
- globalSelection( aMap );
+ aMap.Add(GEOM_COMPOUNDFILTER);
+
+ QValueList<int> aSubShapes;
+ aSubShapes.append(GEOM_FACE);
+ globalSelection( aMap, aSubShapes );
+
}
getDisplayer()->GlobalSelection( theModes, update );
}
+//================================================================
+// Function : globalSelection
+// Purpose : Activate selection of subshapes. Set selection filters
+// in accordance with mode. theMode is from GEOMImpl_Types
+//================================================================
+void GEOMBase_Helper::globalSelection( const TColStd_MapOfInteger& theModes,
+ const QValueList<int>& subShapes,
+ const bool update )
+{
+ getDisplayer()->GlobalSelection( theModes, update, &subShapes);
+}
+
//================================================================
// Function : addInStudy
// Purpose : Add object in study
void activate( const int );
void globalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
void globalSelection( const TColStd_MapOfInteger&, const bool = false );
+ void globalSelection( const TColStd_MapOfInteger&, const QValueList<int>& ,const bool = false );
void updateViewer ();
void prepareSelection( const ObjectList&, const int );
--- /dev/null
+// GEOM GEOM_CompoundFilter : filter selector for the viewer
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : GEOM_CompoundFilter.cxx
+// Author : Roman NIKOLAEV
+// Module : GEOM
+
+#include "GEOM_CompoundFilter.h"
+
+// OCCT Includes
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopoDS_Iterator.hxx>
+
+
+
+//=======================================================================
+// function : GEOM_CompoundFilter
+// purpose :
+//=======================================================================
+GEOM_CompoundFilter::GEOM_CompoundFilter(SalomeApp_Study* study)
+: GEOM_SelectionFilter( study )
+{
+ add( TopAbs_COMPOUND );
+}
+
+//=======================================================================
+// function : ~GEOM_CompoundFilter
+// purpose :
+//=======================================================================
+GEOM_CompoundFilter::~GEOM_CompoundFilter()
+{
+}
+
+//=======================================================================
+// function : isOk
+// purpose :
+//=======================================================================
+bool GEOM_CompoundFilter::isOk( const SUIT_DataOwner* sOwner) const
+{
+ if(GEOM_SelectionFilter::isOk(sOwner)){
+
+ GEOM::GEOM_Object_var obj = getObject( sOwner );
+ TopoDS_Shape shape;
+ if ( getShape( obj, shape )){
+ bool subTypes[TopAbs_SHAPE];
+ getInfo(shape,subTypes);
+ QValueList<int>::const_iterator it;
+ bool result = false;
+ for ( it = myKinds.constBegin(); it != myKinds.constEnd(); ++it )
+ result = result || subTypes[(*it)];
+
+ return result;
+ }
+ }
+ return false;
+}
+
+
+//=======================================================================
+// function : addSubType
+// purpose :
+//=======================================================================
+void GEOM_CompoundFilter::addSubType( const int type)
+{
+ if(!myKinds.contains(type))
+ myKinds.append(type);
+}
+
+//=======================================================================
+// function : addSubTypes
+// purpose :
+//=======================================================================
+void GEOM_CompoundFilter::addSubTypes(const QValueList<int>& kinds)
+{
+ myKinds = kinds;
+}
+
+//=======================================================================
+// function : getInfo()
+// purpose :
+//=======================================================================
+void GEOM_CompoundFilter::getInfo(const TopoDS_Shape& aShape, bool subTypes[]) const
+{
+ int iType, nbTypes[TopAbs_SHAPE];
+ for (iType = 0; iType < TopAbs_SHAPE; ++iType){
+ nbTypes[iType] = 0;
+ subTypes[iType] = false;
+ }
+
+ nbTypes[aShape.ShapeType()]++;
+ TopTools_MapOfShape aMapOfShape;
+ aMapOfShape.Add(aShape);
+ TopTools_ListOfShape aListOfShape;
+ aListOfShape.Append(aShape);
+
+ TopTools_ListIteratorOfListOfShape itL (aListOfShape);
+ for (; itL.More(); itL.Next()) {
+ TopoDS_Iterator it (itL.Value());
+ for (; it.More(); it.Next()) {
+ TopoDS_Shape s = it.Value();
+ if (aMapOfShape.Add(s)) {
+ aListOfShape.Append(s);
+ nbTypes[s.ShapeType()]++;
+ }
+ }
+ }
+
+ for(iType = TopAbs_COMPSOLID; iType < TopAbs_SHAPE; ++iType) {
+ if(nbTypes[iType] > 0) {
+ subTypes[iType] = true;
+ break;
+ }
+ }
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef GEOM_COMPOUNDFILTER_H
+#define GEOM_COMPOUNDFILTER_H
+#include "GEOM_SelectionFilter.h"
+
+class Standard_EXPORT GEOM_CompoundFilter : public GEOM_SelectionFilter
+{
+ public:
+ GEOM_CompoundFilter( SalomeApp_Study* study );
+ ~GEOM_CompoundFilter();
+
+ virtual bool isOk( const SUIT_DataOwner* ) const;
+ void addSubType(const int );
+ void addSubTypes(const QValueList<int>& );
+
+ private:
+ void getInfo(const TopoDS_Shape&, bool subTypes []) const;
+
+
+ private:
+ QValueList<int> myKinds;
+};
+
+
+#endif
+
GEOM_TypeFilter.h \
GEOM_PreviewFilter.h \
GEOM_LogicalFilter.h \
- GEOM_OCCFilter.h
+ GEOM_OCCFilter.h \
+ GEOM_CompoundFilter.h
# Sources
dist_libGEOMFiltersSelection_la_SOURCES = \
GEOM_TypeFilter.cxx \
GEOM_PreviewFilter.cxx \
GEOM_LogicalFilter.cxx \
- GEOM_OCCFilter.cxx
+ GEOM_OCCFilter.cxx \
+ GEOM_CompoundFilter.cxx
# LIB_CLIENT_IDL= GEOM_Gen.idl SALOMEDS.idl SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl
#include "GEOM_TypeFilter.h"
#include "GEOM_EdgeFilter.h"
#include "GEOM_FaceFilter.h"
+#include "GEOM_CompoundFilter.h"
#include "GEOM_PreviewFilter.h"
#include "GEOM_LogicalFilter.h"
#include "GEOM_OCCFilter.h"
return aFilter;
}
+//================================================================
+// Function : getComplexFilter
+// Purpose : Get compound filter corresponding to the type of
+// object from GEOMImpl_Types.h
+//================================================================
+SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QValueList<int>* aSubShapes)
+{
+ GEOM_CompoundFilter* aFilter;
+
+ if(aSubShapes != NULL ) {
+ aFilter = new GEOM_CompoundFilter(getStudy());
+ QValueList<int> aTopAbsTypes;
+ QValueList<int>::const_iterator it;
+ for(it = aSubShapes->constBegin(); it != aSubShapes->constEnd(); ++it ) {
+ int topAbsMode = getTopAbsMode(*it);
+ if(topAbsMode != -1 )
+ aTopAbsTypes.append(topAbsMode);
+ }
+ aFilter->addSubTypes(aTopAbsTypes);
+ }
+
+ return aFilter;
+}
+
//================================================================
// Function : getEntry
// Purpose :
*/
//=================================================================
void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
- const bool update )
+ const bool update, const QValueList<int>* theSubShapes)
{
SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( theModes.Extent() == 1 )
{
int aMode = TColStd_MapIteratorOfMapOfInteger( theModes ).Key();
- aFilter = getFilter( aMode );
+
+ if(aMode == GEOM_COMPOUNDFILTER)
+ aFilter = getComplexFilter(theSubShapes);
+ else
+ aFilter = getFilter( aMode );
}
else if ( theModes.Extent() > 1 )
{
QPtrList<SUIT_SelectionFilter> aListOfFilters;
for ( ; anIter.More(); anIter.Next() )
{
- SUIT_SelectionFilter* aFilter = getFilter( anIter.Key() );
+ SUIT_SelectionFilter* aFilter;
+ int aMode = anIter.Key();
+ if(aMode == GEOM_COMPOUNDFILTER)
+ aFilter = getComplexFilter(theSubShapes);
+ else
+ aFilter = getFilter( aMode );
+
if ( aFilter )
aListOfFilters.append( aFilter );
}
void LocalSelection( const Handle(SALOME_InteractiveObject)&, const int );
void LocalSelection( const SALOME_ListIO& theIOList, const int );
void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
- void GlobalSelection( const TColStd_MapOfInteger&, const bool = false );
+ void GlobalSelection( const TColStd_MapOfInteger&, const bool = false, const QValueList<int>* = 0 );
SalomeApp_Study* getStudy() const;
void clearTemporary( LightApp_SelectionMgr* theSelMgr );
SUIT_SelectionFilter* getFilter( const int theMode );
+ SUIT_SelectionFilter* getComplexFilter(const QValueList<int>* );
protected:
Handle(SALOME_InteractiveObject) myIO;
#define GEOM_THRUSECTIONS 40
+#define GEOM_COMPOUNDFILTER 41
+
//GEOM_Function types
#define COPY_WITH_REF 1