// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
+// License as published by the Free Software Foundation; either
// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include <GEOM_Function.hxx>
#include <GEOM_Object.hxx>
#include <GEOM_Solver.hxx>
+#include <GEOM_ISubShape.hxx>
#include "utilities.h"
TopoDS_Shape aShape;
TDF_Label aLabel = GetOwnerEntry();
- if(aLabel.IsRoot()) return aShape;
+ if (aLabel.IsRoot()) return aShape;
Handle(GEOM_Object) anObject = GEOM_Object::GetObject(aLabel);
- if(anObject.IsNull()) return aShape;
- if(!anObject->IsMainShape()) {
- try {
+ if (anObject.IsNull()) return aShape;
+
+ if (!anObject->IsMainShape()) {
+ bool isResult = false;
+ TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
+ if (!aResultLabel.IsNull()) {
+ Handle(TNaming_NamedShape) aNS;
+ if (aResultLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS))
+ isResult = true;
+ }
+
+ // compare tics
+ if (isResult) {
+ // tic of this
+ Standard_Integer aTic = anObject->GetTic();
+
+ // tic of main shape
+ GEOM_ISubShape aCI (this);
+ TDF_Label aLabelObjMainSh = aCI.GetMainShape()->GetOwnerEntry();
+ if (aLabelObjMainSh.IsRoot()) return aShape;
+ Handle(GEOM_Object) anObjMainSh = GEOM_Object::GetObject(aLabelObjMainSh);
+ if (anObjMainSh.IsNull()) return aShape;
+ Standard_Integer aTicMainSh = anObjMainSh->GetTic();
+
+ // compare
+ isResult = ((aTic == aTicMainSh) ? true : false);
+ }
+
+ if (!isResult) {
+ try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
- OCC_CATCH_SIGNALS;
+ OCC_CATCH_SIGNALS;
#endif
- GEOM_Solver aSolver(GEOM_Engine::GetEngine());
- if (!aSolver.ComputeFunction(this)) {
- MESSAGE("GEOM_Object::GetValue Error : Can't build a sub shape");
- return aShape;
+ GEOM_Solver aSolver(GEOM_Engine::GetEngine());
+ if (!aSolver.ComputeFunction(this)) {
+ MESSAGE("GEOM_Object::GetValue Error : Can't build a sub shape");
+ return aShape;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ MESSAGE("GEOM_Function::GetValue Error: " << aFail->GetMessageString());
+ return aShape;
}
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- MESSAGE("GEOM_Function::GetValue Error: " << aFail->GetMessageString());
- return aShape;
}
}
TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
Handle(TNaming_NamedShape) aNS;
- if(!aResultLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
+ if (!aResultLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
aShape = aNS->Get();
//=============================================================================
/*!
- * GetValue
+ * SetValue
*/
//=============================================================================
void GEOM_Function::SetValue(TopoDS_Shape& theShape)
aBuilder.Generated(theShape);
+ // synchronisation between main shape and its sub-shapes
+ TDF_Label aLabel = GetOwnerEntry();
+ if (aLabel.IsRoot()) return;
+ Handle(GEOM_Object) anObject = GEOM_Object::GetObject(aLabel);
+ if (anObject.IsNull()) return;
+ if (anObject->IsMainShape()) {
+ // increase modifications counter of this (main) shape
+ anObject->IncrementTic();
+ }
+ else {
+ // update modifications counter of this (sub-) shape to be the same as on main shape
+ GEOM_ISubShape aCI (this);
+ TDF_Label aLabelObjMainSh = aCI.GetMainShape()->GetOwnerEntry();
+ if (aLabelObjMainSh.IsRoot()) return;
+ Handle(GEOM_Object) anObjMainSh = GEOM_Object::GetObject(aLabelObjMainSh);
+ if (anObjMainSh.IsNull()) return;
+
+ anObject->SetTic(anObjMainSh->GetTic());
+ }
+
_isDone = true;
}
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
+// License as published by the Free Software Foundation; either
// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
-#define TYPE 2
#define FUNCTION_LABEL(theNb) (_label.FindChild(1).FindChild((theNb)))
+#define TYPE_LABEL 2
#define FREE_LABEL 3
+#define TIC_LABEL 4
//=======================================================================
//function : GetObjectID
{
static Standard_GUID anObjectID("FF1BBB01-5D14-4df2-980B-3A668264EA16");
return anObjectID;
-}
+}
//=======================================================================
//function : GetSubShapeID
static Standard_GUID anObjectID("FF1BBB68-5D14-4df2-980B-3A668264EA16");
return anObjectID;
}
-
+
//=============================================================================
/*!
* GetObject
Handle(TDataStd_Integer) anID;
if(!aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) return NULL;
-
+
GEOM_Engine* anEngine= GEOM_Engine::GetEngine();
if(anEngine == NULL) return NULL;
// Get label of the referenced object
TDF_Label aLabel = aFather->Label();
-
+
return GEOM_Object::GetObject(aLabel);
}
*/
//=============================================================================
GEOM_Object::GEOM_Object(TDF_Label& theEntry)
-: _label(theEntry), _ior("")
+: _label(theEntry), _ior("")
{
- if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root))
+ if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root))
_root = TDataStd_TreeNode::Set(theEntry);
}
*/
//=============================================================================
GEOM_Object::GEOM_Object(TDF_Label& theEntry, int theType)
-: _label(theEntry), _ior("")
+: _label(theEntry), _ior("")
{
theEntry.ForgetAllAttributes(Standard_True);
- if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root))
+ if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root))
_root = TDataStd_TreeNode::Set(theEntry);
- TDataStd_Integer::Set(theEntry.FindChild(TYPE), theType);
+ TDataStd_Integer::Set(theEntry.FindChild(TYPE_LABEL), theType);
TDataStd_UAttribute::Set(theEntry, GetObjectID());
}
int GEOM_Object::GetType()
{
Handle(TDataStd_Integer) aType;
- if(!_label.FindChild(TYPE).FindAttribute(TDataStd_Integer::GetID(), aType)) return -1;
-
+ if(!_label.FindChild(TYPE_LABEL).FindAttribute(TDataStd_Integer::GetID(), aType)) return -1;
+
return aType->Get();
}
//=============================================================================
void GEOM_Object::SetType(int theType)
{
- TDataStd_Integer::Set(_label.FindChild(TYPE), theType);
- return;
+ TDataStd_Integer::Set(_label.FindChild(TYPE_LABEL), theType);
+}
+
+
+//=============================================================================
+/*!
+ * Returns modifications counter of this object.
+ * Comparing this value with modifications counters of argument objects
+ * (on which this object depends) we decide whether this object needs to be updated.
+ */
+//=============================================================================
+int GEOM_Object::GetTic()
+{
+ Handle(TDataStd_Integer) aTicAttr;
+ if (!_label.FindChild(TIC_LABEL).FindAttribute(TDataStd_Integer::GetID(), aTicAttr))
+ return 0;
+
+ return aTicAttr->Get();
+}
+
+//=============================================================================
+/*!
+ * Set another value of modifications counter.
+ *
+ * Use this method to update modifications counter of dependent object
+ * to be equal to modifications counter of its argument.
+ * This is commonly done in GEOM_Function::GetValue()
+ */
+//=============================================================================
+void GEOM_Object::SetTic(int theTic)
+{
+ TDataStd_Integer::Set(_label.FindChild(TIC_LABEL), theTic);
+}
+
+//=============================================================================
+/*!
+ * Increment modifications counter to mark this object as modified.
+ *
+ * Commonly called from GEOM_Function::SetValue()
+ */
+//=============================================================================
+void GEOM_Object::IncrementTic()
+{
+ TDF_Label aTicLabel = _label.FindChild(TIC_LABEL);
+
+ Standard_Integer aTic = 0;
+ Handle(TDataStd_Integer) aTicAttr;
+ if (aTicLabel.FindAttribute(TDataStd_Integer::GetID(), aTicAttr))
+ aTic = aTicAttr->Get();
+
+ TDataStd_Integer::Set(aTicLabel, aTic + 1);
}
Handle(TDataStd_Integer) anID;
if(!aDoc->Main().FindAttribute(TDataStd_Integer::GetID(), anID)) return -1;
-
+
return anID->Get();
}
if (!aFunction.IsNull())
aShape = aFunction->GetValue();
-
+
return aShape;
}
{
Handle(TDataStd_Name) aNameAttr;
if(!_label.FindAttribute(TDataStd_Name::GetID(), aNameAttr)) return NULL;
-
+
TCollection_AsciiString aName(aNameAttr->Get());
return aName.ToCString();
}
/*!
* IsSubShape
*/
-//=============================================================================
+//=============================================================================
bool GEOM_Object::IsMainShape()
{
Handle(GEOM_Function) aFunction = GetFunction(1);
{
Standard_Integer nb = GetNbFunctions();
if(nb) return GetFunction(nb);
-
+
return NULL;
}
}
Standard_Integer aLength = aSeq.Length();
- if(aLength > 0) {
+ if(aLength > 0) {
anArray = new TColStd_HSequenceOfTransient;
for(Standard_Integer j =1; j<=aLength; j++)
anArray->Append(GetReferencedObject(aSeq(j)));
}
-
+
return anArray;
}
//=======================================================================
//function : GEOM_Object_Type_
//purpose :
-//=======================================================================
+//=======================================================================
Standard_EXPORT Handle_Standard_Type& GEOM_Object_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
+ if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
-
+
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOM_Object",
//=======================================================================
//function : DownCast
//purpose :
-//=======================================================================
+//=======================================================================
const Handle(GEOM_Object) Handle(GEOM_Object)::DownCast(const Handle(Standard_Transient)& AnObject)
{
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
+// License as published by the Free Software Foundation; either
// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#endif
#ifndef _Handle_MMgt_TShared_HeaderFile
#include <Handle_MMgt_TShared.hxx>
-#endif
+#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
-#endif
+#endif
#ifndef _Standard_GUID_HeaderFile
#include <Standard_GUID.hxx>
#endif
class Handle(GEOM_Object) : public Handle(MMgt_TShared) {
public:
- inline void* operator new(size_t,void* anAddress)
+ inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
+ inline void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
}
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ inline void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
- Handle(GEOM_Object)():Handle(MMgt_TShared)() {}
- Handle(GEOM_Object)(const Handle(GEOM_Object)& aHandle) : Handle(MMgt_TShared)(aHandle)
+ Handle(GEOM_Object)():Handle(MMgt_TShared)() {}
+ Handle(GEOM_Object)(const Handle(GEOM_Object)& aHandle) : Handle(MMgt_TShared)(aHandle)
{
}
- Handle(GEOM_Object)(const GEOM_Object* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
+ Handle(GEOM_Object)(const GEOM_Object* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
{
}
return *this;
}
- GEOM_Object* operator->()
+ GEOM_Object* operator->()
{
return (GEOM_Object *)ControlAccess();
}
- GEOM_Object* operator->() const
+ GEOM_Object* operator->() const
{
return (GEOM_Object *)ControlAccess();
}
Standard_EXPORT ~Handle(GEOM_Object)() {};
-
+
Standard_EXPORT static const Handle(GEOM_Object) DownCast(const Handle(Standard_Transient)& AnObject);
};
-
#include <Standard_GUID.hxx>
#include <TDataStd_TreeNode.hxx>
#include "GEOM_Function.hxx"
#include "GEOM_Engine.hxx"
-
class GEOM_Object : public MMgt_TShared
{
- friend class GEOM_Engine;
+ friend class GEOM_Engine;
public:
- inline void* operator new(size_t,void* anAddress)
+ inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
+ inline void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
}
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ inline void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
-
+
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& GEOM_Object_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Object) ; }
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_Object) == AType || MMgt_TShared::IsKind(AType)); }
+ Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
+ { return (STANDARD_TYPE(GEOM_Object) == AType || MMgt_TShared::IsKind(AType)); }
private:
- GEOM_Object(TDF_Label& theLabel);
+ GEOM_Object(TDF_Label& theLabel);
public:
Standard_EXPORT GEOM_Object(TDF_Label& theEntry, int theType);
Standard_EXPORT static const Standard_GUID& GetSubShapeID();
//###########################################################
- //Access to properties
+ //Access to properties
//###########################################################
//Returns a TreeNode that presents a root of a function tree for this GEOM_Object
- Standard_EXPORT Handle(TDataStd_TreeNode) GetRootNode() { return _root; }
-
+ Standard_EXPORT Handle(TDataStd_TreeNode) GetRootNode() { return _root; }
+
//Returns a label of this GEOM_Object
Standard_EXPORT TDF_Label GetEntry() { return _label; }
-
+
//Returns a type of this GEOM_Object (GEOM_POINT, GEOM_VECTOR...)
- Standard_EXPORT int GetType();
+ Standard_EXPORT int GetType();
//Sets the type of this GEOM_Object
Standard_EXPORT void SetType(int theType);
-
+
+ //Modifications counter management
+ Standard_EXPORT int GetTic();
+ Standard_EXPORT void SetTic(int theTic);
+ Standard_EXPORT void IncrementTic();
+
//Returns an ID of the OCAF document where this GEOM_Object is stored
- Standard_EXPORT int GetDocID();
+ Standard_EXPORT int GetDocID();
- //Returns a value (as TopoDS_Shape) of this GEOM_Object
+ //Returns a value (as TopoDS_Shape) of this GEOM_Object
Standard_EXPORT TopoDS_Shape GetValue();
//Sets a name of this GEOM_Object
//Returns an auxiliary data
Standard_EXPORT TCollection_AsciiString GetAuxData();
- //###########################################################
+ //###########################################################
// Sub shape methods
//###########################################################
-
+
//Returns false if the object is a sub shape of another object
Standard_EXPORT bool IsMainShape();
- //###########################################################
- // CORBA related methods
- //###########################################################
-
- //Sets an IOR of CORBA GEOM_Object_i which refers to this object
- Standard_EXPORT void SetIOR(TCollection_AsciiString& theIOR) { _ior = theIOR; }
+ //###########################################################
+ // CORBA related methods
+ //###########################################################
+
+ //Sets an IOR of CORBA GEOM_Object_i which refers to this object
+ Standard_EXPORT void SetIOR(TCollection_AsciiString& theIOR) { _ior = theIOR; }
- //Returns an IOR of CORBA GEOM_Object_i which refers to this object
- Standard_EXPORT TCollection_AsciiString GetIOR() { return _ior; }
+ //Returns an IOR of CORBA GEOM_Object_i which refers to this object
+ Standard_EXPORT TCollection_AsciiString GetIOR() { return _ior; }
//###########################################################
//Functions methods
//###########################################################
- //Adds a function with a driver GUID = theGUID and a type theFunctionType to the function tree of this GEOM_Object
+ //Adds a function with a driver GUID = theGUID and a type theFunctionType
+ //to the function tree of this GEOM_Object
Standard_EXPORT Handle(GEOM_Function) AddFunction(const Standard_GUID& theGUID, int theFunctionType);
-
+
//Returns a number of functions of this GEOM_Object
- Standard_EXPORT int GetNbFunctions();
-
+ Standard_EXPORT int GetNbFunctions();
+
//Returns a function with given number theFunctionNumber
Standard_EXPORT Handle(GEOM_Function) GetFunction(int theFunctionNumber);
-
+
//Return the last function of this GEOM_Object
Standard_EXPORT Handle(GEOM_Function) GetLastFunction();
//Returns the dependencies of the last function
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetLastDependency();
- //###########################################################
- // Internal methods
- //###########################################################
+ //###########################################################
+ // Internal methods
+ //###########################################################
- //Returns a label which could be used to store some additional data
- Standard_EXPORT TDF_Label GetFreeLabel();
-
+ //Returns a label which could be used to store some additional data
+ Standard_EXPORT TDF_Label GetFreeLabel();
private:
-
Handle(TDataStd_TreeNode) _root;
- TDF_Label _label;
- TCollection_AsciiString _ior;
+ TDF_Label _label;
+ TCollection_AsciiString _ior;
};
#endif
#include <qvaluelist.h>
#include <qstringlist.h>
+#include <set>
+
#include "GEOMImpl_Types.hxx"
using namespace std;
{
QString aName = "";
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+ // collect all object names of GEOM component
+ SalomeApp_Study* appStudy =
+ dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( !appStudy ) return aName;
_PTR(Study) aStudy = appStudy->studyDS();
- int aNumber = 0;
- _PTR(SObject) obj;
- do
- {
- aName = theOperation+"_"+QString::number(++aNumber);
- obj = aStudy->FindObject(aName.latin1());
+ std::set<std::string> aSet;
+ _PTR(SComponent) aGeomCompo (aStudy->FindComponent("GEOM"));
+ if (aGeomCompo) {
+ _PTR(ChildIterator) it (aStudy->NewChildIterator(aGeomCompo));
+ _PTR(SObject) obj;
+ for (it->InitEx(true); it->More(); it->Next()) {
+ obj = it->Value();
+ aSet.insert(obj->GetName());
}
- while (obj);
+ }
+
+ // build a unique name
+ int aNumber = 0;
+ bool isUnique = false;
+ while (!isUnique) {
+ aName = theOperation + "_" + QString::number(++aNumber);
+ isUnique = (aSet.count(aName.latin1()) == 0);
+ }
return aName;
}
anArray = new TColStd_HArray1OfInteger(1,1);
anArray->SetValue(1, anIndices.FindIndex(aValue));
anObj = GetEngine()->AddSubShape(theShape, anArray);
- aSeq->Append(anObj);
+ if (!anObj.IsNull()) {
+ aSeq->Append(anObj);
- // for python command
- TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- anAsciiList += anEntry;
- anAsciiList += ",";
+ // for python command
+ TDF_Tool::Entry(anObj->GetEntry(), anEntry);
+ anAsciiList += anEntry;
+ anAsciiList += ",";
+ }
}
//Make a Python command
TopTools_IndexedMapOfShape aResIndices;
TopExp::MapShapes(aShape, aResIndices);
+ // Map: source_shape/images of source_shape in Result
+ const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult();
+
// history for all argument shapes
TDF_LabelSequence aLabelSeq;
aFunction->GetDependency(aLabelSeq);
for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
- const TopTools_ListOfShape& aModified = PS.Modified(anEntity);
+ if (!aMR.Contains(anEntity)) continue;
+
+ const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity);
Standard_Integer nbModified = aModified.Extent();
if (nbModified > 0) {
Handle(TDataStd_IntegerArray) anAttr =
TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
+ int ih = 1;
TopTools_ListIteratorOfListOfShape itM (aModified);
- for (int im = 1; itM.More(); itM.Next(), ++im) {
+ for (; itM.More(); itM.Next(), ++ih) {
int id = aResIndices.FindIndex(itM.Value());
- anAttr->SetValue(im, id);
+ anAttr->SetValue(ih, id);
}
}
}