1 // Created on: 1997-10-22
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <TopOpeBRepDS_traceDSX.hxx>
20 //////////////////////////////////////////////////////////////
22 TopOpeBRepDS_traceDS::TopOpeBRepDS_traceDS()
25 void TopOpeBRepDS_traceDS::SetHDS(const Handle(TopOpeBRepDS_HDataStructure)& HDS)
33 void TopOpeBRepDS_traceDS::Allocate()
35 Standard_Integer n = Nelem();
36 Standard_Boolean all = (myhe.IsNull()) || (n > myne);
39 myhe = new TColStd_HArray1OfBoolean(0,n);
40 myhe->Init(Standard_False);
45 Standard_Integer TopOpeBRepDS_traceDS::Nelem() const
50 const Handle(TopOpeBRepDS_HDataStructure)& TopOpeBRepDS_traceDS::GetHDS() const
55 void TopOpeBRepDS_traceDS::Set(const Standard_Integer ie, const Standard_Boolean b)
58 if (!(ie>=1 && ie<=myne)) return;
62 void TopOpeBRepDS_traceDS::Set(const Standard_Boolean b, Standard_Integer na, char** a)
66 if (!na) myhe->Init(b);
67 else for (ia=0; ia<na; ia++) Set(atoi(a[ia]),b);
70 Standard_Boolean TopOpeBRepDS_traceDS::GetI(const Standard_Integer ie) const
72 if (myhe.IsNull()) return Standard_False;
73 if (!(ie>=1 && ie<=myne)) return Standard_False;
74 return myhe->Value(ie);
77 //////////////////////////////////////////////////////////////
79 TopOpeBRepDS_traceCURVE::TopOpeBRepDS_traceCURVE(){}
80 Standard_Integer TopOpeBRepDS_traceCURVE::Nelem() const
82 if (myHDS.IsNull()) return 0;
83 else return myHDS->NbCurves();
86 //////////////////////////////////////////////////////////////
89 #include <TopTools_IndexedMapOfShape.hxx>
91 TopOpeBRepDS_traceSHAPE::TopOpeBRepDS_traceSHAPE() {myns = 0;}
92 void TopOpeBRepDS_traceSHAPE::SetSS(const TopoDS_Shape& s1,const TopoDS_Shape& s2)
94 TopTools_IndexedMapOfShape M;
96 //JMB s1 ou s2 peut etre nul (voir ChFi3d chez lvt)
98 TopExp::MapShapes(s1,M);
100 Standard_Integer n1 = M.Extent();
103 TopExp::MapShapes(s2,M);
105 Standard_Integer n2 = M.Extent();
109 void TopOpeBRepDS_traceSHAPE::SetSSHDS(const TopoDS_Shape& s1,const TopoDS_Shape& s2,const Handle(TopOpeBRepDS_HDataStructure)& HDS)
115 Standard_Integer TopOpeBRepDS_traceSHAPE::Nelem() const
120 Standard_Integer TopOpeBRepDS_traceSHAPE::Index(const TopoDS_Shape& S) const
122 if (myHDS.IsNull()) return 0;
123 Standard_Integer i = myHDS->Shape(S);
127 Standard_Boolean TopOpeBRepDS_traceSHAPE::GetS(const TopoDS_Shape& S) const
129 if (myHDS.IsNull()) return Standard_False;
130 Standard_Integer is = myHDS->Shape(S);
131 Standard_Boolean b = GetI(is);
135 //////////////////////////////////////////////////////////////
136 static TopOpeBRepDS_traceCURVE VCX;
137 Standard_EXPORT void TopOpeBRepDS_SettraceCX(const Standard_Boolean b,Standard_Integer n,char** a) { VCX.Set(b,n,a); }
138 Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceCX(const Standard_Integer i) { return VCX.GetI(i); }
140 //////////////////////////////////////////////////////////////
141 static TopOpeBRepDS_traceSHAPE VSPSX;
142 static TopOpeBRepDS_traceSHAPE VSPSXX;
144 Standard_EXPORT void TopOpeBRepDS_SettraceSPSX(const Standard_Boolean b,Standard_Integer n,char** a) { VSPSX.Set(b,n,a); }
145 Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer i) { return VSPSX.GetI(i); }
146 Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceSPSX(const TopoDS_Shape& S) { return VSPSX.GetS(S); }
147 Standard_EXPORT Standard_Integer TopOpeBRepDS_GetindexSPSX(const TopoDS_Shape& S) { return VSPSX.Index(S); }
148 Standard_EXPORT void TopOpeBRepDS_SettraceSPSX(const Standard_Integer i,const Standard_Boolean b) { VSPSX.Set(i,b); }
149 Standard_EXPORT void TopOpeBRepDS_SettraceSPSXX(const Standard_Boolean b, Standard_Integer n, char** a) { VSPSXX.Set(b,n,a);}
150 Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceSPSXX(const Standard_Integer i1,const Standard_Integer i2)
151 { Standard_Boolean b1 = VSPSXX.GetI(i1); Standard_Boolean b2 = VSPSXX.GetI(i2); return (b1 && b2); }
152 Standard_EXPORT void TopOpeBRepDS_SettraceSPSX_SS(const TopoDS_Shape& S1,const TopoDS_Shape& S2)
153 { VSPSX.SetSS(S1,S2); VSPSXX.SetSS(S1,S2); }
154 Standard_EXPORT void TopOpeBRepDS_SettraceSPSX_HDS(const Handle(TopOpeBRepDS_HDataStructure)& HDS)
155 { VSPSX.SetHDS(HDS); VSPSXX.SetHDS(HDS); }
156 Standard_EXPORT void TopOpeBRepDS_SettraceSPSX_SSHDS
157 (const TopoDS_Shape& a,const TopoDS_Shape& b,const Handle(TopOpeBRepDS_HDataStructure)& HDS)
158 { VSPSX.SetSSHDS(a,b,HDS); VSPSXX.SetSSHDS(a,b,HDS); }