Prevent processing SHAPERSTUDY objects`

This commit is contained in:
eap 2020-05-07 19:49:06 +03:00
parent 535033fcd5
commit 49fd9a6330
15 changed files with 60 additions and 43 deletions

View File

@ -141,12 +141,14 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
GEOM::GEOM_FieldStep_var step; GEOM::GEOM_FieldStep_var step;
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() ); SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( aList.Extent() > 0 && study ) { if ( study )
for ( ; anIter.More(); anIter.Next() ) for ( ; anIter.More(); anIter.Next() )
{ {
Handle(SALOME_InteractiveObject) anIObj = anIter.Value(); Handle(SALOME_InteractiveObject) anIObj = anIter.Value();
if ( !anIObj.IsNull() && anIObj->hasEntry() ) if ( !anIObj.IsNull() && anIObj->hasEntry() )
if ( _PTR(SObject) obj = study->studyDS()->FindObjectID( anIObj->getEntry() )) {
_PTR(SObject) obj = study->studyDS()->FindObjectID( anIObj->getEntry() );
if ( GeometryGUI::IsInGeomComponent( obj ))
{ {
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj ); CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj );
GEOM::GEOM_BaseObject_var bo = GEOM::GEOM_BaseObject::_narrow( corbaObj ); GEOM::GEOM_BaseObject_var bo = GEOM::GEOM_BaseObject::_narrow( corbaObj );
@ -175,7 +177,6 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
} }
} }
} }
if ( !field->_is_nil()) { if ( !field->_is_nil()) {
int stepID; int stepID;
if ( !step->_is_nil() ) { if ( !step->_is_nil() ) {

View File

@ -1478,6 +1478,7 @@ int EntityGUI_FieldDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMa
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData())); _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData()));
if ( ! GeometryGUI::IsInGeomComponent( aSObj )) continue;
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object_var aGeomObj =
GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -1773,6 +1774,7 @@ void EntityGUI_FieldDlg::highlightSubShapes()
CORBA::String_var aMainEntry = myShape->GetStudyEntry(); CORBA::String_var aMainEntry = myShape->GetStudyEntry();
_PTR(SObject) aSObj = aStudy->FindObjectID( aMainEntry.in() ); _PTR(SObject) aSObj = aStudy->FindObjectID( aMainEntry.in() );
_PTR(ChildIterator) anIt = aStudy->NewChildIterator(aSObj); _PTR(ChildIterator) anIt = aStudy->NewChildIterator(aSObj);
if ( GeometryGUI::IsInGeomComponent( aSObj ))
for (anIt->InitEx(true); anIt->More(); anIt->Next()) { for (anIt->InitEx(true); anIt->More(); anIt->Next()) {
GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object_var aChild =
GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anIt->Value())); GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anIt->Value()));

View File

@ -694,6 +694,7 @@ int EntityGUI_SubShapeDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& th
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData())); _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData()));
if ( ! GeometryGUI::IsInGeomComponent( aSObj )) continue;
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object_var aGeomObj =
GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
TopoDS_Shape aShape; TopoDS_Shape aShape;

View File

@ -450,10 +450,9 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_Inter
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() ); SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( study ) { if ( study ) {
_PTR(Study) studyDS = study->studyDS(); _PTR(Study) studyDS = study->studyDS();
_PTR(SObject) obj( studyDS->FindObjectID( IO->getEntry() ) ); _PTR(SObject) obj = studyDS->FindObjectID( IO->getEntry() );
if ( obj ) { if ( GeometryGUI::IsInGeomComponent( obj )) {
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj ); CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj );
if ( !CORBA::is_nil( corbaObj ) )
object = GEOM::GEOM_Object::_narrow( corbaObj ); object = GEOM::GEOM_Object::_narrow( corbaObj );
} }
} }
@ -489,7 +488,6 @@ void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects,
} }
} }
//================================================================================= //=================================================================================
// function : CreateArrowForLinearEdge() // function : CreateArrowForLinearEdge()
// purpose : Create a cone topology to be used to display an arrow in the middle // purpose : Create a cone topology to be used to display an arrow in the middle

View File

@ -38,7 +38,7 @@ class GEOM_Annotation;
class GEOM_Displayer; class GEOM_Displayer;
/*! /*!
* \brief A help class to process visualizatin of annotation presentations. * \brief A help class to process visualization of annotation presentations.
* It contains a map of presentations shown in each viewer. * It contains a map of presentations shown in each viewer.
* and correct 2D position persistent properties of annotations of active viewer. * and correct 2D position persistent properties of annotations of active viewer.
* When the viewer is closed, information about the viewer is removed from the manager * When the viewer is closed, information about the viewer is removed from the manager

View File

@ -132,7 +132,7 @@ void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* sel
QString anEntry = entry( idx ); QString anEntry = entry( idx );
if ( study && !anEntry.isEmpty() ) { if ( study && !anEntry.isEmpty() ) {
_PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) ); _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
if ( aSO ) { if ( GeometryGUI::IsInGeomComponent( aSO )) {
CORBA::Object_var varObj = GeometryGUI::ClientSObjectToObject( aSO ); CORBA::Object_var varObj = GeometryGUI::ClientSObjectToObject( aSO );
myObjects[idx] = GEOM::GEOM_BaseObject::_narrow( varObj ); myObjects[idx] = GEOM::GEOM_BaseObject::_narrow( varObj );
} }

View File

@ -1765,7 +1765,7 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry,
if ( getStudy() ) if ( getStudy() )
{ {
_PTR(SObject) SO ( getStudy()->studyDS()->FindObjectID( theIO->getEntry() ) ); _PTR(SObject) SO ( getStudy()->studyDS()->FindObjectID( theIO->getEntry() ) );
if ( SO ) if ( SO ) //GeometryGUI::IsInGeomComponent( SO ))
{ {
// get CORBA reference to data object // get CORBA reference to data object
CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO); CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
@ -2377,6 +2377,7 @@ void GEOM_Displayer::setFieldStepInfo( const GEOM::field_data_type theFieldDataT
bool GEOM_Displayer::canBeDisplayed( const QString& entry, const QString& viewer_type ) const bool GEOM_Displayer::canBeDisplayed( const QString& entry, const QString& viewer_type ) const
{ {
_PTR(SObject) anObj = getStudy()->studyDS()->FindObjectID( (const char*)entry.toUtf8() ); _PTR(SObject) anObj = getStudy()->studyDS()->FindObjectID( (const char*)entry.toUtf8() );
//if ( ! GeometryGUI::IsInGeomComponent( anObj )) return false;
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM objects GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM objects
GEOM::GEOM_FieldStep_var aFieldStepObj = GEOM::GEOM_FieldStep::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM field steps GEOM::GEOM_FieldStep_var aFieldStepObj = GEOM::GEOM_FieldStep::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM field steps
GEOM::GEOM_Gen_var aCompObj = GEOM::GEOM_Gen::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of whole GEOM component GEOM::GEOM_Gen_var aCompObj = GEOM::GEOM_Gen::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of whole GEOM component
@ -2538,7 +2539,7 @@ PropMap GEOM_Displayer::getObjectProperties( const QString& entry,
if ( !entry.isEmpty() ) { if ( !entry.isEmpty() ) {
// get CORBA reference to geom object // get CORBA reference to geom object
_PTR(SObject) SO( getStudy()->studyDS()->FindObjectID( entry.toStdString() ) ); _PTR(SObject) SO( getStudy()->studyDS()->FindObjectID( entry.toStdString() ) );
if ( SO ) { if ( SO ) { //GeometryGUI::IsInGeomComponent( SO )) {
CORBA::Object_var object = GeometryGUI::ClientSObjectToObject( SO ); CORBA::Object_var object = GeometryGUI::ClientSObjectToObject( SO );
if ( !CORBA::is_nil( object ) ) { if ( !CORBA::is_nil( object ) ) {
GEOM::GEOM_Object_var geomObject = GEOM::GEOM_Object::_narrow( object ); GEOM::GEOM_Object_var geomObject = GEOM::GEOM_Object::_narrow( object );

View File

@ -176,6 +176,17 @@ CORBA::Object_var GeometryGUI::ClientSObjectToObject (_PTR(SObject) theSObject)
} }
return anObj._retn(); return anObj._retn();
} }
//=================================================================================
// function : IsInGeomComponent
// purpose : Check if an SObject is under GEOM component
//=================================================================================
bool GeometryGUI::IsInGeomComponent( _PTR(SObject) sobject )
{
if ( sobject )
if ( _PTR(SComponent) aComp = sobject->GetFatherComponent() )
return aComp->ComponentDataType() == "GEOM";
return false;
}
//======================================================================= //=======================================================================
// function : GetStudy // function : GetStudy
@ -2128,7 +2139,7 @@ void GeometryGUI::updateCreationInfo()
Handle(SALOME_InteractiveObject) io = selIt.Value(); Handle(SALOME_InteractiveObject) io = selIt.Value();
if ( !io->hasEntry() ) continue; if ( !io->hasEntry() ) continue;
_PTR(SObject) sobj = study->FindObjectID( io->getEntry() ); _PTR(SObject) sobj = study->FindObjectID( io->getEntry() );
if ( !sobj ) continue; if ( !GeometryGUI::IsInGeomComponent( sobj )) continue;
CORBA::Object_var obj = GeometryGUI::ClientSObjectToObject( sobj ); CORBA::Object_var obj = GeometryGUI::ClientSObjectToObject( sobj );
GEOM::GEOM_BaseObject_var gobj = GEOM::GEOM_BaseObject::_narrow( obj ); GEOM::GEOM_BaseObject_var gobj = GEOM::GEOM_BaseObject::_narrow( obj );
if ( !gobj->_is_nil() ) if ( !gobj->_is_nil() )

View File

@ -92,6 +92,7 @@ public:
static GEOM::GEOM_Gen_var GetGeomGen(); static GEOM::GEOM_Gen_var GetGeomGen();
static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject); static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
static bool IsInGeomComponent( _PTR(SObject) theSObject );
static SALOMEDS::Study_var getStudyServant(); static SALOMEDS::Study_var getStudyServant();
static void Modified( bool = true ); static void Modified( bool = true );

View File

@ -94,7 +94,7 @@ static bool inUse( const QString& component, const QMap<QString,QString>& object
for ( oit = objects.begin(); oit != objects.end(); ++oit ) for ( oit = objects.begin(); oit != objects.end(); ++oit )
{ {
_PTR(SObject) so = study->FindObjectID( oit.key().toUtf8().data() ); _PTR(SObject) so = study->FindObjectID( oit.key().toUtf8().data() );
if ( !so ) if ( !GeometryGUI::IsInGeomComponent( so ))
continue; continue;
aSelectedSO.push_back(so); aSelectedSO.push_back(so);
CORBA::Object_var corbaObj_rem = GeometryGUI::ClientSObjectToObject( so ); CORBA::Object_var corbaObj_rem = GeometryGUI::ClientSObjectToObject( so );

View File

@ -160,7 +160,7 @@ void GEOMToolsGUI::OnAutoColor()
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aMainSObject(aStudy->FindObjectID(anIObject->getEntry())); _PTR(SObject) aMainSObject(aStudy->FindObjectID(anIObject->getEntry()));
GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject)); GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject));
if (CORBA::is_nil(aMainObject)) return; if (CORBA::is_nil(aMainObject) || !GeometryGUI::IsInGeomComponent( aMainSObject )) return;
aMainObject->SetAutoColor( true ); aMainObject->SetAutoColor( true );
@ -229,7 +229,7 @@ void GEOMToolsGUI::OnDisableAutoColor()
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) ); _PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject)); GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject));
if( CORBA::is_nil( aMainObject ) ) if( CORBA::is_nil( aMainObject ) || !GeometryGUI::IsInGeomComponent( aMainSObject ))
return; return;
aMainObject->SetAutoColor( false ); aMainObject->SetAutoColor( false );

View File

@ -220,7 +220,7 @@ void GEOMToolsGUI_MarkerDlg::accept()
_PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) ); _PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) );
GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object_var anObject =
GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) ); GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) );
if ( !anObject->_is_nil() ) { if ( !anObject->_is_nil() && GeometryGUI::IsInGeomComponent( aSObject )) {
if ( myWGStack->currentIndex() == 0 ) { if ( myWGStack->currentIndex() == 0 ) {
anObject->SetMarkerStd( getMarkerType(), getStandardMarkerScale() ); anObject->SetMarkerStd( getMarkerType(), getStandardMarkerScale() );
QString aMarker = "%1%2%3"; QString aMarker = "%1%2%3";
@ -296,7 +296,7 @@ void GEOMToolsGUI_MarkerDlg::init()
_PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) ); _PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) );
GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object_var anObject =
GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) ); GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) );
if ( !anObject->_is_nil() ) { if ( !anObject->_is_nil() && GeometryGUI::IsInGeomComponent( aSObject )) {
GEOM::marker_type mtype = anObject->GetMarkerType(); GEOM::marker_type mtype = anObject->GetMarkerType();
if ( aType == -1 ) if ( aType == -1 )
aType = mtype; aType = mtype;

View File

@ -44,7 +44,7 @@ GEOM_Swig_LocalSelector::GEOM_Swig_LocalSelector(QWidget* parent, SUIT_ViewWindo
{ {
_PTR(Study) studyDS = study->studyDS(); _PTR(Study) studyDS = study->studyDS();
_PTR(SObject) obj( studyDS->FindObjectID( shapeEntry ) ); _PTR(SObject) obj( studyDS->FindObjectID( shapeEntry ) );
if (obj) if ( GeometryGUI::IsInGeomComponent( obj ))
{ {
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj); CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(obj);
if (!CORBA::is_nil(corbaObj)) if (!CORBA::is_nil(corbaObj))

View File

@ -876,6 +876,7 @@ int GroupGUI_GroupDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMap
_PTR(Study) aStudy = appStudy->studyDS(); _PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData())); _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData()));
if ( ! GeometryGUI::IsInGeomComponent( aSObj )) continue;
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object_var aGeomObj =
GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
TopoDS_Shape aShape; TopoDS_Shape aShape;

View File

@ -224,6 +224,7 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument()
QString anEntry = anIO->getEntry(); QString anEntry = anIO->getEntry();
_PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData())); _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry.toUtf8().constData()));
if ( ! GeometryGUI::IsInGeomComponent( aSObj )) continue;
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object_var aGeomObj =
GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj));
TopoDS_Shape aShape; TopoDS_Shape aShape;