ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/CAD4FE_MCEdge.cpp
Revision: 5
Committed: Tue Jun 12 20:26:34 2007 UTC (17 years, 11 months ago)
Original Path: magic/lib/geometrie/geometrie/src/CAD4FE_MCEdge.cpp
File size: 3166 byte(s)
Log Message:

File Contents

# User Rev Content
1 5 #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(__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     if (element->get_dimension()==1)
64     {
65     element->change_lien_topologie2(this);
66     get_lien_maillage()->ajouter(element);
67    
68     MG_SEGMENT * seg = (MG_SEGMENT *) element;
69     MG_NOEUD * nos[2];
70     nos[0] = seg->get_noeud1();
71     nos[1] = seg->get_noeud2();
72     for (i=0; i<2; i++)
73     {
74     if (!nos[i]->get_lien_topologie() || nos[i]->get_lien_topologie()->get_dimension() >= 1)
75     nos[i]->change_lien_topologie2(this);
76     }
77     }
78     else
79     {
80     printf("Error\n");
81     }
82     }
83     }
84    
85     PolyCurve *
86     MCEdge::GetPolyCurve ( )
87     {
88     return (PolyCurve *) get_courbe();
89     }
90    
91     void MCEdge::enregistrer(std::ostream& o)
92     {
93     int nb=get_nb_ccf();
94     o << "%" << get_id() << "=CAD4FE_MCEDGE("<< get_idoriginal() << ",$" << get_courbe()->get_id() << ",$"<<get_cosommet1()->get_id() << ",$" <<get_cosommet2()->get_id() << "," << get_orientation() << "," << nb;
95     if (nb!=0)
96     {
97     o << ",(";
98     for (int i=0;i<nb;i++)
99     {
100     char nom[3];
101     get_type_ccf(i,nom);
102     o << "(" << nom << "," << get_valeur_ccf(i) << ")";
103     if (i!=nb-1) o << "," ;
104     }
105     o << ")";
106     }
107     o << ");" << std::endl;
108     }
109