ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/CAD4FE_MCVertex.cpp
Revision: 253
Committed: Tue Jul 13 19:40:46 2010 UTC (14 years, 10 months ago) by francois
File size: 2401 byte(s)
Log Message:
changement de hiearchie et utilisation de ccmake + mise a jour

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     #include "CAD4FE_MCVertex.h"
9    
10     #include "CAD4FE_MCEdge.h"
11     #include "ot_algorithme_geometrique.h"
12    
13     #ifdef __BORLANDC__
14     #pragma warn -8012
15     #endif
16    
17     using namespace CAD4FE;
18    
19     MCVertex::MCVertex(MG_SOMMET *__vertex)
20     : 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     }
25    
26     MG_SOMMET * MCVertex::GetRefVertex()
27     {
28     return _ref_vertex;
29     }
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     itRefVertex != _lst_vertices.end();
38     itRefVertex ++)
39     {
40     if (itRefVertex != _lst_vertices.begin())
41     o << ",";
42     o << "$"<< itRefVertex->first;
43     }
44     o << ")";
45     o << "," << get_nb_ccf();
46     if (get_nb_ccf()!=0)
47     {
48     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     }
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     _lst_vertices.insert(std::make_pair(it->first,it->second));
71     }
72    
73     std::map<unsigned long, MG_SOMMET * > & MCVertex::GetMergedRefVertices()
74     {
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     void MCVertex::RemoveRefVertex(MG_SOMMET * __refVertex)
84     {
85     std::map<unsigned long, MG_SOMMET*>::iterator itRefVertex = _lst_vertices.find(__refVertex->get_id());
86     if (itRefVertex != _lst_vertices.end())
87     {
88     _lst_vertices.erase(itRefVertex);
89     }
90     }