mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
139
src/BooleanOperations/BooleanOperations.cdl
Executable file
139
src/BooleanOperations/BooleanOperations.cdl
Executable file
@@ -0,0 +1,139 @@
|
||||
-- File: BooleanOperations.cdl
|
||||
-- Created: Mon Jul 10 10:19:21 2000
|
||||
-- Author: Vincent DELOS
|
||||
-- <vds@bulox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
package BooleanOperations
|
||||
|
||||
---Purpose: package to perform Boolean Operations between two
|
||||
-- solids called Object and Tool.
|
||||
|
||||
uses
|
||||
gp,
|
||||
Bnd,
|
||||
math,
|
||||
BRep,
|
||||
Geom,
|
||||
TopAbs,
|
||||
TopExp,
|
||||
TopoDS,
|
||||
TColStd,
|
||||
TopTools,
|
||||
Standard,
|
||||
TCollection,
|
||||
BRepAdaptor,
|
||||
GeomAdaptor,
|
||||
IntTools,
|
||||
BOPTColStd
|
||||
is
|
||||
|
||||
class AncestorsAndSuccessors;
|
||||
---Purpose: to have a fast access in the class ShapesDataStructure
|
||||
-- to the upper and lower shapes of a given shape.
|
||||
-- e.g. : ancestors of an edge are the wires that contain
|
||||
-- it and its successors are the vertices that it holds.
|
||||
|
||||
|
||||
--modified by NIZNHY-PKV Wed Feb 2 14:47:51 2005f
|
||||
-- class InterferenceResult;
|
||||
--Purpose: to describe a single interference between two shapes
|
||||
-- in the class ShapesDataStructure.
|
||||
|
||||
-- pointer PInterferenceResult to InterferenceResult from BooleanOperations;
|
||||
|
||||
-- class InterferencesList;
|
||||
--Purpose: if the considered shape S belongs to the Object this
|
||||
-- class will list all the shapes of the Tool whose
|
||||
-- bounding boxes intersects with the bounding box of S;
|
||||
-- if S belongs to the Tool we store all the shapes of
|
||||
-- the Object whose intersection with S is not empty.
|
||||
--modified by NIZNHY-PKV Wed Feb 2 14:48:00 2005t
|
||||
|
||||
class ShapeAndInterferences;
|
||||
---Purpose: contains a shape S, its bounding box, its state
|
||||
-- according to the other solid, its ancestors and
|
||||
-- successors, all of its interferences with the other
|
||||
-- solid.
|
||||
|
||||
pointer PShapeAndInterferences to ShapeAndInterferences from BooleanOperations;
|
||||
|
||||
class ShapesDataStructure;
|
||||
---Purpose: contains all the shapes of the Object and Tool, all
|
||||
-- the shapes created by intersection, their bounding
|
||||
-- boxes, their states, their ancestors and successors,
|
||||
-- and all of their interferences.
|
||||
|
||||
pointer PShapesDataStructure to ShapesDataStructure from BooleanOperations;
|
||||
|
||||
class Explorer;
|
||||
---Purpose: to find subshapes of a given shape of the Data Structure.
|
||||
|
||||
class OnceExplorer;
|
||||
---Purpose: the derived class of Explorer to find subshapes only once.
|
||||
|
||||
--class BooleanOperations;
|
||||
---Purpose: is to be deferred with inherited classes Cut, Common,
|
||||
-- Fuse to perform boolean operations .
|
||||
|
||||
|
||||
enumeration StateOfShape is
|
||||
---Purpose: State of a Shape of the 1st solid according to the
|
||||
-- 2nd one. State INOROUT is used when we know that
|
||||
-- a shape is totally IN or totally OUT. State
|
||||
-- INTERSECTED refers to a shape of the 1st solid cut
|
||||
-- by the 2nd solid. When a shape has a state
|
||||
-- different of INTERSECTED or UNKNOWN all of its
|
||||
-- subshapes have the same state.
|
||||
IN,
|
||||
OUT,
|
||||
ON,
|
||||
UNKNOWN,
|
||||
INOROUT,
|
||||
INTERSECTED
|
||||
end StateOfShape;
|
||||
|
||||
enumeration KindOfInterference is
|
||||
---Purpose: Interferences describe an intersection between two
|
||||
-- shapes. They are classified following a hierarchy
|
||||
-- from the lower until the upper.
|
||||
SurfaceSurface,
|
||||
EdgeSurface,
|
||||
VertexSurface,
|
||||
EdgeEdge,
|
||||
VertexEdge,
|
||||
VertexVertex,
|
||||
UnknownInterference
|
||||
end StateOfShape;
|
||||
|
||||
enumeration KindOfIntersection is
|
||||
---Purpose: Describes the fact that we can have no
|
||||
-- intersection between two shapes, or a true or a
|
||||
-- tangent one.
|
||||
NoIntersection,
|
||||
TrueIntersection,
|
||||
SameDomain
|
||||
end KindOfIntersection;
|
||||
|
||||
|
||||
------------------------
|
||||
-- For internal needs --
|
||||
------------------------
|
||||
|
||||
class AncestorsSeqAndSuccessorsSeq;
|
||||
|
||||
class IndexedDataMapOfShapeAncestorsSuccessors instantiates IndexedDataMap from TCollection
|
||||
(Shape from TopoDS,AncestorsSeqAndSuccessorsSeq from BooleanOperations,ShapeMapHasher from TopTools);
|
||||
|
||||
|
||||
|
||||
class IndexedDataMapOfShapeInteger instantiates
|
||||
IndexedDataMap from TCollection(Shape from TopoDS,
|
||||
Integer from Standard,
|
||||
ShapeMapHasher from TopTools);
|
||||
|
||||
end BooleanOperations;
|
||||
|
||||
|
||||
|
83
src/BooleanOperations/BooleanOperations_AncestorsAndSuccessors.cdl
Executable file
83
src/BooleanOperations/BooleanOperations_AncestorsAndSuccessors.cdl
Executable file
@@ -0,0 +1,83 @@
|
||||
-- File: BooleanOperations_AncestorsAndSuccessors.cdl
|
||||
-- Created: Mon Jul 10 15:32:53 2000
|
||||
-- Author: Vincent DELOS
|
||||
-- <vds@bulox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class AncestorsAndSuccessors from BooleanOperations
|
||||
|
||||
---Purpose: provides all the ancestors and successors of a
|
||||
-- given shape. Exemple : for an edge the ancestors
|
||||
-- are the wires that hold it and the successors are
|
||||
-- its vertices.
|
||||
|
||||
uses
|
||||
Orientation from TopAbs,
|
||||
SequenceOfInteger from TColStd,
|
||||
AncestorsSeqAndSuccessorsSeq from BooleanOperations
|
||||
|
||||
is
|
||||
|
||||
Create returns AncestorsAndSuccessors from BooleanOperations;
|
||||
|
||||
Create (AncSuccessors: AncestorsSeqAndSuccessorsSeq; shift: Integer) returns AncestorsAndSuccessors from BooleanOperations;
|
||||
---Purpose: allocates space and fills it with the data of AncSuccessors.
|
||||
|
||||
Destroy(me:in out);
|
||||
---C++: alias ~
|
||||
|
||||
|
||||
Dump (me);
|
||||
---Purpose: to display the fields.
|
||||
|
||||
|
||||
--------------------
|
||||
-- INLINE METHODS --
|
||||
--------------------
|
||||
|
||||
GetAncestor (me; AncestorIndex: Integer) returns Integer;
|
||||
---C++: inline
|
||||
SetAncestor (me:in out; AncestorIndex,AncestorNumber: Integer);
|
||||
---C++: inline
|
||||
GetAncestors(me; theArrayOfAncestors:out Address;AncestorsNumber:out Integer);
|
||||
---C++: inline
|
||||
|
||||
GetSuccessor (me; SuccessorIndex: Integer) returns Integer;
|
||||
---C++: inline
|
||||
SetSuccessor (me:in out; SuccessorIndex,SuccessorNumber: Integer);
|
||||
---C++: inline
|
||||
GetSuccessors(me; theArrayOfSuccessors:out Address; SuccessorsNumber:out Integer);
|
||||
---C++: inline
|
||||
|
||||
GetOrientation (me; OrientationIndex: Integer) returns Orientation;
|
||||
---C++: inline
|
||||
SetOrientation (me:in out; OrientationIndex: Integer; anOrientation: Orientation from TopAbs);
|
||||
---C++: inline
|
||||
GetOrientations(me; theArrayOfOrientations:out Address;OrientationsNumber:out Integer);
|
||||
---C++: inline
|
||||
|
||||
NumberOfAncestors (me) returns Integer;
|
||||
---C++: inline
|
||||
NumberOfSuccessors (me) returns Integer;
|
||||
---C++: inline
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myAncestors: Address;
|
||||
---Purpose: the array containing all the ancestors of our given shape.
|
||||
|
||||
mySuccessors: Address;
|
||||
---Purpose: the array containing all the successors.
|
||||
|
||||
myOrientations: Address;
|
||||
---Purpose: the array containing all the orientation of the successors.
|
||||
|
||||
myAncestorsSize : Integer;
|
||||
---Purpose: the number of ancestors.
|
||||
|
||||
mySuccessorsSize: Integer;
|
||||
---Purpose: the number of successors.
|
||||
|
||||
end AncestorsAndSuccessors;
|
104
src/BooleanOperations/BooleanOperations_AncestorsAndSuccessors.cxx
Executable file
104
src/BooleanOperations/BooleanOperations_AncestorsAndSuccessors.cxx
Executable file
@@ -0,0 +1,104 @@
|
||||
// File: BooleanOperations_AncestorsAndSuccessors.cxx
|
||||
// Created: Mon Jul 10 15:52:52 2000
|
||||
// Author: Vincent DELOS
|
||||
// <vds@bulox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <BooleanOperations_AncestorsAndSuccessors.ixx>
|
||||
#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
|
||||
|
||||
//===========================================================================
|
||||
//function : BooleanOperations_AncestorsAndSuccessors
|
||||
//purpose : default creator
|
||||
//===========================================================================
|
||||
BooleanOperations_AncestorsAndSuccessors::BooleanOperations_AncestorsAndSuccessors():
|
||||
myAncestors(0L),
|
||||
mySuccessors(0L),
|
||||
myOrientations(0L),
|
||||
myAncestorsSize(0),
|
||||
mySuccessorsSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : BooleanOperations_AncestorsAndSuccessors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
BooleanOperations_AncestorsAndSuccessors::BooleanOperations_AncestorsAndSuccessors
|
||||
(const BooleanOperations_AncestorsSeqAndSuccessorsSeq& AncSuc,
|
||||
const Standard_Integer shift) :
|
||||
|
||||
myAncestors(0L),
|
||||
mySuccessors(0L),
|
||||
myOrientations(0L),
|
||||
myAncestorsSize(0),
|
||||
mySuccessorsSize(0)
|
||||
{
|
||||
Standard_Integer i, j;
|
||||
//
|
||||
// Ancestors
|
||||
//
|
||||
myAncestorsSize = AncSuc.NumberOfAncestors();
|
||||
if (myAncestorsSize) {
|
||||
myAncestors = (Standard_Integer*)Standard::Allocate(myAncestorsSize*sizeof(Standard_Integer));
|
||||
|
||||
for (i=1; i<=myAncestorsSize; i++) {
|
||||
((Standard_Integer*)myAncestors)[i-1] = AncSuc.GetAncestor(i) + shift;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Successors
|
||||
//
|
||||
mySuccessorsSize = AncSuc.NumberOfSuccessors();
|
||||
if (mySuccessorsSize) {
|
||||
mySuccessors = (Standard_Integer*) Standard::Allocate(mySuccessorsSize*sizeof(Standard_Integer));
|
||||
myOrientations = (TopAbs_Orientation*)Standard::Allocate(mySuccessorsSize*sizeof(TopAbs_Orientation));
|
||||
|
||||
for (i=1; i<=mySuccessorsSize; i++) {
|
||||
j=i-1;
|
||||
((Standard_Integer*)mySuccessors )[j] = AncSuc.GetSuccessor(i) + shift;
|
||||
((TopAbs_Orientation*)myOrientations)[j] = AncSuc.GetOrientation(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : Destroy
|
||||
//purpose : destructor
|
||||
//===========================================================================
|
||||
void BooleanOperations_AncestorsAndSuccessors::Destroy()
|
||||
{
|
||||
if (myAncestors) {
|
||||
Standard::Free((Standard_Address&)myAncestors);
|
||||
}
|
||||
if (mySuccessors) {
|
||||
Standard::Free((Standard_Address&)mySuccessors);
|
||||
}
|
||||
if (myOrientations) {
|
||||
Standard::Free((Standard_Address&)myOrientations);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_AncestorsAndSuccessors::Dump() const
|
||||
{
|
||||
Standard_Integer i;
|
||||
|
||||
cout<<endl<<"AncestorsAndSuccessors :";
|
||||
cout<<endl<<"myAncestorsSize = "<<myAncestorsSize<<endl;
|
||||
for (i=1;i<=NumberOfAncestors();i++)
|
||||
cout<<GetAncestor(i)<<" ";
|
||||
cout<<endl<<"mySuccessorsSize = "<<mySuccessorsSize<<endl;
|
||||
for (i=1;i<=NumberOfSuccessors();i++)
|
||||
cout<<GetSuccessor(i)<<" ";
|
||||
cout<<endl;
|
||||
for (i=1;i<=NumberOfSuccessors();i++)
|
||||
cout<<GetOrientation(i)<<" ";
|
||||
cout<<endl;
|
||||
}
|
123
src/BooleanOperations/BooleanOperations_AncestorsAndSuccessors.lxx
Executable file
123
src/BooleanOperations/BooleanOperations_AncestorsAndSuccessors.lxx
Executable file
@@ -0,0 +1,123 @@
|
||||
// File: BooleanOperations_AncestorsAndSuccessors.lxx
|
||||
// Created: Tue Jul 25 11:46:44 2000
|
||||
// Author: Vincent DELOS
|
||||
// <vds@bulox.paris1.matra-dtv.fr>
|
||||
|
||||
//===========================================================================
|
||||
//function : GetAncestor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_AncestorsAndSuccessors::GetAncestor
|
||||
(const Standard_Integer AncestorIndex) const
|
||||
{
|
||||
Standard_Integer nIndex=((Standard_Integer*)myAncestors)[AncestorIndex-1];
|
||||
return nIndex;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : GetAncestors
|
||||
//purpose : returns the array of ancestors.
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_AncestorsAndSuccessors::GetAncestors
|
||||
(Standard_Address& theArrayOfAncestors,
|
||||
Standard_Integer& AncestorsNumber) const
|
||||
{
|
||||
theArrayOfAncestors = (Standard_Integer*)myAncestors;
|
||||
AncestorsNumber = myAncestorsSize;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : SetAncestor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_AncestorsAndSuccessors::SetAncestor
|
||||
(const Standard_Integer AncestorIndex,
|
||||
const Standard_Integer AncestorNumber)
|
||||
{
|
||||
((Standard_Integer*)myAncestors)[AncestorIndex-1] = AncestorNumber;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : GetSuccessor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_AncestorsAndSuccessors::GetSuccessor
|
||||
(const Standard_Integer SuccessorIndex) const
|
||||
{
|
||||
Standard_Integer nIndex=((Standard_Integer*)mySuccessors)[SuccessorIndex-1];
|
||||
return nIndex;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : GetSuccessors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_AncestorsAndSuccessors::GetSuccessors
|
||||
(Standard_Address& theArrayOfSuccessors,
|
||||
Standard_Integer& SuccessorsNumber) const
|
||||
{
|
||||
SuccessorsNumber = mySuccessorsSize;
|
||||
theArrayOfSuccessors = (Standard_Integer*)mySuccessors;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : SetSuccessor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_AncestorsAndSuccessors::SetSuccessor
|
||||
(const Standard_Integer SuccessorIndex,
|
||||
const Standard_Integer SuccessorNumber)
|
||||
{
|
||||
((Standard_Integer*)mySuccessors)[SuccessorIndex-1] = SuccessorNumber;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : NumberOfAncestors
|
||||
//purpose : returns the number of ancestors
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_AncestorsAndSuccessors::NumberOfAncestors() const
|
||||
{
|
||||
return myAncestorsSize;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : NumberOfSuccessors
|
||||
//purpose : returns the number of successors
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_AncestorsAndSuccessors::NumberOfSuccessors() const
|
||||
{
|
||||
return mySuccessorsSize;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : GetOrientation
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline TopAbs_Orientation BooleanOperations_AncestorsAndSuccessors::GetOrientation(const Standard_Integer OrientationIndex) const
|
||||
{
|
||||
return ((TopAbs_Orientation*)myOrientations)[OrientationIndex-1];
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : GetOrientations
|
||||
//purpose : returns the array of orientations.
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_AncestorsAndSuccessors::GetOrientations
|
||||
(Standard_Address& theArrayOfOrientations,
|
||||
Standard_Integer& OrientationsNumber) const
|
||||
{
|
||||
OrientationsNumber = mySuccessorsSize;
|
||||
theArrayOfOrientations = (TopAbs_Orientation*)myOrientations;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : SetOrientation
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_AncestorsAndSuccessors::SetOrientation
|
||||
(const Standard_Integer OrientationIndex,
|
||||
const TopAbs_Orientation OrientationNumber)
|
||||
{
|
||||
((TopAbs_Orientation*)myOrientations)[OrientationIndex-1] = OrientationNumber;
|
||||
}
|
72
src/BooleanOperations/BooleanOperations_AncestorsSeqAndSuccessorsSeq.cdl
Executable file
72
src/BooleanOperations/BooleanOperations_AncestorsSeqAndSuccessorsSeq.cdl
Executable file
@@ -0,0 +1,72 @@
|
||||
-- File: BooleanOperations_AncestorsSeqAndSuccessorsSeq.cdl
|
||||
-- Created: Thu Aug 17 09:52:15 2000
|
||||
-- Author: Vincent DELOS
|
||||
-- <vds@bulox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class AncestorsSeqAndSuccessorsSeq from BooleanOperations
|
||||
|
||||
---Purpose: provide all the ancestors and successors of a --
|
||||
-- given shape. Exemple : for an edge the ancestors
|
||||
-- -- are the wires that hold it and the successors
|
||||
-- are -- its vertices. As we don't know the number
|
||||
-- of -- ancestors of a given shape we first put them
|
||||
-- in a -- sequence of integers (our data structure
|
||||
-- -- defining the shapes does not have back
|
||||
-- pointers). Then we transfer these data in the
|
||||
-- class AncestorsAndSuccessors.
|
||||
|
||||
uses
|
||||
Orientation from TopAbs,
|
||||
SequenceOfInteger from TColStd,
|
||||
AncestorsAndSuccessors from BooleanOperations
|
||||
|
||||
is
|
||||
|
||||
Create returns AncestorsSeqAndSuccessorsSeq from BooleanOperations;
|
||||
|
||||
|
||||
Dump (me);
|
||||
---Purpose: to display the fields.
|
||||
|
||||
|
||||
--------------------
|
||||
-- INLINE METHODS --
|
||||
--------------------
|
||||
|
||||
GetAncestor (me; AncestorIndex: Integer) returns Integer;
|
||||
---C++: inline
|
||||
GetSuccessor (me; SuccessorIndex: Integer) returns Integer;
|
||||
---C++: inline
|
||||
GetOrientation(me; OrientationIndex: Integer) returns Orientation;
|
||||
---C++: inline
|
||||
|
||||
NumberOfAncestors (me) returns Integer;
|
||||
---C++: inline
|
||||
NumberOfSuccessors (me) returns Integer;
|
||||
---C++: inline
|
||||
|
||||
SetNewAncestor (me:in out; AncestorNumber: Integer);
|
||||
---C++: inline
|
||||
---Purpose: appends AncestorNumber in the sequence.
|
||||
SetNewSuccessor (me:in out; SuccessorNumber: Integer);
|
||||
---C++: inline
|
||||
---Purpose: appends SuccessorNumber in the array refering to <mySuccessorsInserted>.
|
||||
SetNewOrientation(me:in out; theOrientation: Orientation);
|
||||
---C++: inline
|
||||
---Purpose: appends SuccessorNumber in the array refering to <mySuccessorsInserted>.
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myAncestors: SequenceOfInteger;
|
||||
---Purpose: the sequence containing all the ancestors of our given shape.
|
||||
|
||||
mySuccessors: SequenceOfInteger;
|
||||
---Purpose: the array containing all the successors.
|
||||
|
||||
myOrientations:SequenceOfInteger;
|
||||
---Purpose: the array containing all orientations corresponding to the successors.
|
||||
|
||||
end AncestorsSeqAndSuccessorsSeq;
|
36
src/BooleanOperations/BooleanOperations_AncestorsSeqAndSuccessorsSeq.cxx
Executable file
36
src/BooleanOperations/BooleanOperations_AncestorsSeqAndSuccessorsSeq.cxx
Executable file
@@ -0,0 +1,36 @@
|
||||
// File: BooleanOperations_AncestorsSeqAndSuccessorsSeq.cxx
|
||||
// Created: Thu Aug 17 10:04:35 2000
|
||||
// Author: Vincent DELOS
|
||||
// <vds@bulox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.ixx>
|
||||
|
||||
//===========================================================================
|
||||
//function : BooleanOperations_AncestorsSeqAndSuccessorsSeq
|
||||
//purpose : creator
|
||||
//===========================================================================
|
||||
BooleanOperations_AncestorsSeqAndSuccessorsSeq::BooleanOperations_AncestorsSeqAndSuccessorsSeq() :
|
||||
myAncestors(),
|
||||
mySuccessors()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_AncestorsSeqAndSuccessorsSeq::Dump() const
|
||||
{
|
||||
Standard_Integer i;
|
||||
|
||||
cout<<endl<<"AncestorsSeqAndSuccessorsSeq :";
|
||||
cout<<endl<<"myAncestorsSize = "<<myAncestors.Length()<<endl;
|
||||
for (i=1;i<=NumberOfAncestors();i++)
|
||||
cout<<GetAncestor(i)<<" ";
|
||||
cout<<endl<<"mySuccessorsSize = "<<mySuccessors.Length()<<endl;
|
||||
for (i=1;i<=NumberOfSuccessors();i++)
|
||||
cout<<GetSuccessor(i)<<" ";
|
||||
cout<<endl;
|
||||
}
|
85
src/BooleanOperations/BooleanOperations_AncestorsSeqAndSuccessorsSeq.lxx
Executable file
85
src/BooleanOperations/BooleanOperations_AncestorsSeqAndSuccessorsSeq.lxx
Executable file
@@ -0,0 +1,85 @@
|
||||
// File: BooleanOperations_AncestorsSeqAndSuccessorsSeq.lxx
|
||||
// Created: Thu Aug 17 10:16:26 2000
|
||||
// Author: Vincent DELOS
|
||||
// <vds@bulox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : GetAncestor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_AncestorsSeqAndSuccessorsSeq::GetAncestor
|
||||
(const Standard_Integer AncestorIndex) const
|
||||
{
|
||||
return myAncestors.Value(AncestorIndex);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : GetSuccessor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_AncestorsSeqAndSuccessorsSeq::GetSuccessor
|
||||
(const Standard_Integer SuccessorIndex) const
|
||||
{
|
||||
return mySuccessors.Value(SuccessorIndex);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : GetOrientation
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline TopAbs_Orientation BooleanOperations_AncestorsSeqAndSuccessorsSeq::GetOrientation
|
||||
(const Standard_Integer OrientationIndex) const
|
||||
{
|
||||
return (TopAbs_Orientation)myOrientations.Value(OrientationIndex);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : NumberOfSuccessors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_AncestorsSeqAndSuccessorsSeq::NumberOfSuccessors() const
|
||||
{
|
||||
return mySuccessors.Length();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : NumberOfAncestors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_AncestorsSeqAndSuccessorsSeq::NumberOfAncestors() const
|
||||
{
|
||||
return myAncestors.Length();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : SetNewAncestor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_AncestorsSeqAndSuccessorsSeq::SetNewAncestor
|
||||
(const Standard_Integer AncestorNumber)
|
||||
{
|
||||
myAncestors.Append(AncestorNumber);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : SetNewSuccessor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_AncestorsSeqAndSuccessorsSeq::SetNewSuccessor
|
||||
(const Standard_Integer SuccessorNumber)
|
||||
{
|
||||
mySuccessors.Append(SuccessorNumber);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : SetNewOrientation
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_AncestorsSeqAndSuccessorsSeq::SetNewOrientation
|
||||
(const TopAbs_Orientation OrientationNumber)
|
||||
{
|
||||
myOrientations.Append((Standard_Integer)OrientationNumber);
|
||||
}
|
69
src/BooleanOperations/BooleanOperations_Explorer.cdl
Executable file
69
src/BooleanOperations/BooleanOperations_Explorer.cdl
Executable file
@@ -0,0 +1,69 @@
|
||||
-- File: BooleanOperations_Explorer.cdl
|
||||
-- Created: Mon Sep 4 11:04:51 2000
|
||||
-- Author: Vincent DELOS
|
||||
-- <vds@bulox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class Explorer from BooleanOperations
|
||||
|
||||
---Purpose: the explorer associated to the Data Structure to
|
||||
-- retrieve subshapes of a given shape stored in
|
||||
-- ShapesDataStructure.
|
||||
|
||||
uses
|
||||
Shape from TopoDS,
|
||||
ShapeEnum from TopAbs,
|
||||
ShapesDataStructure from BooleanOperations,
|
||||
PShapesDataStructure from BooleanOperations
|
||||
|
||||
is
|
||||
Create (SDS: ShapesDataStructure)
|
||||
returns Explorer from BooleanOperations;
|
||||
|
||||
--modified by NIZNHY-PKV Sun Dec 15 16:24:39 2002 f
|
||||
Delete(me: out)
|
||||
is virtual;
|
||||
---C++: alias "Standard_EXPORT virtual ~BooleanOperations_Explorer() {Delete();}"
|
||||
--modified by NIZNHY-PKV Sun Dec 15 16:27:53 2002 t
|
||||
|
||||
Init (me:in out;
|
||||
aShape: Integer;
|
||||
TargetToFind: ShapeEnum;
|
||||
TargetToAvoid: ShapeEnum = TopAbs_SHAPE) is virtual;
|
||||
|
||||
Next (me:in out)
|
||||
is virtual;
|
||||
|
||||
More (me)
|
||||
returns Boolean;
|
||||
|
||||
Current (me:in out)
|
||||
returns Integer is virtual;
|
||||
|
||||
Dump (me; S : in out OStream)
|
||||
is virtual;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myShapesDataStructure: PShapesDataStructure is protected;
|
||||
---Purpose: the data structure we're working on.
|
||||
|
||||
myStack : Address is protected;
|
||||
---Purpose: contains all the numbers associated to the shapes.
|
||||
myTopOfStack : Integer is protected;
|
||||
---Purpose: gives the position of the highest element in the stack,
|
||||
-- i.e. the index of the number of the current shape.
|
||||
mySizeOfStack : Integer is protected;
|
||||
---Purpose: gives the number of elements in the stack.
|
||||
|
||||
myTargetToFind : ShapeEnum is protected;
|
||||
---Purpose: the kind of shape we are looking for.
|
||||
myTargetToAvoid: ShapeEnum is protected;
|
||||
---Purpose: the kind of shape we want to avoid.
|
||||
|
||||
hasMore : Boolean is protected;
|
||||
---Purpose: if we still have a new shape to return.
|
||||
|
||||
end Explorer;
|
237
src/BooleanOperations/BooleanOperations_Explorer.cxx
Executable file
237
src/BooleanOperations/BooleanOperations_Explorer.cxx
Executable file
@@ -0,0 +1,237 @@
|
||||
// File: BooleanOperations_Explorer.cxx
|
||||
// Created: Mon Sep 4 11:58:18 2000
|
||||
// Author: Vincent DELOS
|
||||
// <vds@bulox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <BooleanOperations_Explorer.ixx>
|
||||
|
||||
const static Standard_Integer theStackSize=20;
|
||||
//
|
||||
//===========================================================================
|
||||
//function : BooleanOperations_Explorer
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
BooleanOperations_Explorer::BooleanOperations_Explorer
|
||||
(const BooleanOperations_ShapesDataStructure& SDS):
|
||||
myStack(0L),
|
||||
myTopOfStack(-1),
|
||||
mySizeOfStack(-1),
|
||||
myTargetToFind(TopAbs_SHAPE),
|
||||
myTargetToAvoid(TopAbs_SHAPE)
|
||||
{
|
||||
myShapesDataStructure = (BooleanOperations_PShapesDataStructure)&SDS;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : Delete
|
||||
//purpose : ~BooleanOperations_Explorer
|
||||
//===========================================================================
|
||||
void BooleanOperations_Explorer::Delete()
|
||||
{
|
||||
if(myStack != 0L) {
|
||||
|
||||
Standard::Free((Standard_Address&)myStack);
|
||||
}
|
||||
myStack = 0;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_Explorer::Init(const Standard_Integer aShapeNumber,
|
||||
const TopAbs_ShapeEnum TargetToFind,
|
||||
const TopAbs_ShapeEnum TargetToAvoid)
|
||||
{
|
||||
Standard_Integer i,j,k,theNumberOfTheShapeOnTop;
|
||||
TopAbs_ShapeEnum theTypeOfShapeOnTop,successorType;
|
||||
|
||||
myTargetToFind = TargetToFind;
|
||||
myTargetToAvoid = TargetToAvoid;
|
||||
|
||||
if (myStack != 0L) {
|
||||
Standard::Free((Standard_Address&)myStack);
|
||||
}
|
||||
|
||||
mySizeOfStack = theStackSize;
|
||||
myStack = (Standard_Integer*)Standard::Allocate(theStackSize*sizeof(Standard_Integer));
|
||||
|
||||
((Standard_Integer*)myStack)[0] = aShapeNumber;
|
||||
myTopOfStack = 0;
|
||||
|
||||
theNumberOfTheShapeOnTop = ((Standard_Integer*)myStack)[myTopOfStack];
|
||||
theTypeOfShapeOnTop = (*myShapesDataStructure).GetShapeType(theNumberOfTheShapeOnTop);
|
||||
if (theTypeOfShapeOnTop == myTargetToFind)
|
||||
{
|
||||
hasMore = Standard_True;
|
||||
return;
|
||||
}
|
||||
while (theTypeOfShapeOnTop != myTargetToFind)
|
||||
{
|
||||
Standard_Address theSuccessors;
|
||||
Standard_Integer theNumberOfSuccessors;
|
||||
// We get the successors of the shape on top of the stack.
|
||||
(*myShapesDataStructure).GetSuccessors(theNumberOfTheShapeOnTop,theSuccessors,theNumberOfSuccessors);
|
||||
// Do we have enough place to store our new successors ?
|
||||
if ((myTopOfStack+theNumberOfSuccessors > mySizeOfStack) && (theSuccessors != 0L))
|
||||
{
|
||||
// We don't have enough place so we reallocate.
|
||||
Standard_Address theNewStack = (Standard_Integer*)Standard::Allocate
|
||||
((mySizeOfStack+theStackSize+theNumberOfSuccessors)*sizeof(Standard_Integer));
|
||||
// We copy the old array in the one.
|
||||
for (j=0;j<myTopOfStack;j++)
|
||||
((Standard_Integer*)theNewStack)[j] = ((Standard_Integer*)myStack)[j];
|
||||
|
||||
Standard::Free((Standard_Address&)myStack);
|
||||
myStack = theNewStack;
|
||||
mySizeOfStack = mySizeOfStack+theStackSize+theNumberOfSuccessors;
|
||||
}
|
||||
// We remove the shape on top and replace it by its own successors.
|
||||
// We must skip the shape of type TargetToAvoid.
|
||||
k = 0;
|
||||
for (i=0;i<theNumberOfSuccessors;i++)
|
||||
{
|
||||
successorType = (*myShapesDataStructure).GetShapeType(((Standard_Integer*)theSuccessors)[i]);
|
||||
if (successorType == myTargetToAvoid)
|
||||
k++;
|
||||
else
|
||||
((Standard_Integer*)myStack)[i+myTopOfStack-k] = ((Standard_Integer*)theSuccessors)[i];
|
||||
}
|
||||
if (theNumberOfSuccessors-k == 0)
|
||||
{
|
||||
// No valid successor...
|
||||
myTopOfStack--;
|
||||
if (myTopOfStack < 0)
|
||||
{
|
||||
// Empty stack.
|
||||
hasMore = Standard_False;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
myTopOfStack = myTopOfStack+theNumberOfSuccessors-k-1;
|
||||
theNumberOfTheShapeOnTop = ((Standard_Integer*)myStack)[myTopOfStack];
|
||||
theTypeOfShapeOnTop = (*myShapesDataStructure).GetShapeType(theNumberOfTheShapeOnTop);
|
||||
if (theTypeOfShapeOnTop == myTargetToFind)
|
||||
{
|
||||
hasMore = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : Current
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer BooleanOperations_Explorer::Current()
|
||||
{
|
||||
myTopOfStack--;
|
||||
if (myTopOfStack < 0)
|
||||
hasMore = Standard_False;
|
||||
return ((Standard_Integer*)myStack)[myTopOfStack+1];
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : Next
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_Explorer::Next()
|
||||
{
|
||||
TopAbs_ShapeEnum theTypeOfShapeOnTop,successorType;
|
||||
Standard_Integer j,k,theNumberOfTheShapeOnTop,successorNumber;
|
||||
|
||||
if (myTopOfStack < 0)
|
||||
{
|
||||
hasMore = Standard_False;
|
||||
return;
|
||||
}
|
||||
theNumberOfTheShapeOnTop = ((Standard_Integer*)myStack)[myTopOfStack];
|
||||
theTypeOfShapeOnTop = (*myShapesDataStructure).GetShapeType(theNumberOfTheShapeOnTop);
|
||||
if (theTypeOfShapeOnTop == myTargetToFind)
|
||||
{
|
||||
hasMore = Standard_True;
|
||||
return;
|
||||
}
|
||||
while (theTypeOfShapeOnTop != myTargetToFind)
|
||||
{
|
||||
Standard_Address theSuccessors = 0L;
|
||||
Standard_Integer theNumberOfSuccessors;
|
||||
(*myShapesDataStructure).GetSuccessors(theNumberOfTheShapeOnTop,(Standard_Address&)theSuccessors,theNumberOfSuccessors);
|
||||
// Do we have enough place to store our new successors ?
|
||||
if ((myTopOfStack+theNumberOfSuccessors > mySizeOfStack) && (theSuccessors != 0L))
|
||||
{
|
||||
Standard_Address theNewStack;
|
||||
theNewStack = (Standard_Integer*)Standard::Allocate
|
||||
((mySizeOfStack+theNumberOfSuccessors+theStackSize)*sizeof(Standard_Integer));
|
||||
for (j=0;j<myTopOfStack;j++)
|
||||
((Standard_Integer*)theNewStack)[j] = ((Standard_Integer*)myStack)[j];
|
||||
|
||||
Standard::Free((Standard_Address&)myStack);
|
||||
myStack = theNewStack;
|
||||
mySizeOfStack = mySizeOfStack+theNumberOfSuccessors+theStackSize;
|
||||
}
|
||||
// We remove the shape on top and replace it by its own successors.
|
||||
// We must skip the shape of type TargetToAvoid.
|
||||
k = 0;
|
||||
for (j=0;j<theNumberOfSuccessors;j++)
|
||||
{
|
||||
successorNumber = ((Standard_Integer*)theSuccessors)[j];
|
||||
successorType = (*myShapesDataStructure).GetShapeType(successorNumber);
|
||||
if (successorType == myTargetToAvoid)
|
||||
k++;
|
||||
else
|
||||
((Standard_Integer*)myStack)[j+myTopOfStack-k] = ((Standard_Integer*)theSuccessors)[j];
|
||||
}
|
||||
if (theNumberOfSuccessors-k == 0)
|
||||
{
|
||||
myTopOfStack--;
|
||||
if (myTopOfStack < 0)
|
||||
{
|
||||
hasMore = Standard_False;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
myTopOfStack = myTopOfStack+theNumberOfSuccessors-k-1;
|
||||
theNumberOfTheShapeOnTop = ((Standard_Integer*)myStack)[myTopOfStack];
|
||||
theTypeOfShapeOnTop = (*myShapesDataStructure).GetShapeType(theNumberOfTheShapeOnTop);
|
||||
if (theTypeOfShapeOnTop == myTargetToFind)
|
||||
{
|
||||
hasMore = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : More
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Boolean BooleanOperations_Explorer::More() const
|
||||
{
|
||||
return hasMore;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_Explorer::Dump(Standard_OStream& S) const
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Integer* theSuccessors;
|
||||
|
||||
theSuccessors = ((Standard_Integer*)myStack);
|
||||
S << "\n" << "Dump of BooleanOperations_Explorer:" << "\n";
|
||||
S << "mySizeOfStack = " << mySizeOfStack << "\n";
|
||||
S << "myTopOfStack = " << myTopOfStack << "\n";
|
||||
S << "myTargetToFind = " << myTargetToFind << "\n";
|
||||
S << "myTargetToAvoid = " << myTargetToAvoid << "\n";
|
||||
S << "hasMore = " << hasMore << "\n";
|
||||
for (i=0;i<=myTopOfStack;i++)
|
||||
{
|
||||
S << " " << *theSuccessors;
|
||||
theSuccessors++;
|
||||
}
|
||||
S << "\n";
|
||||
}
|
52
src/BooleanOperations/BooleanOperations_OnceExplorer.cdl
Executable file
52
src/BooleanOperations/BooleanOperations_OnceExplorer.cdl
Executable file
@@ -0,0 +1,52 @@
|
||||
-- File: BooleanOperations_OnceExplorer.cdl
|
||||
-- Created: Thu Sep 7 14:37:43 2000
|
||||
-- Author: Vincent DELOS
|
||||
-- <vds@bulox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class OnceExplorer from BooleanOperations
|
||||
inherits Explorer from BooleanOperations
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
Shape from TopoDS,
|
||||
ShapeEnum from TopAbs,
|
||||
ShapesDataStructure from BooleanOperations,
|
||||
PShapesDataStructure from BooleanOperations
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
Create (SDS: ShapesDataStructure)
|
||||
returns OnceExplorer from BooleanOperations;
|
||||
--modified by NIZNHY-PKV Sun Dec 15 16:24:39 2002 f
|
||||
Delete(me: out)
|
||||
is redefined virtual;
|
||||
---C++: alias "Standard_EXPORT virtual ~BooleanOperations_OnceExplorer() {Delete();}"
|
||||
--modified by NIZNHY-PKV Sun Dec 15 16:24:42 2002 t
|
||||
|
||||
Init (me:in out;
|
||||
aShape: Integer;
|
||||
TargetToFind: ShapeEnum;
|
||||
TargetToAvoid: ShapeEnum = TopAbs_SHAPE) is redefined;
|
||||
|
||||
Next (me:in out)
|
||||
is redefined;
|
||||
|
||||
Current (me:in out)
|
||||
returns Integer is redefined;
|
||||
|
||||
Dump (me; S : in out OStream)
|
||||
is redefined;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myArrayOfBits : Address;
|
||||
---Purpose: to say if we already visited a shape.
|
||||
mySizeOfArrayOfBits : Integer;
|
||||
---Purpose: the size of <myArrayOfBits>.
|
||||
|
||||
end OnceExplorer;
|
295
src/BooleanOperations/BooleanOperations_OnceExplorer.cxx
Executable file
295
src/BooleanOperations/BooleanOperations_OnceExplorer.cxx
Executable file
@@ -0,0 +1,295 @@
|
||||
// File: BooleanOperations_OnceExplorer.cxx
|
||||
// Created: Thu Sep 7 17:13:36 2000
|
||||
// Author: Vincent DELOS
|
||||
// <vds@bulox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <BooleanOperations_OnceExplorer.ixx>
|
||||
|
||||
//#define theStackSize (20)
|
||||
const static Standard_Integer theStackSize=20;
|
||||
|
||||
#define BITFLAG(n) (1 << (n)) // creation of 2 power n.
|
||||
#define BITSET(word,mask) (word) |= (mask) // to set a bit to 1 in word using mask.
|
||||
#define BITCLEAR(word,mask) (word) &= ~(mask) // to set a bit to 0 in word using mask.
|
||||
#define BITISSET(word,mask) ((word) & (mask)) // returns the value of the bit corresponding to mask.
|
||||
#define LEMOT(id) ((id) >> 5) // the number of the integer we will work on.
|
||||
#define LEBIT(id) (BITFLAG((id) & 31)) // the number of the bit we will work on (2 power (id%32)).
|
||||
#define CC0BIT(id,anArray) BITCLEAR(anArray[LEMOT(id)],LEBIT(id)) // sets to 0 the bit number id in anArray.
|
||||
#define CC1BIT(id,anArray) BITSET(anArray[LEMOT(id)],LEBIT(id)) // sets to 1 the bit number id in anArray.
|
||||
#define NNNBIT(id,anArray) (BITISSET(anArray[LEMOT(id)],LEBIT(id)) ? 1 : 0) // returns the bit number id in anArray.
|
||||
|
||||
//===========================================================================
|
||||
//function : BooleanOperations_OnceExplorer
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
BooleanOperations_OnceExplorer::BooleanOperations_OnceExplorer
|
||||
(const BooleanOperations_ShapesDataStructure& SDS):
|
||||
BooleanOperations_Explorer(SDS)
|
||||
{
|
||||
hasMore = Standard_False;
|
||||
// The size of the array of bits is the lower multiple of
|
||||
//32 greater than the number of shapes in myShapesDataStructure.
|
||||
Standard_Integer MultipleOf32= (((*myShapesDataStructure).myLength+31) & (~31));
|
||||
|
||||
mySizeOfArrayOfBits = MultipleOf32/32;
|
||||
myArrayOfBits = 0L;
|
||||
}
|
||||
//modified by NIZNHY-PKV Sun Dec 15 16:28:15 2002 f
|
||||
//===========================================================================
|
||||
//function : Delete
|
||||
//purpose : alias ~BooleanOperations_Explorer
|
||||
//===========================================================================
|
||||
void BooleanOperations_OnceExplorer::Delete()
|
||||
{
|
||||
if (myArrayOfBits) {
|
||||
free (myArrayOfBits);
|
||||
}
|
||||
BooleanOperations_Explorer::Delete();
|
||||
}
|
||||
//modified by NIZNHY-PKV Sun Dec 15 16:29:10 2002 t
|
||||
//===========================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_OnceExplorer::Init(const Standard_Integer aShapeNumber,
|
||||
const TopAbs_ShapeEnum TargetToFind,
|
||||
const TopAbs_ShapeEnum TargetToAvoid)
|
||||
{
|
||||
Standard_Integer i,j,k,theNumberOfTheShapeOnTop,aSuccessorNumber;
|
||||
Standard_Integer* anArrayOfBits;
|
||||
Standard_Boolean shapeAlreadyProcessed;
|
||||
TopAbs_ShapeEnum theTypeOfShapeOnTop,successorType;
|
||||
|
||||
myTargetToFind = TargetToFind;
|
||||
myTargetToAvoid = TargetToAvoid;
|
||||
|
||||
// Modified by skv - Thu Apr 7 11:19:39 2005 Begin
|
||||
hasMore = Standard_False;
|
||||
// Modified by skv - Thu Apr 7 11:19:41 2005 End
|
||||
|
||||
// We first test if myShapesDataStructure has changed.
|
||||
Standard_Integer MultipleOf32= (((*myShapesDataStructure).myLength+31) & (~31));
|
||||
Standard_Integer NewSize = MultipleOf32/32;
|
||||
if (myArrayOfBits!=0L)
|
||||
free(myArrayOfBits);
|
||||
myArrayOfBits = (Standard_Integer*)calloc(mySizeOfArrayOfBits,sizeof(Standard_Integer));
|
||||
mySizeOfArrayOfBits = NewSize;
|
||||
|
||||
if (myStack != 0L) {
|
||||
Standard::Free((Standard_Address&)myStack);
|
||||
}
|
||||
mySizeOfStack = theStackSize;
|
||||
myStack = (Standard_Integer*)Standard::Allocate(theStackSize*sizeof(Standard_Integer));
|
||||
|
||||
((Standard_Integer*)myStack)[0] = aShapeNumber;
|
||||
myTopOfStack = 0;
|
||||
|
||||
theNumberOfTheShapeOnTop = ((Standard_Integer*)myStack)[myTopOfStack];
|
||||
theTypeOfShapeOnTop = (*myShapesDataStructure).GetShapeType(theNumberOfTheShapeOnTop);
|
||||
if (theTypeOfShapeOnTop == myTargetToFind)
|
||||
{
|
||||
hasMore = Standard_True;
|
||||
return;
|
||||
}
|
||||
// Modified by skv - Thu Apr 7 11:19:39 2005 Begin
|
||||
if (theTypeOfShapeOnTop == TopAbs_VERTEX) {
|
||||
hasMore = Standard_False;
|
||||
|
||||
return;
|
||||
}
|
||||
// Modified by skv - Thu Apr 7 11:19:41 2005 End
|
||||
|
||||
while (theTypeOfShapeOnTop != myTargetToFind)
|
||||
{
|
||||
Standard_Address theSuccessors;
|
||||
Standard_Integer theNumberOfSuccessors;
|
||||
// We get the successors of the shape on top of the stack.
|
||||
(*myShapesDataStructure).GetSuccessors(theNumberOfTheShapeOnTop,theSuccessors,theNumberOfSuccessors);
|
||||
// Do we have enough place to store our new successors ?
|
||||
if ((myTopOfStack+theNumberOfSuccessors > mySizeOfStack) && (theSuccessors != 0L))
|
||||
{
|
||||
// We don't have enough place so we reallocate.
|
||||
Standard_Address theNewStack = (Standard_Integer*)Standard::Allocate
|
||||
((mySizeOfStack+theStackSize+theNumberOfSuccessors)*sizeof(Standard_Integer));
|
||||
// We copy the old array in the new one.
|
||||
for (j=0;j<myTopOfStack;j++)
|
||||
((Standard_Integer*)theNewStack)[j] = ((Standard_Integer*)myStack)[j];
|
||||
|
||||
Standard::Free((Standard_Address&)myStack);
|
||||
myStack = theNewStack;
|
||||
mySizeOfStack = mySizeOfStack+theStackSize+theNumberOfSuccessors;
|
||||
}
|
||||
// We remove the shape on top and replace it by its own successors.
|
||||
// We must skip the shape of type TargetToAvoid, k counts them.
|
||||
k = 0;
|
||||
anArrayOfBits = (Standard_Integer*)myArrayOfBits;
|
||||
for (i=0;i<theNumberOfSuccessors;i++)
|
||||
{
|
||||
aSuccessorNumber = ((Standard_Integer*)theSuccessors)[i];
|
||||
shapeAlreadyProcessed = NNNBIT(aSuccessorNumber,anArrayOfBits);
|
||||
successorType = (*myShapesDataStructure).GetShapeType(((Standard_Integer*)theSuccessors)[i]);
|
||||
// Modified by skv - Thu Apr 7 11:19:39 2005 Begin
|
||||
// if ((successorType == myTargetToAvoid) || (shapeAlreadyProcessed==1))
|
||||
if ((successorType == myTargetToAvoid) || (shapeAlreadyProcessed==1) ||
|
||||
(successorType != myTargetToFind && successorType == TopAbs_VERTEX))
|
||||
// Modified by skv - Thu Apr 7 11:19:41 2005 End
|
||||
k++;
|
||||
else
|
||||
{
|
||||
// Insertion of the successor in the stack.
|
||||
((Standard_Integer*)myStack)[i+myTopOfStack-k] = ((Standard_Integer*)theSuccessors)[i];
|
||||
// We need to set the corresponding bit to one to say that we processed this shape.
|
||||
CC1BIT(aSuccessorNumber,anArrayOfBits);
|
||||
}
|
||||
}
|
||||
if (theNumberOfSuccessors-k == 0)
|
||||
{
|
||||
// No successor of a type different of myTargetToAvoid.
|
||||
myTopOfStack--;
|
||||
if (myTopOfStack < 0)
|
||||
{
|
||||
// Empty stack.
|
||||
hasMore = Standard_False;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
myTopOfStack = myTopOfStack+theNumberOfSuccessors-k-1;
|
||||
theNumberOfTheShapeOnTop = ((Standard_Integer*)myStack)[myTopOfStack];
|
||||
theTypeOfShapeOnTop = (*myShapesDataStructure).GetShapeType(theNumberOfTheShapeOnTop);
|
||||
if (theTypeOfShapeOnTop == myTargetToFind)
|
||||
{
|
||||
hasMore = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : Current
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer BooleanOperations_OnceExplorer::Current()
|
||||
{
|
||||
myTopOfStack--;
|
||||
if (myTopOfStack < 0)
|
||||
hasMore = Standard_False;
|
||||
return ((Standard_Integer*)myStack)[myTopOfStack+1];
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : Next
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_OnceExplorer::Next()
|
||||
{
|
||||
TopAbs_ShapeEnum theTypeOfShapeOnTop,successorType;
|
||||
Standard_Integer j,k,theNumberOfTheShapeOnTop,successorNumber;
|
||||
Standard_Boolean shapeAlreadyProcessed;
|
||||
Standard_Integer* anArrayOfBits;
|
||||
|
||||
if (myTopOfStack < 0)
|
||||
{
|
||||
hasMore = Standard_False;
|
||||
return;
|
||||
}
|
||||
theNumberOfTheShapeOnTop = ((Standard_Integer*)myStack)[myTopOfStack];
|
||||
theTypeOfShapeOnTop = (*myShapesDataStructure).GetShapeType(theNumberOfTheShapeOnTop);
|
||||
if (theTypeOfShapeOnTop == myTargetToFind)
|
||||
{
|
||||
hasMore = Standard_True;
|
||||
return;
|
||||
}
|
||||
while (theTypeOfShapeOnTop != myTargetToFind)
|
||||
{
|
||||
Standard_Address theSuccessors = 0L;
|
||||
Standard_Integer theNumberOfSuccessors;
|
||||
(*myShapesDataStructure).GetSuccessors(theNumberOfTheShapeOnTop,(Standard_Address&)theSuccessors,theNumberOfSuccessors);
|
||||
// Do we have enough place to store our new successors ?
|
||||
if ((myTopOfStack+theNumberOfSuccessors > mySizeOfStack) && (theSuccessors != 0L))
|
||||
{
|
||||
Standard_Address theNewStack;
|
||||
theNewStack = (Standard_Integer*)Standard::Allocate
|
||||
((mySizeOfStack+theNumberOfSuccessors+theStackSize)*sizeof(Standard_Integer));
|
||||
for (j=0;j<myTopOfStack;j++)
|
||||
((Standard_Integer*)theNewStack)[j] = ((Standard_Integer*)myStack)[j];
|
||||
Standard::Free((Standard_Address&)myStack);
|
||||
myStack = theNewStack;
|
||||
mySizeOfStack = mySizeOfStack+theNumberOfSuccessors+theStackSize;
|
||||
}
|
||||
// We remove the shape on top and replace it by its own successors.
|
||||
// We must skip the shape of type TargetToAvoid.
|
||||
k = 0;
|
||||
anArrayOfBits = (Standard_Integer*)myArrayOfBits;
|
||||
for (j=0;j<theNumberOfSuccessors;j++)
|
||||
{
|
||||
successorNumber = ((Standard_Integer*)theSuccessors)[j];
|
||||
successorType = (*myShapesDataStructure).GetShapeType(successorNumber);
|
||||
shapeAlreadyProcessed = NNNBIT(successorNumber,anArrayOfBits);
|
||||
if ((successorType == myTargetToAvoid) || (shapeAlreadyProcessed==1))
|
||||
k++;
|
||||
else
|
||||
{
|
||||
((Standard_Integer*)myStack)[j+myTopOfStack-k] = ((Standard_Integer*)theSuccessors)[j];
|
||||
// We need to set the corresponding bit to one to say that we processed this shape.
|
||||
CC1BIT(successorNumber,anArrayOfBits);
|
||||
}
|
||||
}
|
||||
if (theNumberOfSuccessors-k == 0)
|
||||
{
|
||||
// No valid successors...
|
||||
myTopOfStack--;
|
||||
if (myTopOfStack < 0)
|
||||
{
|
||||
// Empty stack...
|
||||
hasMore = Standard_False;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
myTopOfStack = myTopOfStack+theNumberOfSuccessors-k-1;
|
||||
theNumberOfTheShapeOnTop = ((Standard_Integer*)myStack)[myTopOfStack];
|
||||
theTypeOfShapeOnTop = (*myShapesDataStructure).GetShapeType(theNumberOfTheShapeOnTop);
|
||||
if (theTypeOfShapeOnTop == myTargetToFind)
|
||||
{
|
||||
hasMore = Standard_True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_OnceExplorer::Dump(Standard_OStream& S) const
|
||||
{
|
||||
Standard_Integer u;
|
||||
Standard_Integer* anArrayOfBits;
|
||||
Standard_Integer* theSuccessors;
|
||||
|
||||
theSuccessors = ((Standard_Integer*)myStack);
|
||||
S << "\n" << "Dump of BooleanOperations_Explorer:" << "\n";
|
||||
S << "mySizeOfStack = " << mySizeOfStack << "\n";
|
||||
S << "myTopOfStack = " << myTopOfStack << "\n";
|
||||
S << "myTargetToFind = " << myTargetToFind << "\n";
|
||||
S << "myTargetToAvoid = " << myTargetToAvoid << "\n";
|
||||
S << "hasMore = " << hasMore << "\n";
|
||||
for (u=0;u<=myTopOfStack;u++)
|
||||
{
|
||||
S << " " << *theSuccessors;
|
||||
theSuccessors++;
|
||||
}
|
||||
|
||||
anArrayOfBits = (Standard_Integer*)myArrayOfBits;
|
||||
|
||||
S << "\n" ;
|
||||
for (u=1; u<=mySizeOfArrayOfBits*32; u++)
|
||||
{
|
||||
S << NNNBIT(u,anArrayOfBits);
|
||||
if (u%32==0)
|
||||
S << " ";
|
||||
}
|
||||
S << "\n" ;
|
||||
}
|
135
src/BooleanOperations/BooleanOperations_ShapeAndInterferences.cdl
Executable file
135
src/BooleanOperations/BooleanOperations_ShapeAndInterferences.cdl
Executable file
@@ -0,0 +1,135 @@
|
||||
-- File: BooleanOperations_ShapeAndInterferences.cdl
|
||||
-- Created: Mon Jul 24 18:27:49 2000
|
||||
-- Author: Vincent DELOS
|
||||
-- <vds@bulox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class ShapeAndInterferences from BooleanOperations
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
Box from Bnd,
|
||||
Shape from TopoDS,
|
||||
ShapeEnum from TopAbs,
|
||||
Orientation from TopAbs,
|
||||
StateOfShape from BooleanOperations,
|
||||
--modified by NIZNHY-PKV Wed Feb 2 14:45:12 2005f
|
||||
|
||||
-- InterferencesList from BooleanOperations,
|
||||
-- InterferenceResult from BooleanOperations,
|
||||
--modified by NIZNHY-PKV Wed Feb 2 14:45:40 2005t
|
||||
AncestorsAndSuccessors from BooleanOperations
|
||||
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
Create returns ShapeAndInterferences;
|
||||
|
||||
--------------------
|
||||
-- INLINE METHODS --
|
||||
--------------------
|
||||
|
||||
GetShape (me)
|
||||
returns Shape from TopoDS;
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
|
||||
GetShapeType (me)
|
||||
returns ShapeEnum from TopAbs;
|
||||
---C++: inline
|
||||
|
||||
GetState (me)
|
||||
returns StateOfShape from BooleanOperations;
|
||||
---C++: inline
|
||||
|
||||
SetState (me:in out;
|
||||
theState: StateOfShape);
|
||||
---C++: inline
|
||||
|
||||
GetBoundingBox (me)
|
||||
returns Box from Bnd;
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
|
||||
NumberOfAncestors(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
NumberOfSuccessors(me)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
GetAncestor (me; index:Integer)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
GetSuccessor (me; index:Integer)
|
||||
returns Integer from Standard;
|
||||
---C++: inline
|
||||
|
||||
GetAncestors (me;
|
||||
theArrayOfAncestors: out Address;
|
||||
AncestorsSize:out Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
GetSuccessors (me;
|
||||
theArrayOfSuccessors:out Address;
|
||||
SuccessorsSize:out Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
GetOrientation (me;
|
||||
index:Integer)
|
||||
returns Orientation from TopAbs;
|
||||
---C++: inline
|
||||
|
||||
GetOrientations (me;
|
||||
theArrayOfOrientations:out Address;
|
||||
OrientationsSize:out Integer from Standard);
|
||||
---C++: inline
|
||||
|
||||
--modified by NIZNHY-PKV Thu Feb 3 11:13:49 2005f
|
||||
-- GetInterference (me; index:Integer) returns InterferenceResult;
|
||||
-- --C++: inline
|
||||
-- --C++: return const &
|
||||
-- NumberOfInterferences (me) returns Integer;
|
||||
--C++: inline
|
||||
-- GetIntersectionResult (me; index:Integer) returns Integer;
|
||||
-- --C++: inline
|
||||
-- GetIntersectedShape (me; index:Integer) returns Integer;
|
||||
-- --C++: inline
|
||||
------------------
|
||||
-- MAIN METHODS --
|
||||
------------------
|
||||
-- SetInterference (me:in out; Interf: InterferenceResult);
|
||||
---Purpose: sets an interference in <myInterferencesList>.
|
||||
|
||||
-- Dump (me);
|
||||
---Purpose: to display the fields.
|
||||
--modified by NIZNHY-PKV Wed Feb 2 12:55:39 2005t
|
||||
|
||||
fields
|
||||
myBoundingBox : Box from Bnd;
|
||||
---Purpose: the bounding box of <myShape>.
|
||||
|
||||
myAncestorsAndSuccessors : AncestorsAndSuccessors from BooleanOperations;
|
||||
---Purpose: the shapes that contain <myShape> and/or containded by <myShape>.
|
||||
|
||||
myShape : Shape;
|
||||
---Purpose: can be a shape of the Object, of the Tool or created by
|
||||
-- intersecting both of them.
|
||||
|
||||
myState : StateOfShape;
|
||||
---Purpose: the state of <myShape>.
|
||||
|
||||
--modified by NIZNHY-PKV Wed Feb 2 12:53:22 2005f
|
||||
--myInterferencesList : InterferencesList;
|
||||
--modified by NIZNHY-PKV Wed Feb 2 12:53:40 2005t
|
||||
---Purpose: all the shapes whose intersection with <myShape> is not empty.
|
||||
|
||||
friends
|
||||
class ShapesDataStructure from BooleanOperations
|
||||
|
||||
end ShapeAndInterferences;
|
43
src/BooleanOperations/BooleanOperations_ShapeAndInterferences.cxx
Executable file
43
src/BooleanOperations/BooleanOperations_ShapeAndInterferences.cxx
Executable file
@@ -0,0 +1,43 @@
|
||||
// File: BooleanOperations_ShapeAndInterferences.cxx
|
||||
// Created: Tue Jul 25 11:27:07 2000
|
||||
// Author: Vincent DELOS
|
||||
// <vds@bulox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <BooleanOperations_ShapeAndInterferences.ixx>
|
||||
|
||||
//===========================================================================
|
||||
//function : ShapeAndInterferences
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
BooleanOperations_ShapeAndInterferences::BooleanOperations_ShapeAndInterferences():
|
||||
myState(BooleanOperations_UNKNOWN)
|
||||
{
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Feb 2 12:55:46 2005f
|
||||
/*
|
||||
//===========================================================================
|
||||
//function : SetInterference
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapeAndInterferences::SetInterference
|
||||
(const BooleanOperations_InterferenceResult& Interf)
|
||||
{
|
||||
myInterferencesList.SetInterference(Interf);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapeAndInterferences::Dump() const
|
||||
{
|
||||
cout<<endl<<"myBoundingBox :"<<endl;
|
||||
myBoundingBox.Dump();
|
||||
myAncestorsAndSuccessors.Dump();
|
||||
|
||||
myInterferencesList.Dump();
|
||||
cout<<endl<<"myState = "<<myState<<endl;
|
||||
}
|
||||
*/
|
||||
//modified by NIZNHY-PKV Wed Feb 2 12:55:56 2005
|
172
src/BooleanOperations/BooleanOperations_ShapeAndInterferences.lxx
Executable file
172
src/BooleanOperations/BooleanOperations_ShapeAndInterferences.lxx
Executable file
@@ -0,0 +1,172 @@
|
||||
// File: BooleanOperations_ShapeAndInterferences.lxx
|
||||
// Created: Tue Jul 25 11:53:21 2000
|
||||
// Author: Vincent DELOS
|
||||
// <vds@bulox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : GetShape
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline const TopoDS_Shape& BooleanOperations_ShapeAndInterferences::GetShape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetShapeType
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline TopAbs_ShapeEnum BooleanOperations_ShapeAndInterferences::GetShapeType() const
|
||||
{
|
||||
return myShape.ShapeType();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetState
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline BooleanOperations_StateOfShape BooleanOperations_ShapeAndInterferences::GetState() const
|
||||
{
|
||||
return myState;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : SetState
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_ShapeAndInterferences::SetState(const BooleanOperations_StateOfShape theState)
|
||||
{
|
||||
myState = theState;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetBoundingBox
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline const Bnd_Box& BooleanOperations_ShapeAndInterferences::GetBoundingBox() const
|
||||
{
|
||||
return myBoundingBox;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetAncestor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_ShapeAndInterferences::GetAncestor
|
||||
(const Standard_Integer index) const
|
||||
{
|
||||
Standard_Integer anc = myAncestorsAndSuccessors.GetAncestor(index);
|
||||
return anc;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetSuccessor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_ShapeAndInterferences::GetSuccessor
|
||||
(const Standard_Integer index) const
|
||||
{
|
||||
Standard_Integer suc = myAncestorsAndSuccessors.GetSuccessor(index);
|
||||
return suc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : NumberOfAncestors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_ShapeAndInterferences::NumberOfAncestors() const
|
||||
{
|
||||
return myAncestorsAndSuccessors.NumberOfAncestors();
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : NumberOfSuccessors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_ShapeAndInterferences::NumberOfSuccessors() const
|
||||
{
|
||||
return myAncestorsAndSuccessors.NumberOfSuccessors();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetAncestors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_ShapeAndInterferences::GetAncestors
|
||||
(Standard_Address& theArrayOfAncestors,
|
||||
Standard_Integer& AncestorsSize) const
|
||||
{
|
||||
myAncestorsAndSuccessors.GetAncestors(theArrayOfAncestors,AncestorsSize);
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetSuccessors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_ShapeAndInterferences::GetSuccessors
|
||||
(Standard_Address& theArrayOfSuccessors,
|
||||
Standard_Integer& SuccessorsSize) const
|
||||
{
|
||||
myAncestorsAndSuccessors.GetSuccessors(theArrayOfSuccessors,SuccessorsSize);
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetOrientation
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline TopAbs_Orientation BooleanOperations_ShapeAndInterferences::GetOrientation
|
||||
(const Standard_Integer index) const
|
||||
{
|
||||
TopAbs_Orientation suc = myAncestorsAndSuccessors.GetOrientation(index);
|
||||
return suc;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetOrientations
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline void BooleanOperations_ShapeAndInterferences::GetOrientations
|
||||
(Standard_Address& theArrayOfOrientations,
|
||||
Standard_Integer& OrientationsSize) const
|
||||
{
|
||||
myAncestorsAndSuccessors.GetOrientations(theArrayOfOrientations,OrientationsSize);
|
||||
}
|
||||
|
||||
//modified by NIZNHY-PKV Wed Feb 2 12:56:35 2005 f
|
||||
/*
|
||||
//===========================================================================
|
||||
//function : GetInterference
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline const BooleanOperations_InterferenceResult&
|
||||
BooleanOperations_ShapeAndInterferences::GetInterference
|
||||
(const Standard_Integer index) const
|
||||
{
|
||||
const BooleanOperations_InterferenceResult& Interf = myInterferencesList.GetInterference(index);
|
||||
return Interf;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : NumberOfInterferences
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer BooleanOperations_ShapeAndInterferences::NumberOfInterferences() const
|
||||
{
|
||||
return myInterferencesList.NumberOfInterferences();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetIntersectionResult
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer
|
||||
BooleanOperations_ShapeAndInterferences::GetIntersectionResult
|
||||
(const Standard_Integer index) const
|
||||
{
|
||||
return myInterferencesList.GetIntersectionResult(index);
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetIntersectedShape
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
inline Standard_Integer
|
||||
BooleanOperations_ShapeAndInterferences::GetIntersectedShape
|
||||
(const Standard_Integer index) const
|
||||
{
|
||||
return myInterferencesList.GetIntersectedShape(index);
|
||||
}
|
||||
|
||||
*/
|
||||
//modified by NIZNHY-PKV Wed Feb 2 12:56:43 2005 t
|
282
src/BooleanOperations/BooleanOperations_ShapesDataStructure.cdl
Executable file
282
src/BooleanOperations/BooleanOperations_ShapesDataStructure.cdl
Executable file
@@ -0,0 +1,282 @@
|
||||
-- File: BooleanOperations_ShapesDataStructure.cdl
|
||||
-- Created: Thu Aug 10 10:29:38 2000
|
||||
-- Author: Vincent DELOS
|
||||
-- <vds@bulox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class ShapesDataStructure from BooleanOperations
|
||||
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
Box from Bnd,
|
||||
Shape from TopoDS,
|
||||
ShapeEnum from TopAbs,
|
||||
Orientation from TopAbs,
|
||||
StateOfShape from BooleanOperations,
|
||||
--modified by NIZNHY-PKV Wed Feb 2 14:20:09 2005f
|
||||
-- InterferencesList from BooleanOperations,
|
||||
-- InterferenceResult from BooleanOperations,
|
||||
--modified by NIZNHY-PKV Wed Feb 2 14:20:14 2005t
|
||||
ShapeAndInterferences from BooleanOperations,
|
||||
AncestorsAndSuccessors from BooleanOperations,
|
||||
PShapeAndInterferences from BooleanOperations,
|
||||
IndexedMapOfInteger from TColStd,
|
||||
IndexedMapOfShape from TopTools,
|
||||
IndexedMapOfOrientedShape from TopTools,
|
||||
AncestorsSeqAndSuccessorsSeq from BooleanOperations,
|
||||
IndexedDataMapOfShapeAncestorsSuccessors from BooleanOperations,
|
||||
IndexedDataMapOfShapeInteger from BooleanOperations,
|
||||
CArray1OfInteger from BOPTColStd
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
returns ShapesDataStructure;
|
||||
---C++: alias "Standard_EXPORT virtual ~BooleanOperations_ShapesDataStructure();"
|
||||
--modified by NIZNHY-PKV Wed Feb 2 11:34:40 2005ft
|
||||
Create (Object,Tool: Shape from TopoDS)
|
||||
returns ShapesDataStructure;
|
||||
|
||||
--modified by NIZNHY-PKV Wed Feb 2 11:34:46 2005ft
|
||||
Destroy(me: in out)
|
||||
is protected;
|
||||
-- --C++: alias ~
|
||||
|
||||
ReInit (me:in out)
|
||||
is private;
|
||||
|
||||
InsertShapeAndAncestorsSuccessors (me:in out;
|
||||
S: Shape from TopoDS;
|
||||
AncSuc: AncestorsSeqAndSuccessorsSeq;
|
||||
shift: Integer=0);
|
||||
---Purpose: fill a line of the data structure, the shift is used
|
||||
-- for the numbers of the shapes of the Tool.
|
||||
|
||||
|
||||
|
||||
FillIndexedMapOfShapesAncestorsAndSuccessors (me;
|
||||
Sha: Shape from TopoDS;
|
||||
IndDatMap:out IndexedDataMapOfShapeAncestorsSuccessors);
|
||||
---Purpose: to find the data structure we first decompose the
|
||||
-- Object and Tool in the indexed data map of shapes.
|
||||
|
||||
FindSubshapes (me;
|
||||
Sha: Shape from TopoDS;
|
||||
TotalNumberOfShapes:out Integer from Standard;
|
||||
IndDatMap:out IndexedDataMapOfShapeAncestorsSuccessors);
|
||||
---Purpose: to find all the subshapes of Sha and store them in
|
||||
-- IndDatMap if they had not been already taken into account.
|
||||
|
||||
Dump (me;
|
||||
S : in out OStream);
|
||||
---Purpose: dump the content of the fields.
|
||||
LightDump (me;
|
||||
S : in out OStream);
|
||||
---Purpose: dump the types of the shapes.
|
||||
|
||||
--------------------
|
||||
-- INLINE METHODS --
|
||||
--------------------
|
||||
GetShape (me;
|
||||
index: Integer from Standard)
|
||||
returns Shape from TopoDS;
|
||||
---C++: return const &
|
||||
|
||||
Shape (me;
|
||||
anIndex: Integer from Standard)
|
||||
returns Shape from TopoDS;
|
||||
---C++: return const &
|
||||
|
||||
|
||||
|
||||
GetShapeType (me;
|
||||
index: Integer from Standard)
|
||||
returns ShapeEnum from TopAbs;
|
||||
|
||||
GetBoundingBox (me;
|
||||
index: Integer from Standard)
|
||||
returns Box;
|
||||
---C++: return const &
|
||||
|
||||
GetState (me;
|
||||
index: Integer from Standard)
|
||||
returns StateOfShape from BooleanOperations;
|
||||
|
||||
SetState (me:in out;
|
||||
index: Integer from Standard;
|
||||
theState: StateOfShape from BooleanOperations);
|
||||
|
||||
GetAncestor(me;
|
||||
index: Integer from Standard;
|
||||
ancestorNumber: Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
GetSuccessor(me;
|
||||
index: Integer from Standard;
|
||||
successorNumber: Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
GetAncestors (me;
|
||||
index: Integer from Standard;
|
||||
theArrayOfAncestors: out Address from Standard;
|
||||
AncestorsSize:out Integer from Standard);
|
||||
|
||||
GetSuccessors (me;
|
||||
index: Integer from Standard;
|
||||
theArrayOfSuccessors:out Address from Standard;
|
||||
SuccessorsSize:out Integer from Standard);
|
||||
|
||||
|
||||
|
||||
NumberOfAncestors (me;
|
||||
index: Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
NumberOfSuccessors (me;
|
||||
index: Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
|
||||
|
||||
NumberOfShapesOfTheTool (me)
|
||||
returns Integer from Standard;
|
||||
|
||||
NumberOfShapesOfTheObject (me)
|
||||
returns Integer from Standard;
|
||||
|
||||
--
|
||||
NumberOfSourceShapes (me)
|
||||
returns Integer from Standard ;
|
||||
|
||||
IsNewShape (me;
|
||||
index: Integer from Standard)
|
||||
returns Boolean from Standard ;
|
||||
|
||||
--NumberOfShapesOfTheTool+NumberOfShapesOfTheObject+NewShapes
|
||||
NumberOfInsertedShapes(me)
|
||||
returns Integer from Standard ;
|
||||
|
||||
NumberOfNewShapes(me)
|
||||
returns Integer from Standard ;
|
||||
|
||||
Line (me; index: Integer from Standard)
|
||||
returns ShapeAndInterferences from BooleanOperations;
|
||||
---C++: return const &
|
||||
|
||||
|
||||
ShapeIndexMap (me;
|
||||
iRank:Integer from Standard)
|
||||
returns IndexedDataMapOfShapeInteger from BooleanOperations;
|
||||
---C++: return const &
|
||||
|
||||
ShapeIndex (me;
|
||||
aS:Shape from TopoDS;
|
||||
iRank:Integer from Standard)
|
||||
returns Integer from Standard
|
||||
is virtual;--modified by NIZNHY-PKV Thu Feb 5 14:20:31 2004
|
||||
|
||||
Object (me)
|
||||
returns Shape from TopoDS;
|
||||
---C++: return const &
|
||||
|
||||
Tool (me)
|
||||
returns Shape from TopoDS;
|
||||
---C++: return const &
|
||||
|
||||
ObjectRange (me;
|
||||
iFirst:out Integer from Standard;
|
||||
iLast :out Integer from Standard);
|
||||
|
||||
ToolRange (me;
|
||||
iFirst:out Integer from Standard;
|
||||
iLast :out Integer from Standard);
|
||||
|
||||
Rank (me;
|
||||
anIndex:Integer from Standard)
|
||||
returns Integer from Standard -- 1-Object, 2-Tool, 3-New 0-?
|
||||
is virtual; --XX
|
||||
|
||||
RefEdge(me;
|
||||
anIndex:Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose: for given index "anIndex" of an edge in DS get
|
||||
--- reference index of an edge
|
||||
|
||||
NbEdges(me)
|
||||
returns Integer from Standard;
|
||||
---Purpose: returns number of edges from source shapes
|
||||
|
||||
GetOrientation (me;
|
||||
index: Integer from Standard;
|
||||
successorNumber: Integer from Standard)
|
||||
returns Orientation;
|
||||
|
||||
GetOrientations (me;
|
||||
index: Integer from Standard;
|
||||
theArrayOfOrientations:out Address;
|
||||
OrientationsSize:out Integer from Standard);
|
||||
|
||||
--modified by NIZNHY-PKV Thu Feb 3 11:17:25 2005f
|
||||
-- InsertInterference (me:in out;
|
||||
-- index: Integer; IR: InterferenceResult);
|
||||
-- GetInterference (me;
|
||||
-- index: Integer from Standard;
|
||||
-- interfNumber: Integer from Standard)
|
||||
-- returns InterferenceResult;
|
||||
-- --C++: return const &
|
||||
-- GetIntersectedShape (me;
|
||||
-- index: Integer from Standard;
|
||||
-- interfNumber: Integer from Standard)
|
||||
-- returns Integer from Standard;
|
||||
|
||||
-- GetIntersectionResult (me;
|
||||
-- index: Integer from Standard;
|
||||
-- interfNumber: Integer from Standard)
|
||||
-- returns Integer from Standard;
|
||||
|
||||
-- NumberOfInterferences (me; index: Integer)
|
||||
-- returns Integer from Standard;
|
||||
--modified by NIZNHY-PKV Wed Feb 2 14:18:57 2005t
|
||||
|
||||
fields
|
||||
|
||||
myListOfShapeAndInterferences : PShapeAndInterferences from BooleanOperations is protected;
|
||||
---Purpose: gives the number of interferences inserted in myListOfInterferences.
|
||||
|
||||
myNumberOfShapesOfTheObject : Integer is protected;
|
||||
---Purpose: the total number of the shapes of the Object.
|
||||
|
||||
myNumberOfShapesOfTheTool : Integer is protected;
|
||||
---Purpose: the total number of the shapes of the Tool.
|
||||
|
||||
myNumberOfInsertedShapes : Integer is protected;
|
||||
---Purpose: the total number of the shapes of the Object, Tool and
|
||||
-- also the shapes created by interferences.
|
||||
myLength : Integer is protected;
|
||||
---Purpose: the total number of allocated space to store.
|
||||
|
||||
--
|
||||
myObject : Shape from TopoDS is protected;
|
||||
|
||||
myTool : Shape from TopoDS is protected;
|
||||
--
|
||||
myShapeIndexMapObj : IndexedDataMapOfShapeInteger from BooleanOperations is protected;
|
||||
|
||||
myShapeIndexMapTool: IndexedDataMapOfShapeInteger from BooleanOperations is protected;
|
||||
|
||||
--
|
||||
myRefEdges: CArray1OfInteger from BOPTColStd is protected;
|
||||
|
||||
myNbEdges : Integer from Standard is protected;
|
||||
--
|
||||
|
||||
friends
|
||||
|
||||
class Explorer from BooleanOperations,
|
||||
class OnceExplorer from BooleanOperations
|
||||
|
||||
end ShapesDataStructure;
|
977
src/BooleanOperations/BooleanOperations_ShapesDataStructure.cxx
Executable file
977
src/BooleanOperations/BooleanOperations_ShapesDataStructure.cxx
Executable file
@@ -0,0 +1,977 @@
|
||||
// File: BooleanOperations_ShapesDataStructure.cxx
|
||||
// Created: Thu Aug 10 13:39:43 2000
|
||||
// Author: Vincent DELOS
|
||||
// <vds@bulox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <BooleanOperations_ShapesDataStructure.ixx>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_TShape.hxx>
|
||||
#include <TopoDS_TVertex.hxx>
|
||||
#include <TopoDS_TEdge.hxx>
|
||||
#include <TopoDS_TWire.hxx>
|
||||
#include <TopoDS_TFace.hxx>
|
||||
#include <TopoDS_TShell.hxx>
|
||||
#include <TopoDS_TSolid.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_TCompound.hxx>
|
||||
#include <TopoDS_TCompSolid.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepTools_ShapeSet.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_ShapeSet.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfOrientedShape.hxx>
|
||||
|
||||
#include <BooleanOperations_OnceExplorer.hxx>
|
||||
#include <BooleanOperations_AncestorsAndSuccessors.hxx>
|
||||
#include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
|
||||
#include <BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors.hxx>
|
||||
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <BOPTColStd_Dump.hxx>
|
||||
|
||||
|
||||
#ifdef WNT
|
||||
#pragma warning ( disable : 4291 )
|
||||
#endif
|
||||
|
||||
static
|
||||
void Message(const Standard_Integer i);
|
||||
|
||||
const static Standard_Integer AddedValue=20;
|
||||
|
||||
//===========================================================================
|
||||
//function : BooleanOperations_ShapesDataStructure
|
||||
//purpose : creator
|
||||
//===========================================================================
|
||||
BooleanOperations_ShapesDataStructure::BooleanOperations_ShapesDataStructure():
|
||||
myListOfShapeAndInterferences(NULL),
|
||||
myNumberOfShapesOfTheObject(0),
|
||||
myNumberOfShapesOfTheTool(0),
|
||||
myNumberOfInsertedShapes(0),
|
||||
myLength(0),
|
||||
myNbEdges(0)
|
||||
{
|
||||
//printf("-BOPDS_ShapesDataStructure CREATE:%x\n", (int)this);
|
||||
}
|
||||
//===========================================================================
|
||||
//function : BooleanOperations_ShapesDataStructure
|
||||
//purpose : creator
|
||||
//===========================================================================
|
||||
BooleanOperations_ShapesDataStructure::BooleanOperations_ShapesDataStructure(const TopoDS_Shape& Object,
|
||||
const TopoDS_Shape& Tool)
|
||||
:
|
||||
myListOfShapeAndInterferences(NULL),
|
||||
myNumberOfShapesOfTheObject(0),
|
||||
myNumberOfShapesOfTheTool(0),
|
||||
myNumberOfInsertedShapes(0),
|
||||
myLength(0),
|
||||
myObject(Object),
|
||||
myTool(Tool),
|
||||
myNbEdges(0)
|
||||
{
|
||||
//printf(" BOPDS_ShapesDataStructure CREATE:%x\n", (int)this);
|
||||
Standard_Integer i, Average;//, aNbShapes;
|
||||
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors IndDatMapTool;
|
||||
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors IndDatMapObject;
|
||||
|
||||
FillIndexedMapOfShapesAncestorsAndSuccessors(Object,IndDatMapObject);
|
||||
FillIndexedMapOfShapesAncestorsAndSuccessors(Tool,IndDatMapTool);
|
||||
myNumberOfShapesOfTheObject = IndDatMapObject.Extent();
|
||||
myNumberOfShapesOfTheTool = IndDatMapTool.Extent();
|
||||
Average = (myNumberOfShapesOfTheTool+myNumberOfShapesOfTheObject)/2;
|
||||
myLength = myNumberOfShapesOfTheTool+myNumberOfShapesOfTheObject+Average;
|
||||
/////
|
||||
myListOfShapeAndInterferences = (BooleanOperations_PShapeAndInterferences)
|
||||
Standard::Allocate(myLength*sizeof(BooleanOperations_ShapeAndInterferences));
|
||||
//
|
||||
// Inserting the shapes into the DS
|
||||
// Object
|
||||
for (i=1; i<=myNumberOfShapesOfTheObject; i++){
|
||||
const BooleanOperations_AncestorsSeqAndSuccessorsSeq& theAncestorsSeqAndSuccessorsSeq =
|
||||
IndDatMapObject.FindFromIndex(i);
|
||||
const TopoDS_Shape& theShape = IndDatMapObject.FindKey(i);
|
||||
InsertShapeAndAncestorsSuccessors(theShape, theAncestorsSeqAndSuccessorsSeq, 0);
|
||||
}
|
||||
// Tool
|
||||
for (i=1;i<=myNumberOfShapesOfTheTool;i++){
|
||||
const BooleanOperations_AncestorsSeqAndSuccessorsSeq& theAncestorsSeqAndSuccessorsSeq =
|
||||
IndDatMapTool.FindFromIndex(i);
|
||||
const TopoDS_Shape& theShape = IndDatMapTool.FindKey(i);
|
||||
InsertShapeAndAncestorsSuccessors(theShape,theAncestorsSeqAndSuccessorsSeq,myNumberOfShapesOfTheObject);
|
||||
}
|
||||
//
|
||||
// Fill the myShapeIndexMapObj
|
||||
for (i=1; i<=myNumberOfShapesOfTheObject; ++i){
|
||||
const TopoDS_Shape& aS=GetShape(i);
|
||||
myShapeIndexMapObj.Add(aS, i);
|
||||
}
|
||||
//
|
||||
//
|
||||
// Fill the myShapeIndexMapObj
|
||||
Standard_Integer iFirst, iLast;
|
||||
//
|
||||
ToolRange (iFirst, iLast);
|
||||
for (i=iFirst; i<=iLast; ++i){
|
||||
const TopoDS_Shape& aS=GetShape(i);
|
||||
myShapeIndexMapTool.Add(aS, i);
|
||||
}
|
||||
//
|
||||
iLast=myNumberOfShapesOfTheObject+myNumberOfShapesOfTheTool;
|
||||
//
|
||||
// Fill myRefEdges
|
||||
myRefEdges.Resize(iLast);
|
||||
|
||||
for (i=1; i<=iLast; ++i) {
|
||||
const TopoDS_Shape& aS=Shape(i);
|
||||
myRefEdges(i)=0;
|
||||
if (aS.ShapeType()==TopAbs_EDGE) {
|
||||
myNbEdges++;
|
||||
myRefEdges(i)=myNbEdges;
|
||||
}
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Feb 2 11:34:07 2005f
|
||||
//===========================================================================
|
||||
//function : ~
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
BooleanOperations_ShapesDataStructure::~BooleanOperations_ShapesDataStructure()
|
||||
{
|
||||
//printf(" BOPDS_ShapesDataStructure DELETE:%x\n", (int)this);
|
||||
Destroy();
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Feb 2 11:34:12 2005t
|
||||
//===========================================================================
|
||||
//function : BooleanOperations_ShapesDataStructure
|
||||
//purpose : destructor
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::Destroy()
|
||||
{
|
||||
Standard_Integer i;
|
||||
|
||||
for (i=0;i<myNumberOfInsertedShapes;i++) {
|
||||
myListOfShapeAndInterferences[i].~BooleanOperations_ShapeAndInterferences();
|
||||
}
|
||||
|
||||
//modified by NIZNHY-PKV Wed Feb 2 12:31:28 2005f
|
||||
//printf(" ~ :%x, now:%x\n",
|
||||
// (int)this,
|
||||
// (int)myListOfShapeAndInterferences);
|
||||
//modified by NIZNHY-PKV Wed Feb 2 12:31:31 2005t
|
||||
//
|
||||
Standard::Free((Standard_Address&)myListOfShapeAndInterferences);
|
||||
}
|
||||
//===========================================================================
|
||||
//function : ShapeIndexMap
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
const BooleanOperations_IndexedDataMapOfShapeInteger&
|
||||
BooleanOperations_ShapesDataStructure::ShapeIndexMap(const Standard_Integer iRank)const
|
||||
{
|
||||
if (iRank == 1)
|
||||
return myShapeIndexMapObj;
|
||||
else
|
||||
return myShapeIndexMapTool;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : ShapeIndex
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer BooleanOperations_ShapesDataStructure::ShapeIndex(const TopoDS_Shape& aS,
|
||||
const Standard_Integer iRank) const
|
||||
{
|
||||
Standard_Integer anIndex=0;
|
||||
const BooleanOperations_IndexedDataMapOfShapeInteger& aMap=ShapeIndexMap(iRank);
|
||||
if (aMap.Contains(aS)) {
|
||||
anIndex=aMap.FindFromKey(aS);
|
||||
return anIndex;
|
||||
}
|
||||
return anIndex;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : FillIndexedMapOfShapesAncestorsAndSuccessors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::FillIndexedMapOfShapesAncestorsAndSuccessors
|
||||
(const TopoDS_Shape& Sha,
|
||||
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& IndDatMap) const
|
||||
{
|
||||
Standard_Integer TotalNumberOfShapes = 1;
|
||||
BooleanOperations_AncestorsSeqAndSuccessorsSeq theAncestorAndSuccessor;
|
||||
IndDatMap.Add(Sha,theAncestorAndSuccessor);
|
||||
this->FindSubshapes(Sha,TotalNumberOfShapes,IndDatMap);
|
||||
//
|
||||
Standard_Integer aNumberOfShapes = IndDatMap.Extent();
|
||||
for(Standard_Integer i=1; i <= aNumberOfShapes; i++) {
|
||||
const BooleanOperations_AncestorsSeqAndSuccessorsSeq& anAncestorAndSuccessorSeq1=IndDatMap(i);
|
||||
TColStd_MapOfInteger aMapOfIndices;
|
||||
for(Standard_Integer j = 1; j <= anAncestorAndSuccessorSeq1.NumberOfSuccessors(); j++) {
|
||||
Standard_Integer aShapeIndex = anAncestorAndSuccessorSeq1.GetSuccessor(j);
|
||||
if(aMapOfIndices.Add(aShapeIndex)) {
|
||||
BooleanOperations_AncestorsSeqAndSuccessorsSeq& anAncestorAndSuccessorSeq2 =
|
||||
IndDatMap.ChangeFromIndex(aShapeIndex);
|
||||
anAncestorAndSuccessorSeq2.SetNewAncestor(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//===========================================================================
|
||||
//function : FindSubshapes
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::FindSubshapes
|
||||
(const TopoDS_Shape& Sha,
|
||||
Standard_Integer& TotalNumberOfShapes,
|
||||
BooleanOperations_IndexedDataMapOfShapeAncestorsSuccessors& IndDatMap) const
|
||||
{
|
||||
//
|
||||
TopoDS_Iterator anIt(Sha, Standard_True);//Standard_False);
|
||||
Standard_Integer anIndexOfShape = IndDatMap.FindIndex(Sha);
|
||||
BooleanOperations_AncestorsSeqAndSuccessorsSeq& AncSucOfShape=IndDatMap.ChangeFromIndex(anIndexOfShape);
|
||||
for(; anIt.More(); anIt.Next()) {
|
||||
const TopoDS_Shape& aSubShape = anIt.Value();
|
||||
Standard_Integer aSubShapeIndex = 0;
|
||||
Standard_Boolean isNewSubShape = Standard_False;
|
||||
if(!IndDatMap.Contains(aSubShape)) {
|
||||
isNewSubShape = Standard_True;
|
||||
BooleanOperations_AncestorsSeqAndSuccessorsSeq anAncestorAndSuccessorSeq;
|
||||
aSubShapeIndex = IndDatMap.Add(aSubShape, anAncestorAndSuccessorSeq);
|
||||
}
|
||||
else {
|
||||
aSubShapeIndex = IndDatMap.FindIndex(aSubShape);
|
||||
}
|
||||
AncSucOfShape.SetNewSuccessor(aSubShapeIndex);
|
||||
AncSucOfShape.SetNewOrientation(aSubShape.Orientation());
|
||||
//
|
||||
if(isNewSubShape && (aSubShape.ShapeType() != TopAbs_VERTEX)) {
|
||||
FindSubshapes(aSubShape, TotalNumberOfShapes, IndDatMap);
|
||||
}
|
||||
}
|
||||
TotalNumberOfShapes = IndDatMap.Extent();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : ReInit
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::ReInit()
|
||||
{
|
||||
Standard_Integer i,NewLength;
|
||||
BooleanOperations_PShapeAndInterferences NewListOfShapeAndInterferences;
|
||||
|
||||
NewLength = AddedValue + myLength;
|
||||
NewListOfShapeAndInterferences = (BooleanOperations_PShapeAndInterferences)
|
||||
Standard::Allocate(NewLength*sizeof(BooleanOperations_ShapeAndInterferences));
|
||||
|
||||
//modified by NIZNHY-PKV Wed Feb 2 12:16:51 2005f
|
||||
//printf(" ReInit:%x, was:%x, now:%x\n",
|
||||
// (int)this,
|
||||
// (int)myListOfShapeAndInterferences,
|
||||
// (int)NewListOfShapeAndInterferences);
|
||||
//modified by NIZNHY-PKV Wed Feb 2 12:16:55 2005t
|
||||
|
||||
for (i=0;i<myNumberOfInsertedShapes;i++) {
|
||||
new (&NewListOfShapeAndInterferences[i])
|
||||
BooleanOperations_ShapeAndInterferences(myListOfShapeAndInterferences[i]);
|
||||
myListOfShapeAndInterferences[i].myShape.Nullify();
|
||||
}
|
||||
|
||||
if (myLength>0) {
|
||||
Standard::Free((Standard_Address&) myListOfShapeAndInterferences);
|
||||
}
|
||||
|
||||
myLength = NewLength;
|
||||
myListOfShapeAndInterferences = NewListOfShapeAndInterferences;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : InsertShapeAndAncestorsSuccessors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::InsertShapeAndAncestorsSuccessors
|
||||
(const TopoDS_Shape& S,
|
||||
const BooleanOperations_AncestorsSeqAndSuccessorsSeq& AncSuc,
|
||||
const Standard_Integer shift)
|
||||
{
|
||||
if ((myNumberOfInsertedShapes<0)||(myNumberOfInsertedShapes>myLength)) {
|
||||
Message(1);
|
||||
}
|
||||
//
|
||||
Bnd_Box B;
|
||||
//
|
||||
if (myNumberOfInsertedShapes==myLength) {
|
||||
ReInit();
|
||||
}
|
||||
|
||||
new (&(myListOfShapeAndInterferences[myNumberOfInsertedShapes].myShape)) TopoDS_Shape(S);
|
||||
// Compute and insert the bounding box of <myShape>.
|
||||
if (!S.IsNull()) {
|
||||
BRepBndLib::Add(S,B);
|
||||
}
|
||||
new (&(myListOfShapeAndInterferences[myNumberOfInsertedShapes].myBoundingBox))
|
||||
Bnd_Box(B);
|
||||
new (&(myListOfShapeAndInterferences[myNumberOfInsertedShapes].myAncestorsAndSuccessors))
|
||||
BooleanOperations_AncestorsAndSuccessors(AncSuc,shift);
|
||||
|
||||
myListOfShapeAndInterferences[myNumberOfInsertedShapes].myState = BooleanOperations_UNKNOWN;
|
||||
myNumberOfInsertedShapes++;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : GetShape
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
const TopoDS_Shape& BooleanOperations_ShapesDataStructure::GetShape(const Standard_Integer index) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
return myListOfShapeAndInterferences[index-1].GetShape();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : Shape
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
const TopoDS_Shape& BooleanOperations_ShapesDataStructure::Shape(const Standard_Integer index) const
|
||||
{
|
||||
return GetShape(index);
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetShapeType
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
TopAbs_ShapeEnum BooleanOperations_ShapesDataStructure::GetShapeType(const Standard_Integer index) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
return myListOfShapeAndInterferences[index-1].GetShapeType();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetBoundingBox
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
const Bnd_Box& BooleanOperations_ShapesDataStructure::GetBoundingBox(const Standard_Integer index) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
return myListOfShapeAndInterferences[index-1].GetBoundingBox();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetState
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
BooleanOperations_StateOfShape BooleanOperations_ShapesDataStructure::GetState(const Standard_Integer index) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
return myListOfShapeAndInterferences[index-1].GetState();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : SetState
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::SetState(const Standard_Integer index,
|
||||
const BooleanOperations_StateOfShape theState)
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
myListOfShapeAndInterferences[index-1].SetState(theState);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : NumberOfAncestors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer
|
||||
BooleanOperations_ShapesDataStructure::NumberOfAncestors(const Standard_Integer index) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
return myListOfShapeAndInterferences[index-1].NumberOfAncestors();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : NumberOfSuccessors
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer
|
||||
BooleanOperations_ShapesDataStructure::NumberOfSuccessors(const Standard_Integer index) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
return myListOfShapeAndInterferences[index-1].NumberOfSuccessors();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetAncestor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer
|
||||
BooleanOperations_ShapesDataStructure::GetAncestor(const Standard_Integer index,
|
||||
const Standard_Integer ancestorNumber) const
|
||||
{
|
||||
if ((index<1)||
|
||||
(index>myNumberOfInsertedShapes)||
|
||||
(ancestorNumber<1)||
|
||||
(ancestorNumber>NumberOfAncestors(index))) {
|
||||
Message(1);
|
||||
}
|
||||
return myListOfShapeAndInterferences[index-1].GetAncestor(ancestorNumber);
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetSuccessor
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer
|
||||
BooleanOperations_ShapesDataStructure::GetSuccessor(const Standard_Integer index,
|
||||
const Standard_Integer successorNumber) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)||(successorNumber<1)||(successorNumber>NumberOfSuccessors(index))) {
|
||||
Message(1);
|
||||
}
|
||||
if (GetShapeType(index) == TopAbs_VERTEX) {
|
||||
Message(2);
|
||||
}
|
||||
return myListOfShapeAndInterferences[index-1].GetSuccessor(successorNumber);
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetAncestors
|
||||
//purpose : returns the array of ancestors
|
||||
//===========================================================================
|
||||
void
|
||||
BooleanOperations_ShapesDataStructure::GetAncestors(const Standard_Integer index,
|
||||
Standard_Address& theArrayOfAncestors,
|
||||
Standard_Integer& ancestorsNumber) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
myListOfShapeAndInterferences[index-1].GetAncestors(theArrayOfAncestors,ancestorsNumber);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : GetSuccessors
|
||||
//purpose : returns the array of successors
|
||||
//===========================================================================
|
||||
void
|
||||
BooleanOperations_ShapesDataStructure::GetSuccessors(const Standard_Integer index,
|
||||
Standard_Address& theArrayOfSuccessors,
|
||||
Standard_Integer& successorsNumber) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
if (GetShapeType(index) == TopAbs_VERTEX) {
|
||||
Message(2);
|
||||
}
|
||||
myListOfShapeAndInterferences[index-1].GetSuccessors(theArrayOfSuccessors,successorsNumber);
|
||||
}
|
||||
|
||||
//
|
||||
//===========================================================================
|
||||
//function : NumberOfShapesOfTheObject
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer BooleanOperations_ShapesDataStructure::NumberOfShapesOfTheObject()const
|
||||
{
|
||||
return myNumberOfShapesOfTheObject;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : NumberOfShapesOfTheTool
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer BooleanOperations_ShapesDataStructure::NumberOfShapesOfTheTool()const
|
||||
{
|
||||
return myNumberOfShapesOfTheTool;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//===========================================================================
|
||||
//function : NumberOfInsertedShapes
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer BooleanOperations_ShapesDataStructure::NumberOfInsertedShapes()const
|
||||
{
|
||||
return myNumberOfInsertedShapes;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : NumberOfNewShapes
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer BooleanOperations_ShapesDataStructure::NumberOfNewShapes()const
|
||||
{
|
||||
Standard_Integer aNb;
|
||||
|
||||
aNb=NumberOfSourceShapes();
|
||||
aNb=myNumberOfInsertedShapes-aNb;
|
||||
return aNb;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : NumberOfSourceShapes
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer BooleanOperations_ShapesDataStructure::NumberOfSourceShapes()const
|
||||
{
|
||||
Standard_Integer aNb;
|
||||
aNb=myNumberOfShapesOfTheTool+myNumberOfShapesOfTheObject;
|
||||
return aNb;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : IsNewShape
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Boolean
|
||||
BooleanOperations_ShapesDataStructure::IsNewShape(const Standard_Integer anIndex)const
|
||||
{
|
||||
Standard_Boolean aFlag;
|
||||
aFlag=anIndex>NumberOfSourceShapes();
|
||||
return aFlag;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : Line
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
const BooleanOperations_ShapeAndInterferences&
|
||||
BooleanOperations_ShapesDataStructure::Line(const Standard_Integer index) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
return myListOfShapeAndInterferences[index-1];
|
||||
}
|
||||
//===========================================================================
|
||||
//function : Object
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
const TopoDS_Shape& BooleanOperations_ShapesDataStructure::Object()const
|
||||
{
|
||||
return myObject;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : Tool
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
const TopoDS_Shape& BooleanOperations_ShapesDataStructure::Tool()const
|
||||
{
|
||||
return myTool;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : ObjectRange
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::ObjectRange(Standard_Integer& iFirst,
|
||||
Standard_Integer& iLast)const
|
||||
{
|
||||
iFirst=1;
|
||||
iLast=NumberOfShapesOfTheObject();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : ToolRange
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::ToolRange(Standard_Integer& iFirst,
|
||||
Standard_Integer& iLast)const
|
||||
{
|
||||
iFirst=NumberOfShapesOfTheObject()+1;
|
||||
iLast=NumberOfShapesOfTheObject()+NumberOfShapesOfTheTool();
|
||||
}
|
||||
//===========================================================================
|
||||
//function : Rank
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer BooleanOperations_ShapesDataStructure::Rank(const Standard_Integer nS)const
|
||||
|
||||
{
|
||||
if (IsNewShape(nS)) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
Standard_Integer iFirst, iLast;
|
||||
|
||||
ObjectRange(iFirst, iLast);
|
||||
if (nS >= iFirst && nS <= iLast){
|
||||
return 1;
|
||||
}
|
||||
|
||||
ToolRange(iFirst, iLast);
|
||||
if (nS >= iFirst && nS <= iLast){
|
||||
return 2;
|
||||
}
|
||||
return 0; // ?
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : RefEdge
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer
|
||||
BooleanOperations_ShapesDataStructure::RefEdge(const Standard_Integer anIndex)const
|
||||
{
|
||||
Standard_Integer iRefEdge;
|
||||
iRefEdge=myRefEdges(anIndex);
|
||||
return iRefEdge;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : NbEdges
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer BooleanOperations_ShapesDataStructure::NbEdges()const
|
||||
{
|
||||
return myNbEdges;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : Message
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void Message(const Standard_Integer i)
|
||||
{
|
||||
char buf[256];
|
||||
sprintf(buf, " BooleanOperations_ShapesDataStructure:: ");
|
||||
BOPTColStd_Dump::PrintMessage(buf);
|
||||
|
||||
switch (i) {
|
||||
case 1:
|
||||
sprintf (buf, "index is out of range\n");
|
||||
break;
|
||||
case 2:
|
||||
sprintf (buf, "incorrect Type\n");
|
||||
break;
|
||||
default:
|
||||
sprintf(buf, "undefined message\n");
|
||||
break;
|
||||
}
|
||||
BOPTColStd_Dump::PrintMessage(buf);
|
||||
Standard_DomainError::Raise("Message");
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::Dump(Standard_OStream& S) const
|
||||
{
|
||||
|
||||
Standard_Integer i,j;
|
||||
TopAbs_ShapeEnum T;
|
||||
//ZZ gp_Pnt thePoint;
|
||||
BooleanOperations_StateOfShape St;
|
||||
|
||||
S<<endl<<"BooleanOperations_ShapesDataStructure::Dump()"<<endl;
|
||||
S<<endl<<"myLength = "<<myLength;
|
||||
S<<endl<<"myNumberOfInsertedShapes = "<<myNumberOfInsertedShapes;
|
||||
S<<endl<<"myNumberOfShapesOfTheTool = "<<myNumberOfShapesOfTheTool;
|
||||
S<<endl<<"myNumberOfShapesOfTheObject = "<<myNumberOfShapesOfTheObject<<endl;
|
||||
|
||||
for (i=1;i<=myNumberOfInsertedShapes;i++)
|
||||
{
|
||||
S << "---";
|
||||
if (i < 10) cout<< " ";
|
||||
if (i < 100) cout<< " ";
|
||||
if (i < 1000) cout<< " ";
|
||||
cout << i << " --- ";
|
||||
T = GetShape(i).ShapeType();
|
||||
switch(T)
|
||||
{
|
||||
case TopAbs_VERTEX :
|
||||
S << "VERTEX ";
|
||||
break;
|
||||
|
||||
case TopAbs_EDGE :
|
||||
S << "EDGE ";
|
||||
break;
|
||||
|
||||
case TopAbs_WIRE :
|
||||
S << "WIRE ";
|
||||
break;
|
||||
|
||||
case TopAbs_FACE :
|
||||
S << "FACE ";
|
||||
break;
|
||||
|
||||
case TopAbs_SHELL :
|
||||
S << "SHELL ";
|
||||
break;
|
||||
|
||||
case TopAbs_SOLID :
|
||||
S << "SOLID ";
|
||||
break;
|
||||
|
||||
case TopAbs_COMPSOLID :
|
||||
S << "COMPSOLID";
|
||||
break;
|
||||
|
||||
case TopAbs_COMPOUND :
|
||||
S << "COMPOUND ";
|
||||
break;
|
||||
|
||||
case TopAbs_SHAPE :
|
||||
S << "SHAPE";
|
||||
break;
|
||||
}
|
||||
St = GetState(i);
|
||||
switch(St)
|
||||
{
|
||||
case BooleanOperations_IN :
|
||||
S << "IN ";
|
||||
break;
|
||||
|
||||
case BooleanOperations_OUT :
|
||||
S << "OUT ";
|
||||
break;
|
||||
|
||||
case BooleanOperations_UNKNOWN :
|
||||
S << "UNKNOWN ";
|
||||
break;
|
||||
|
||||
case BooleanOperations_ON :
|
||||
S << "ON ";
|
||||
break;
|
||||
|
||||
case BooleanOperations_INOROUT :
|
||||
S << "INOROUT ";
|
||||
break;
|
||||
|
||||
case BooleanOperations_INTERSECTED :
|
||||
S << "INTERSECTED ";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
Standard_Real a,b,c,d,e,f;
|
||||
GetBoundingBox(i).Get(a,b,c,d,e,f);
|
||||
S << " @ " << a << " " << b << " " << c << " " << d << " " << e << " " << f << " @ " ;
|
||||
|
||||
S << " Ancestors :" ;
|
||||
for (j=1;j<=NumberOfAncestors(i);j++)
|
||||
S << " " << GetAncestor(i,j);
|
||||
S << " Successors :" ;
|
||||
for (j=1;j<=NumberOfSuccessors(i);j++)
|
||||
S << " " << GetSuccessor(i,j);
|
||||
/*
|
||||
S << " INTERF = " ;
|
||||
for (j=1;j<=NumberOfInterferences(i);j++)
|
||||
S << " " << GetIntersectedShape(i,j) << " " << GetIntersectionResult(i,j) << " #";
|
||||
*/
|
||||
S << endl;
|
||||
}
|
||||
S << endl;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//function : LightDump
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::LightDump(Standard_OStream& S) const
|
||||
{
|
||||
Standard_Real a,b,c,d,e,f;
|
||||
Standard_Integer i;
|
||||
TopAbs_ShapeEnum T;
|
||||
|
||||
S<<endl<<"BooleanOperations_ShapesDataStructure::Dump()"<<endl;
|
||||
S<<endl<<"myLength = "<<myLength;
|
||||
S<<endl<<"myNumberOfInsertedShapes = "<<myNumberOfInsertedShapes;
|
||||
S<<endl<<"myNumberOfShapesOfTheTool = "<<myNumberOfShapesOfTheTool;
|
||||
S<<endl<<"myNumberOfShapesOfTheObject = "<<myNumberOfShapesOfTheObject<<endl;
|
||||
|
||||
for (i=1;i<=myNumberOfInsertedShapes;i++)
|
||||
{
|
||||
S << "---";
|
||||
if (i < 10) cout<< " ";
|
||||
if (i < 100) cout<< " ";
|
||||
if (i < 1000) cout<< " ";
|
||||
cout << i << " --- ";
|
||||
T = GetShape(i).ShapeType();
|
||||
switch(T)
|
||||
{
|
||||
case TopAbs_VERTEX :
|
||||
S << "VERTEX ";
|
||||
break;
|
||||
|
||||
case TopAbs_EDGE :
|
||||
S << "EDGE ";
|
||||
break;
|
||||
|
||||
case TopAbs_WIRE :
|
||||
S << "WIRE ";
|
||||
break;
|
||||
|
||||
case TopAbs_FACE :
|
||||
S << "FACE ";
|
||||
break;
|
||||
|
||||
case TopAbs_SHELL :
|
||||
S << "SHELL ";
|
||||
break;
|
||||
|
||||
case TopAbs_SOLID :
|
||||
S << "SOLID ";
|
||||
break;
|
||||
|
||||
case TopAbs_COMPSOLID :
|
||||
S << "COMPSOLID";
|
||||
break;
|
||||
|
||||
case TopAbs_COMPOUND :
|
||||
S << "COMPOUND ";
|
||||
break;
|
||||
|
||||
case TopAbs_SHAPE :
|
||||
S << "SHAPE";
|
||||
break;
|
||||
}
|
||||
GetBoundingBox(i).Get(a,b,c,d,e,f);
|
||||
S << " @ " << a << " " << b << " " << c << " " << d << " " << e << " " << f << endl;
|
||||
}
|
||||
S << endl;
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetOrientation
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
TopAbs_Orientation
|
||||
BooleanOperations_ShapesDataStructure::GetOrientation(const Standard_Integer index,
|
||||
const Standard_Integer successorNumber) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)||(successorNumber<1)||(successorNumber>NumberOfSuccessors(index))) {
|
||||
Message(1);
|
||||
}
|
||||
if (GetShapeType(index) == TopAbs_VERTEX) {
|
||||
Message(2);
|
||||
}
|
||||
return myListOfShapeAndInterferences[index-1].GetOrientation(successorNumber);
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetOrientations
|
||||
//purpose : returns the array of orientations
|
||||
//===========================================================================
|
||||
void
|
||||
BooleanOperations_ShapesDataStructure::GetOrientations(const Standard_Integer index,
|
||||
Standard_Address& theArrayOfOrientations,
|
||||
Standard_Integer& orientationsNumber) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
if (GetShapeType(index) == TopAbs_VERTEX) {
|
||||
Message(2);
|
||||
}
|
||||
myListOfShapeAndInterferences[index-1].GetOrientations(theArrayOfOrientations,orientationsNumber);
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Feb 2 14:44:08 2005f
|
||||
/*
|
||||
#ifdef WNT
|
||||
#pragma warning ( default : 4291 )
|
||||
#endif
|
||||
*/
|
||||
/*
|
||||
//===========================================================================
|
||||
//function : InsertInterference
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
void BooleanOperations_ShapesDataStructure::InsertInterference(const Standard_Integer index,
|
||||
const BooleanOperations_InterferenceResult&)// IR)
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Feb 2 13:02:32 2005ft
|
||||
// myListOfShapeAndInterferences[index-1].SetInterference(IR);
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetInterference
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
const BooleanOperations_InterferenceResult&
|
||||
BooleanOperations_ShapesDataStructure::GetInterference(const Standard_Integer index,
|
||||
const Standard_Integer interfNumber) const
|
||||
{
|
||||
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Feb 2 13:04:12 2005f
|
||||
//return myListOfShapeAndInterferences[index-1].GetInterference(interfNumber);
|
||||
|
||||
static BooleanOperations_InterferenceResult aIR;
|
||||
return aIR;
|
||||
//modified by NIZNHY-PKV Wed Feb 2 13:04:22 2005t
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//function : GetIntersectedShape
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer
|
||||
BooleanOperations_ShapesDataStructure::GetIntersectedShape(const Standard_Integer index,
|
||||
const Standard_Integer interfNumber) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Feb 2 13:04:39 2005f
|
||||
//return myListOfShapeAndInterferences[index-1].GetIntersectedShape(interfNumber);
|
||||
return 0;
|
||||
//modified by NIZNHY-PKV Wed Feb 2 13:04:45 2005t
|
||||
}
|
||||
//===========================================================================
|
||||
//function : GetIntersectionResult
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer
|
||||
BooleanOperations_ShapesDataStructure::GetIntersectionResult (const Standard_Integer index,
|
||||
const Standard_Integer interfNumber) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Feb 2 13:05:36 2005f
|
||||
//return myListOfShapeAndInterferences[index-1].GetIntersectionResult(interfNumber);
|
||||
return 0;
|
||||
//modified by NIZNHY-PKV Wed Feb 2 13:04:45 2005t
|
||||
}
|
||||
//===========================================================================
|
||||
//function : NumberOfInterferences
|
||||
//purpose :
|
||||
//===========================================================================
|
||||
Standard_Integer
|
||||
BooleanOperations_ShapesDataStructure::NumberOfInterferences(const Standard_Integer index) const
|
||||
{
|
||||
if ((index<1)||(index>myNumberOfInsertedShapes)) {
|
||||
Message(1);
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Feb 2 13:06:43 2005f
|
||||
//return myListOfShapeAndInterferences[index-1].NumberOfInterferences();
|
||||
return 0;
|
||||
//modified by NIZNHY-PKV Wed Feb 2 13:04:45 2005t
|
||||
}
|
||||
|
||||
*/
|
||||
//modified by NIZNHY-PKV Wed Feb 2 14:44:11 2005t
|
Reference in New Issue
Block a user