return NoneState;
}
+void PartSet_ObjectNode::update()
+{
+ ResultBodyPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultBody>(myObject);
+ if (aCompRes.get()) {
+ int aNb = aCompRes->numberOfSubs(true);
+ ModuleBase_ITreeNode* aNode;
+ ResultBodyPtr aBody;
+ int i;
+ for (i = 0; i < aNb; i++) {
+ aBody = aCompRes->subResult(i, true);
+ if (i < myChildren.size()) {
+ aNode = myChildren.at(i);
+ if (aNode->object() != aBody) {
+ ((PartSet_ObjectNode*)aNode)->setObject(aBody);
+ }
+ } else {
+ aNode = new PartSet_ObjectNode(aBody, this);
+ myChildren.append(aNode);
+ }
+ }
+ // Delete extra objects
+ while (myChildren.size() > aNb) {
+ aNode = myChildren.takeLast();
+ delete aNode;
+ }
+ }
+}
+QTreeNodesList PartSet_ObjectNode::objectCreated(const QObjectPtrList& theObjects)
+{
+ QTreeNodesList aResult;
+
+ ResultBodyPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultBody>(myObject);
+ if (aCompRes.get()) {
+ int aNb = aCompRes->numberOfSubs(true);
+ ModuleBase_ITreeNode* aNode;
+ ResultBodyPtr aBody;
+ int i;
+ for (i = 0; i < aNb; i++) {
+ aBody = aCompRes->subResult(i, true);
+ if (i < myChildren.size()) {
+ aNode = myChildren.at(i);
+ if (aNode->object() != aBody) {
+ ((PartSet_ObjectNode*)aNode)->setObject(aBody);
+ aResult.append(aNode);
+ }
+ } else {
+ aNode = new PartSet_ObjectNode(aBody, this);
+ myChildren.append(aNode);
+ aResult.append(aNode);
+ }
+ }
+ }
+ return aResult;
+}
+
+QTreeNodesList PartSet_ObjectNode::objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup)
+{
+ QTreeNodesList aResult;
+ ResultBodyPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultBody>(myObject);
+ if (aCompRes.get()) {
+ int aNb = aCompRes->numberOfSubs(true);
+ ModuleBase_ITreeNode* aNode;
+ // Delete extra objects
+ bool isDeleted = false;
+ while (myChildren.size() > aNb) {
+ aNode = myChildren.takeLast();
+ delete aNode;
+ isDeleted = true;
+ }
+ if (isDeleted)
+ aResult.append(this);
+ }
+ return aResult;
+}
//////////////////////////////////////////////////////////////////////////////////
PartSet_FolderNode::PartSet_FolderNode(ModuleBase_ITreeNode* theParent,
FolderType theType)
ModuleBase_ITreeNode* PartSet_FolderNode::createNode(const ObjectPtr& theObj)
{
- ResultBodyPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theObj);
- if (aCompRes.get())
- return new PartSet_CompsolidNode(theObj, this);
+ //ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObj);
+ //if (aCompRes.get())
+ // return new PartSet_CompsolidNode(theObj, this);
return new PartSet_ObjectNode(theObj, this);
}
//////////////////////////////////////////////////////////////////////////////////
-PartSet_CompsolidNode::PartSet_CompsolidNode(const ObjectPtr& theObj,
- ModuleBase_ITreeNode* theParent) : PartSet_ObjectNode(theObj, theParent)
-{
- update();
-}
-
-void PartSet_CompsolidNode::update()
-{
- ResultBodyPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultBody>(myObject);
- int aNb = aCompRes->numberOfSubs(true);
- ModuleBase_ITreeNode* aNode;
- ResultBodyPtr aBody;
- int i;
- for (i = 0; i < aNb; i++) {
- aBody = aCompRes->subResult(i, true);
- if (i < myChildren.size()) {
- aNode = myChildren.at(i);
- if (aNode->object() != aBody) {
- ((PartSet_ObjectNode*)aNode)->setObject(aBody);
- }
- } else {
- aNode = new PartSet_ObjectNode(aBody, this);
- myChildren.append(aNode);
- }
- }
- // Delete extra objects
- while (myChildren.size() > aNb) {
- aNode = myChildren.takeLast();
- delete aNode;
- }
-}
-
-QTreeNodesList PartSet_CompsolidNode::objectCreated(const QObjectPtrList& theObjects)
-{
- QTreeNodesList aResult;
-
- ResultBodyPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultBody>(myObject);
- int aNb = aCompRes->numberOfSubs(true);
- ModuleBase_ITreeNode* aNode;
- ResultBodyPtr aBody;
- int i;
- for (i = 0; i < aNb; i++) {
- aBody = aCompRes->subResult(i, true);
- if (i < myChildren.size()) {
- aNode = myChildren.at(i);
- if (aNode->object() != aBody) {
- ((PartSet_ObjectNode*)aNode)->setObject(aBody);
- aResult.append(aNode);
- }
- } else {
- aNode = new PartSet_ObjectNode(aBody, this);
- myChildren.append(aNode);
- aResult.append(aNode);
- }
- }
- return aResult;
-}
-
-QTreeNodesList PartSet_CompsolidNode::objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup)
-{
- QTreeNodesList aResult;
- ResultBodyPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultBody>(myObject);
- int aNb = aCompRes->numberOfSubs(true);
- ModuleBase_ITreeNode* aNode;
- // Delete extra objects
- bool isDeleted = false;
- while (myChildren.size() > aNb) {
- aNode = myChildren.takeLast();
- delete aNode;
- isDeleted = true;
- }
- if (isDeleted)
- aResult.append(this);
- return aResult;
-}
\ No newline at end of file
+//PartSet_CompsolidNode::PartSet_CompsolidNode(const ObjectPtr& theObj,
+// ModuleBase_ITreeNode* theParent) : PartSet_ObjectNode(theObj, theParent)
+//{
+// update();
+//}
+
+//void PartSet_CompsolidNode::update()
+//{
+// ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(myObject);
+// int aNb = aCompRes->numberOfSubs(true);
+// ModuleBase_ITreeNode* aNode;
+// ResultBodyPtr aBody;
+// int i;
+// for (i = 0; i < aNb; i++) {
+// aBody = aCompRes->subResult(i, true);
+// if (i < myChildren.size()) {
+// aNode = myChildren.at(i);
+// if (aNode->object() != aBody) {
+// ((PartSet_ObjectNode*)aNode)->setObject(aBody);
+// }
+// } else {
+// aNode = new PartSet_ObjectNode(aBody, this);
+// myChildren.append(aNode);
+// }
+// }
+// // Delete extra objects
+// while (myChildren.size() > aNb) {
+// aNode = myChildren.takeLast();
+// delete aNode;
+// }
+//}
+//
+//QTreeNodesList PartSet_CompsolidNode::objectCreated(const QObjectPtrList& theObjects)
+//{
+// QTreeNodesList aResult;
+//
+// ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(myObject);
+// int aNb = aCompRes->numberOfSubs(true);
+// ModuleBase_ITreeNode* aNode;
+// ResultBodyPtr aBody;
+// int i;
+// for (i = 0; i < aNb; i++) {
+// aBody = aCompRes->subResult(i, true);
+// if (i < myChildren.size()) {
+// aNode = myChildren.at(i);
+// if (aNode->object() != aBody) {
+// ((PartSet_ObjectNode*)aNode)->setObject(aBody);
+// aResult.append(aNode);
+// }
+// } else {
+// aNode = new PartSet_ObjectNode(aBody, this);
+// myChildren.append(aNode);
+// aResult.append(aNode);
+// }
+// }
+// return aResult;
+//}
+//
+//QTreeNodesList PartSet_CompsolidNode::objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup)
+//{
+// QTreeNodesList aResult;
+// ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(myObject);
+// int aNb = aCompRes->numberOfSubs(true);
+// ModuleBase_ITreeNode* aNode;
+// // Delete extra objects
+// bool isDeleted = false;
+// while (myChildren.size() > aNb) {
+// aNode = myChildren.takeLast();
+// delete aNode;
+// isDeleted = true;
+// }
+// if (isDeleted)
+// aResult.append(this);
+// return aResult;
+//}
\ No newline at end of file
/// theObj a new object
void setObject(ObjectPtr theObj) { myObject = theObj; }
+ virtual VisibilityState visibilityState() const;
+
/// Updates sub-nodes of the node
- virtual void update() {}
+ virtual void update();
- virtual VisibilityState visibilityState() const;
+ /// Process creation of objects.
+ /// \param theObjects a list of created objects
+ /// \return a list of nodes which corresponds to the created objects
+ virtual QTreeNodesList objectCreated(const QObjectPtrList& theObjects);
+
+ /// Process deletion of objects.
+ /// \param theDoc a document where objects were deleted
+ /// \param theGroup a name of group where objects were deleted
+ virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup);
protected:
ObjectPtr myObject;
* \ingroup Modules
* Implementation of a node for compsolid representation
*/
-class PartSet_CompsolidNode : public PartSet_ObjectNode
-{
-public:
- PartSet_CompsolidNode(const ObjectPtr& theObj, ModuleBase_ITreeNode* theParent);
-
- static std::string typeId()
- {
- static std::string myType = "CompSolid";
- return myType;
- }
-
- virtual std::string type() const { return typeId(); }
-
- /// Updates sub-nodes of the node
- virtual void update();
-
- /// Process creation of objects.
- /// \param theObjects a list of created objects
- /// \return a list of nodes which corresponds to the created objects
- virtual QTreeNodesList objectCreated(const QObjectPtrList& theObjects);
-
- /// Process deletion of objects.
- /// \param theDoc a document where objects were deleted
- /// \param theGroup a name of group where objects were deleted
- virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup);
-
-};
+//class PartSet_CompsolidNode : public PartSet_ObjectNode
+//{
+//public:
+// PartSet_CompsolidNode(const ObjectPtr& theObj, ModuleBase_ITreeNode* theParent);
+//
+// static std::string typeId()
+// {
+// static std::string myType = "CompSolid";
+// return myType;
+// }
+//
+// virtual std::string type() const { return typeId(); }
+//
+// /// Updates sub-nodes of the node
+// virtual void update();
+//
+// /// Process creation of objects.
+// /// \param theObjects a list of created objects
+// /// \return a list of nodes which corresponds to the created objects
+// virtual QTreeNodesList objectCreated(const QObjectPtrList& theObjects);
+//
+// /// Process deletion of objects.
+// /// \param theDoc a document where objects were deleted
+// /// \param theGroup a name of group where objects were deleted
+// virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup);
+//
+//};
#endif