2 // CC++ : Ancienne interface Cascade de la classe Elements ** A SUPPRIMER **
4 // Copyright (C) 2009-2013 CEA/DEN, EDF R&D
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HexElements.hxx"
24 #include "HexEdge.hxx"
25 #include "HexDocument.hxx"
26 #include "HexEdgeShape.hxx"
27 #include "HexAssoEdge.hxx"
28 #include "HexVertex.hxx"
30 /*****************************************
31 #include <BRepTools.hxx>
32 #include <BRep_Builder.hxx>
33 #include <BRepAdaptor_Curve.hxx>
34 #include <BRepBuilderAPI_Transform.hxx>
35 #include <BRepBuilderAPI_MakeVertex.hxx>
37 #include <GCPnts_AbscissaPoint.hxx>
40 #include <TopoDS_Shape.hxx>
41 #include <TopoDS_Edge.hxx>
42 #include <TopoDS_Compound.hxx>
43 #include <TopoDS_Vertex.hxx>
50 #include <GEOMImpl_CircleDriver.hxx>
51 #include <GEOMImpl_ICircle.hxx>
52 #include <GC_MakeCircle.hxx>
53 #include <Geom_Circle.hxx>
54 #include <gp_Circ.hxx>
56 #include <BRepBuilderAPI_MakeEdge.hxx>
57 #include <BRep_Tool.hxx>
58 ***************************************************/
62 // ---------------------------------------------------------------------
63 bool requals (const double pnt1[], const double pnt2[]);
64 // ========================================================= cutAssociation
65 void Elements::cutAssociation (Edge* orig, Edges& tedges)
67 int nbedges = tedges.size();
68 int nbassos = orig->countAssociation();
70 // ----------- Ordonnancement des shapes
73 for (int ns = 0 ; ns<nbassos ; ns++)
75 AssoEdge* asso = orig->getAssociation (ns);
76 lgpara += fabs (asso->getEnd () - asso->getStart ());
79 double delta = lgpara / nbedges;
81 AssoEdge* asso = orig->getAssociation (nasso);
82 EdgeShape* shape = asso->getEdgeShape ();
83 double param1 = asso->getStart ();
84 double parmax = asso->getEnd ();
86 for (int ned = 0 ; ned<nbedges ; ned++)
88 Edge* edge = tedges [ned];
89 double param2 = param1 + delta;
93 Vertex* node = edge->getVertex (V_AMONT);
94 shape->getPoint (param1, point);
95 node->setAssociation (point);
98 edge->addAssociation (shape, param1, param2);
101 edge->addAssociation (shape, param1, parmax);
103 if (nasso >= nbassos)
105 asso = orig->getAssociation (nasso);
106 shape = asso->getEdgeShape ();
108 parmax = asso->getEnd ();
109 edge->addAssociation (shape, 0, param2);
114 // ====================================================== geom_dump_asso
115 void geom_dump_asso (Edge* edge)
118 cout << " _______________________________________________________ "
119 << " dump_edge :" << endl;
121 if (edge==NULL || NOT edge->isHere ())
123 cout << "*** deleted ***" << endl;
128 cout << " ... Edge = " << edge->getName ()
129 << " = (" << edge->getVertex(V_AMONT)->getName()
130 << ", " << edge->getVertex(V_AVAL )->getName() << ")" << endl;
132 for (int nro=0 ; nro<V_TWO ; nro++)
134 Vertex* node = edge->getVertex (nro);
135 cout << " ... " << node->getName()
136 << " = (" << node->getX()
137 << ", " << node->getY()
138 << ", " << node->getZ() << ")";
140 if (node->isAssociated())
141 cout << " --> (" << node->getAssoX()
142 << ", " << node->getAssoY()
143 << ", " << node->getAssoZ() << ")";
145 cout << " (not associated)";
149 int nbr_associations = edge->countAssociation ();
150 PutData (nbr_associations);
152 for (int nro=0 ; nro<nbr_associations ; nro++)
154 AssoEdge* asso = edge->getAssociation (nro);
155 cout << " *** Association nro " << nro+1 << endl;
156 const double* shape_origin = asso->getOrigin();
157 const double* shape_extrem = asso->getExtrem();
158 PutData (asso->getStart());
159 PutData (asso->getEnd());
160 PutCoord (shape_origin);
161 PutCoord (shape_extrem);
163 cout << endl << endl;