\return An object
*/
Object ConvertIORToObject(in string theIOR);
+
/*! \brief Get a new %UseCaseBuilder.
*/
UseCaseBuilder GetUseCaseBuilder();
Returns True if the given object <VAR>theObject</VAR> of the use case has child objects.
*/
boolean HasChildren(in SObject theObject);
+/*!
+ Gets father object of the given object <VAR>theObject</VAR> in the use cases tree.
+*/
+ SObject GetFather(in SObject theObject);
/*!
Sets the name of the use case.
*/
Returns True if the given object <VAR>theObject</VAR> represents a use case.
*/
boolean IsUseCase(in SObject theObject);
+/*!
+ Returns True if the given object <VAR>theObject</VAR> is included in the use cases tree on any level.
+*/
+ boolean IsUseCaseNode(in SObject theObject);
/*!
Gets the current object of the use case.
*/
// 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 : SALOMEDS_UseCaseBuilder.cxx
// Author : Sergey RUIN
// Module : SALOME
-//
+
#include "SALOMEDS_UseCaseBuilder.hxx"
#include "SALOMEDS.hxx"
return ret;
}
+_PTR(SObject) SALOMEDS_UseCaseBuilder::GetFather(const _PTR(SObject)& theObject)
+{
+ SALOMEDS_SObject* father = NULL;
+ SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ father = new SALOMEDS_SObject(_local_impl->GetFather(*(obj->GetLocalImpl())));
+ }
+ else father = new SALOMEDS_SObject(_corba_impl->GetFather(obj->GetCORBAImpl()));
+ return _PTR(SObject)(father);
+}
+
bool SALOMEDS_UseCaseBuilder::IsUseCase(const _PTR(SObject)& theObject)
{
bool ret;
return ret;
}
+bool SALOMEDS_UseCaseBuilder::IsUseCaseNode(const _PTR(SObject)& theObject)
+{
+ bool ret;
+ SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ ret = _local_impl->IsUseCaseNode(*(obj->GetLocalImpl()));
+ }
+ else ret = _corba_impl->IsUseCaseNode(obj->GetCORBAImpl());
+ return ret;
+}
+
bool SALOMEDS_UseCaseBuilder::SetName(const std::string& theName)
{
bool ret;
// 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 : SALOMEDS_UseCaseBuilder.hxx
// Author : Sergey RUIN
// Module : SALOME
-//
+
#ifndef __SALOMEDS_USECaseBuilder_H__
#define __SALOMEDS_USECaseBuilder_H__
virtual bool SetCurrentObject(const _PTR(SObject)& theObject);
virtual bool SetRootCurrent();
virtual bool HasChildren(const _PTR(SObject)& theObject);
+ virtual _PTR(SObject) GetFather(const _PTR(SObject)& theObject);
virtual bool IsUseCase(const _PTR(SObject)& theObject);
+ virtual bool IsUseCaseNode(const _PTR(SObject)& theObject);
virtual bool SetName(const std::string& theName);
virtual _PTR(SObject) GetCurrentObject();
virtual std::string GetName();
// 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 : SALOMEDS_UseCaseBuilder_i.cxx
// Author : Sergey RUIN
// Module : SALOME
-//
+
#include "SALOMEDS_UseCaseBuilder_i.hxx"
#include "SALOMEDS_UseCaseIterator_i.hxx"
#include "SALOMEDS_SObject_i.hxx"
return _impl->HasChildren(_impl->GetSObject(theObject->GetID()));
}
+//============================================================================
+/*! Function : GetFather
+ * Purpose :
+ */
+//============================================================================
+SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::GetFather(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+
+ if(!_impl) return NULL;
+ SALOMEDSImpl_SObject aSO = _impl->GetFather(_impl->GetSObject(theObject->GetID()));
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
+ return so._retn();
+}
+
//============================================================================
/*! Function : SetName
* Purpose :
return _impl->IsUseCase(_impl->GetSObject(theObject->GetID()));
}
+//============================================================================
+/*! Function : IsUseCaseNode
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_UseCaseBuilder_i::IsUseCaseNode(SALOMEDS::SObject_ptr theObject)
+{
+ SALOMEDS::Locker lock;
+
+ if(!_impl || theObject->_is_nil()) return false;
+ return _impl->IsUseCaseNode(_impl->GetSObject(theObject->GetID()));
+}
+
//============================================================================
/*! Function : NewUseCase
* Purpose :
// 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 : SALOMEDS_UseCaseBuilder_i.hxx
// Author : Sergey RUIN
// Module : SALOME
-//
+
#ifndef __SALOMEDS_USECaseBuilder_I_H__
#define __SALOMEDS_USECaseBuilder_I_H__
virtual CORBA::Boolean HasChildren(SALOMEDS::SObject_ptr theObject);
+ virtual SALOMEDS::SObject_ptr GetFather(SALOMEDS::SObject_ptr theObject);
+
virtual CORBA::Boolean IsUseCase(SALOMEDS::SObject_ptr theObject);
+ virtual CORBA::Boolean IsUseCaseNode(SALOMEDS::SObject_ptr theObject);
+
virtual CORBA::Boolean SetName(const char* theName);
virtual SALOMEDS::SObject_ptr GetCurrentObject();
// 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 : SALOMEDSClient_UseCaseBuilder.hxx
// Author : Sergey RUIN
// Module : SALOME
-//
+
#ifndef __SALOMEDSClient_USECaseBuilder_H__
#define __SALOMEDSClient_USECaseBuilder_H__
virtual bool SetCurrentObject(const _PTR(SObject)& theObject) = 0;
virtual bool SetRootCurrent() = 0;
virtual bool HasChildren(const _PTR(SObject)& theObject) = 0;
+ virtual _PTR(SObject) GetFather(const _PTR(SObject)& theObject) = 0;
virtual bool IsUseCase(const _PTR(SObject)& theObject) = 0;
+ virtual bool IsUseCaseNode(const _PTR(SObject)& theObject) = 0;
virtual bool SetName(const std::string& theName) = 0;
virtual _PTR(SObject) GetCurrentObject() = 0;
virtual std::string GetName() = 0;
// 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 : SALOMEDSImpl_UseCaseBuilder.cxx
// Author : Sergey RUIN
// Module : SALOME
-//
+
#include "SALOMEDSImpl_UseCaseBuilder.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
aCurrentNode->Append(aNode);
+ // Mantis issue 0020136: Drag&Drop in OB
+ theObject.GetStudy()->addSO_Notification(theObject);
+
return true;
}
aNode->Remove();
- return aFather->Append(aNode);
+ bool ret = aFather->Append(aNode);
+
+ // Mantis issue 0020136: Drag&Drop in OB
+ theObject.GetStudy()->addSO_Notification(theObject);
+
+ return ret;
}
//============================================================================
aFirstNode->Remove();
- return aNode->InsertBefore(aFirstNode);
+ bool ret = aNode->InsertBefore(aFirstNode);
+
+ // Mantis issue 0020136: Drag&Drop in OB
+ theFirst.GetStudy()->addSO_Notification(theFirst);
+
+ return ret;
}
return (aNode->GetFirst());
}
+//============================================================================
+/*! Function : GetFather
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::GetFather(const SALOMEDSImpl_SObject& theObject)
+{
+ SALOMEDSImpl_SObject so;
+ if (!_root || !theObject) return so;
+
+ DF_Label aLabel = theObject.GetLabel();
+ if (aLabel.IsNull()) return so;
+
+ SALOMEDSImpl_AttributeTreeNode* aNode = NULL;
+ if (!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return so;
+
+ SALOMEDSImpl_AttributeTreeNode* aFatherNode = aNode->GetFather();
+ if (!aFatherNode) return so;
+
+ return aFatherNode->GetSObject();
+}
+
//============================================================================
/*! Function : SetName
* Purpose :
return false;
}
+//============================================================================
+/*! Function : IsUseCaseNode
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_UseCaseBuilder::IsUseCaseNode(const SALOMEDSImpl_SObject& theObject)
+{
+ if(!_root) return false;
+
+ DF_Label aLabel;
+ if (!theObject) aLabel = _root->Label();
+ else
+ aLabel = theObject.GetLabel();
+ if(aLabel.IsNull()) return false;
+
+ SALOMEDSImpl_AttributeTreeNode* aNode = NULL;
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false;
+
+ return true;
+}
+
//============================================================================
/*! Function : NewUseCase
* Purpose :
virtual bool HasChildren(const SALOMEDSImpl_SObject& theObject);
+ virtual SALOMEDSImpl_SObject GetFather(const SALOMEDSImpl_SObject& theObject);
+
virtual bool IsUseCase(const SALOMEDSImpl_SObject& theObject);
+ virtual bool IsUseCaseNode(const SALOMEDSImpl_SObject& theObject);
+
virtual bool SetName(const std::string& theName);
virtual SALOMEDSImpl_SObject GetCurrentObject();