]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMAlgo/GEOMAlgo_PassKeyShape.cxx
Salome HOME
PAL12607: Static objects in Geometry GUI libraries.
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_PassKeyShape.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 // File:        GEOMAlgo_PassKeyShape.cxx
21 // Created:     
22 // Author:      Peter KURNEV
23 //              <pkv@irinox>
24
25
26 #include <GEOMAlgo_PassKeyShape.ixx>
27
28 #include <stdio.h>
29 #include <string.h>
30
31 #include <TopTools_ListIteratorOfListOfShape.hxx>
32 #include <TColStd_ListOfInteger.hxx>
33
34 //=======================================================================
35 //function :
36 //purpose  : 
37 //=======================================================================
38   GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape()
39 :
40   GEOMAlgo_PassKey()
41 {
42   myUpper=432123;
43   GEOMAlgo_PassKey::Clear();
44 }
45 //=======================================================================
46 //function :SetIds
47 //purpose  : 
48 //=======================================================================
49   void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1)
50                                
51 {
52   Standard_Integer anId1;
53   //
54   anId1=aS1.HashCode(myUpper);
55   GEOMAlgo_PassKey::SetIds(anId1);
56 }
57 //=======================================================================
58 //function :SetIds
59 //purpose  : 
60 //=======================================================================
61   void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1,
62                                      const TopoDS_Shape& aS2)
63 {
64   Standard_Integer anId1, anId2;
65   //
66   anId1=aS1.HashCode(myUpper);
67   anId2=aS2.HashCode(myUpper);
68   //
69   GEOMAlgo_PassKey::SetIds(anId1, anId2);
70 }
71 //=======================================================================
72 //function :SetIds
73 //purpose  : 
74 //=======================================================================
75   void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1,
76                                      const TopoDS_Shape& aS2,
77                                      const TopoDS_Shape& aS3)
78 {
79   Standard_Integer anId1, anId2, anId3;
80   //
81   anId1=aS1.HashCode(myUpper);
82   anId2=aS2.HashCode(myUpper);
83   anId3=aS3.HashCode(myUpper);
84   //
85   GEOMAlgo_PassKey::SetIds(anId1, anId2, anId3);
86 }
87 //=======================================================================
88 //function :SetIds
89 //purpose  : 
90 //=======================================================================
91   void GEOMAlgo_PassKeyShape::SetIds(const TopoDS_Shape& aS1,
92                                 const TopoDS_Shape& aS2,
93                                 const TopoDS_Shape& aS3,
94                                 const TopoDS_Shape& aS4)
95 {
96   Standard_Integer anId1, anId2, anId3, anId4;
97   //
98   anId1=aS1.HashCode(myUpper);
99   anId2=aS2.HashCode(myUpper);
100   anId3=aS3.HashCode(myUpper);
101   anId4=aS4.HashCode(myUpper);
102   //
103   GEOMAlgo_PassKey::SetIds(anId1, anId2, anId3, anId4);
104 }
105 //=======================================================================
106 //function :SetIds
107 //purpose  : 
108 //=======================================================================
109   void GEOMAlgo_PassKeyShape::SetIds(const TopTools_ListOfShape& aLS)
110 {
111   Standard_Integer anId;
112   TopTools_ListIteratorOfListOfShape aIt;
113   TColStd_ListOfInteger aLI;
114   //
115   //aNb=aLS.Extent();
116   //if (aNb<1 || aNb > myNbMax) {
117   //  return;
118   //}
119   //
120   //myNbIds=aNb;
121   //mySum=0;
122   //i=myNbMax-myNbIds;
123   
124   aIt.Initialize(aLS);
125   for (; aIt.More(); aIt.Next()) {
126     const TopoDS_Shape& aS=aIt.Value();
127     anId=aS.HashCode(myUpper);
128     aLI.Append(anId);
129   }
130   GEOMAlgo_PassKey::SetIds(aLI);
131 }