-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 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
else if ( p=="nbChildren") val = QVariant( nbChildren( ind ) );
else if ( p=="isContainer") val = QVariant( isContainer( ind ) );
else if ( p=="guiState") val = QVariant( guiState() );
+ else if ( p=="canBreakLink") val = QVariant( canBreakLink(ind) );
if ( val.isValid() )
return val;
return false;
}
+//=======================================================================
+//function : canBreakLink
+//purpose : returns true if selected object is a Shaper object and it can break link
+//=======================================================================
+
+bool SMESHGUI_Selection::canBreakLink( int ind ) const
+{
+ if ( ind >= 0 && isReference(ind) ) {
+ QString aEntry = objectInfo(ind, OI_RefEntry).toString();
+ if (!aEntry.isEmpty()) {
+ _PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID( aEntry.toStdString());
+ if (aSObject) {
+ _PTR(SObject) aFatherObj = aSObject->GetFather();
+ if (aFatherObj) {
+ _PTR(SComponent) aComponent = aFatherObj->GetFatherComponent();
+ if (aComponent && aComponent->ComponentDataType() == "SMESH") {
+ QString aObjEntry = entry(ind);
+ _PTR(SObject) aGeomSObject = SMESH::getStudy()->FindObjectID(aObjEntry.toStdString());
+ GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aGeomSObject);
+ if (!aObject->_is_nil())
+ return aObject->IsParametrical();
+ }
+ }
+ }
+ }
+ }
+ return false;
+}
+
//=======================================================================
//function : isEditableHyp
//purpose :