Merge from BR_phase16 branch (09/12/09)

This commit is contained in:
vsr 2009-12-09 13:26:30 +00:00
parent 499b281dc4
commit f697bd6392
5 changed files with 650 additions and 682 deletions

View File

@ -18,7 +18,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "GEOM_SelectionFilter.h" #include "GEOM_SelectionFilter.h"
#include "GEOM_Client.hxx" #include "GEOM_Client.hxx"
@ -65,6 +65,19 @@ bool GEOM_SelectionFilter::isOk( const SUIT_DataOwner* sOwner ) const
if ( getShape( obj, shape ) ) if ( getShape( obj, shape ) )
return contains( shape.ShapeType() ) && isShapeOk( shape ); return contains( shape.ShapeType() ) && isShapeOk( shape );
} }
// IMP 0020435: fine local selection
{
const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>(sOwner);
if (owner) {
QString entry = owner->entry();
int index = entry.lastIndexOf("_");
if (index > 0) {
return true;
}
}
}
return false; return false;
} }
@ -72,7 +85,8 @@ bool GEOM_SelectionFilter::isOk( const SUIT_DataOwner* sOwner ) const
// function : getObject // function : getObject
// purpose : // purpose :
//======================================================================= //=======================================================================
GEOM::GEOM_Object_ptr GEOM_SelectionFilter::getObject( const SUIT_DataOwner* sOwner, const bool extractReference ) const GEOM::GEOM_Object_ptr GEOM_SelectionFilter::getObject (const SUIT_DataOwner* sOwner,
const bool extractReference) const
{ {
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
@ -119,18 +133,18 @@ bool GEOM_SelectionFilter::getShape (const GEOM::GEOM_Object_ptr& theObject,
SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( app->namingService() ); SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( app->namingService() );
static GEOM::GEOM_Gen_var geomGen; static GEOM::GEOM_Gen_var geomGen;
if(CORBA::is_nil( geomGen )) { if(CORBA::is_nil( geomGen )) {
Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" );
geomGen = GEOM::GEOM_Gen::_narrow( comp ); geomGen = GEOM::GEOM_Gen::_narrow( comp );
} }
if ( !CORBA::is_nil( geomGen ) ) if ( !CORBA::is_nil( geomGen ) )
{ {
TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject ); TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject );
if ( !aTopoDSShape.IsNull() ) if ( !aTopoDSShape.IsNull() )
{ {
theShape = aTopoDSShape; theShape = aTopoDSShape;
return true; return true;
} }
} }
} }
} }

View File

@ -1025,6 +1025,44 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry,
return prs; return prs;
} }
//=================================================================
/*!
* GEOM_Displayer::buildSubshapePresentation
* Builds/finds object's presentation for the current viewer
* Calls corresponding Update() method by means of double dispatch
* For not published objects (for Mantis issue 0020435)
*/
//=================================================================
SALOME_Prs* GEOM_Displayer::buildSubshapePresentation(const TopoDS_Shape& aShape,
const QString& entry,
SALOME_View* theViewFrame)
{
SALOME_Prs* prs = 0;
internalReset();
myViewFrame = theViewFrame ? theViewFrame : GetActiveView();
if (myViewFrame)
{
prs = LightApp_Displayer::buildPresentation(entry, theViewFrame);
if (prs)
{
Handle(SALOME_InteractiveObject) theIO = new SALOME_InteractiveObject();
theIO->setEntry(entry.toLatin1().constData());
if (!theIO.IsNull())
{
// set interactive object
setIO(theIO);
// finally set shape
setShape(aShape);
myType = GEOM_SUBSHAPE;
}
UpdatePrs(prs); // Update presentation by using of the double dispatch
}
}
return prs;
}
//================================================================= //=================================================================
/*! /*!
* GEOM_Displayer::internalReset * GEOM_Displayer::internalReset

View File

@ -155,9 +155,14 @@ public:
static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& ); static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
/* Builds presentation of not published object */
virtual SALOME_Prs* buildSubshapePresentation(const TopoDS_Shape& aShape,
const QString&,
SALOME_View* = 0);
protected: protected:
/* internal methods */ /* internal methods */
/* Builds presentation accordint to the current viewer type */ /* Builds presentation according to the current viewer type */
virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 );
/* Sets interactive object */ /* Sets interactive object */

File diff suppressed because it is too large Load Diff

View File

@ -19,10 +19,10 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : GroupGUI_GroupDlg.h // File : GroupGUI_GroupDlg.h
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
//
#ifndef GROUPGUI_GROUPDLG_H #ifndef GROUPGUI_GROUPDLG_H
#define GROUPGUI_GROUPDLG_H #define GROUPGUI_GROUPDLG_H
@ -30,6 +30,7 @@
#include <TopAbs_ShapeEnum.hxx> #include <TopAbs_ShapeEnum.hxx>
#include <TColStd_DataMapOfIntegerInteger.hxx> #include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
class QGroupBox; class QGroupBox;
class QLineEdit; class QLineEdit;
@ -74,6 +75,7 @@ private slots:
void selectAllSubShapes(); void selectAllSubShapes();
void add(); void add();
void remove(); void remove();
void showOnlySelected();
void selectionChanged(); void selectionChanged();
private: private:
@ -83,10 +85,11 @@ private:
TopAbs_ShapeEnum getShapeType() const; TopAbs_ShapeEnum getShapeType() const;
void setShapeType( const TopAbs_ShapeEnum ); void setShapeType( const TopAbs_ShapeEnum );
void activateSelection(); void activateSelection();
void updateState(); void updateState(bool isAdd = false);
void highlightSubShapes(); void highlightSubShapes();
void onGetInPlace(); void onGetInPlace();
void setInPlaceObj( GEOM::GEOM_Object_var, const bool isVisible=1); void setInPlaceObj( GEOM::GEOM_Object_var, const bool isVisible=1);
int getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMapIndex);
private: private:
Mode myMode; Mode myMode;
@ -102,11 +105,14 @@ private:
QLineEdit* myMainName; QLineEdit* myMainName;
QPushButton* mySelBtn2; QPushButton* mySelBtn2;
QLineEdit* myShape2Name; QLineEdit* myShape2Name;
QGroupBox* mySelectionWayGroupBox; QGroupBox* myRestrictGroupBox;
QButtonGroup* mySelectionWayGroup; QButtonGroup* myRestrictGroup;
QPushButton* mySelAllBtn; QPushButton* mySelAllBtn;
QPushButton* myAddBtn; QPushButton* myAddBtn;
QPushButton* myRemBtn; QPushButton* myRemBtn;
QPushButton* myShowOnlyBtn;
QPushButton* myHideSelBtn;
QPushButton* myShowAllBtn;
QListWidget* myIdList; QListWidget* myIdList;
}; };