Salome HOME
Copyright update 2022
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_1.cxx
index 410ccf7e152ef5321e1e72f79ceeb3f11ac3a0f2..95086a66061934e0aaaea24cd3d06b28b0c00e09 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -160,7 +160,7 @@ void GEOMToolsGUI::OnAutoColor()
   _PTR(Study) aStudy = appStudy->studyDS();
   _PTR(SObject) aMainSObject(aStudy->FindObjectID(anIObject->getEntry()));
   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 );
 
@@ -229,7 +229,7 @@ void GEOMToolsGUI::OnDisableAutoColor()
   _PTR(Study) aStudy = appStudy->studyDS();
   _PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
   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;
 
   aMainObject->SetAutoColor( false );
@@ -471,7 +471,7 @@ void GEOMToolsGUI::OnDeflection()
   int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
 
   QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Deflection ), QVariant() );
-  double aDC =  v.isValid() ? v.toDouble() : SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "deflection_coef", 0.001 );
+  double aDC =  v.isValid() ? v.toDouble() : SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "deflection_coeff", 0.001 );
 
   GEOMToolsGUI_DeflectionDlg * DeflectionDlg = new GEOMToolsGUI_DeflectionDlg
     ( SUIT_Session::session()->activeApplication()->desktop() );
@@ -607,7 +607,7 @@ void GEOMToolsGUI::OnUnpublishObject() {
             disp->EraseWithChildren(IObject);
             // hide references if any
             std::vector< _PTR(SObject) > vso = aStudy->FindDependances(obj);
-            for ( int i = 0; i < vso.size(); i++ ) {
+            for ( int i = 0; i < (int)vso.size(); i++ ) {
               _PTR(SObject) refObj = vso[i];
               aDrw = B->FindOrCreateAttribute( refObj, "AttributeDrawable" );
               aDrw->SetDrawable( false );