1 |
francois |
1158 |
//####//------------------------------------------------------------ |
2 |
|
|
//####//------------------------------------------------------------ |
3 |
|
|
//####// MAGiC |
4 |
|
|
//####// Jean Christophe Cuilliere et Vincent FRANCOIS |
5 |
|
|
//####// Departement de Genie Mecanique - UQTR |
6 |
|
|
//####//------------------------------------------------------------ |
7 |
|
|
//####// MAGIC est un projet de recherche de l equipe ERICCA |
8 |
|
|
//####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres |
9 |
|
|
//####// http://www.uqtr.ca/ericca |
10 |
|
|
//####// http://www.uqtr.ca/ |
11 |
|
|
//####//------------------------------------------------------------ |
12 |
|
|
//####//------------------------------------------------------------ |
13 |
|
|
//####// |
14 |
|
|
//####// CAD4FE_MCVertex.cpp |
15 |
|
|
//####// |
16 |
|
|
//####//------------------------------------------------------------ |
17 |
|
|
//####//------------------------------------------------------------ |
18 |
|
|
//####// COPYRIGHT 2000-2024 |
19 |
|
|
//####// jeu 13 jun 2024 11:58:54 EDT |
20 |
|
|
//####//------------------------------------------------------------ |
21 |
|
|
//####//------------------------------------------------------------ |
22 |
foucault |
27 |
#include <vector> |
23 |
|
|
#include <sstream> |
24 |
|
|
#pragma hdrstop |
25 |
|
|
|
26 |
|
|
#include "gestionversion.h" |
27 |
|
|
#include "mg_point.h" |
28 |
|
|
#include "lc_point.h" |
29 |
foucault |
569 |
#include "CAD4FE_MCVertex.h" |
30 |
francois |
283 |
|
31 |
foucault |
569 |
#include "CAD4FE_MCEdge.h" |
32 |
francois |
283 |
#include "ot_algorithme_geometrique.h" |
33 |
foucault |
27 |
|
34 |
|
|
#ifdef __BORLANDC__ |
35 |
|
|
#pragma warn -8012 |
36 |
|
|
#endif |
37 |
|
|
|
38 |
|
|
using namespace CAD4FE; |
39 |
|
|
|
40 |
|
|
MCVertex::MCVertex(MG_SOMMET *__vertex) |
41 |
foucault |
569 |
: MG_SOMMET(std::string("MC")+std::string(__vertex->get_idoriginal()), __vertex->get_point()), _ref_vertex(__vertex) |
42 |
|
|
{ |
43 |
|
|
time = 0; |
44 |
francois |
830 |
transfert_ccf(*__vertex); |
45 |
foucault |
27 |
} |
46 |
|
|
|
47 |
|
|
MG_SOMMET * MCVertex::GetRefVertex() |
48 |
|
|
{ |
49 |
foucault |
569 |
return _ref_vertex; |
50 |
foucault |
27 |
} |
51 |
|
|
|
52 |
francois |
763 |
void MCVertex::enregistrer(std::ostream& o,double version) |
53 |
foucault |
27 |
{ |
54 |
|
|
o <<"%" << get_id() << "=CAD4FE_MCVERTEX("<< get_idoriginal() << ",$" << GetRefVertex()->get_id() ; |
55 |
|
|
o <<","<<_lst_vertices.size(); |
56 |
|
|
o <<",("; |
57 |
|
|
for (std::map<unsigned long , MG_SOMMET*>::iterator itRefVertex = _lst_vertices.begin(); |
58 |
foucault |
569 |
itRefVertex != _lst_vertices.end(); |
59 |
|
|
itRefVertex ++) |
60 |
|
|
{ |
61 |
|
|
if (itRefVertex != _lst_vertices.begin()) |
62 |
|
|
o << ","; |
63 |
|
|
o << "$"<< itRefVertex->first; |
64 |
|
|
} |
65 |
foucault |
27 |
o << ")"; |
66 |
|
|
o << "," << get_nb_ccf(); |
67 |
|
|
if (get_nb_ccf()!=0) |
68 |
|
|
{ |
69 |
foucault |
569 |
o << ",("; |
70 |
|
|
for (int i=0;i<get_nb_ccf();i++) |
71 |
|
|
{ |
72 |
|
|
char nom[3]; |
73 |
|
|
get_type_ccf(i,nom); |
74 |
|
|
o << "(" << nom << "," << get_valeur_ccf(i) << ")"; |
75 |
|
|
if (i!=get_nb_ccf()-1) o << "," ; |
76 |
|
|
} |
77 |
|
|
o << ")"; |
78 |
foucault |
27 |
} |
79 |
|
|
o << ");" << std::endl; |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
void MCVertex::MergeRefVertex(MG_SOMMET* __refVertex) |
83 |
|
|
{ |
84 |
|
|
_lst_vertices[__refVertex->get_id()] = __refVertex; |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
void MCVertex::Merge(MCVertex * __mcVertex) |
88 |
|
|
{ |
89 |
|
|
_lst_vertices[__mcVertex->GetRefVertex()->get_id()] = __mcVertex->GetRefVertex(); |
90 |
|
|
for (std::map<unsigned long, MG_SOMMET *>::const_iterator it=__mcVertex->_lst_vertices.begin(); it != __mcVertex->_lst_vertices.end(); it++) |
91 |
foucault |
569 |
_lst_vertices.insert(std::make_pair(it->first,it->second)); |
92 |
foucault |
27 |
} |
93 |
|
|
|
94 |
foucault |
569 |
std::map<unsigned long, MG_SOMMET * > & MCVertex::GetMergedRefVertices() |
95 |
foucault |
27 |
{ |
96 |
|
|
return _lst_vertices; |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
bool MCVertex::Contains(MG_SOMMET* __refVertex) const |
100 |
|
|
{ |
101 |
|
|
return _ref_vertex==__refVertex || _lst_vertices.find(__refVertex->get_id()) != _lst_vertices.end(); |
102 |
|
|
} |
103 |
|
|
|
104 |
foucault |
569 |
void MCVertex::RemoveRefVertex(MG_SOMMET * __refVertex) |
105 |
foucault |
27 |
{ |
106 |
|
|
std::map<unsigned long, MG_SOMMET*>::iterator itRefVertex = _lst_vertices.find(__refVertex->get_id()); |
107 |
|
|
if (itRefVertex != _lst_vertices.end()) |
108 |
foucault |
569 |
{ |
109 |
|
|
_lst_vertices.erase(itRefVertex); |
110 |
|
|
} |
111 |
foucault |
27 |
} |