ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/CAD4FE_MCVertex.cpp
Revision: 569
Committed: Thu Oct 16 14:36:31 2014 UTC (10 years, 6 months ago) by foucault
File size: 2398 byte(s)
Log Message:
Mise à jour pour CAD4FE (Gilles) : operation 1 (tentative)

File Contents

# User Rev Content
1 foucault 27 #include <vector>
2     #include <sstream>
3     #pragma hdrstop
4    
5     #include "gestionversion.h"
6     #include "mg_point.h"
7     #include "lc_point.h"
8 foucault 569 #include "CAD4FE_MCVertex.h"
9 francois 283
10 foucault 569 #include "CAD4FE_MCEdge.h"
11 francois 283 #include "ot_algorithme_geometrique.h"
12 foucault 27
13     #ifdef __BORLANDC__
14     #pragma warn -8012
15     #endif
16    
17     using namespace CAD4FE;
18    
19     MCVertex::MCVertex(MG_SOMMET *__vertex)
20 foucault 569 : MG_SOMMET(std::string("MC")+std::string(__vertex->get_idoriginal()), __vertex->get_point()), _ref_vertex(__vertex)
21     {
22     time = 0;
23     copie_ccf(*__vertex);
24 foucault 27 }
25    
26     MG_SOMMET * MCVertex::GetRefVertex()
27     {
28 foucault 569 return _ref_vertex;
29 foucault 27 }
30    
31     void MCVertex::enregistrer(std::ostream& o)
32     {
33     o <<"%" << get_id() << "=CAD4FE_MCVERTEX("<< get_idoriginal() << ",$" << GetRefVertex()->get_id() ;
34     o <<","<<_lst_vertices.size();
35     o <<",(";
36     for (std::map<unsigned long , MG_SOMMET*>::iterator itRefVertex = _lst_vertices.begin();
37 foucault 569 itRefVertex != _lst_vertices.end();
38     itRefVertex ++)
39     {
40     if (itRefVertex != _lst_vertices.begin())
41     o << ",";
42     o << "$"<< itRefVertex->first;
43     }
44 foucault 27 o << ")";
45     o << "," << get_nb_ccf();
46     if (get_nb_ccf()!=0)
47     {
48 foucault 569 o << ",(";
49     for (int i=0;i<get_nb_ccf();i++)
50     {
51     char nom[3];
52     get_type_ccf(i,nom);
53     o << "(" << nom << "," << get_valeur_ccf(i) << ")";
54     if (i!=get_nb_ccf()-1) o << "," ;
55     }
56     o << ")";
57 foucault 27 }
58     o << ");" << std::endl;
59     }
60    
61     void MCVertex::MergeRefVertex(MG_SOMMET* __refVertex)
62     {
63     _lst_vertices[__refVertex->get_id()] = __refVertex;
64     }
65    
66     void MCVertex::Merge(MCVertex * __mcVertex)
67     {
68     _lst_vertices[__mcVertex->GetRefVertex()->get_id()] = __mcVertex->GetRefVertex();
69     for (std::map<unsigned long, MG_SOMMET *>::const_iterator it=__mcVertex->_lst_vertices.begin(); it != __mcVertex->_lst_vertices.end(); it++)
70 foucault 569 _lst_vertices.insert(std::make_pair(it->first,it->second));
71 foucault 27 }
72    
73 foucault 569 std::map<unsigned long, MG_SOMMET * > & MCVertex::GetMergedRefVertices()
74 foucault 27 {
75     return _lst_vertices;
76     }
77    
78     bool MCVertex::Contains(MG_SOMMET* __refVertex) const
79     {
80     return _ref_vertex==__refVertex || _lst_vertices.find(__refVertex->get_id()) != _lst_vertices.end();
81     }
82    
83 foucault 569 void MCVertex::RemoveRefVertex(MG_SOMMET * __refVertex)
84 foucault 27 {
85     std::map<unsigned long, MG_SOMMET*>::iterator itRefVertex = _lst_vertices.find(__refVertex->get_id());
86     if (itRefVertex != _lst_vertices.end())
87 foucault 569 {
88     _lst_vertices.erase(itRefVertex);
89     }
90 foucault 27 }