mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-05-09 18:30:48 +05:00
PAL14122: EDF307: GetInPlace --> COMM_FAILURE. Use new method GEOMAlgo_BuilderShape::ImagesResult() to obtain partition history.
This commit is contained in:
parent
11568f579b
commit
a25fd83519
@ -23,6 +23,7 @@
|
|||||||
#include <GEOM_Function.hxx>
|
#include <GEOM_Function.hxx>
|
||||||
#include <GEOM_Object.hxx>
|
#include <GEOM_Object.hxx>
|
||||||
#include <GEOM_Solver.hxx>
|
#include <GEOM_Solver.hxx>
|
||||||
|
#include <GEOM_ISubShape.hxx>
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
@ -164,7 +165,34 @@ TopoDS_Shape GEOM_Function::GetValue()
|
|||||||
if (aLabel.IsRoot()) return aShape;
|
if (aLabel.IsRoot()) return aShape;
|
||||||
Handle(GEOM_Object) anObject = GEOM_Object::GetObject(aLabel);
|
Handle(GEOM_Object) anObject = GEOM_Object::GetObject(aLabel);
|
||||||
if (anObject.IsNull()) return aShape;
|
if (anObject.IsNull()) return aShape;
|
||||||
|
|
||||||
if (!anObject->IsMainShape()) {
|
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 {
|
try {
|
||||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
@ -181,6 +209,7 @@ TopoDS_Shape GEOM_Function::GetValue()
|
|||||||
return aShape;
|
return aShape;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
|
TDF_Label aResultLabel = _label.FindChild(RESULT_LABEL);
|
||||||
Handle(TNaming_NamedShape) aNS;
|
Handle(TNaming_NamedShape) aNS;
|
||||||
@ -194,7 +223,7 @@ TopoDS_Shape GEOM_Function::GetValue()
|
|||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* GetValue
|
* SetValue
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void GEOM_Function::SetValue(TopoDS_Shape& theShape)
|
void GEOM_Function::SetValue(TopoDS_Shape& theShape)
|
||||||
@ -205,6 +234,26 @@ void GEOM_Function::SetValue(TopoDS_Shape& theShape)
|
|||||||
|
|
||||||
aBuilder.Generated(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;
|
_isDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +38,10 @@
|
|||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
|
|
||||||
#define TYPE 2
|
|
||||||
#define FUNCTION_LABEL(theNb) (_label.FindChild(1).FindChild((theNb)))
|
#define FUNCTION_LABEL(theNb) (_label.FindChild(1).FindChild((theNb)))
|
||||||
|
#define TYPE_LABEL 2
|
||||||
#define FREE_LABEL 3
|
#define FREE_LABEL 3
|
||||||
|
#define TIC_LABEL 4
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetObjectID
|
//function : GetObjectID
|
||||||
@ -136,7 +137,7 @@ GEOM_Object::GEOM_Object(TDF_Label& theEntry, int theType)
|
|||||||
if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root))
|
if(!theEntry.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), _root))
|
||||||
_root = TDataStd_TreeNode::Set(theEntry);
|
_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());
|
TDataStd_UAttribute::Set(theEntry, GetObjectID());
|
||||||
}
|
}
|
||||||
@ -149,7 +150,7 @@ GEOM_Object::GEOM_Object(TDF_Label& theEntry, int theType)
|
|||||||
int GEOM_Object::GetType()
|
int GEOM_Object::GetType()
|
||||||
{
|
{
|
||||||
Handle(TDataStd_Integer) aType;
|
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();
|
return aType->Get();
|
||||||
}
|
}
|
||||||
@ -161,8 +162,57 @@ int GEOM_Object::GetType()
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
void GEOM_Object::SetType(int theType)
|
void GEOM_Object::SetType(int theType)
|
||||||
{
|
{
|
||||||
TDataStd_Integer::Set(_label.FindChild(TYPE), theType);
|
TDataStd_Integer::Set(_label.FindChild(TYPE_LABEL), theType);
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,13 +115,11 @@ class Handle(GEOM_Object) : public Handle(MMgt_TShared) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <Standard_GUID.hxx>
|
#include <Standard_GUID.hxx>
|
||||||
#include <TDataStd_TreeNode.hxx>
|
#include <TDataStd_TreeNode.hxx>
|
||||||
#include "GEOM_Function.hxx"
|
#include "GEOM_Function.hxx"
|
||||||
#include "GEOM_Engine.hxx"
|
#include "GEOM_Engine.hxx"
|
||||||
|
|
||||||
|
|
||||||
class GEOM_Object : public MMgt_TShared
|
class GEOM_Object : public MMgt_TShared
|
||||||
{
|
{
|
||||||
friend class GEOM_Engine;
|
friend class GEOM_Engine;
|
||||||
@ -144,7 +142,8 @@ class GEOM_Object : public MMgt_TShared
|
|||||||
//
|
//
|
||||||
Standard_EXPORT friend Handle_Standard_Type& GEOM_Object_Type_();
|
Standard_EXPORT friend Handle_Standard_Type& GEOM_Object_Type_();
|
||||||
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Object) ; }
|
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:
|
private:
|
||||||
GEOM_Object(TDF_Label& theLabel);
|
GEOM_Object(TDF_Label& theLabel);
|
||||||
@ -181,6 +180,11 @@ class GEOM_Object : public MMgt_TShared
|
|||||||
//Sets the type of this GEOM_Object
|
//Sets the type of this GEOM_Object
|
||||||
Standard_EXPORT void SetType(int theType);
|
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
|
//Returns an ID of the OCAF document where this GEOM_Object is stored
|
||||||
Standard_EXPORT int GetDocID();
|
Standard_EXPORT int GetDocID();
|
||||||
|
|
||||||
@ -220,7 +224,8 @@ class GEOM_Object : public MMgt_TShared
|
|||||||
//Functions methods
|
//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);
|
Standard_EXPORT Handle(GEOM_Function) AddFunction(const Standard_GUID& theGUID, int theFunctionType);
|
||||||
|
|
||||||
//Returns a number of functions of this GEOM_Object
|
//Returns a number of functions of this GEOM_Object
|
||||||
@ -245,9 +250,7 @@ class GEOM_Object : public MMgt_TShared
|
|||||||
//Returns a label which could be used to store some additional data
|
//Returns a label which could be used to store some additional data
|
||||||
Standard_EXPORT TDF_Label GetFreeLabel();
|
Standard_EXPORT TDF_Label GetFreeLabel();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Handle(TDataStd_TreeNode) _root;
|
Handle(TDataStd_TreeNode) _root;
|
||||||
TDF_Label _label;
|
TDF_Label _label;
|
||||||
TCollection_AsciiString _ior;
|
TCollection_AsciiString _ior;
|
||||||
|
@ -82,6 +82,8 @@
|
|||||||
#include <qvaluelist.h>
|
#include <qvaluelist.h>
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include "GEOMImpl_Types.hxx"
|
#include "GEOMImpl_Types.hxx"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -849,18 +851,30 @@ QString GEOMBase::GetDefaultName(const QString& theOperation)
|
|||||||
{
|
{
|
||||||
QString aName = "";
|
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;
|
if ( !appStudy ) return aName;
|
||||||
_PTR(Study) aStudy = appStudy->studyDS();
|
_PTR(Study) aStudy = appStudy->studyDS();
|
||||||
|
|
||||||
int aNumber = 0;
|
std::set<std::string> aSet;
|
||||||
|
_PTR(SComponent) aGeomCompo (aStudy->FindComponent("GEOM"));
|
||||||
|
if (aGeomCompo) {
|
||||||
|
_PTR(ChildIterator) it (aStudy->NewChildIterator(aGeomCompo));
|
||||||
_PTR(SObject) obj;
|
_PTR(SObject) obj;
|
||||||
do
|
for (it->InitEx(true); it->More(); it->Next()) {
|
||||||
{
|
obj = it->Value();
|
||||||
aName = theOperation+"_"+QString::number(++aNumber);
|
aSet.insert(obj->GetName());
|
||||||
obj = aStudy->FindObject(aName.latin1());
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// build a unique name
|
||||||
|
int aNumber = 0;
|
||||||
|
bool isUnique = false;
|
||||||
|
while (!isUnique) {
|
||||||
|
aName = theOperation + "_" + QString::number(++aNumber);
|
||||||
|
isUnique = (aSet.count(aName.latin1()) == 0);
|
||||||
}
|
}
|
||||||
while (obj);
|
|
||||||
|
|
||||||
return aName;
|
return aName;
|
||||||
}
|
}
|
||||||
|
@ -608,6 +608,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
|
|||||||
anArray = new TColStd_HArray1OfInteger(1,1);
|
anArray = new TColStd_HArray1OfInteger(1,1);
|
||||||
anArray->SetValue(1, anIndices.FindIndex(aValue));
|
anArray->SetValue(1, anIndices.FindIndex(aValue));
|
||||||
anObj = GetEngine()->AddSubShape(theShape, anArray);
|
anObj = GetEngine()->AddSubShape(theShape, anArray);
|
||||||
|
if (!anObj.IsNull()) {
|
||||||
aSeq->Append(anObj);
|
aSeq->Append(anObj);
|
||||||
|
|
||||||
// for python command
|
// for python command
|
||||||
@ -615,6 +616,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode
|
|||||||
anAsciiList += anEntry;
|
anAsciiList += anEntry;
|
||||||
anAsciiList += ",";
|
anAsciiList += ",";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Make a Python command
|
//Make a Python command
|
||||||
anAsciiList.Trunc(anAsciiList.Length() - 1);
|
anAsciiList.Trunc(anAsciiList.Length() - 1);
|
||||||
|
@ -209,6 +209,9 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
TopTools_IndexedMapOfShape aResIndices;
|
TopTools_IndexedMapOfShape aResIndices;
|
||||||
TopExp::MapShapes(aShape, 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
|
// history for all argument shapes
|
||||||
TDF_LabelSequence aLabelSeq;
|
TDF_LabelSequence aLabelSeq;
|
||||||
aFunction->GetDependency(aLabelSeq);
|
aFunction->GetDependency(aLabelSeq);
|
||||||
@ -231,7 +234,9 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
|
for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
|
||||||
TopoDS_Shape anEntity = anArgumentIndices.FindKey(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();
|
Standard_Integer nbModified = aModified.Extent();
|
||||||
|
|
||||||
if (nbModified > 0) {
|
if (nbModified > 0) {
|
||||||
@ -239,10 +244,11 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Handle(TDataStd_IntegerArray) anAttr =
|
Handle(TDataStd_IntegerArray) anAttr =
|
||||||
TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
|
TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
|
||||||
|
|
||||||
|
int ih = 1;
|
||||||
TopTools_ListIteratorOfListOfShape itM (aModified);
|
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());
|
int id = aResIndices.FindIndex(itM.Value());
|
||||||
anAttr->SetValue(im, id);
|
anAttr->SetValue(ih, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user