2 # Copyright (C) 2007-2021 EDF R&D
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 from __future__ import absolute_import
25 from __future__ import print_function
27 from builtins import object
32 from .N_UserASSD import UserASSD
33 from .N_ASSD import ASSD
36 from collections import UserList
38 from UserList import UserList
40 class UserASSDMultiple(UserASSD):
42 Classe de base pour definir des types de structures de donnees definie par
44 equivalent d un concept ASSD pour un SIMP ou un FACT
45 mais pouvant referencer 2 objets par exemple les groupes de mailles qui peuvent porter
46 le meme nom dans 2 maillages differents
48 def __init__(self,nom='sansNom'):
49 #print ('dans init de UserASSDMultiple ',nom)
50 UserASSD.__init__(self,nom)
53 def ajouteUnPere(self,pere):
54 #print ('dans ajouteUnPere', self.peres, self.nom, pere)
55 if pere not in self.peres : self.peres.append(pere)
56 etape = pere.getEtape()
57 if self not in etape.userASSDCrees : etape.userASSDCrees.append(self)
59 def renomme(self,nouveauNom):
60 print ('je passe dans renomme')
62 #traceback.print_stack()
63 self.jdc.delConcept(self.nom)
64 self.jdc.sdsDict[nouveauNom] = self
65 self.setName(nouveauNom)
66 for mc in (self.utilisePar):
70 def initialiseParent(self, pere):
71 # surcharge N_UserASSD parent ici n a pas de sens
74 def deleteReference(self,mcCreateur):
75 print ('je passe dans deleteReference', mcCreateur.nom)
76 if not(mcCreateur in self.peres) : return
77 self.peres.pop(self.peres.index(mcCreateur))
78 if len(self.peres)==0 :
79 UserASSD.deleteReference(self)
82 def getParentsWithId(self):
83 #print ('je suis dans getParentsWithId ')
84 listeRetour= listUserASSD()
85 for pere in self.peres :
86 pereWithId = pere.parent
87 monEtape = pere.getEtape()
89 if pereWithId==monEtape :
90 listeRetour.append(pereWithId)
92 if pereWithId.estIdentifiePar != None :
93 listeRetour.append(pereWithId)
95 pereWithId=pereWithId.parent
99 listeRetour= listUserASSD()
100 for pere in self.peres :
101 if pere.etape not in listeRetour : listeRetour.append(pere.etape)
105 class listUserASSD(UserList):
107 def getListeMotsCles(self,nomMc):
108 if self.data == None : return []
110 for concept in self.data:
111 listeRetour.append(concept.getChild(nomMc).val)
114 def getListeNomsUserASSD(self,nomMc):
115 if self.data == None : return []
117 for concept in self.data:
118 listeRetour.append(concept.getChild(nomMc).val.nom)
121 def getListeUserASSD(self,nomMc):
122 if self.data == None : return []
124 for concept in self.data:
125 if concept.getChild(nomMc) :
126 if concept.getChild(nomMc).val :
127 listeRetour.append(concept.getChild(nomMc).val)