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

File Contents

# User Rev Content
1 foucault 27 #pragma hdrstop
2    
3     #include "gestionversion.h"
4    
5     #include "CAD4FE_MCEdge.h"
6     #include "math.h"
7     #include "CAD4FE_MCVertex.h"
8     #include "CAD4FE_MCFace.h"
9     #include "CAD4FE_PolyCurve.h"
10     #include "ot_algorithme_geometrique.h"
11    
12     #include <sstream>
13     #include <string>
14    
15     #ifdef __BORLANDC__
16     #pragma warn -8012
17     #pragma warn -8037
18     #endif
19    
20     using namespace CAD4FE;
21    
22     MCEdge::MCEdge(MG_ARETE * __refEdge)
23     : MG_ARETE(std::string("MC")+std::string(__refEdge->get_idoriginal()), new PolyCurve(__refEdge), 1)
24     {
25     time = 0;
26     copie_ccf(*__refEdge);
27     }
28    
29     MCEdge::MCEdge(std::string __idOriginal, PolyCurve * __polycurve)
30     : MG_ARETE(__idOriginal, (PolyCurve*)__polycurve, 1)
31     {
32     time = 0;
33     }
34    
35     MCEdge::~MCEdge()
36     {
37     }
38    
39     // Warning 1 : the graph node __G1Node MUST have a name
40     // Warning 2 : the graph arc G2Arc(__G1Node) MUST be connected to the adjacent faces of the swEdge
41     MCEdge::MCEdge(std::string __idoriginal, MCEdge & __A, MCEdge & __B)
42     : MG_ARETE(__idoriginal, new PolyCurve(), 1)
43     {
44     time = 0;
45    
46     GetPolyCurve()->Merge (*__A.GetPolyCurve());
47     GetPolyCurve()->Merge (*__B.GetPolyCurve());
48     copie_ccf(__A);
49     copie_ccf(__B);
50    
51     _CopyMeshLink(__A);
52     _CopyMeshLink(__B);
53     }
54    
55     void MCEdge::_CopyMeshLink( MCEdge & __mcEdge)
56     {
57     int i;
58     TPL_SET<MG_ELEMENT_MAILLAGE*> * lien_maillage = __mcEdge.get_lien_maillage();
59     TPL_SET<MG_ELEMENT_MAILLAGE*>::ITERATEUR it;
60    
61     for (MG_ELEMENT_MAILLAGE* element = lien_maillage->get_premier(it);element;element = lien_maillage->get_suivant(it))
62     {
63     element->change_lien_topologie2(this);
64     get_lien_maillage()->ajouter(element);
65    
66     MG_SEGMENT * seg = (MG_SEGMENT *) element;
67     MG_NOEUD * nos[2];
68     nos[0] = seg->get_noeud1();
69     nos[1] = seg->get_noeud2();
70     for (i=0; i<2; i++)
71     {
72     if (!nos[i]->get_lien_topologie() || nos[i]->get_lien_topologie()->get_dimension() >= 1)
73     nos[i]->change_lien_topologie2(this);
74     }
75     }
76     }
77    
78     PolyCurve *
79     MCEdge::GetPolyCurve ( )
80     {
81     return (PolyCurve *) get_courbe();
82     }
83    
84     void MCEdge::enregistrer(std::ostream& o)
85     {
86     int nb=get_nb_ccf();
87     o << "%" << get_id() << "=CAD4FE_MCEDGE("<< get_idoriginal() << ",$" << get_courbe()->get_id() << ",$"<<get_cosommet1()->get_id() << ",$" <<get_cosommet2()->get_id() << "," << get_orientation() << "," << nb;
88     if (nb!=0)
89     {
90     o << ",(";
91     for (int i=0;i<nb;i++)
92     {
93     char nom[3];
94     get_type_ccf(i,nom);
95     o << "(" << nom << "," << get_valeur_ccf(i) << ")";
96     if (i!=nb-1) o << "," ;
97     }
98     o << ")";
99     }
100     o << ");" << std::endl;
101     }
102