1 |
francois |
283 |
//------------------------------------------------------------ |
2 |
|
|
//------------------------------------------------------------ |
3 |
|
|
// MAGiC |
4 |
|
|
// Jean Christophe Cuilli�re et Vincent FRANCOIS |
5 |
|
|
// D�partement de G�nie M�canique - UQTR |
6 |
|
|
//------------------------------------------------------------ |
7 |
|
|
// Le projet MAGIC est un projet de recherche du d�partement |
8 |
|
|
// de g�nie m�canique de l'Universit� du Qu�bec � |
9 |
|
|
// Trois Rivi�res |
10 |
|
|
// Les librairies ne peuvent �tre utilis�es sans l'accord |
11 |
|
|
// des auteurs (contact : francois@uqtr.ca) |
12 |
|
|
//------------------------------------------------------------ |
13 |
|
|
//------------------------------------------------------------ |
14 |
|
|
// |
15 |
|
|
// mg_sommet.cpp |
16 |
|
|
// |
17 |
|
|
//------------------------------------------------------------ |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
// COPYRIGHT 2000 |
20 |
|
|
// Version du 02/03/2006 � 11H22 |
21 |
|
|
//------------------------------------------------------------ |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h" |
26 |
|
|
#include "mg_sommet.h" |
27 |
|
|
#include "vct_sommet.h" |
28 |
|
|
//#include "affiche.h" |
29 |
|
|
//#include "message.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
couturad |
814 |
MG_SOMMET::MG_SOMMET(std::string idori,unsigned long num,MG_POINT* mgpt):MG_ELEMENT_TOPOLOGIQUE(num,idori),point(mgpt),vect(NULL),pole(false) |
34 |
francois |
283 |
{ |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
|
38 |
couturad |
814 |
MG_SOMMET::MG_SOMMET(std::string idori,MG_POINT* mgpt):MG_ELEMENT_TOPOLOGIQUE(idori),point(mgpt),vect(NULL),pole(false) |
39 |
francois |
283 |
{ |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
couturad |
814 |
MG_SOMMET::MG_SOMMET(MG_SOMMET& mdd):MG_ELEMENT_TOPOLOGIQUE(mdd),point(mdd.point),vect(NULL),pole(mdd.pole) |
45 |
francois |
283 |
{ |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
|
49 |
|
|
MG_SOMMET::~MG_SOMMET() |
50 |
|
|
{ |
51 |
|
|
// if (lst_cosommet.size()!=0) afficheur << WARCOSOMMET << this->get_id() << enderr; |
52 |
|
|
if (vect!=NULL) delete vect; |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
|
56 |
|
|
MG_POINT* MG_SOMMET::get_point(void) |
57 |
|
|
{ |
58 |
|
|
return point; |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
void MG_SOMMET::ajouter_mg_cosommet(class MG_COSOMMET* cosom) |
64 |
|
|
{ |
65 |
|
|
lst_cosommet.insert(lst_cosommet.end(),cosom); |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
int MG_SOMMET::get_nb_mg_cosommet(void) |
69 |
|
|
{ |
70 |
|
|
return lst_cosommet.size(); |
71 |
|
|
} |
72 |
|
|
|
73 |
|
|
|
74 |
|
|
void MG_SOMMET::supprimer_mg_cosommet(class MG_COSOMMET* cosom) |
75 |
|
|
{ |
76 |
|
|
std::vector<MG_COSOMMET*>::iterator i; |
77 |
|
|
for (i=lst_cosommet.begin();i!=lst_cosommet.end();i++) |
78 |
|
|
{ |
79 |
|
|
if ((*i)==cosom) |
80 |
|
|
{ |
81 |
|
|
lst_cosommet.erase(i); |
82 |
|
|
return; |
83 |
|
|
} |
84 |
|
|
} |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
void MG_SOMMET::get_topologie_sousjacente(TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> *lst) |
88 |
|
|
{ |
89 |
|
|
} |
90 |
|
|
|
91 |
|
|
|
92 |
|
|
MG_COSOMMET* MG_SOMMET::get_mg_cosommet(int num) |
93 |
|
|
{ |
94 |
|
|
return lst_cosommet[num]; |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
int MG_SOMMET::get_dimension(void) |
98 |
|
|
{ |
99 |
|
|
return 0; |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
VCT& MG_SOMMET::get_vectorisation(void) |
103 |
|
|
{ |
104 |
|
|
if (vect==NULL) vect=new VCT_SOMMET(this); |
105 |
|
|
return *vect; |
106 |
|
|
} |
107 |
francois |
526 |
|
108 |
|
|
|
109 |
|
|
bool MG_SOMMET::est_un_sommet_noeud(void) |
110 |
|
|
{ |
111 |
|
|
return false; |
112 |
|
|
} |
113 |
couturad |
814 |
|
114 |
|
|
bool MG_SOMMET::est_pole(void) |
115 |
|
|
{ |
116 |
|
|
return pole; |
117 |
|
|
} |
118 |
|
|
void MG_SOMMET::change_pole(bool val) |
119 |
|
|
{ |
120 |
|
|
pole=val; |
121 |
|
|
} |
122 |
|
|
|
123 |
francois |
763 |
void MG_SOMMET::enregistrer(std::ostream& o,double version) |
124 |
francois |
283 |
{ |
125 |
|
|
int nb=get_nb_ccf(); |
126 |
francois |
763 |
o <<"%" << get_id() << "=SOMMET("<< get_idoriginal() << ",$" << point->get_id() << "," ; |
127 |
couturad |
814 |
if (pole) o << "1,"; else o << "0,"; |
128 |
francois |
763 |
if (version<2) |
129 |
|
|
{ |
130 |
|
|
o << nb; |
131 |
francois |
283 |
if (nb!=0) |
132 |
|
|
{ |
133 |
|
|
o << ",("; |
134 |
|
|
for (int i=0;i<nb;i++) |
135 |
|
|
{ |
136 |
|
|
char nom[3]; |
137 |
|
|
get_type_ccf(i,nom); |
138 |
|
|
o << "(" << nom << "," << get_valeur_ccf(i) << ")"; |
139 |
|
|
if (i!=nb-1) o << "," ; |
140 |
|
|
} |
141 |
|
|
o << ")"; |
142 |
|
|
} |
143 |
francois |
763 |
} |
144 |
|
|
else enregistrer_ccf(o,version); |
145 |
francois |
283 |
o << ");" << std::endl; |
146 |
|
|
} |
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|