mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-29 10:50:35 +05:00
22869: Groups store to/Retrieve from OCAF
This commit is contained in:
parent
7598e448c9
commit
97a79670fa
@ -61,6 +61,7 @@
|
||||
#include <GEOMImpl_IDisk.hxx>
|
||||
#include <GEOMImpl_ICylinder.hxx>
|
||||
#include <GEOMImpl_ICone.hxx>
|
||||
#include <GEOMImpl_IGroupOperations.hxx>
|
||||
#include <GEOMImpl_ISphere.hxx>
|
||||
#include <GEOMImpl_ITorus.hxx>
|
||||
#include <GEOMImpl_IPrism.hxx>
|
||||
@ -75,6 +76,8 @@
|
||||
#include <GEOMImpl_IPipePath.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
||||
@ -88,6 +91,7 @@ GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations (GEOM_Engine* theEngine,
|
||||
: GEOM_IOperations(theEngine, theDocID)
|
||||
{
|
||||
MESSAGE("GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations");
|
||||
myGroupOperations = new GEOMImpl_IGroupOperations(GetEngine(), GetDocID());
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -98,6 +102,7 @@ GEOMImpl_I3DPrimOperations::GEOMImpl_I3DPrimOperations (GEOM_Engine* theEngine,
|
||||
GEOMImpl_I3DPrimOperations::~GEOMImpl_I3DPrimOperations()
|
||||
{
|
||||
MESSAGE("GEOMImpl_I3DPrimOperations::~GEOMImpl_I3DPrimOperations");
|
||||
delete myGroupOperations;
|
||||
}
|
||||
|
||||
|
||||
@ -1475,6 +1480,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_I3DPrimOperations::MakePipe
|
||||
|
||||
aCI.SetBase(aRefBase);
|
||||
aCI.SetPath(aRefPath);
|
||||
aCI.SetGenerateGroups(IsGenerateGroups);
|
||||
|
||||
//Compute the Pipe value
|
||||
try {
|
||||
@ -1490,9 +1496,12 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_I3DPrimOperations::MakePipe
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create the sequence of objects.
|
||||
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
|
||||
|
||||
aSeq->Append(aPipe);
|
||||
createGroups(aPipe, &aCI, aSeq);
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump pyDump(aFunction);
|
||||
|
||||
@ -1885,6 +1894,7 @@ Handle(TColStd_HSequenceOfTransient)
|
||||
aCI.SetPath(aRefPath);
|
||||
aCI.SetWithContactMode(theWithContact);
|
||||
aCI.SetWithCorrectionMode(theWithCorrections);
|
||||
aCI.SetGenerateGroups(IsGenerateGroups);
|
||||
|
||||
//Compute the Pipe value
|
||||
try {
|
||||
@ -1900,9 +1910,12 @@ Handle(TColStd_HSequenceOfTransient)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create the sequence of objects.
|
||||
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
|
||||
|
||||
aSeq->Append(aPipeDS);
|
||||
createGroups(aPipeDS, &aCI, aSeq);
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump pyDump(aFunction);
|
||||
|
||||
@ -2059,6 +2072,7 @@ Handle(TColStd_HSequenceOfTransient)
|
||||
aCI.SetPath(aRefPath);
|
||||
aCI.SetWithContactMode(theWithContact);
|
||||
aCI.SetWithCorrectionMode(theWithCorrections);
|
||||
aCI.SetGenerateGroups(IsGenerateGroups);
|
||||
|
||||
//Compute the Pipe value
|
||||
try {
|
||||
@ -2074,9 +2088,12 @@ Handle(TColStd_HSequenceOfTransient)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create the sequence of objects.
|
||||
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
|
||||
|
||||
aSeq->Append(aPipeDS);
|
||||
createGroups(aPipeDS, &aCI, aSeq);
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump pyDump(aFunction);
|
||||
|
||||
@ -2221,6 +2238,7 @@ Handle(TColStd_HSequenceOfTransient)
|
||||
|
||||
aCI.SetBases(aSeqBases);
|
||||
aCI.SetLocations(aSeqLocs);
|
||||
aCI.SetGenerateGroups(IsGenerateGroups);
|
||||
|
||||
//Compute the Pipe value
|
||||
try {
|
||||
@ -2236,9 +2254,12 @@ Handle(TColStd_HSequenceOfTransient)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create the sequence of objects.
|
||||
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
|
||||
|
||||
aSeq->Append(aPipeDS);
|
||||
createGroups(aPipeDS, &aCI, aSeq);
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump pyDump(aFunction);
|
||||
|
||||
@ -2331,6 +2352,7 @@ Handle(TColStd_HSequenceOfTransient)
|
||||
aCI.SetBase(aRefBase);
|
||||
aCI.SetPath(aRefPath);
|
||||
aCI.SetVector(aRefVec);
|
||||
aCI.SetGenerateGroups(IsGenerateGroups);
|
||||
|
||||
//Compute the Pipe value
|
||||
try {
|
||||
@ -2346,9 +2368,11 @@ Handle(TColStd_HSequenceOfTransient)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create the sequence of objects.
|
||||
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
|
||||
|
||||
aSeq->Append(aPipe);
|
||||
createGroups(aPipe, &aCI, aSeq);
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump pyDump(aFunction);
|
||||
@ -2627,3 +2651,122 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::RestorePath
|
||||
SetErrorCode(OK);
|
||||
return aPath;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* createGroup
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::createGroup
|
||||
(const Handle(GEOM_Object) &theBaseObject,
|
||||
const Handle(TColStd_HArray1OfInteger) &theGroupIDs,
|
||||
const TCollection_AsciiString &theName,
|
||||
const TopTools_IndexedMapOfShape &theIndices)
|
||||
{
|
||||
if (theBaseObject.IsNull() || theGroupIDs.IsNull()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get the Shape type.
|
||||
const Standard_Integer anID = theGroupIDs->Value(theGroupIDs->Lower());
|
||||
const Standard_Integer aNbShapes = theIndices.Extent();
|
||||
|
||||
if (anID < 1 || anID > aNbShapes) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const TopoDS_Shape aSubShape = theIndices.FindKey(anID);
|
||||
|
||||
if (aSubShape.IsNull()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create a group.
|
||||
const TopAbs_ShapeEnum aGroupType = aSubShape.ShapeType();
|
||||
Handle(GEOM_Object) aGroup =
|
||||
myGroupOperations->CreateGroup(theBaseObject, aGroupType);
|
||||
|
||||
if (aGroup.IsNull() == Standard_False) {
|
||||
aGroup->GetLastFunction()->SetDescription("");
|
||||
aGroup->SetName(theName.ToCString());
|
||||
|
||||
Handle(TColStd_HSequenceOfInteger) aSeqIDs = new TColStd_HSequenceOfInteger;
|
||||
Standard_Integer i;
|
||||
|
||||
for (i = theGroupIDs->Lower(); i <= theGroupIDs->Upper(); ++i) {
|
||||
// Get and check the index.
|
||||
const Standard_Integer anIndex = theGroupIDs->Value(i);
|
||||
|
||||
if (anIndex < 1 || anIndex > aNbShapes) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get and check the sub-shape.
|
||||
const TopoDS_Shape aSubShape = theIndices.FindKey(anIndex);
|
||||
|
||||
if (aSubShape.IsNull()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Check the shape type.
|
||||
if (aSubShape.ShapeType() != aGroupType) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
aSeqIDs->Append(anIndex);
|
||||
}
|
||||
|
||||
myGroupOperations->UnionIDs(aGroup, aSeqIDs);
|
||||
aGroup->GetLastFunction()->SetDescription("");
|
||||
}
|
||||
|
||||
return aGroup;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* createGroups
|
||||
*/
|
||||
//=============================================================================
|
||||
void GEOMImpl_I3DPrimOperations::createGroups
|
||||
(const Handle(GEOM_Object) &theBaseObject,
|
||||
GEOMImpl_IPipe *thePipe,
|
||||
Handle(TColStd_HSequenceOfTransient) &theSequence)
|
||||
{
|
||||
if (theBaseObject.IsNull() || thePipe == NULL || theSequence.IsNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TopoDS_Shape aShape = theBaseObject->GetValue();
|
||||
|
||||
if (aShape.IsNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TopTools_IndexedMapOfShape anIndices;
|
||||
Handle(TColStd_HArray1OfInteger) aGroupIDs;
|
||||
TopoDS_Shape aShapeType;
|
||||
const Standard_Integer aNbGroups = 5;
|
||||
Handle(GEOM_Object) aGrps[aNbGroups];
|
||||
Standard_Integer i;
|
||||
|
||||
TopExp::MapShapes(aShape, anIndices);
|
||||
|
||||
// Create groups.
|
||||
aGroupIDs = thePipe->GetGroupDown();
|
||||
aGrps[0] = createGroup(theBaseObject, aGroupIDs, "GROUP_DOWN", anIndices);
|
||||
aGroupIDs = thePipe->GetGroupUp();
|
||||
aGrps[1] = createGroup(theBaseObject, aGroupIDs, "GROUP_UP", anIndices);
|
||||
aGroupIDs = thePipe->GetGroupSide1();
|
||||
aGrps[2] = createGroup(theBaseObject, aGroupIDs, "GROUP_SIDE1", anIndices);
|
||||
aGroupIDs = thePipe->GetGroupSide2();
|
||||
aGrps[3] = createGroup(theBaseObject, aGroupIDs, "GROUP_SIDE2", anIndices);
|
||||
aGroupIDs = thePipe->GetGroupOther();
|
||||
aGrps[4] = createGroup(theBaseObject, aGroupIDs, "GROUP_OTHER", anIndices);
|
||||
|
||||
for (i = 0; i < aNbGroups; ++i) {
|
||||
if (aGrps[i].IsNull() == Standard_False) {
|
||||
theSequence->Append(aGrps[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,11 @@
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
|
||||
class GEOMImpl_IGroupOperations;
|
||||
class GEOMImpl_IPipe;
|
||||
class TopTools_IndexedMapOfShape;
|
||||
|
||||
|
||||
class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
||||
public:
|
||||
Standard_EXPORT GEOMImpl_I3DPrimOperations(GEOM_Engine* theEngine, int theDocID);
|
||||
@ -165,6 +170,23 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
||||
Standard_EXPORT Handle(GEOM_Object) RestorePath (Handle(GEOM_Object) theShape,
|
||||
const Handle(TColStd_HSequenceOfTransient)& theBase1,
|
||||
const Handle(TColStd_HSequenceOfTransient)& theBase2);
|
||||
|
||||
private:
|
||||
|
||||
Handle(GEOM_Object) createGroup
|
||||
(const Handle(GEOM_Object) &theBaseObject,
|
||||
const Handle(TColStd_HArray1OfInteger) &theGroupIDs,
|
||||
const TCollection_AsciiString &theName,
|
||||
const TopTools_IndexedMapOfShape &theIndices);
|
||||
|
||||
void createGroups(const Handle(GEOM_Object) &theBaseObject,
|
||||
GEOMImpl_IPipe *thePipe,
|
||||
Handle(TColStd_HSequenceOfTransient) &theSequence);
|
||||
|
||||
private:
|
||||
|
||||
GEOMImpl_IGroupOperations *myGroupOperations;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -27,20 +27,69 @@
|
||||
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
#define PIPE_ARG_BASE 1
|
||||
#define PIPE_ARG_PATH 2
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
|
||||
// ---- GEOMImpl_IPipe
|
||||
#define PIPE_ARG_BASE 1
|
||||
#define PIPE_ARG_PATH 2
|
||||
|
||||
// ---- GEOMImpl_IPipeBiNormal
|
||||
#define PIPE_ARG_VEC 3
|
||||
|
||||
// ---- GEOMImpl_IPipeDiffSect
|
||||
#define PIPEDS_LIST_BASES 1
|
||||
//#define PIPEDS_ARG_PATH 2
|
||||
#define PIPEDS_LIST_LOCATIONS 3
|
||||
#define PIPEDS_ARG_WITHCONTACT 4
|
||||
#define PIPEDS_ARG_WITHCORRECT 5
|
||||
|
||||
// ---- GEOMImpl_IPipeShellSect
|
||||
#define PIPEDS_LIST_SUBBASES 6
|
||||
|
||||
// ---- Generate groups block (common)
|
||||
#define PIPE_GENERATE_GROUPS 7
|
||||
#define PIPE_GROUP_DOWN 8
|
||||
#define PIPE_GROUP_UP 9
|
||||
#define PIPE_GROUP_SIDE1 10
|
||||
#define PIPE_GROUP_SIDE2 11
|
||||
#define PIPE_GROUP_OTHER 12
|
||||
|
||||
|
||||
class GEOMImpl_IPipe
|
||||
{
|
||||
public:
|
||||
|
||||
GEOMImpl_IPipe(Handle(GEOM_Function) theFunction): _func(theFunction) {}
|
||||
virtual ~GEOMImpl_IPipe() {}
|
||||
|
||||
void SetBase (Handle(GEOM_Function) theBase) { _func->SetReference(PIPE_ARG_BASE, theBase); }
|
||||
void SetPath (Handle(GEOM_Function) thePath) { _func->SetReference(PIPE_ARG_PATH, thePath); }
|
||||
void SetGenerateGroups (int theGenerateGroups)
|
||||
{ _func->SetInteger(PIPE_GENERATE_GROUPS, theGenerateGroups); }
|
||||
void SetGroupDown (const Handle(TColStd_HArray1OfInteger) &theGroup)
|
||||
{ _func->SetIntegerArray(PIPE_GROUP_DOWN, theGroup); }
|
||||
void SetGroupUp (const Handle(TColStd_HArray1OfInteger) &theGroup)
|
||||
{ _func->SetIntegerArray(PIPE_GROUP_UP, theGroup); }
|
||||
void SetGroupSide1 (const Handle(TColStd_HArray1OfInteger) &theGroup)
|
||||
{ _func->SetIntegerArray(PIPE_GROUP_SIDE1, theGroup); }
|
||||
void SetGroupSide2 (const Handle(TColStd_HArray1OfInteger) &theGroup)
|
||||
{ _func->SetIntegerArray(PIPE_GROUP_SIDE2, theGroup); }
|
||||
void SetGroupOther (const Handle(TColStd_HArray1OfInteger) &theGroup)
|
||||
{ _func->SetIntegerArray(PIPE_GROUP_OTHER, theGroup); }
|
||||
|
||||
Handle(GEOM_Function) GetBase() { return _func->GetReference(PIPE_ARG_BASE); }
|
||||
Handle(GEOM_Function) GetPath() { return _func->GetReference(PIPE_ARG_PATH); }
|
||||
int GetGenerateGroups () { return _func->GetInteger(PIPE_GENERATE_GROUPS); }
|
||||
Handle(TColStd_HArray1OfInteger) GetGroupDown ()
|
||||
{ return _func->GetIntegerArray(PIPE_GROUP_DOWN); }
|
||||
Handle(TColStd_HArray1OfInteger) GetGroupUp ()
|
||||
{ return _func->GetIntegerArray(PIPE_GROUP_UP); }
|
||||
Handle(TColStd_HArray1OfInteger) GetGroupSide1 ()
|
||||
{ return _func->GetIntegerArray(PIPE_GROUP_SIDE1); }
|
||||
Handle(TColStd_HArray1OfInteger) GetGroupSide2 ()
|
||||
{ return _func->GetIntegerArray(PIPE_GROUP_SIDE2); }
|
||||
Handle(TColStd_HArray1OfInteger) GetGroupOther ()
|
||||
{ return _func->GetIntegerArray(PIPE_GROUP_OTHER); }
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -22,15 +22,10 @@
|
||||
#ifndef _GEOMImpl_IPIPEBINORMAL_HXX_
|
||||
#define _GEOMImpl_IPIPEBINORMAL_HXX_
|
||||
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
#ifndef _GEOMImpl_IPIPE_HXX_
|
||||
#include "GEOMImpl_IPipe.hxx"
|
||||
#endif
|
||||
|
||||
#define PIPE_ARG_BASE 1
|
||||
#define PIPE_ARG_PATH 2
|
||||
#define PIPE_ARG_VEC 3
|
||||
// Position definitions are declared in the base class.
|
||||
|
||||
class GEOMImpl_IPipeBiNormal : public GEOMImpl_IPipe
|
||||
{
|
||||
|
@ -25,20 +25,11 @@
|
||||
#ifndef _GEOMImpl_IPIPEDIFFSECT_HXX_
|
||||
#define _GEOMImpl_IPIPEDIFFSECT_HXX_
|
||||
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
#include "GEOMImpl_IPipe.hxx"
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
|
||||
#ifndef _GEOMImpl_IPIPE_HXX_
|
||||
#include "GEOMImpl_IPipe.hxx"
|
||||
#endif
|
||||
|
||||
#define PIPEDS_LIST_BASES 1
|
||||
#define PIPEDS_LIST_LOCATIONS 3
|
||||
//#define PIPEDS_ARG_PATH 2
|
||||
#define PIPEDS_ARG_WITHCONTACT 4
|
||||
#define PIPEDS_ARG_WITHCORRECT 5
|
||||
|
||||
// Position definitions are declared in the base class.
|
||||
|
||||
class GEOMImpl_IPipeDiffSect : public GEOMImpl_IPipe
|
||||
{
|
||||
|
@ -22,16 +22,12 @@
|
||||
#ifndef _GEOMImpl_IPIPESHELLSECT_HXX_
|
||||
#define _GEOMImpl_IPIPESHELLSECT_HXX_
|
||||
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
#ifndef _GEOMImpl_IPIPEDIFFSECT_HXX_
|
||||
#include "GEOMImpl_IPipeDiffSect.hxx"
|
||||
#endif
|
||||
|
||||
#include "GEOM_Function.hxx"
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
|
||||
#define PIPEDS_LIST_SUBBASES 6
|
||||
|
||||
// Position definitions are declared in the base class GEOMImpl_IPipe.
|
||||
|
||||
class GEOMImpl_IPipeShellSect : public GEOMImpl_IPipeDiffSect
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user