Salome HOME
Modified a method createAndDisplayGO
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_PassKeyShape.cxx
1 // File:        GEOMAlgo_PassKeyShape.cxx
2 // Created:     
3 // Author:      Peter KURNEV
4 //              <pkv@irinox>
5
6
7 #include <GEOMAlgo_PassKeyShape.ixx>
8
9 #include <stdio.h>
10 #include <string.h>
11
12 #include <TopTools_ListIteratorOfListOfShape.hxx>
13 #include <TColStd_ListOfInteger.hxx>
14
15 //=======================================================================
16 //function :
17 //purpose  : 
18 //=======================================================================
19   GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape()
20 :
21   GEOMAlgo_PassKey()
22 {
23   myUpper=432123;
24   GEOMAlgo_PassKey::Clear();
25 }
26 //=======================================================================
27 //function :SetIds
28 //purpose  : 
29 //=======================================================================
30   void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1)
31                                
32 {
33   Standard_Integer anId1;
34   //
35   anId1=aS1.HashCode(myUpper);
36   GEOMAlgo_PassKey::SetIds(anId1);
37 }
38 //=======================================================================
39 //function :SetIds
40 //purpose  : 
41 //=======================================================================
42   void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1,
43                                      const TopoDS_Shape& aS2)
44 {
45   Standard_Integer anId1, anId2;
46   //
47   anId1=aS1.HashCode(myUpper);
48   anId2=aS2.HashCode(myUpper);
49   //
50   GEOMAlgo_PassKey::SetIds(anId1, anId2);
51 }
52 //=======================================================================
53 //function :SetIds
54 //purpose  : 
55 //=======================================================================
56   void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1,
57                                      const TopoDS_Shape& aS2,
58                                      const TopoDS_Shape& aS3)
59 {
60   Standard_Integer anId1, anId2, anId3;
61   //
62   anId1=aS1.HashCode(myUpper);
63   anId2=aS2.HashCode(myUpper);
64   anId3=aS3.HashCode(myUpper);
65   //
66   GEOMAlgo_PassKey::SetIds(anId1, anId2, anId3);
67 }
68 //=======================================================================
69 //function :SetIds
70 //purpose  : 
71 //=======================================================================
72   void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1,
73                                 const TopoDS_Shape& aS2,
74                                 const TopoDS_Shape& aS3,
75                                 const TopoDS_Shape& aS4)
76 {
77   Standard_Integer anId1, anId2, anId3, anId4;
78   //
79   anId1=aS1.HashCode(myUpper);
80   anId2=aS2.HashCode(myUpper);
81   anId3=aS3.HashCode(myUpper);
82   anId4=aS4.HashCode(myUpper);
83   //
84   GEOMAlgo_PassKey::SetIds(anId1, anId2, anId3, anId4);
85 }
86 //=======================================================================
87 //function :SetIds
88 //purpose  : 
89 //=======================================================================
90   void GEOMAlgo_PassKeyShape::SetIds(const TopTools_ListOfShape& aLS)
91 {
92   Standard_Integer anId;
93   TopTools_ListIteratorOfListOfShape aIt;
94   TColStd_ListOfInteger aLI;
95   //
96   //aNb=aLS.Extent();
97   //if (aNb<1 || aNb > myNbMax) {
98   //  return;
99   //}
100   //
101   //myNbIds=aNb;
102   //mySum=0;
103   //i=myNbMax-myNbIds;
104   
105   aIt.Initialize(aLS);
106   for (; aIt.More(); aIt.Next()) {
107     const TopoDS_Shape& aS=aIt.Value();
108     anId=aS.HashCode(myUpper);
109     aLI.Append(anId);
110   }
111   GEOMAlgo_PassKey::SetIds(aLI);
112 }